diff --git a/DEPS b/DEPS index 0a1ab7b..8720803 100644 --- a/DEPS +++ b/DEPS
@@ -297,7 +297,7 @@ # 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': '9f08d3ebfddaabc05434f70b9e50d86a01ca4924', + 'skia_revision': '27ccebd5bef495f51a61160ade5366ed59755e35', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. @@ -305,7 +305,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - 'angle_revision': 'b9c3c5d675675100858019d87cd8c82f5a8429cf', + 'angle_revision': '31ac3fefdefa4b0dc6709e95a23b84ce4d7182e0', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -324,7 +324,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Fuchsia sdk # and whatever else without interference from each other. - 'fuchsia_version': 'version:9.20220821.0.1', + 'fuchsia_version': 'version:9.20220821.3.1', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling google-toolbox-for-mac # and whatever else without interference from each other. @@ -348,7 +348,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling freetype # and whatever else without interference from each other. - 'freetype_revision': '7cd3f19f21cc9d600e3b765ef2058474d20233e2', + 'freetype_revision': '395da3d72ac5186fdf68fb450bba1d57515fce1e', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling freetype # and whatever else without interference from each other. @@ -412,7 +412,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'dawn_revision': '0d84a31364d6b6a053f00fddf195aa62347fcb20', + 'dawn_revision': 'a39e56c817db275b38d62d1fc23f208a6a440350', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -480,7 +480,7 @@ # If you change this, also update the libc++ revision in # //buildtools/deps_revisions.gni. - 'libcxx_revision': 'af1968ac52c132d40f80797f0baca8f942d5c96d', + 'libcxx_revision': 'c58c612d748ed8529354453f384cc49711e812b5', # GN CIPD package version. 'gn_version': 'git_revision:0bcd37bd2b83f1a9ee17088037ebdfe6eab6d31a', @@ -1573,7 +1573,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + '695a70b29174a7dc11107885a7f713d75b3856d4', + Var('android_git') + '/platform/external/perfetto.git' + '@' + 'b67499fd17b1968b5db52e13b4d616d1ea2be4a2', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1732,7 +1732,7 @@ Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + 'e204a3c377547e11d2be1edecb1593c3259acc8e', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '75bda4dfd0c5c708f1d4369db1ee4abd9250fdd1', + Var('webrtc_git') + '/src.git' + '@' + '3d01e68e708b65241090b8d8f77369b7430d6694', 'src/third_party/libgifcodec': Var('skia_git') + '/libgifcodec' + '@'+ Var('libgifcodec_revision'), @@ -1805,7 +1805,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@c6adff44c6578de9a072a1268d245e6585ba49c9', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@b8a058587e52aff5df3131f1bd1a6cc2ac5e9101', 'condition': 'checkout_src_internal', }, @@ -1846,7 +1846,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/media_app/app', - 'version': 'kkZsgoM0UALwqjZQEDGp7GgkspqWdGPfYlD_3SZ3jhgC', + 'version': 'tPxFoWKjR_JjaBU-gLKVLwRG_dCZi4fltHFR4KImtPAC', }, ], 'condition': 'checkout_chromeos and checkout_src_internal',
diff --git a/WATCHLISTS b/WATCHLISTS index c10e86a..dcf881c 100644 --- a/WATCHLISTS +++ b/WATCHLISTS
@@ -179,6 +179,7 @@ '|ash/webui/personalization_app/'\ '|chromeos/ash/components/assistant/'\ '|chromeos/ash/services/assistant/'\ + '|chromeos/ash/services/libassistant/'\ '|chromeos/services/assistant/'\ '|chromeos/services/libassistant/'\ '|chrome/browser/ash/wallpaper_handlers/'\
diff --git a/ash/components/arc/camera/OWNERS b/ash/components/arc/camera/OWNERS index 682740d..d46ea56 100644 --- a/ash/components/arc/camera/OWNERS +++ b/ash/components/arc/camera/OWNERS
@@ -1,4 +1,2 @@ -henryhsu@chromium.org -hywu@chromium.org jcliang@chromium.org shik@chromium.org
diff --git a/ash/quick_pair/repository/fast_pair/saved_device_registry_unittest.cc b/ash/quick_pair/repository/fast_pair/saved_device_registry_unittest.cc index 237fa76..d89a1df 100644 --- a/ash/quick_pair/repository/fast_pair/saved_device_registry_unittest.cc +++ b/ash/quick_pair/repository/fast_pair/saved_device_registry_unittest.cc
@@ -5,6 +5,7 @@ #include "ash/quick_pair/repository/fast_pair/saved_device_registry.h" #include "ash/quick_pair/common/mock_quick_pair_browser_delegate.h" +#include "build/build_config.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" #include "components/prefs/scoped_user_pref_update.h" @@ -194,7 +195,15 @@ EXPECT_FALSE(saved_device_registry_->DeleteAccountKey(kAccountKey1)); } -TEST_F(SavedDeviceRegistryTest, IsAccountKeySavedToRegistry_DeviceRemoved) { +#if BUILDFLAG(IS_CHROMEOS) +#define MAYBE_IsAccountKeySavedToRegistry_DeviceRemoved \ + DISABLED_IsAccountKeySavedToRegistry_DeviceRemoved +#else +#define MAYBE_IsAccountKeySavedToRegistry_DeviceRemoved \ + IsAccountKeySavedToRegistry_DeviceRemoved +#endif +TEST_F(SavedDeviceRegistryTest, + MAYBE_IsAccountKeySavedToRegistry_DeviceRemoved) { // Simulate a user saving devices to their account. saved_device_registry_->SaveAccountKey(kFirstSavedMacAddress, kAccountKey1); saved_device_registry_->SaveAccountKey(kSecondSavedMacAddress, kAccountKey2);
diff --git a/base/BUILD.gn b/base/BUILD.gn index 57ce146..81f6d32 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn
@@ -3749,10 +3749,10 @@ "allocator/partition_allocator/partition_alloc_base/rand_util_pa_unittest.cc", "allocator/partition_allocator/partition_alloc_base/scoped_clear_last_error_pa_unittest.cc", "allocator/partition_allocator/partition_alloc_base/strings/stringprintf_pa_unittest.cc", - "allocator/partition_allocator/partition_alloc_base/sys_byteorder_pa_unittest.cc", "allocator/partition_allocator/partition_alloc_base/thread_annotations_pa_unittest.cc", "allocator/partition_allocator/partition_alloc_unittest.cc", "allocator/partition_allocator/partition_lock_unittest.cc", + "allocator/partition_allocator/reverse_bytes_unittest.cc", "allocator/partition_allocator/starscan/pcscan_scheduling_unittest.cc", "allocator/partition_allocator/starscan/pcscan_unittest.cc", "allocator/partition_allocator/starscan/scan_loop_unittest.cc",
diff --git a/base/allocator/partition_allocator/BUILD.gn b/base/allocator/partition_allocator/BUILD.gn index 3eb4ca11..15f1a2f 100644 --- a/base/allocator/partition_allocator/BUILD.gn +++ b/base/allocator/partition_allocator/BUILD.gn
@@ -122,7 +122,6 @@ "partition_alloc_base/scoped_clear_last_error.h", "partition_alloc_base/strings/stringprintf.cc", "partition_alloc_base/strings/stringprintf.h", - "partition_alloc_base/sys_byteorder.h", "partition_alloc_base/thread_annotations.h", "partition_alloc_base/threading/platform_thread.cc", "partition_alloc_base/threading/platform_thread.h", @@ -164,6 +163,7 @@ "random.h", "reservation_offset_table.cc", "reservation_offset_table.h", + "reverse_bytes.h", "spinning_mutex.cc", "spinning_mutex.h", "starscan/logging.h",
diff --git a/base/allocator/partition_allocator/build_config.md b/base/allocator/partition_allocator/build_config.md index 90f9d0b0..c58c95a 100644 --- a/base/allocator/partition_allocator/build_config.md +++ b/base/allocator/partition_allocator/build_config.md
@@ -103,9 +103,6 @@ * `MEMORY_TOOL_REPLACES_ALLOCATOR` * `*_SANITIZER` - mainly influences unit tests. -TODO(crbug.com/1151236): don't `PA_COMPONENT_EXPORT()` functions defined -under `partition_alloc_base/`. - *** note Over time, the above list should evolve into a list of macros / GN args that influence PartitionAlloc's behavior.
diff --git a/base/allocator/partition_allocator/partition_alloc_base/compiler_specific.h b/base/allocator/partition_allocator/partition_alloc_base/compiler_specific.h index ba946f0..6fd893f3 100644 --- a/base/allocator/partition_allocator/partition_alloc_base/compiler_specific.h +++ b/base/allocator/partition_allocator/partition_alloc_base/compiler_specific.h
@@ -7,10 +7,6 @@ #include "build/build_config.h" -#if defined(COMPILER_MSVC) && !defined(__clang__) -#error "Only clang-cl is supported on Windows, see https://crbug.com/988071" -#endif - // This is a wrapper around `__has_cpp_attribute`, which can be used to test for // the presence of an attribute. In case the compiler does not support this // macro it will simply evaluate to 0.
diff --git a/base/allocator/partition_allocator/partition_alloc_base/sys_byteorder.h b/base/allocator/partition_allocator/partition_alloc_base/sys_byteorder.h deleted file mode 100644 index 59b3ee4..0000000 --- a/base/allocator/partition_allocator/partition_alloc_base/sys_byteorder.h +++ /dev/null
@@ -1,144 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This header defines cross-platform ByteSwap() implementations for 16, 32 and -// 64-bit values, and NetToHostXX() / HostToNextXX() functions equivalent to -// the traditional ntohX() and htonX() functions. -// Use the functions defined here rather than using the platform-specific -// functions directly. - -#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_SYS_BYTEORDER_H_ -#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_SYS_BYTEORDER_H_ - -#include <cstdint> - -#include "base/allocator/partition_allocator/partition_alloc_base/migration_adapter.h" -#include "build/build_config.h" - -#if defined(COMPILER_MSVC) -#include <cstdlib> -#endif - -namespace partition_alloc::internal::base { - -// Returns a value with all bytes in |x| swapped, i.e. reverses the endianness. -inline constexpr uint16_t ByteSwap(uint16_t x) { -#if defined(COMPILER_MSVC) && !defined(__clang__) - return _byteswap_ushort(x); -#else - return __builtin_bswap16(x); -#endif -} - -inline constexpr uint32_t ByteSwap(uint32_t x) { -#if defined(COMPILER_MSVC) && !defined(__clang__) - return _byteswap_ulong(x); -#else - return __builtin_bswap32(x); -#endif -} - -inline constexpr uint64_t ByteSwap(uint64_t x) { - // Per build/build_config.h, clang masquerades as MSVC on Windows. If we are - // actually using clang, we can rely on the builtin. - // - // This matters in practice, because on x86(_64), this is a single "bswap" - // instruction. MSVC correctly replaces the call with an inlined bswap at /O2 - // as of 2021, but clang as we use it in Chromium doesn't, keeping a function - // call for a single instruction. -#if defined(COMPILER_MSVC) && !defined(__clang__) - return _byteswap_uint64(x); -#else - return __builtin_bswap64(x); -#endif -} - -inline constexpr uintptr_t ByteSwapUintPtrT(uintptr_t x) { - // We do it this way because some build configurations are ILP32 even when - // defined(ARCH_CPU_64_BITS). Unfortunately, we can't use sizeof in #ifs. But, - // because these conditionals are constexprs, the irrelevant branches will - // likely be optimized away, so this construction should not result in code - // bloat. - static_assert(sizeof(uintptr_t) == 4 || sizeof(uintptr_t) == 8, - "Unsupported uintptr_t size"); - if (sizeof(uintptr_t) == 4) - return ByteSwap(static_cast<uint32_t>(x)); - return ByteSwap(static_cast<uint64_t>(x)); -} - -// Converts the bytes in |x| from host order (endianness) to little endian, and -// returns the result. -inline constexpr uint16_t ByteSwapToLE16(uint16_t x) { -#if defined(ARCH_CPU_LITTLE_ENDIAN) - return x; -#else - return ByteSwap(x); -#endif -} -inline constexpr uint32_t ByteSwapToLE32(uint32_t x) { -#if defined(ARCH_CPU_LITTLE_ENDIAN) - return x; -#else - return ByteSwap(x); -#endif -} -inline constexpr uint64_t ByteSwapToLE64(uint64_t x) { -#if defined(ARCH_CPU_LITTLE_ENDIAN) - return x; -#else - return ByteSwap(x); -#endif -} - -// Converts the bytes in |x| from network to host order (endianness), and -// returns the result. -inline constexpr uint16_t NetToHost16(uint16_t x) { -#if defined(ARCH_CPU_LITTLE_ENDIAN) - return ByteSwap(x); -#else - return x; -#endif -} -inline constexpr uint32_t NetToHost32(uint32_t x) { -#if defined(ARCH_CPU_LITTLE_ENDIAN) - return ByteSwap(x); -#else - return x; -#endif -} -inline constexpr uint64_t NetToHost64(uint64_t x) { -#if defined(ARCH_CPU_LITTLE_ENDIAN) - return ByteSwap(x); -#else - return x; -#endif -} - -// Converts the bytes in |x| from host to network order (endianness), and -// returns the result. -inline constexpr uint16_t HostToNet16(uint16_t x) { -#if defined(ARCH_CPU_LITTLE_ENDIAN) - return ByteSwap(x); -#else - return x; -#endif -} -inline constexpr uint32_t HostToNet32(uint32_t x) { -#if defined(ARCH_CPU_LITTLE_ENDIAN) - return ByteSwap(x); -#else - return x; -#endif -} -inline constexpr uint64_t HostToNet64(uint64_t x) { -#if defined(ARCH_CPU_LITTLE_ENDIAN) - return ByteSwap(x); -#else - return x; -#endif -} - -} // namespace partition_alloc::internal::base - -#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_BASE_SYS_BYTEORDER_H_
diff --git a/base/allocator/partition_allocator/partition_alloc_base/sys_byteorder_pa_unittest.cc b/base/allocator/partition_allocator/partition_alloc_base/sys_byteorder_pa_unittest.cc deleted file mode 100644 index b67245b..0000000 --- a/base/allocator/partition_allocator/partition_alloc_base/sys_byteorder_pa_unittest.cc +++ /dev/null
@@ -1,144 +0,0 @@ -// Copyright (c) 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 "base/allocator/partition_allocator/partition_alloc_base/sys_byteorder.h" - -#include "build/build_config.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace { - -const uint16_t k16BitTestData = 0xaabb; -const uint16_t k16BitSwappedTestData = 0xbbaa; -const uint32_t k32BitTestData = 0xaabbccdd; -const uint32_t k32BitSwappedTestData = 0xddccbbaa; -const uint64_t k64BitTestData = 0xaabbccdd44332211; -const uint64_t k64BitSwappedTestData = 0x11223344ddccbbaa; - -} // namespace - -namespace partition_alloc::internal { - -TEST(ByteOrderTest, ByteSwap16) { - uint16_t swapped = base::ByteSwap(k16BitTestData); - EXPECT_EQ(k16BitSwappedTestData, swapped); - uint16_t reswapped = base::ByteSwap(swapped); - EXPECT_EQ(k16BitTestData, reswapped); -} - -TEST(ByteOrderTest, ByteSwap32) { - uint32_t swapped = base::ByteSwap(k32BitTestData); - EXPECT_EQ(k32BitSwappedTestData, swapped); - uint32_t reswapped = base::ByteSwap(swapped); - EXPECT_EQ(k32BitTestData, reswapped); -} - -TEST(ByteOrderTest, ByteSwap64) { - uint64_t swapped = base::ByteSwap(k64BitTestData); - EXPECT_EQ(k64BitSwappedTestData, swapped); - uint64_t reswapped = base::ByteSwap(swapped); - EXPECT_EQ(k64BitTestData, reswapped); -} - -TEST(ByteOrderTest, ByteSwapUintPtrT) { -#if defined(ARCH_CPU_64_BITS) - const uintptr_t test_data = static_cast<uintptr_t>(k64BitTestData); - const uintptr_t swapped_test_data = - static_cast<uintptr_t>(k64BitSwappedTestData); -#elif defined(ARCH_CPU_32_BITS) - const uintptr_t test_data = static_cast<uintptr_t>(k32BitTestData); - const uintptr_t swapped_test_data = - static_cast<uintptr_t>(k32BitSwappedTestData); -#else -#error architecture not supported -#endif - - uintptr_t swapped = base::ByteSwapUintPtrT(test_data); - EXPECT_EQ(swapped_test_data, swapped); - uintptr_t reswapped = base::ByteSwapUintPtrT(swapped); - EXPECT_EQ(test_data, reswapped); -} - -TEST(ByteOrderTest, ByteSwapToLE16) { - uint16_t le = base::ByteSwapToLE16(k16BitTestData); -#if defined(ARCH_CPU_LITTLE_ENDIAN) - EXPECT_EQ(k16BitTestData, le); -#else - EXPECT_EQ(k16BitSwappedTestData, le); -#endif -} - -TEST(ByteOrderTest, ByteSwapToLE32) { - uint32_t le = base::ByteSwapToLE32(k32BitTestData); -#if defined(ARCH_CPU_LITTLE_ENDIAN) - EXPECT_EQ(k32BitTestData, le); -#else - EXPECT_EQ(k32BitSwappedTestData, le); -#endif -} - -TEST(ByteOrderTest, ByteSwapToLE64) { - uint64_t le = base::ByteSwapToLE64(k64BitTestData); -#if defined(ARCH_CPU_LITTLE_ENDIAN) - EXPECT_EQ(k64BitTestData, le); -#else - EXPECT_EQ(k64BitSwappedTestData, le); -#endif -} - -TEST(ByteOrderTest, NetToHost16) { - uint16_t h = base::NetToHost16(k16BitTestData); -#if defined(ARCH_CPU_LITTLE_ENDIAN) - EXPECT_EQ(k16BitSwappedTestData, h); -#else - EXPECT_EQ(k16BitTestData, h); -#endif -} - -TEST(ByteOrderTest, NetToHost32) { - uint32_t h = base::NetToHost32(k32BitTestData); -#if defined(ARCH_CPU_LITTLE_ENDIAN) - EXPECT_EQ(k32BitSwappedTestData, h); -#else - EXPECT_EQ(k32BitTestData, h); -#endif -} - -TEST(ByteOrderTest, NetToHost64) { - uint64_t h = base::NetToHost64(k64BitTestData); -#if defined(ARCH_CPU_LITTLE_ENDIAN) - EXPECT_EQ(k64BitSwappedTestData, h); -#else - EXPECT_EQ(k64BitTestData, h); -#endif -} - -TEST(ByteOrderTest, HostToNet16) { - uint16_t n = base::HostToNet16(k16BitTestData); -#if defined(ARCH_CPU_LITTLE_ENDIAN) - EXPECT_EQ(k16BitSwappedTestData, n); -#else - EXPECT_EQ(k16BitTestData, n); -#endif -} - -TEST(ByteOrderTest, HostToNet32) { - uint32_t n = base::HostToNet32(k32BitTestData); -#if defined(ARCH_CPU_LITTLE_ENDIAN) - EXPECT_EQ(k32BitSwappedTestData, n); -#else - EXPECT_EQ(k32BitTestData, n); -#endif -} - -TEST(ByteOrderTest, HostToNet64) { - uint64_t n = base::HostToNet64(k64BitTestData); -#if defined(ARCH_CPU_LITTLE_ENDIAN) - EXPECT_EQ(k64BitSwappedTestData, n); -#else - EXPECT_EQ(k64BitTestData, n); -#endif -} - -} // namespace partition_alloc::internal
diff --git a/base/allocator/partition_allocator/partition_freelist_entry.h b/base/allocator/partition_allocator/partition_freelist_entry.h index 993a642..4eab1eac 100644 --- a/base/allocator/partition_allocator/partition_freelist_entry.h +++ b/base/allocator/partition_allocator/partition_freelist_entry.h
@@ -13,7 +13,6 @@ #include "base/allocator/partition_allocator/partition_alloc_base/compiler_specific.h" #include "base/allocator/partition_allocator/partition_alloc_base/debug/debugging_buildflags.h" #include "base/allocator/partition_allocator/partition_alloc_base/immediate_crash.h" -#include "base/allocator/partition_allocator/partition_alloc_base/sys_byteorder.h" #include "base/allocator/partition_allocator/partition_alloc_buildflags.h" #include "base/allocator/partition_allocator/partition_alloc_check.h" #include "base/allocator/partition_allocator/partition_alloc_config.h" @@ -21,6 +20,10 @@ #include "base/allocator/partition_allocator/partition_ref_count.h" #include "build/build_config.h" +#if !defined(ARCH_CPU_BIG_ENDIAN) +#include "base/allocator/partition_allocator/reverse_bytes.h" +#endif // !defined(ARCH_CPU_BIG_ENDIAN) + namespace partition_alloc::internal { namespace { @@ -71,7 +74,7 @@ #if defined(ARCH_CPU_BIG_ENDIAN) uintptr_t transformed = ~address; #else - uintptr_t transformed = base::ByteSwapUintPtrT(address); + uintptr_t transformed = ReverseBytes(address); #endif return transformed; }
diff --git a/base/allocator/partition_allocator/partition_root.cc b/base/allocator/partition_allocator/partition_root.cc index c6eed2be..2c031a9 100644 --- a/base/allocator/partition_allocator/partition_root.cc +++ b/base/allocator/partition_allocator/partition_root.cc
@@ -279,6 +279,11 @@ namespace internal { namespace { +// 64 was chosen arbitrarily, as it seems like a reasonable trade-off between +// performance and purging opportunity. Higher value (i.e. smaller slots) +// wouldn't necessarily increase chances of purging, but would result in +// more work and larger |slot_usage| array. Lower value would probably decrease +// chances of purging. Not empirically tested. constexpr size_t kMaxPurgeableSlotsPerSystemPage = 64; PAGE_ALLOCATOR_CONSTANTS_DECLARE_CONSTEXPR PA_ALWAYS_INLINE size_t MinPurgeableSlotSize() { @@ -294,9 +299,6 @@ const internal::PartitionBucket<thread_safe>* bucket = slot_span->bucket; size_t slot_size = bucket->slot_size; - // We will do nothing if slot_size is smaller than SystemPageSize() / 2 - // because |kMaxSlotCount| will be too large in that case, which leads to - // |slot_usage| using up too much memory. if (slot_size < MinPurgeableSlotSize() || !slot_span->num_allocated_slots) return 0;
diff --git a/base/allocator/partition_allocator/reverse_bytes.h b/base/allocator/partition_allocator/reverse_bytes.h new file mode 100644 index 0000000..9088b32 --- /dev/null +++ b/base/allocator/partition_allocator/reverse_bytes.h
@@ -0,0 +1,48 @@ +// Copyright 2022 The Chromium Authors. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_REVERSE_BYTES_H_ +#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_REVERSE_BYTES_H_ + +// This header defines drop-in constexpr replacements for the +// byte-reversing routines that we used from `//base/sys_byteorder.h`. +// They will be made moot by C++23's <endian> header or by C++20's +// <bit> header. + +#include <cstdint> + +#include "build/build_config.h" + +namespace partition_alloc::internal { + +constexpr uint32_t ReverseFourBytes(uint32_t value) { +#if defined(COMPILER_MSVC) && !defined(__clang__) + return value >> 24 | (value >> 8 & 0xff00) | (value & 0xff00) << 8 | + value << 24; +#else + return __builtin_bswap32(value); +#endif // defined(COMPILER_MSVC) && !defined(__clang__) +} + +constexpr uint64_t ReverseEightBytes(uint64_t value) { +#if defined(COMPILER_MSVC) && !defined(__clang__) + return value >> 56 | (value >> 40 & 0xff00) | (value >> 24 & 0xff0000) | + (value >> 8 & 0xff000000) | (value & 0xff000000) << 8 | + (value & 0xff0000) << 24 | (value & 0xff00) << 40 | + (value & 0xff) << 56; +#else + return __builtin_bswap64(value); +#endif // defined(COMPILER_MSVC) && !defined(__clang__) +} + +constexpr uintptr_t ReverseBytes(uintptr_t value) { + if (sizeof(uintptr_t) == 4) { + return ReverseFourBytes(static_cast<uint32_t>(value)); + } + return ReverseEightBytes(static_cast<uint64_t>(value)); +} + +} // namespace partition_alloc::internal + +#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_REVERSE_BYTES_H_
diff --git a/base/allocator/partition_allocator/reverse_bytes_unittest.cc b/base/allocator/partition_allocator/reverse_bytes_unittest.cc new file mode 100644 index 0000000..834bcd6 --- /dev/null +++ b/base/allocator/partition_allocator/reverse_bytes_unittest.cc
@@ -0,0 +1,26 @@ +// Copyright 2022 The Chromium Authors. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/allocator/partition_allocator/reverse_bytes.h" + +#include <cstdint> + +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace partition_alloc::internal { +namespace { + +TEST(ReverseBytes, DeadBeefScramble) { + if (sizeof(uintptr_t) == 4) { + EXPECT_EQ(ReverseBytes(uintptr_t{0xefbeadde}), 0xdeadbeef); + } else { + // Hacky kludge to escape the compiler from immediately noticing that + // this won't fit into a uintptr_t when it's four bytes. + EXPECT_EQ(ReverseBytes(uint64_t{0xffeeddccefbeadde}), 0xdeadbeefccddeeff); + } +} + +} // namespace +} // namespace partition_alloc::internal
diff --git a/base/check_unittest.cc b/base/check_unittest.cc index 8feb87b..ec8b25a 100644 --- a/base/check_unittest.cc +++ b/base/check_unittest.cc
@@ -392,6 +392,8 @@ } #endif // CHECK_WILL_STREAM() +// TODO(crbug.com/1354494): Short term fix by sheriff to get compiling. +#if !BUILDFLAG(DCHECK_IS_CONFIGURABLE) TEST_F(CheckTest, OstreamVsToString) { StructWithOstream a, b; EXPECT_CHECK("Check failed: a == b (ostream vs. ostream)", CHECK_EQ(a, b)); @@ -406,6 +408,7 @@ EXPECT_CHECK("Check failed: g == h (ToString+ostream vs. ToString+ostream)", CHECK_EQ(g, h)); } +#endif #define EXPECT_LOG_ERROR(expected_line, expr, msg) \ do { \
diff --git a/base/containers/README.md b/base/containers/README.md index 3498fd8..95beccb 100644 --- a/base/containers/README.md +++ b/base/containers/README.md
@@ -238,7 +238,7 @@ provide performance consistent across platforms that better matches most programmer's expectations on performance (it doesn't waste as much space as libc++ and doesn't do as many heap allocations as MSVC). It also generates less -code tham `std::queue`: using it across the code base saves several hundred +code than `std::queue`: using it across the code base saves several hundred kilobytes. Since `base::deque` does not have stable iterators and it will move the objects
diff --git a/base/test/scoped_feature_list.cc b/base/test/scoped_feature_list.cc index 8ccc1f0..cbdd1f9a 100644 --- a/base/test/scoped_feature_list.cc +++ b/base/test/scoped_feature_list.cc
@@ -326,6 +326,11 @@ // Restore params to how they were before. FieldTrialParamAssociator::GetInstance()->ClearAllParamsForTesting(); if (!original_params_.empty()) { + // Before restoring params, we need to make all field trials in-active, + // because FieldTrialParamAssociator checks whether the given field trial + // is active or not, and associates no parameters if the trial is active. + // So temporarily restore field trial list to be nullptr. + FieldTrialList::RestoreInstanceForTesting(nullptr); AssociateFieldTrialParamsFromString(original_params_, &HexDecodeString); }
diff --git a/base/test/scoped_feature_list_unittest.cc b/base/test/scoped_feature_list_unittest.cc index b28a2d23..7a5e527 100644 --- a/base/test/scoped_feature_list_unittest.cc +++ b/base/test/scoped_feature_list_unittest.cc
@@ -633,6 +633,46 @@ ExpectFeatures("*TestFeature1", std::string()); } +TEST_F(ScopedFeatureListTest, + RestoreFieldTrialParamsCorrectlyWhenLeakedFieldTrialCreated) { + test::ScopedFeatureList feature_list1; + feature_list1.InitFromCommandLine("TestFeature1:TestParam/TestValue1", ""); + EXPECT_TRUE(FeatureList::IsEnabled(kTestFeature1)); + EXPECT_EQ("TestValue1", + GetFieldTrialParamValueByFeature(kTestFeature1, "TestParam")); + + // content::InitializeFieldTrialAndFeatureList() creates a leaked + // FieldTrialList. To emulate the leaked one, declare + // unique_ptr<FieldTriaList> here and initialize it inside the following + // child scope. + std::unique_ptr<FieldTrialList> leaked_field_trial_list; + { + test::ScopedFeatureList feature_list2; + feature_list2.InitWithNullFeatureAndFieldTrialLists(); + + leaked_field_trial_list = std::make_unique<FieldTrialList>(nullptr); + FeatureList::InitializeInstance("TestFeature1:TestParam/TestValue2", "", + {}); + EXPECT_TRUE(FeatureList::IsEnabled(kTestFeature1)); + EXPECT_EQ("TestValue2", + GetFieldTrialParamValueByFeature(kTestFeature1, "TestParam")); + } + EXPECT_TRUE(FeatureList::IsEnabled(kTestFeature1)); + EXPECT_EQ("TestValue1", + GetFieldTrialParamValueByFeature(kTestFeature1, "TestParam")); + + { + FieldTrialList* backup_field_trial = + FieldTrialList::BackupInstanceForTesting(); + + // To free leaked_field_trial_list, need RestoreInstanceForTesting() + // to pass DCHECK_EQ(this, global_) at ~FieldTrialList(). + FieldTrialList::RestoreInstanceForTesting(leaked_field_trial_list.get()); + leaked_field_trial_list.reset(); + FieldTrialList::RestoreInstanceForTesting(backup_field_trial); + } +} + TEST(ScopedFeatureListTestWithMemberList, ScopedFeatureListLocalOverride) { test::ScopedFeatureList initial_feature_list; initial_feature_list.InitAndDisableFeature(kTestFeature1);
diff --git a/base/trace_event/memory_infra_background_allowlist.cc b/base/trace_event/memory_infra_background_allowlist.cc index eef5525..a393c4c 100644 --- a/base/trace_event/memory_infra_background_allowlist.cc +++ b/base/trace_event/memory_infra_background_allowlist.cc
@@ -273,6 +273,7 @@ "sync/0x?/model_type/AUTOFILL_WALLET", "sync/0x?/model_type/AUTOFILL_WALLET_OFFER", "sync/0x?/model_type/BOOKMARK", + "sync/0x?/model_type/CONTACT_INFO", "sync/0x?/model_type/DEVICE_INFO", "sync/0x?/model_type/DICTIONARY", "sync/0x?/model_type/EXTENSION",
diff --git a/buildtools/deps_revisions.gni b/buildtools/deps_revisions.gni index 65b71e1..eeaffcc 100644 --- a/buildtools/deps_revisions.gni +++ b/buildtools/deps_revisions.gni
@@ -5,5 +5,5 @@ declare_args() { # Used to cause full rebuilds on libc++ rolls. This should be kept in sync # with the libcxx_revision vars in //DEPS. - libcxx_revision = "af1968ac52c132d40f80797f0baca8f942d5c96d" + libcxx_revision = "c58c612d748ed8529354453f384cc49711e812b5" }
diff --git a/chrome/VERSION b/chrome/VERSION index 7095fb4b..4cdcd7f 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=107 MINOR=0 -BUILD=5254 +BUILD=5255 PATCH=0
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/services/gcm/OWNERS b/chrome/android/java/src/org/chromium/chrome/browser/services/gcm/OWNERS index bc1cace..e3a1739 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/services/gcm/OWNERS +++ b/chrome/android/java/src/org/chromium/chrome/browser/services/gcm/OWNERS
@@ -1,2 +1 @@ -johnme@chromium.org peter@chromium.org
diff --git a/chrome/android/profiles/newest.txt b/chrome/android/profiles/newest.txt index a3796875..719191b 100644 --- a/chrome/android/profiles/newest.txt +++ b/chrome/android/profiles/newest.txt
@@ -1 +1 @@ -chromeos-chrome-amd64-106.0.5249.5_rc-r1-merged.afdo.bz2 +chromeos-chrome-amd64-106.0.5249.6_rc-r1-merged.afdo.bz2
diff --git a/chrome/browser/android/chrome_backup_agent.cc b/chrome/browser/android/chrome_backup_agent.cc index 37f44b3..94be246 100644 --- a/chrome/browser/android/chrome_backup_agent.cc +++ b/chrome/browser/android/chrome_backup_agent.cc
@@ -20,7 +20,7 @@ // TODO(crbug.com/1305213): The data type toggles shouldn't be individually // listed here. -static_assert(40 == syncer::GetNumModelTypes(), +static_assert(41 == syncer::GetNumModelTypes(), "If the new type has a corresponding pref, add it here"); const char* backed_up_preferences_[] = { autofill::prefs::kAutofillWalletImportEnabled,
diff --git a/chrome/browser/ash/BUILD.gn b/chrome/browser/ash/BUILD.gn index 6df8c84a..318ef66 100644 --- a/chrome/browser/ash/BUILD.gn +++ b/chrome/browser/ash/BUILD.gn
@@ -1581,6 +1581,7 @@ "//chromeos/ash/components/dbus/cicerone:cicerone_proto", "//chromeos/ash/components/dbus/concierge", "//chromeos/ash/components/dbus/concierge:concierge_proto", + "//chromeos/ash/components/dbus/constants", "//chromeos/ash/components/dbus/cros_disks", "//chromeos/ash/components/dbus/cryptohome:cryptohome_proto", "//chromeos/ash/components/dbus/debug_daemon",
diff --git a/chrome/browser/ash/attestation/attestation_ca_client.h b/chrome/browser/ash/attestation/attestation_ca_client.h index 427e576..11c7669 100644 --- a/chrome/browser/ash/attestation/attestation_ca_client.h +++ b/chrome/browser/ash/attestation/attestation_ca_client.h
@@ -10,7 +10,7 @@ #include <string> #include "chromeos/ash/components/attestation/attestation_flow.h" -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" namespace network {
diff --git a/chrome/browser/ash/attestation/attestation_policy_observer.h b/chrome/browser/ash/attestation/attestation_policy_observer.h index f918d8d3..8bef03d 100644 --- a/chrome/browser/ash/attestation/attestation_policy_observer.h +++ b/chrome/browser/ash/attestation/attestation_policy_observer.h
@@ -8,7 +8,7 @@ #include "base/callback.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/ash/settings/cros_settings.h" -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" namespace ash { namespace attestation {
diff --git a/chrome/browser/ash/attestation/enrollment_certificate_uploader_impl.cc b/chrome/browser/ash/attestation/enrollment_certificate_uploader_impl.cc index c7f2473..6780513f 100644 --- a/chrome/browser/ash/attestation/enrollment_certificate_uploader_impl.cc +++ b/chrome/browser/ash/attestation/enrollment_certificate_uploader_impl.cc
@@ -31,15 +31,15 @@ void DBusPrivacyCACallback( const base::RepeatingCallback<void(const std::string&)> on_success, - const base::RepeatingCallback< - void(chromeos::attestation::AttestationStatus)> on_failure, + const base::RepeatingCallback<void(ash::attestation::AttestationStatus)> + on_failure, const base::Location& from_here, - chromeos::attestation::AttestationStatus status, + ash::attestation::AttestationStatus status, const std::string& data) { DCHECK(on_success); DCHECK(on_failure); - if (status == chromeos::attestation::ATTESTATION_SUCCESS) { + if (status == ash::attestation::ATTESTATION_SUCCESS) { on_success.Run(data); return; }
diff --git a/chrome/browser/ash/attestation/enrollment_certificate_uploader_impl.h b/chrome/browser/ash/attestation/enrollment_certificate_uploader_impl.h index 5d6799a..c059894 100644 --- a/chrome/browser/ash/attestation/enrollment_certificate_uploader_impl.h +++ b/chrome/browser/ash/attestation/enrollment_certificate_uploader_impl.h
@@ -13,7 +13,7 @@ #include "base/memory/weak_ptr.h" #include "base/time/time.h" #include "chrome/browser/ash/attestation/enrollment_certificate_uploader.h" -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" namespace policy { class CloudPolicyClient;
diff --git a/chrome/browser/ash/attestation/enrollment_id_upload_manager.h b/chrome/browser/ash/attestation/enrollment_id_upload_manager.h index 8551107..5d1a5a1f 100644 --- a/chrome/browser/ash/attestation/enrollment_id_upload_manager.h +++ b/chrome/browser/ash/attestation/enrollment_id_upload_manager.h
@@ -14,7 +14,7 @@ #include "chrome/browser/ash/attestation/enrollment_certificate_uploader.h" #include "chrome/browser/ash/settings/device_settings_service.h" #include "chromeos/ash/components/dbus/attestation/interface.pb.h" -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" namespace policy { class CloudPolicyClient;
diff --git a/chrome/browser/ash/attestation/machine_certificate_uploader_impl.cc b/chrome/browser/ash/attestation/machine_certificate_uploader_impl.cc index ddd2755..c4dfefb 100644 --- a/chrome/browser/ash/attestation/machine_certificate_uploader_impl.cc +++ b/chrome/browser/ash/attestation/machine_certificate_uploader_impl.cc
@@ -42,12 +42,12 @@ void DBusPrivacyCACallback( const base::RepeatingCallback<void(const std::string&)> on_success, - const base::RepeatingCallback< - void(chromeos::attestation::AttestationStatus)> on_failure, + const base::RepeatingCallback<void(ash::attestation::AttestationStatus)> + on_failure, const base::Location& from_here, - chromeos::attestation::AttestationStatus status, + ash::attestation::AttestationStatus status, const std::string& data) { - if (status == chromeos::attestation::ATTESTATION_SUCCESS) { + if (status == ash::attestation::ATTESTATION_SUCCESS) { on_success.Run(data); return; }
diff --git a/chrome/browser/ash/attestation/machine_certificate_uploader_impl.h b/chrome/browser/ash/attestation/machine_certificate_uploader_impl.h index 0635c9f..c689ede 100644 --- a/chrome/browser/ash/attestation/machine_certificate_uploader_impl.h +++ b/chrome/browser/ash/attestation/machine_certificate_uploader_impl.h
@@ -13,7 +13,7 @@ #include "base/time/time.h" #include "chrome/browser/ash/attestation/machine_certificate_uploader.h" #include "chromeos/ash/components/dbus/attestation/interface.pb.h" -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace policy {
diff --git a/chrome/browser/ash/attestation/mock_tpm_challenge_key.h b/chrome/browser/ash/attestation/mock_tpm_challenge_key.h index 0cde1d1..d77fe00 100644 --- a/chrome/browser/ash/attestation/mock_tpm_challenge_key.h +++ b/chrome/browser/ash/attestation/mock_tpm_challenge_key.h
@@ -8,7 +8,7 @@ #include <string> #include "chrome/browser/ash/attestation/tpm_challenge_key.h" -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" #include "testing/gmock/include/gmock/gmock.h" namespace ash { @@ -23,7 +23,7 @@ MOCK_METHOD(void, BuildResponse, - (chromeos::attestation::AttestationKeyType key_type, + (AttestationKeyType key_type, Profile* profile, TpmChallengeKeyCallback callback, const std::string& challenge,
diff --git a/chrome/browser/ash/attestation/platform_verification_flow.h b/chrome/browser/ash/attestation/platform_verification_flow.h index 25bfc22..e20e358 100644 --- a/chrome/browser/ash/attestation/platform_verification_flow.h +++ b/chrome/browser/ash/attestation/platform_verification_flow.h
@@ -14,7 +14,7 @@ #include "base/time/time.h" #include "base/timer/timer.h" #include "chromeos/ash/components/dbus/attestation/interface.pb.h" -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" #include "components/account_id/account_id.h" #include "url/gurl.h"
diff --git a/chrome/browser/ash/attestation/soft_bind_attestation_flow.cc b/chrome/browser/ash/attestation/soft_bind_attestation_flow.cc index 5b1f7998..2a369f2 100644 --- a/chrome/browser/ash/attestation/soft_bind_attestation_flow.cc +++ b/chrome/browser/ash/attestation/soft_bind_attestation_flow.cc
@@ -12,7 +12,7 @@ #include "chrome/browser/ash/settings/cros_settings.h" #include "chromeos/ash/components/cryptohome/cryptohome_parameters.h" #include "chromeos/ash/components/dbus/attestation/attestation_client.h" -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" #include "content/public/browser/browser_thread.h" #include "crypto/openssl_util.h" #include "crypto/random.h"
diff --git a/chrome/browser/ash/attestation/tpm_challenge_key.cc b/chrome/browser/ash/attestation/tpm_challenge_key.cc index ba37d15..6d87e645 100644 --- a/chrome/browser/ash/attestation/tpm_challenge_key.cc +++ b/chrome/browser/ash/attestation/tpm_challenge_key.cc
@@ -14,7 +14,7 @@ #include "chrome/browser/ash/attestation/tpm_challenge_key_result.h" #include "chrome/browser/ash/attestation/tpm_challenge_key_subtle.h" #include "chrome/common/pref_names.h" -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" #include "components/pref_registry/pref_registry_syncable.h" class Profile;
diff --git a/chrome/browser/ash/attestation/tpm_challenge_key.h b/chrome/browser/ash/attestation/tpm_challenge_key.h index 0ea92373..aa2d4c9 100644 --- a/chrome/browser/ash/attestation/tpm_challenge_key.h +++ b/chrome/browser/ash/attestation/tpm_challenge_key.h
@@ -12,7 +12,7 @@ #include "base/sequence_checker.h" #include "chrome/browser/ash/attestation/tpm_challenge_key_result.h" #include "chrome/browser/ash/attestation/tpm_challenge_key_subtle.h" -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" #include "third_party/abseil-cpp/absl/types/optional.h" class Profile;
diff --git a/chrome/browser/ash/attestation/tpm_challenge_key_subtle.cc b/chrome/browser/ash/attestation/tpm_challenge_key_subtle.cc index 12b2b4b7..1882c3ec 100644 --- a/chrome/browser/ash/attestation/tpm_challenge_key_subtle.cc +++ b/chrome/browser/ash/attestation/tpm_challenge_key_subtle.cc
@@ -28,8 +28,8 @@ #include "chromeos/ash/components/cryptohome/cryptohome_parameters.h" #include "chromeos/ash/components/dbus/attestation/attestation_client.h" #include "chromeos/ash/components/dbus/attestation/interface.pb.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" #include "chromeos/ash/components/install_attributes/install_attributes.h" -#include "chromeos/dbus/constants/attestation_constants.h" #include "chromeos/dbus/tpm_manager/tpm_manager.pb.h" #include "chromeos/dbus/tpm_manager/tpm_manager_client.h" #include "components/pref_registry/pref_registry_syncable.h"
diff --git a/chrome/browser/ash/attestation/tpm_challenge_key_subtle.h b/chrome/browser/ash/attestation/tpm_challenge_key_subtle.h index 5f4c48bd..8a9d7eb6 100644 --- a/chrome/browser/ash/attestation/tpm_challenge_key_subtle.h +++ b/chrome/browser/ash/attestation/tpm_challenge_key_subtle.h
@@ -17,7 +17,7 @@ #include "chromeos/ash/components/dbus/attestation/attestation_ca.pb.h" #include "chromeos/ash/components/dbus/attestation/attestation_client.h" #include "chromeos/ash/components/dbus/attestation/interface.pb.h" -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" #include "chromeos/dbus/tpm_manager/tpm_manager.pb.h" #include "components/account_id/account_id.h" #include "components/user_manager/user.h"
diff --git a/chrome/browser/ash/attestation/tpm_challenge_key_subtle_unittest.cc b/chrome/browser/ash/attestation/tpm_challenge_key_subtle_unittest.cc index 52c4fc1b..856dcb2 100644 --- a/chrome/browser/ash/attestation/tpm_challenge_key_subtle_unittest.cc +++ b/chrome/browser/ash/attestation/tpm_challenge_key_subtle_unittest.cc
@@ -26,7 +26,7 @@ #include "chromeos/ash/components/cryptohome/cryptohome_parameters.h" #include "chromeos/ash/components/dbus/attestation/fake_attestation_client.h" #include "chromeos/ash/components/dbus/attestation/interface.pb.h" -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" #include "chromeos/dbus/tpm_manager/tpm_manager_client.h" #include "components/prefs/pref_service.h" #include "components/sync_preferences/testing_pref_service_syncable.h"
diff --git a/chrome/browser/ash/cert_provisioning/cert_provisioning_common.h b/chrome/browser/ash/cert_provisioning/cert_provisioning_common.h index e8c6e8d4..01ffd46e 100644 --- a/chrome/browser/ash/cert_provisioning/cert_provisioning_common.h +++ b/chrome/browser/ash/cert_provisioning/cert_provisioning_common.h
@@ -13,7 +13,7 @@ #include "base/values.h" #include "chrome/browser/platform_keys/platform_keys.h" #include "chromeos/ash/components/dbus/attestation/interface.pb.h" -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" #include "components/policy/proto/device_management_backend.pb.h" #include "net/cert/x509_certificate.h" #include "third_party/abseil-cpp/absl/types/optional.h"
diff --git a/chrome/browser/ash/chrome_browser_main_parts_ash.cc b/chrome/browser/ash/chrome_browser_main_parts_ash.cc index e791270..7cae6c9 100644 --- a/chrome/browser/ash/chrome_browser_main_parts_ash.cc +++ b/chrome/browser/ash/chrome_browser_main_parts_ash.cc
@@ -194,6 +194,7 @@ #include "chromeos/ash/components/browser_context_helper/browser_context_helper.h" #include "chromeos/ash/components/cryptohome/cryptohome_parameters.h" #include "chromeos/ash/components/cryptohome/system_salt_getter.h" +#include "chromeos/ash/components/dbus/constants/cryptohome_key_delegate_constants.h" #include "chromeos/ash/components/dbus/dbus_thread_manager.h" #include "chromeos/ash/components/dbus/debug_daemon/debug_daemon_client.h" #include "chromeos/ash/components/dbus/services/cros_dbus_service.h" @@ -213,7 +214,6 @@ #include "chromeos/ash/services/cros_healthd/private/cpp/data_collector.h" #include "chromeos/ash/services/cros_healthd/public/cpp/service_connection.h" #include "chromeos/components/sensors/ash/sensor_hal_dispatcher.h" -#include "chromeos/dbus/constants/cryptohome_key_delegate_constants.h" #include "chromeos/dbus/power/fake_power_manager_client.h" #include "chromeos/dbus/power/power_manager_client.h" #include "chromeos/dbus/power/power_policy_controller.h"
diff --git a/chrome/browser/ash/crosapi/browser_data_migrator_util.h b/chrome/browser/ash/crosapi/browser_data_migrator_util.h index 7390865..ca977daa 100644 --- a/chrome/browser/ash/crosapi/browser_data_migrator_util.h +++ b/chrome/browser/ash/crosapi/browser_data_migrator_util.h
@@ -296,7 +296,7 @@ }; // List of data types in Sync Data that have to stay in Ash and Ash only. -static_assert(40 == syncer::GetNumModelTypes(), +static_assert(41 == syncer::GetNumModelTypes(), "If adding a new sync data type, update the lists below if" " you want to keep the new data type in Ash only."); constexpr syncer::ModelType kAshOnlySyncDataTypes[] = {
diff --git a/chrome/browser/ash/crosapi/keystore_service_ash.cc b/chrome/browser/ash/crosapi/keystore_service_ash.cc index 0d37650..5eede74b 100644 --- a/chrome/browser/ash/crosapi/keystore_service_ash.cc +++ b/chrome/browser/ash/crosapi/keystore_service_ash.cc
@@ -206,19 +206,19 @@ return; } - chromeos::attestation::AttestationKeyType key_type; + ash::attestation::AttestationKeyType key_type; switch (type) { case mojom::KeystoreType::kUser: - key_type = chromeos::attestation::KEY_USER; + key_type = ash::attestation::KEY_USER; break; case mojom::KeystoreType::kDevice: - key_type = chromeos::attestation::KEY_DEVICE; + key_type = ash::attestation::KEY_DEVICE; break; } Profile* profile = ProfileManager::GetActiveUserProfile(); std::string key_name_for_spkac; - if (migrate && (key_type == chromeos::attestation::KEY_DEVICE)) { + if (migrate && (key_type == ash::attestation::KEY_DEVICE)) { key_name_for_spkac = base::StrCat( {ash::attestation::kEnterpriseMachineKeyForSpkacPrefix, "keystore-", base::UnguessableToken::Create().ToString()}); @@ -283,19 +283,19 @@ return; } - chromeos::attestation::AttestationKeyType key_type; + ash::attestation::AttestationKeyType key_type; switch (type) { case mojom::KeystoreType::kUser: - key_type = chromeos::attestation::KEY_USER; + key_type = ash::attestation::KEY_USER; break; case mojom::KeystoreType::kDevice: - key_type = chromeos::attestation::KEY_DEVICE; + key_type = ash::attestation::KEY_DEVICE; break; } Profile* profile = ProfileManager::GetActiveUserProfile(); std::string key_name_for_spkac; - if (migrate && (key_type == chromeos::attestation::KEY_DEVICE)) { + if (migrate && (key_type == ash::attestation::KEY_DEVICE)) { key_name_for_spkac = base::StrCat({ash::attestation::kEnterpriseMachineKeyForSpkacPrefix, "lacros-", base::UnguessableToken::Create().ToString()});
diff --git a/chrome/browser/ash/crosapi/keystore_service_ash_unittest.cc b/chrome/browser/ash/crosapi/keystore_service_ash_unittest.cc index 1dbed3c..8951c05 100644 --- a/chrome/browser/ash/crosapi/keystore_service_ash_unittest.cc +++ b/chrome/browser/ash/crosapi/keystore_service_ash_unittest.cc
@@ -702,7 +702,7 @@ EXPECT_CALL( *challenge_key_ptr, - BuildResponse(chromeos::attestation::AttestationKeyType::KEY_USER, + BuildResponse(ash::attestation::AttestationKeyType::KEY_USER, /*profile=*/_, /*callback=*/_, /*challenge=*/GetDataStr(), /*register_key=*/false, /*key_name_for_spkac=*/std::string(), @@ -730,7 +730,7 @@ EXPECT_CALL( *challenge_key_ptr, - BuildResponse(chromeos::attestation::AttestationKeyType::KEY_USER, + BuildResponse(ash::attestation::AttestationKeyType::KEY_USER, /*profile=*/_, /*callback=*/_, /*challenge=*/GetDataStr(), /*register_key=*/true, /*key_name_for_spkac=*/std::string(), @@ -758,7 +758,7 @@ EXPECT_CALL( *challenge_key_ptr, - BuildResponse(chromeos::attestation::AttestationKeyType::KEY_DEVICE, + BuildResponse(ash::attestation::AttestationKeyType::KEY_DEVICE, /*profile=*/_, /*callback=*/_, /*challenge=*/GetDataStr(), /*register_key=*/false, /*key_name_for_spkac=*/std::string(), @@ -787,7 +787,7 @@ EXPECT_CALL( *challenge_key_ptr, BuildResponse( - chromeos::attestation::AttestationKeyType::KEY_DEVICE, + ash::attestation::AttestationKeyType::KEY_DEVICE, /*profile=*/_, /*callback=*/_, /*challenge=*/GetDataStr(), /*register_key=*/true, /*key_name_for_spkac=*/StrStartsWith("attest-ent-machine-keystore-"), @@ -815,7 +815,7 @@ EXPECT_CALL( *challenge_key_ptr, - BuildResponse(chromeos::attestation::AttestationKeyType::KEY_USER, + BuildResponse(ash::attestation::AttestationKeyType::KEY_USER, /*profile=*/_, /*callback=*/_, /*challenge=*/GetDataStr(), /*register_key=*/false, /*key_name_for_spkac=*/std::string(), @@ -1068,7 +1068,7 @@ EXPECT_CALL( *challenge_key_ptr, - BuildResponse(chromeos::attestation::AttestationKeyType::KEY_USER, + BuildResponse(ash::attestation::AttestationKeyType::KEY_USER, /*profile=*/_, /*callback=*/_, /*challenge=*/GetDataStr(), /*register_key=*/false, /*key_name_for_spkac=*/std::string(), @@ -1096,7 +1096,7 @@ EXPECT_CALL( *challenge_key_ptr, - BuildResponse(chromeos::attestation::AttestationKeyType::KEY_USER, + BuildResponse(ash::attestation::AttestationKeyType::KEY_USER, /*profile=*/_, /*callback=*/_, /*challenge=*/GetDataStr(), /*register_key=*/true, /*key_name_for_spkac=*/std::string(), @@ -1124,7 +1124,7 @@ EXPECT_CALL( *challenge_key_ptr, - BuildResponse(chromeos::attestation::AttestationKeyType::KEY_DEVICE, + BuildResponse(ash::attestation::AttestationKeyType::KEY_DEVICE, /*profile=*/_, /*callback=*/_, /*challenge=*/GetDataStr(), /*register_key=*/false, /*key_name_for_spkac=*/std::string(), @@ -1153,7 +1153,7 @@ EXPECT_CALL( *challenge_key_ptr, BuildResponse( - chromeos::attestation::AttestationKeyType::KEY_DEVICE, + ash::attestation::AttestationKeyType::KEY_DEVICE, /*profile=*/_, /*callback=*/_, /*challenge=*/GetDataStr(), /*register_key=*/true, /*key_name_for_spkac=*/StrStartsWith("attest-ent-machine-lacros-"), @@ -1181,7 +1181,7 @@ EXPECT_CALL( *challenge_key_ptr, - BuildResponse(chromeos::attestation::AttestationKeyType::KEY_USER, + BuildResponse(ash::attestation::AttestationKeyType::KEY_USER, /*profile=*/_, /*callback=*/_, /*challenge=*/GetDataStr(), /*register_key=*/false, /*key_name_for_spkac=*/std::string(),
diff --git a/chrome/browser/ash/crostini/ansible/ansible_management_test_helper.h b/chrome/browser/ash/crostini/ansible/ansible_management_test_helper.h index c6c523f..e3aff2fd 100644 --- a/chrome/browser/ash/crostini/ansible/ansible_management_test_helper.h +++ b/chrome/browser/ash/crostini/ansible/ansible_management_test_helper.h
@@ -36,7 +36,7 @@ Profile* profile_; base::test::ScopedFeatureList scoped_feature_list_; - // Owned by chromeos::DBusThreadManager + // Owned by ash::DBusThreadManager ash::FakeCiceroneClient* fake_cicerone_client_; };
diff --git a/chrome/browser/ash/crostini/crostini_manager.cc b/chrome/browser/ash/crostini/crostini_manager.cc index 4d6dedf..d350a24 100644 --- a/chrome/browser/ash/crostini/crostini_manager.cc +++ b/chrome/browser/ash/crostini/crostini_manager.cc
@@ -624,7 +624,7 @@ if (it->observer) observer_list_.RemoveObserver(it->observer); callbacks.push_back(std::move(it->callback)); - requests_.erase(it); + it = requests_.erase(it); } return base::BindOnce(
diff --git a/chrome/browser/ash/dbus/ash_dbus_helper.cc b/chrome/browser/ash/dbus/ash_dbus_helper.cc index cab500c..66417b0 100644 --- a/chrome/browser/ash/dbus/ash_dbus_helper.cc +++ b/chrome/browser/ash/dbus/ash_dbus_helper.cc
@@ -125,10 +125,10 @@ chromeos::SystemSaltGetter::Initialize(); // Initialize DBusThreadManager for the browser. - chromeos::DBusThreadManager::Initialize(); + DBusThreadManager::Initialize(); // Initialize Chrome dbus clients. - dbus::Bus* bus = chromeos::DBusThreadManager::Get()->GetSystemBus(); + dbus::Bus* bus = DBusThreadManager::Get()->GetSystemBus(); shill_clients::Initialize(bus); @@ -212,7 +212,7 @@ void InitializeFeatureListDependentDBus() { using chromeos::InitializeDBusClient; - dbus::Bus* bus = chromeos::DBusThreadManager::Get()->GetSystemBus(); + dbus::Bus* bus = DBusThreadManager::Get()->GetSystemBus(); if (floss::features::IsFlossEnabled()) { InitializeDBusClient<floss::FlossDBusManager>(bus); } else { @@ -329,7 +329,7 @@ AnomalyDetectorClient::Shutdown(); shill_clients::Shutdown(); - chromeos::DBusThreadManager::Shutdown(); + DBusThreadManager::Shutdown(); chromeos::SystemSaltGetter::Shutdown(); }
diff --git a/chrome/browser/ash/dbus/cryptohome_key_delegate_service_provider_browsertest.cc b/chrome/browser/ash/dbus/cryptohome_key_delegate_service_provider_browsertest.cc index e7aa7693..88894613 100644 --- a/chrome/browser/ash/dbus/cryptohome_key_delegate_service_provider_browsertest.cc +++ b/chrome/browser/ash/dbus/cryptohome_key_delegate_service_provider_browsertest.cc
@@ -24,10 +24,10 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chromeos/ash/components/cryptohome/cryptohome_parameters.h" +#include "chromeos/ash/components/dbus/constants/cryptohome_key_delegate_constants.h" #include "chromeos/ash/components/dbus/cryptohome/key.pb.h" #include "chromeos/ash/components/dbus/cryptohome/rpc.pb.h" #include "chromeos/ash/components/dbus/services/service_provider_test_helper.h" -#include "chromeos/dbus/constants/cryptohome_key_delegate_constants.h" #include "components/account_id/account_id.h" #include "components/user_manager/user_names.h" #include "content/public/browser/browser_context.h"
diff --git a/chrome/browser/ash/dbus/libvda_service_provider.h b/chrome/browser/ash/dbus/libvda_service_provider.h index 0ad4871..848f521 100644 --- a/chrome/browser/ash/dbus/libvda_service_provider.h +++ b/chrome/browser/ash/dbus/libvda_service_provider.h
@@ -11,7 +11,7 @@ #include "base/memory/weak_ptr.h" #include "chromeos/ash/components/dbus/services/cros_dbus_service.h" #include "dbus/exported_object.h" -#include "mojo/public/cpp/system/core.h" +#include "mojo/public/cpp/system/handle.h" namespace dbus { class MethodCall;
diff --git a/chrome/browser/ash/file_manager/file_manager_browsertest.cc b/chrome/browser/ash/file_manager/file_manager_browsertest.cc index 4a84a04e..da77b98 100644 --- a/chrome/browser/ash/file_manager/file_manager_browsertest.cc +++ b/chrome/browser/ash/file_manager/file_manager_browsertest.cc
@@ -882,6 +882,8 @@ .FilesSwa(), TestCase("openQuickViewCrostini"), TestCase("openQuickViewCrostini").FilesSwa(), + TestCase("openQuickViewGuestOs").EnableGuestOsFiles(), + TestCase("openQuickViewGuestOs").EnableGuestOsFiles().FilesSwa(), TestCase("openQuickViewLastModifiedMetaData") .EnableGenericDocumentsProvider(), TestCase("openQuickViewLastModifiedMetaData")
diff --git a/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc b/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc index f223cc0..4d8117f 100644 --- a/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc +++ b/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc
@@ -235,6 +235,7 @@ LOCAL_VOLUME, DRIVE_VOLUME, CROSTINI_VOLUME, + GUEST_OS_VOLUME_0, // GuestOS volume with provider id 0 (i.e. the first). USB_VOLUME, ANDROID_FILES_VOLUME, GENERIC_DOCUMENTS_PROVIDER_VOLUME, @@ -285,6 +286,8 @@ *volume = DRIVE_VOLUME; else if (value == "crostini") *volume = CROSTINI_VOLUME; + else if (value == "guest_os_0") + *volume = GUEST_OS_VOLUME_0; else if (value == "usb") *volume = USB_VOLUME; else if (value == "android_files") @@ -2580,6 +2583,11 @@ ASSERT_TRUE(crostini_volume_->Initialize(profile())); crostini_volume_->CreateEntry(*message.entries[i]); break; + case AddEntriesMessage::GUEST_OS_VOLUME_0: + CHECK(guest_os_volumes_.size() > 0) + << "Must call registerMountableGuest first"; + guest_os_volumes_["sftp://0:1234"]->CreateEntry(*message.entries[i]); + break; case AddEntriesMessage::DRIVE_VOLUME: if (drive_volume_) { drive_volume_->CreateEntry(*message.entries[i]);
diff --git a/chrome/browser/ash/file_manager/volume_manager.cc b/chrome/browser/ash/file_manager/volume_manager.cc index 6d24f0d..b2f111ba 100644 --- a/chrome/browser/ash/file_manager/volume_manager.cc +++ b/chrome/browser/ash/file_manager/volume_manager.cc
@@ -1627,43 +1627,46 @@ if (!storage_monitor::StorageInfo::IsMTPDevice(info.device_id())) return; - for (const auto& mounted_volume : mounted_volumes_) { - if (mounted_volume->source_path().value() != info.location()) - continue; - - // Unmount the MTP storage device in files app. - const std::string volume_id = mounted_volume->volume_id(); - DoUnmountEvent(*mounted_volume); - - // Remove the MTP storage device from chrome::storage. - const std::string fsid = GetMountPointNameForMediaStorage(info); - auto* mount_points = storage::ExternalMountPoints::GetSystemInstance(); - mount_points->RevokeFileSystem(fsid); - - // Remove the MTP storage device from the MTPDeviceMapService. - content::GetIOThreadTaskRunner({})->PostTask( - FROM_HERE, - base::BindOnce(&MTPDeviceMapService::RevokeMTPFileSystem, - base::Unretained(MTPDeviceMapService::GetInstance()), - fsid)); - - // The fusebox_mounter_ is enabled by a chrome flag. - if (!fusebox_mounter_) + Volumes::const_iterator it = mounted_volumes_.begin(); + for (const Volumes::const_iterator end = mounted_volumes_.end();; ++it) { + if (it == end) return; - - // Unmount the fusebox MTP storage device in files app. - base::WeakPtr<Volume> volume = FindVolumeById(util::kFuseBox + volume_id); - if (volume.get()) - DoUnmountEvent(*volume.get()); - - // Remove the fusebox MTP storage device from chrome::storage. - mount_points->RevokeFileSystem(util::kFuseBox + fsid); - - // Detach the fusebox MTP storage device from the fusebox daemon. - std::string subdir = FuseBoxMTPSubdir(info.device_id()); - fusebox_mounter_->DetachStorage(subdir, base::DoNothing()); - return; + DCHECK(*it); + if ((*it)->source_path().value() == info.location()) + break; } + + // Unmount the MTP storage device in files app. + const std::string volume_id = (*it)->volume_id(); + DoUnmountEvent(std::move(it)); + + // Remove the MTP storage device from chrome::storage. + const std::string fsid = GetMountPointNameForMediaStorage(info); + storage::ExternalMountPoints* const mount_points = + storage::ExternalMountPoints::GetSystemInstance(); + mount_points->RevokeFileSystem(fsid); + + // Remove the MTP storage device from the MTPDeviceMapService. + content::GetIOThreadTaskRunner({})->PostTask( + FROM_HERE, + base::BindOnce(&MTPDeviceMapService::RevokeMTPFileSystem, + base::Unretained(MTPDeviceMapService::GetInstance()), + fsid)); + + // The fusebox_mounter_ is enabled by a chrome flag. + if (!fusebox_mounter_) + return; + + // Unmount the fusebox MTP storage device in files app. + if (base::WeakPtr<Volume> volume = FindVolumeById(util::kFuseBox + volume_id)) + DoUnmountEvent(*volume); + + // Remove the fusebox MTP storage device from chrome::storage. + mount_points->RevokeFileSystem(util::kFuseBox + fsid); + + // Detach the fusebox MTP storage device from the fusebox daemon. + fusebox_mounter_->DetachStorage(FuseBoxMTPSubdir(info.device_id()), + base::DoNothing()); } void VolumeManager::OnDocumentsProviderRootAdded(
diff --git a/chrome/browser/ash/file_manager/volume_manager.h b/chrome/browser/ash/file_manager/volume_manager.h index 2e54ebe9..6d0fbd2 100644 --- a/chrome/browser/ash/file_manager/volume_manager.h +++ b/chrome/browser/ash/file_manager/volume_manager.h
@@ -619,21 +619,21 @@ RemoveSftpGuestOsVolumeCallback callback, ash::MountError error_code); - Profile* profile_; - drive::DriveIntegrationService* drive_integration_service_; // Not owned. - ash::disks::DiskMountManager* disk_mount_manager_; // Not owned. + Profile* const profile_; + drive::DriveIntegrationService* const drive_integration_service_; + ash::disks::DiskMountManager* const disk_mount_manager_; + ash::file_system_provider::Service* const file_system_provider_service_; + PrefChangeRegistrar pref_change_registrar_; base::ObserverList<VolumeManagerObserver>::Unchecked observers_; - ash::file_system_provider::Service* - file_system_provider_service_; // Not owned by this class. GetMtpStorageInfoCallback get_mtp_storage_info_callback_; Volumes mounted_volumes_; std::unique_ptr<FuseBoxMounter> fusebox_mounter_; std::unique_ptr<SnapshotManager> snapshot_manager_; std::unique_ptr<DocumentsProviderRootManager> documents_provider_root_manager_; - bool arc_volumes_mounted_ = false; io_task::IOTaskController io_task_controller_; + bool arc_volumes_mounted_ = false; // Note: This should remain the last member so it'll be destroyed and // invalidate its weak pointers before any other members are destroyed.
diff --git a/chrome/browser/ash/file_manager/volume_manager_unittest.cc b/chrome/browser/ash/file_manager/volume_manager_unittest.cc index fa546b07fc..a3a931a 100644 --- a/chrome/browser/ash/file_manager/volume_manager_unittest.cc +++ b/chrome/browser/ash/file_manager/volume_manager_unittest.cc
@@ -1203,6 +1203,7 @@ EXPECT_EQ(LoggingObserver::Event::VOLUME_MOUNTED, observer.events()[0].type); base::WeakPtr<Volume> volume = volume_manager()->FindVolumeById("mtp:model"); + ASSERT_TRUE(volume); EXPECT_EQ(VOLUME_TYPE_MTP, volume->type()); // Non MTP events from storage monitor are ignored. @@ -1215,7 +1216,7 @@ EXPECT_EQ(LoggingObserver::Event::VOLUME_UNMOUNTED, observer.events()[1].type); - EXPECT_FALSE(volume.get()); + EXPECT_FALSE(volume); volume_manager()->RemoveObserver(&observer); }
diff --git a/chrome/browser/ash/login/enrollment/enrollment_embedded_policy_server_browsertest.cc b/chrome/browser/ash/login/enrollment/enrollment_embedded_policy_server_browsertest.cc index 820bf3e..4acab5a 100644 --- a/chrome/browser/ash/login/enrollment/enrollment_embedded_policy_server_browsertest.cc +++ b/chrome/browser/ash/login/enrollment/enrollment_embedded_policy_server_browsertest.cc
@@ -95,8 +95,7 @@ AttestationClient::Get()->GetTestInterface()->AllowlistSignSimpleChallengeKey( /*username=*/"", attestation::GetKeyNameForProfile( - chromeos::attestation::PROFILE_ENTERPRISE_ENROLLMENT_CERTIFICATE, - "")); + attestation::PROFILE_ENTERPRISE_ENROLLMENT_CERTIFICATE, "")); } class EnrollmentEmbeddedPolicyServerBase : public OobeBaseTest {
diff --git a/chrome/browser/ash/login/oobe_interactive_ui_test.cc b/chrome/browser/ash/login/oobe_interactive_ui_test.cc index fc1f8e3..f29fc30 100644 --- a/chrome/browser/ash/login/oobe_interactive_ui_test.cc +++ b/chrome/browser/ash/login/oobe_interactive_ui_test.cc
@@ -919,10 +919,9 @@ AttestationClient::Get() ->GetTestInterface() ->AllowlistSignSimpleChallengeKey( - /*username=*/"", attestation::GetKeyNameForProfile( - chromeos::attestation:: - PROFILE_ENTERPRISE_ENROLLMENT_CERTIFICATE, - "")); + /*username=*/"", + attestation::GetKeyNameForProfile( + attestation::PROFILE_ENTERPRISE_ENROLLMENT_CERTIFICATE, "")); OobeInteractiveUITest::SetUpOnMainThread(); policy_test_server_mixin_.ConfigureFakeStatisticsForZeroTouch( &fake_statistics_provider_);
diff --git a/chrome/browser/ash/login/saml/saml_browsertest.cc b/chrome/browser/ash/login/saml/saml_browsertest.cc index 1971d7d4..60aafb0 100644 --- a/chrome/browser/ash/login/saml/saml_browsertest.cc +++ b/chrome/browser/ash/login/saml/saml_browsertest.cc
@@ -73,6 +73,7 @@ #include "chromeos/ash/components/cryptohome/system_salt_getter.h" #include "chromeos/ash/components/dbus/attestation/fake_attestation_client.h" #include "chromeos/ash/components/dbus/attestation/interface.pb.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" #include "chromeos/ash/components/dbus/cryptohome/key.pb.h" #include "chromeos/ash/components/dbus/cryptohome/rpc.pb.h" #include "chromeos/ash/components/dbus/session_manager/fake_session_manager_client.h" @@ -81,7 +82,6 @@ #include "chromeos/ash/components/dbus/userdataauth/fake_cryptohome_misc_client.h" #include "chromeos/ash/components/dbus/userdataauth/fake_userdataauth_client.h" #include "chromeos/ash/components/install_attributes/stub_install_attributes.h" -#include "chromeos/dbus/constants/attestation_constants.h" #include "components/account_id/account_id.h" #include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/content_settings/core/common/content_settings_types.h"
diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_installer_unittest.cc b/chrome/browser/ash/plugin_vm/plugin_vm_installer_unittest.cc index 7f34206..a945d0ac 100644 --- a/chrome/browser/ash/plugin_vm/plugin_vm_installer_unittest.cc +++ b/chrome/browser/ash/plugin_vm/plugin_vm_installer_unittest.cc
@@ -278,7 +278,7 @@ // A pointer to a singleton object which is valid until // ConciergeClient::Shutdown() is called. ash::FakeConciergeClient* fake_concierge_client_; - // Owned by chromeos::DBusThreadManager + // Owned by ash::DBusThreadManager chromeos::FakeDlcserviceClient* fake_dlcservice_client_; private:
diff --git a/chrome/browser/ash/policy/core/browser_policy_connector_ash.cc b/chrome/browser/ash/policy/core/browser_policy_connector_ash.cc index 139e9f2..4190f8ed 100644 --- a/chrome/browser/ash/policy/core/browser_policy_connector_ash.cc +++ b/chrome/browser/ash/policy/core/browser_policy_connector_ash.cc
@@ -137,7 +137,7 @@ // DBusThreadManager or DeviceSettingsService may be // uninitialized on unit tests. - if (chromeos::DBusThreadManager::IsInitialized() && + if (ash::DBusThreadManager::IsInitialized() && ash::DeviceSettingsService::IsInitialized()) { std::unique_ptr<DeviceCloudPolicyStoreAsh> device_cloud_policy_store = std::make_unique<DeviceCloudPolicyStoreAsh>(
diff --git a/chrome/browser/ash/policy/core/device_cloud_policy_manager_ash_unittest.cc b/chrome/browser/ash/policy/core/device_cloud_policy_manager_ash_unittest.cc index bc3a0792..bf7ffa42 100644 --- a/chrome/browser/ash/policy/core/device_cloud_policy_manager_ash_unittest.cc +++ b/chrome/browser/ash/policy/core/device_cloud_policy_manager_ash_unittest.cc
@@ -101,9 +101,9 @@ ash::attestation::AttestationFlow::CertificateCallback callback, std::string certificate) { base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), - chromeos::attestation::ATTESTATION_SUCCESS, - std::move(certificate))); + FROM_HERE, + base::BindOnce(std::move(callback), ash::attestation::ATTESTATION_SUCCESS, + std::move(certificate))); } void CertCallbackSuccessWithValidCertificate( @@ -1048,11 +1048,10 @@ ash::switches::kDisableMachineCertRequest); // Set expectation that a request for a machine cert is never made. - EXPECT_CALL( - mock_attestation_flow_, - GetCertificate(chromeos::attestation::AttestationCertificateProfile:: - PROFILE_ENTERPRISE_MACHINE_CERTIFICATE, - _, _, _, _, _)) + EXPECT_CALL(mock_attestation_flow_, + GetCertificate(ash::attestation::AttestationCertificateProfile:: + PROFILE_ENTERPRISE_MACHINE_CERTIFICATE, + _, _, _, _, _)) .Times(0); RunTest();
diff --git a/chrome/browser/ash/policy/enrollment/enrollment_handler.cc b/chrome/browser/ash/policy/enrollment/enrollment_handler.cc index e720c43..8c3b1ab1 100644 --- a/chrome/browser/ash/policy/enrollment/enrollment_handler.cc +++ b/chrome/browser/ash/policy/enrollment/enrollment_handler.cc
@@ -518,16 +518,16 @@ base::BindOnce(&EnrollmentHandler::HandleRegistrationCertificateResult, weak_ptr_factory_.GetWeakPtr(), is_initial_attempt); attestation_flow_->GetCertificate( - chromeos::attestation::PROFILE_ENTERPRISE_ENROLLMENT_CERTIFICATE, + ash::attestation::PROFILE_ENTERPRISE_ENROLLMENT_CERTIFICATE, EmptyAccountId(), /*request_origin=*/std::string(), force_new_key, /*=key_name=*/std::string(), std::move(callback)); } void EnrollmentHandler::HandleRegistrationCertificateResult( bool is_initial_attempt, - chromeos::attestation::AttestationStatus status, + ash::attestation::AttestationStatus status, const std::string& pem_certificate_chain) { - if (status != chromeos::attestation::ATTESTATION_SUCCESS) { + if (status != ash::attestation::ATTESTATION_SUCCESS) { ReportResult(EnrollmentStatus::ForStatus( EnrollmentStatus::REGISTRATION_CERT_FETCH_FAILED)); return;
diff --git a/chrome/browser/ash/policy/enrollment/enrollment_handler.h b/chrome/browser/ash/policy/enrollment/enrollment_handler.h index 26cf6d1..b4c7b80 100644 --- a/chrome/browser/ash/policy/enrollment/enrollment_handler.h +++ b/chrome/browser/ash/policy/enrollment/enrollment_handler.h
@@ -16,9 +16,9 @@ #include "chrome/browser/ash/policy/enrollment/enrollment_config.h" #include "chrome/browser/policy/device_account_initializer.h" #include "chromeos/ash/components/dbus/authpolicy/authpolicy_client.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" #include "chromeos/ash/components/dbus/userdataauth/userdataauth_client.h" #include "chromeos/ash/components/install_attributes/install_attributes.h" -#include "chromeos/dbus/constants/attestation_constants.h" #include "components/policy/core/common/cloud/cloud_policy_client.h" #include "components/policy/core/common/cloud/cloud_policy_constants.h" #include "components/policy/core/common/cloud/cloud_policy_store.h" @@ -162,7 +162,7 @@ // certificate if any. Otherwise, it attempted to fetch a fresh certificate. void HandleRegistrationCertificateResult( bool is_initial_attempt, - chromeos::attestation::AttestationStatus status, + ash::attestation::AttestationStatus status, const std::string& pem_certificate_chain); // Starts registration if the store is initialized.
diff --git a/chrome/browser/ash/policy/enrollment/tpm_enrollment_key_signing_service.cc b/chrome/browser/ash/policy/enrollment/tpm_enrollment_key_signing_service.cc index d75f6863..c44ed5f 100644 --- a/chrome/browser/ash/policy/enrollment/tpm_enrollment_key_signing_service.cc +++ b/chrome/browser/ash/policy/enrollment/tpm_enrollment_key_signing_service.cc
@@ -12,7 +12,7 @@ #include "chromeos/ash/components/dbus/attestation/attestation.pb.h" #include "chromeos/ash/components/dbus/attestation/attestation_client.h" #include "chromeos/ash/components/dbus/attestation/interface.pb.h" -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" #include "components/policy/proto/device_management_backend.pb.h" namespace policy { @@ -23,8 +23,8 @@ void TpmEnrollmentKeySigningService::SignData(const std::string& data, SigningCallback callback) { - const chromeos::attestation::AttestationCertificateProfile cert_profile = - chromeos::attestation::PROFILE_ENTERPRISE_ENROLLMENT_CERTIFICATE; + const ash::attestation::AttestationCertificateProfile cert_profile = + ash::attestation::PROFILE_ENTERPRISE_ENROLLMENT_CERTIFICATE; ::attestation::SignSimpleChallengeRequest request; request.set_username(""); request.set_key_label(
diff --git a/chrome/browser/ash/policy/enrollment/tpm_enrollment_key_signing_service_unittest.cc b/chrome/browser/ash/policy/enrollment/tpm_enrollment_key_signing_service_unittest.cc index 03903dae..7684b69 100644 --- a/chrome/browser/ash/policy/enrollment/tpm_enrollment_key_signing_service_unittest.cc +++ b/chrome/browser/ash/policy/enrollment/tpm_enrollment_key_signing_service_unittest.cc
@@ -55,8 +55,7 @@ ->AllowlistSignSimpleChallengeKey( /*username=*/"", ash::attestation::GetKeyNameForProfile( - chromeos::attestation::PROFILE_ENTERPRISE_ENROLLMENT_CERTIFICATE, - "")); + ash::attestation::PROFILE_ENTERPRISE_ENROLLMENT_CERTIFICATE, "")); base::RunLoop run_loop; bool returned_success = false;
diff --git a/chrome/browser/ash/policy/server_backed_state/active_directory_device_state_uploader_unittest.cc b/chrome/browser/ash/policy/server_backed_state/active_directory_device_state_uploader_unittest.cc index b749e3a5..0e0ee1a 100644 --- a/chrome/browser/ash/policy/server_backed_state/active_directory_device_state_uploader_unittest.cc +++ b/chrome/browser/ash/policy/server_backed_state/active_directory_device_state_uploader_unittest.cc
@@ -20,8 +20,8 @@ #include "chrome/test/base/testing_browser_process.h" #include "chromeos/ash/components/attestation/mock_attestation_flow.h" #include "chromeos/ash/components/dbus/attestation/fake_attestation_client.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" #include "chromeos/ash/components/dbus/session_manager/fake_session_manager_client.h" -#include "chromeos/dbus/constants/attestation_constants.h" #include "components/policy/core/common/cloud/cloud_policy_client.h" #include "components/policy/core/common/cloud/mock_device_management_service.h" #include "content/public/test/browser_task_environment.h"
diff --git a/chrome/browser/ash/system_extensions/system_extensions_data_source.cc b/chrome/browser/ash/system_extensions/system_extensions_data_source.cc index 1edbbbc..af610e0 100644 --- a/chrome/browser/ash/system_extensions/system_extensions_data_source.cc +++ b/chrome/browser/ash/system_extensions/system_extensions_data_source.cc
@@ -99,6 +99,12 @@ std::string SystemExtensionsDataSource::GetContentSecurityPolicy( network::mojom::CSPDirectiveName directive) { + // System extensions are unable to create trusted types policies and require + // disabling trusted types to run. + if (directive == network::mojom::CSPDirectiveName::RequireTrustedTypesFor || + directive == network::mojom::CSPDirectiveName::TrustedTypes) { + return std::string(); + } return content::URLDataSource::GetContentSecurityPolicy(directive); }
diff --git a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc index aa29c8a..ccfead0 100644 --- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc +++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc
@@ -173,8 +173,8 @@ #include "chromeos/ash/components/cryptohome/cryptohome_parameters.h" #include "chromeos/ash/components/dbus/attestation/attestation_client.h" #include "chromeos/ash/components/dbus/attestation/interface.pb.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" // nogncheck #include "chromeos/ash/components/dbus/dbus_thread_manager.h" // nogncheck -#include "chromeos/dbus/constants/attestation_constants.h" // nogncheck #include "components/user_manager/user.h" #include "device/fido/cros/credential_store.h" #endif // BUILDFLAG(IS_CHROMEOS_ASH) @@ -1067,7 +1067,7 @@ user->GetAccountId()) .account_id()); request.set_key_label_match( - chromeos::attestation::kContentProtectionKeyPrefix); + ash::attestation::kContentProtectionKeyPrefix); request.set_match_behavior( ::attestation::DeleteKeysRequest::MATCH_BEHAVIOR_PREFIX);
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index f9d320b..280ee5cc 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -261,6 +261,7 @@ "//chromeos/ash/components/dbus/chunneld", "//chromeos/ash/components/dbus/cicerone", "//chromeos/ash/components/dbus/concierge", + "//chromeos/ash/components/dbus/constants", "//chromeos/ash/components/dbus/cros_disks", "//chromeos/ash/components/dbus/cros_healthd", "//chromeos/ash/components/dbus/cryptohome", @@ -3560,6 +3561,7 @@ "../ui/webui/settings/ash/search/search_handler_unittest.cc", "../ui/webui/settings/ash/search/search_tag_registry_unittest.cc", "../ui/webui/settings/chromeos/bluetooth_handler_unittest.cc", + "../ui/webui/settings/chromeos/change_picture_handler_unittest.cc", "../ui/webui/settings/chromeos/device_keyboard_handler_unittest.cc", "../ui/webui/settings/chromeos/device_name_handler_unittest.cc", "../ui/webui/settings/chromeos/device_storage_handler_unittest.cc", @@ -3642,6 +3644,7 @@ "//chromeos/ash/components/dbus/attestation", "//chromeos/ash/components/dbus/attestation:attestation_proto", "//chromeos/ash/components/dbus/authpolicy", + "//chromeos/ash/components/dbus/constants", "//chromeos/ash/components/dbus/cros_disks", "//chromeos/ash/components/dbus/cryptohome", "//chromeos/ash/components/dbus/cryptohome:attestation_proto",
diff --git a/chrome/browser/enterprise/connectors/device_trust/attestation/ash/ash_attestation_service_unittest.cc b/chrome/browser/enterprise/connectors/device_trust/attestation/ash/ash_attestation_service_unittest.cc index 5dc5b16..6347677 100644 --- a/chrome/browser/enterprise/connectors/device_trust/attestation/ash/ash_attestation_service_unittest.cc +++ b/chrome/browser/enterprise/connectors/device_trust/attestation/ash/ash_attestation_service_unittest.cc
@@ -22,7 +22,7 @@ #include "chrome/test/base/testing_profile_manager.h" #include "chromeos/ash/components/dbus/attestation/attestation_ca.pb.h" #include "chromeos/ash/components/dbus/attestation/attestation_client.h" -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" #include "components/device_signals/core/common/signals_constants.h" #include "content/public/test/browser_task_environment.h" #include "testing/gmock/include/gmock/gmock.h" @@ -137,14 +137,13 @@ }); auto protoChallenge = GetSerializedSignedChallenge(); - EXPECT_CALL( - *mock_challenge_key_, - BuildResponse(chromeos::attestation::AttestationKeyType::KEY_DEVICE, - /*profile=*/&test_profile_, /*callback=*/_, - /*challenge=*/protoChallenge, - /*register_key=*/false, - /*key_name_for_spkac=*/std::string(), - /*signals=*/_)) + EXPECT_CALL(*mock_challenge_key_, + BuildResponse(ash::attestation::AttestationKeyType::KEY_DEVICE, + /*profile=*/&test_profile_, /*callback=*/_, + /*challenge=*/protoChallenge, + /*register_key=*/false, + /*key_name_for_spkac=*/std::string(), + /*signals=*/_)) .WillOnce(RunOnceCallback<2>( ash::attestation::TpmChallengeKeyResult::MakeChallengeResponse( kFakeResponse)));
diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn index ce9898e4..0f83ef0 100644 --- a/chrome/browser/extensions/BUILD.gn +++ b/chrome/browser/extensions/BUILD.gn
@@ -1167,6 +1167,7 @@ "//chromeos/ash/components/dbus", "//chromeos/ash/components/dbus/cicerone:cicerone", "//chromeos/ash/components/dbus/cicerone:cicerone_proto", + "//chromeos/ash/components/dbus/constants", "//chromeos/ash/components/dbus/cros_disks", "//chromeos/ash/components/dbus/cryptohome", "//chromeos/ash/components/dbus/image_burner",
diff --git a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_unittest.cc b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_unittest.cc index f8f6bda..91ccbb3f33 100644 --- a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_unittest.cc +++ b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_unittest.cc
@@ -39,7 +39,7 @@ const char kUserEmail[] = "test@google.com"; -void FakeRunCheckNotRegister(chromeos::attestation::AttestationKeyType key_type, +void FakeRunCheckNotRegister(ash::attestation::AttestationKeyType key_type, Profile* profile, ash::attestation::TpmChallengeKeyCallback callback, const std::string& challenge,
diff --git a/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.cc b/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.cc index 3f5bd3c..4d7c0e6 100644 --- a/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.cc +++ b/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.cc
@@ -39,7 +39,7 @@ return platform_keys::IsExtensionAllowed(profile, extension.get()); } -void EPKPChallengeKey::Run(chromeos::attestation::AttestationKeyType type, +void EPKPChallengeKey::Run(ash::attestation::AttestationKeyType type, scoped_refptr<ExtensionFunction> caller, ash::attestation::TpmChallengeKeyCallback callback, const std::string& challenge, @@ -54,7 +54,7 @@ } std::string key_name_for_spkac; - if (register_key && (type == chromeos::attestation::KEY_DEVICE)) { + if (register_key && (type == ash::attestation::KEY_DEVICE)) { key_name_for_spkac = ash::attestation::kEnterpriseMachineKeyForSpkacPrefix + caller->extension()->id(); } @@ -92,7 +92,7 @@ // |callback| holds a reference to |this|. base::OnceClosure task = base::BindOnce( &EPKPChallengeKey::Run, base::Unretained(&impl_), - chromeos::attestation::KEY_DEVICE, scoped_refptr<ExtensionFunction>(this), + ash::attestation::KEY_DEVICE, scoped_refptr<ExtensionFunction>(this), std::move(callback), challenge, /*register_key=*/false); content::GetUIThreadTaskRunner({})->PostTask(FROM_HERE, std::move(task)); @@ -137,7 +137,7 @@ // |callback| holds a reference to |this|. base::OnceClosure task = base::BindOnce( &EPKPChallengeKey::Run, base::Unretained(&impl_), - chromeos::attestation::KEY_USER, scoped_refptr<ExtensionFunction>(this), + ash::attestation::KEY_USER, scoped_refptr<ExtensionFunction>(this), std::move(callback), challenge, params->register_key); content::GetUIThreadTaskRunner({})->PostTask(FROM_HERE, std::move(task)); return RespondLater();
diff --git a/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.h b/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.h index 1156577..8bdf2ee 100644 --- a/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.h +++ b/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api.h
@@ -12,7 +12,7 @@ #include <string> #include "chrome/browser/ash/attestation/tpm_challenge_key.h" -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" #include "extensions/browser/extension_function.h" #include "extensions/common/extension.h" @@ -35,7 +35,7 @@ // Asynchronously run the flow to challenge a key in the |caller| // context. - void Run(chromeos::attestation::AttestationKeyType type, + void Run(ash::attestation::AttestationKeyType type, scoped_refptr<ExtensionFunction> caller, ash::attestation::TpmChallengeKeyCallback callback, const std::string& challenge,
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 69bbfa7..386ec67 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -1656,7 +1656,7 @@ { "name": "enable-async-dns", "owners": [ "horo", "net-dev" ], - "expiry_milestone": 106 + "expiry_milestone": 110 }, { "name": "enable-auto-disable-accessibility", @@ -5432,7 +5432,7 @@ { "name": "quick-dim", "owners": [ "charleszhao", "martis", "napper" ], - "expiry_milestone": 106 + "expiry_milestone": 109 }, { "name": "quick-intensive-throttling-after-loading", @@ -5997,7 +5997,7 @@ { "name": "snooping-protection", "owners": [ "martis", "charleszhao", "napper" ], - "expiry_milestone": 106 + "expiry_milestone": 109 }, { "name": "spectre-v2-mitigation",
diff --git a/chrome/browser/metrics/chrome_feature_list_creator.cc b/chrome/browser/metrics/chrome_feature_list_creator.cc index 1283e94f..56fbb162 100644 --- a/chrome/browser/metrics/chrome_feature_list_creator.cc +++ b/chrome/browser/metrics/chrome_feature_list_creator.cc
@@ -133,7 +133,7 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) // DBus must be initialized before constructing the policy connector. - CHECK(chromeos::DBusThreadManager::IsInitialized()); + CHECK(ash::DBusThreadManager::IsInitialized()); browser_policy_connector_ = std::make_unique<policy::BrowserPolicyConnectorAsh>(); #else
diff --git a/chrome/browser/metrics/perf/profile_provider_unittest_main.cc b/chrome/browser/metrics/perf/profile_provider_unittest_main.cc index e5ec3980..7086644f 100644 --- a/chrome/browser/metrics/perf/profile_provider_unittest_main.cc +++ b/chrome/browser/metrics/perf/profile_provider_unittest_main.cc
@@ -140,7 +140,7 @@ const ProfileProviderRealCollectionTest&) = delete; void SetUp() override { - chromeos::DBusThreadManager::Initialize(); + ash::DBusThreadManager::Initialize(); // ProfileProvider requires chromeos::LoginState and // chromeos::PowerManagerClient to be initialized. chromeos::PowerManagerClient::InitializeFake(); @@ -186,7 +186,7 @@ TestingBrowserProcess::DeleteInstance(); chromeos::LoginState::Shutdown(); chromeos::PowerManagerClient::Shutdown(); - chromeos::DBusThreadManager::Shutdown(); + ash::DBusThreadManager::Shutdown(); variations::testing::ClearAllVariationParams(); }
diff --git a/chrome/browser/notifications/notification_interactive_uitest_mac.mm b/chrome/browser/notifications/notification_interactive_uitest_mac.mm index 9b0aa058..4131d89 100644 --- a/chrome/browser/notifications/notification_interactive_uitest_mac.mm +++ b/chrome/browser/notifications/notification_interactive_uitest_mac.mm
@@ -27,17 +27,12 @@ { base::scoped_nsobject<WindowedNSNotificationObserver> observer( [[WindowedNSNotificationObserver alloc] - initForNotification:NSApplicationDidHideNotification + initForNotification:NSApplicationDidResignActiveNotification object:NSApp]); [NSApp hide:nil]; [observer wait]; } - EXPECT_TRUE([NSApp isHidden]); - - base::scoped_nsobject<WindowedNSNotificationObserver> observer( - [[WindowedNSNotificationObserver alloc] - initForNotification:NSApplicationDidUnhideNotification - object:NSApp]); + EXPECT_FALSE([NSApp isActive]); std::string result = CreateNotification( browser(), true, "", "", "", "", @@ -48,8 +43,13 @@ message_center::Notification* notification = *message_center->GetVisibleNotifications().begin(); - message_center->ClickOnNotification(notification->id()); - [observer wait]; - - EXPECT_FALSE([NSApp isHidden]); + { + base::scoped_nsobject<WindowedNSNotificationObserver> observer( + [[WindowedNSNotificationObserver alloc] + initForNotification:NSApplicationDidBecomeActiveNotification + object:NSApp]); + message_center->ClickOnNotification(notification->id()); + [observer wait]; + } + EXPECT_TRUE([NSApp isActive]); }
diff --git a/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer.cc index c846bba6..5e833971 100644 --- a/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer.cc +++ b/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer.cc
@@ -10,11 +10,11 @@ namespace { const char kHistogramMediaPageLoadNetworkBytes[] = - "PageLoad.Clients.MediaPageLoad.Experimental.Bytes.Network"; + "PageLoad.Clients.MediaPageLoad2.Experimental.Bytes.Network"; const char kHistogramMediaPageLoadCacheBytes[] = - "PageLoad.Clients.MediaPageLoad.Experimental.Bytes.Cache"; + "PageLoad.Clients.MediaPageLoad2.Experimental.Bytes.Cache"; const char kHistogramMediaPageLoadTotalBytes[] = - "PageLoad.Clients.MediaPageLoad.Experimental.Bytes.Total"; + "PageLoad.Clients.MediaPageLoad2.Experimental.Bytes.Total"; } // namespace @@ -36,6 +36,14 @@ return FORWARD_OBSERVING; } +page_load_metrics::PageLoadMetricsObserver::ObservePolicy +MediaPageLoadMetricsObserver::OnPrerenderStart( + content::NavigationHandle* navigation_handle, + const GURL& currently_committed_url) { + // Records if prerendered page is activated. + return CONTINUE_OBSERVING; +} + void MediaPageLoadMetricsObserver::OnResourceDataUseObserved( content::RenderFrameHost* rfh, const std::vector<page_load_metrics::mojom::ResourceDataUpdatePtr>& @@ -58,14 +66,23 @@ // app is about to be backgrounded, as part of the Activity.onPause() // flow. After this method is invoked, Chrome may be killed without further // notification, so we record final metrics collected up to this point. - if (GetDelegate().DidCommit() && played_media_) { - RecordByteHistograms(); - } + if (!GetDelegate().DidCommit()) + return STOP_OBSERVING; + if (GetDelegate().GetPrerenderingState() == + page_load_metrics::PrerenderingState::kInPrerendering) + return STOP_OBSERVING; + if (!played_media_) + return STOP_OBSERVING; + + RecordByteHistograms(); return STOP_OBSERVING; } void MediaPageLoadMetricsObserver::OnComplete( const page_load_metrics::mojom::PageLoadTiming& timing) { + if (GetDelegate().GetPrerenderingState() == + page_load_metrics::PrerenderingState::kInPrerendering) + return; if (!played_media_) return; RecordByteHistograms(); @@ -81,7 +98,10 @@ } void MediaPageLoadMetricsObserver::RecordByteHistograms() { + DCHECK_NE(GetDelegate().GetPrerenderingState(), + page_load_metrics::PrerenderingState::kInPrerendering); DCHECK(played_media_); + PAGE_BYTES_HISTOGRAM(kHistogramMediaPageLoadNetworkBytes, network_bytes_); PAGE_BYTES_HISTOGRAM(kHistogramMediaPageLoadCacheBytes, cache_bytes_); PAGE_BYTES_HISTOGRAM(kHistogramMediaPageLoadTotalBytes,
diff --git a/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer.h b/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer.h index 9229399c..1fac2d0 100644 --- a/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer.h +++ b/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer.h
@@ -28,6 +28,8 @@ ObservePolicy OnFencedFramesStart( content::NavigationHandle* navigation_handle, const GURL& currently_committed_url) override; + ObservePolicy OnPrerenderStart(content::NavigationHandle* navigation_handle, + const GURL& currently_committed_url) override; void OnComplete( const page_load_metrics::mojom::PageLoadTiming& timing) override; page_load_metrics::PageLoadMetricsObserver::ObservePolicy
diff --git a/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer_unittest.cc index 64f6155f..47d803d 100644 --- a/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer_unittest.cc +++ b/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer_unittest.cc
@@ -104,11 +104,11 @@ false /* simulate_app_background */); tester()->histogram_tester().ExpectTotalCount( - "PageLoad.Clients.MediaPageLoad.Experimental.Bytes.Network", 0); + "PageLoad.Clients.MediaPageLoad2.Experimental.Bytes.Network", 0); tester()->histogram_tester().ExpectTotalCount( - "PageLoad.Clients.MediaPageLoad.Experimental.Bytes.Cache", 0); + "PageLoad.Clients.MediaPageLoad2.Experimental.Bytes.Cache", 0); tester()->histogram_tester().ExpectTotalCount( - "PageLoad.Clients.MediaPageLoad.Experimental.Bytes.Total", 0); + "PageLoad.Clients.MediaPageLoad2.Experimental.Bytes.Total", 0); } TEST_F(MediaPageLoadMetricsObserverTest, MediaPlayed) { @@ -121,13 +121,13 @@ false /* simulate_app_background */); tester()->histogram_tester().ExpectUniqueSample( - "PageLoad.Clients.MediaPageLoad.Experimental.Bytes.Network", + "PageLoad.Clients.MediaPageLoad2.Experimental.Bytes.Network", static_cast<int>(network_bytes_ / 1024), 1); tester()->histogram_tester().ExpectUniqueSample( - "PageLoad.Clients.MediaPageLoad.Experimental.Bytes.Cache", + "PageLoad.Clients.MediaPageLoad2.Experimental.Bytes.Cache", static_cast<int>(cache_bytes_ / 1024), 1); tester()->histogram_tester().ExpectUniqueSample( - "PageLoad.Clients.MediaPageLoad.Experimental.Bytes.Total", + "PageLoad.Clients.MediaPageLoad2.Experimental.Bytes.Total", static_cast<int>((network_bytes_ + cache_bytes_) / 1024), 1); } @@ -141,13 +141,13 @@ true /* simulate_app_background */); tester()->histogram_tester().ExpectUniqueSample( - "PageLoad.Clients.MediaPageLoad.Experimental.Bytes.Network", + "PageLoad.Clients.MediaPageLoad2.Experimental.Bytes.Network", static_cast<int>(network_bytes_ / 1024), 1); tester()->histogram_tester().ExpectUniqueSample( - "PageLoad.Clients.MediaPageLoad.Experimental.Bytes.Cache", + "PageLoad.Clients.MediaPageLoad2.Experimental.Bytes.Cache", static_cast<int>(cache_bytes_ / 1024), 1); tester()->histogram_tester().ExpectUniqueSample( - "PageLoad.Clients.MediaPageLoad.Experimental.Bytes.Total", + "PageLoad.Clients.MediaPageLoad2.Experimental.Bytes.Total", static_cast<int>((network_bytes_ + cache_bytes_) / 1024), 1); } @@ -167,13 +167,13 @@ false /* simulate_app_background */); tester()->histogram_tester().ExpectUniqueSample( - "PageLoad.Clients.MediaPageLoad.Experimental.Bytes.Network", + "PageLoad.Clients.MediaPageLoad2.Experimental.Bytes.Network", static_cast<int>(network_bytes_ / 1024), 1); tester()->histogram_tester().ExpectUniqueSample( - "PageLoad.Clients.MediaPageLoad.Experimental.Bytes.Cache", + "PageLoad.Clients.MediaPageLoad2.Experimental.Bytes.Cache", static_cast<int>(cache_bytes_ / 1024), 1); tester()->histogram_tester().ExpectUniqueSample( - "PageLoad.Clients.MediaPageLoad.Experimental.Bytes.Total", + "PageLoad.Clients.MediaPageLoad2.Experimental.Bytes.Total", static_cast<int>((network_bytes_ + cache_bytes_) / 1024), 1); } @@ -193,12 +193,12 @@ false /* simulate_app_background */); tester()->histogram_tester().ExpectUniqueSample( - "PageLoad.Clients.MediaPageLoad.Experimental.Bytes.Network", + "PageLoad.Clients.MediaPageLoad2.Experimental.Bytes.Network", static_cast<int>(network_bytes_ / 1024), 1); tester()->histogram_tester().ExpectUniqueSample( - "PageLoad.Clients.MediaPageLoad.Experimental.Bytes.Cache", + "PageLoad.Clients.MediaPageLoad2.Experimental.Bytes.Cache", static_cast<int>(cache_bytes_ / 1024), 1); tester()->histogram_tester().ExpectUniqueSample( - "PageLoad.Clients.MediaPageLoad.Experimental.Bytes.Total", + "PageLoad.Clients.MediaPageLoad2.Experimental.Bytes.Total", static_cast<int>((network_bytes_ + cache_bytes_) / 1024), 1); }
diff --git a/chrome/browser/resources/chromeos/cloud_upload/BUILD.gn b/chrome/browser/resources/chromeos/cloud_upload/BUILD.gn index f2530eb..423b3bce 100644 --- a/chrome/browser/resources/chromeos/cloud_upload/BUILD.gn +++ b/chrome/browser/resources/chromeos/cloud_upload/BUILD.gn
@@ -9,11 +9,12 @@ static_files = [ "main.html" ] web_component_files = [ "cloud_upload_dialog.ts" ] - non_web_component_files = [ "browser_proxy.ts" ] + non_web_component_files = [ "cloud_upload_browser_proxy.ts" ] mojo_files = [ "$root_gen_dir/mojom-webui/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload.mojom-webui.js" ] mojo_files_deps = [ "//chrome/browser/ui/webui/chromeos/cloud_upload:mojo_bindings_webui_js", ] + ts_composite = true html_to_wrapper_template = "native"
diff --git a/chrome/browser/resources/chromeos/cloud_upload/browser_proxy.ts b/chrome/browser/resources/chromeos/cloud_upload/browser_proxy.ts deleted file mode 100644 index 56a65cabb..0000000 --- a/chrome/browser/resources/chromeos/cloud_upload/browser_proxy.ts +++ /dev/null
@@ -1,24 +0,0 @@ -// Copyright 2022 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import {PageHandlerFactory, PageHandlerRemote} from './cloud_upload.mojom-webui.js'; - -export class BrowserProxy { - handler: PageHandlerRemote = new PageHandlerRemote(); - - constructor() { - const factory = PageHandlerFactory.getRemote(); - factory.createPageHandler(this.handler.$.bindNewPipeAndPassReceiver()); - } - - static getInstance(): BrowserProxy { - return instance || (instance = new BrowserProxy()); - } - - static setInstance(obj: BrowserProxy) { - instance = obj; - } -} - -let instance: BrowserProxy|null = null; \ No newline at end of file
diff --git a/chrome/browser/resources/chromeos/cloud_upload/cloud_upload_browser_proxy.ts b/chrome/browser/resources/chromeos/cloud_upload/cloud_upload_browser_proxy.ts new file mode 100644 index 0000000..ed16fc02 --- /dev/null +++ b/chrome/browser/resources/chromeos/cloud_upload/cloud_upload_browser_proxy.ts
@@ -0,0 +1,38 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import {PageHandlerFactory, PageHandlerRemote} from './cloud_upload.mojom-webui.js'; + +export abstract class CloudUploadBrowserProxy { + handler: PageHandlerRemote; + + constructor() { + this.handler = new PageHandlerRemote(); + } + + static getInstance(): CloudUploadBrowserProxy { + return instance || (instance = new CloudUploadBrowserProxyImpl()); + } + + static setInstance(obj: CloudUploadBrowserProxy) { + instance = obj; + } + + abstract getDialogArguments(): string; +} + +class CloudUploadBrowserProxyImpl extends CloudUploadBrowserProxy { + constructor() { + super(); + const factory = PageHandlerFactory.getRemote(); + factory.createPageHandler(this.handler.$.bindNewPipeAndPassReceiver()); + } + + // JSON-encoded dialog arguments. + getDialogArguments(): string { + return chrome.getVariableValue('dialogArguments'); + } +} + +let instance: CloudUploadBrowserProxy|null = null;
diff --git a/chrome/browser/resources/chromeos/cloud_upload/cloud_upload_dialog.html b/chrome/browser/resources/chromeos/cloud_upload/cloud_upload_dialog.html index afbe98d..374147c 100644 --- a/chrome/browser/resources/chromeos/cloud_upload/cloud_upload_dialog.html +++ b/chrome/browser/resources/chromeos/cloud_upload/cloud_upload_dialog.html
@@ -9,7 +9,7 @@ } </style> -<cr-dialog> +<cr-dialog show-on-attach> <!-- TODO: Use localized strings --> <div slot="title"> Upload to Drive
diff --git a/chrome/browser/resources/chromeos/cloud_upload/cloud_upload_dialog.ts b/chrome/browser/resources/chromeos/cloud_upload/cloud_upload_dialog.ts index 847fd7e0..395234e 100644 --- a/chrome/browser/resources/chromeos/cloud_upload/cloud_upload_dialog.ts +++ b/chrome/browser/resources/chromeos/cloud_upload/cloud_upload_dialog.ts
@@ -3,20 +3,21 @@ // found in the LICENSE file. import 'chrome://resources/cr_elements/cr_button/cr_button.js'; +import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import {assert} from 'chrome://resources/js/assert_ts.js'; -import {BrowserProxy} from './browser_proxy.js'; import {UserAction} from './cloud_upload.mojom-webui.js'; +import {CloudUploadBrowserProxy} from './cloud_upload_browser_proxy.js'; import {getTemplate} from './cloud_upload_dialog.html.js'; /** * @fileoverview - * 'cloud-upload-dialog' defines the UI for the "Upload to cloud" workflow. + * 'cloud-upload' defines the UI for the "Upload to cloud" workflow. */ -class CloudUploadDialogElement extends HTMLElement { +export class CloudUploadElement extends HTMLElement { constructor() { super(); const template = document.createElement('template'); @@ -25,7 +26,7 @@ this.attachShadow({mode: 'open'}).appendChild(fragment); } - $<T extends Element>(query: string): T { + $<T extends HTMLElement>(query: string): T { return this.shadowRoot!.querySelector(query)!; } @@ -34,37 +35,50 @@ } get proxy() { - return BrowserProxy.getInstance().handler; + return CloudUploadBrowserProxy.getInstance(); } async connectedCallback() { - const dialogArgs = chrome.getVariableValue('dialogArguments'); - assert(dialogArgs); - var args = JSON.parse(dialogArgs); - assert(args); - assert(args.path); - const pathElement = this.$('#path') as HTMLElement; - pathElement.innerText = `File name: ${args.path}`; - - this.dialog.showModal(); const cancelButton = this.$('#cancel-button'); cancelButton.addEventListener('click', () => this.onCancelButtonClick()); const uploadButton = this.$('#upload-button'); uploadButton.addEventListener('click', () => this.onUploadButtonClick()); - const {uploadPath} = await this.proxy.getUploadPath(); - const uploadLocationElement = this.$('#upload-location') as HTMLElement; - uploadLocationElement.innerText = `Upload location: ${uploadPath.path}`; + let fileName = ''; + try { + const dialogArgs = this.proxy.getDialogArguments(); + assert(dialogArgs); + const args = JSON.parse(dialogArgs); + assert(args); + assert(args.fileName); + fileName = args.fileName; + } catch (e) { + // TODO(b/243095484) Define expected behavior. + console.error(`Unable to get dialog arguments . Error: ${e}.`); + } + this.$('#path').innerText = `File name: ${fileName}`; + + let destinationPath = ''; + try { + const {uploadPath} = await this.proxy.handler.getUploadPath(); + assert(uploadPath.path); + destinationPath = uploadPath.path; + } catch (e) { + // TODO(b/243095484) Define expected behavior. + console.error(`Unable to get upload path. Error: ${e}.`); + } + const uploadLocationElement = this.$('#upload-location'); + uploadLocationElement.innerText = `Upload location: ${destinationPath}`; uploadLocationElement.toggleAttribute('hidden', false); } private onCancelButtonClick(): void { - this.proxy.respondAndClose(UserAction.kCancel); + this.proxy.handler.respondAndClose(UserAction.kCancel); } private onUploadButtonClick(): void { - this.proxy.respondAndClose(UserAction.kUpload); + this.proxy.handler.respondAndClose(UserAction.kUpload); } } -customElements.define('cloud-upload-dialog', CloudUploadDialogElement); +customElements.define('cloud-upload', CloudUploadElement);
diff --git a/chrome/browser/resources/chromeos/cloud_upload/main.html b/chrome/browser/resources/chromeos/cloud_upload/main.html index 831e4cf..c07e278 100644 --- a/chrome/browser/resources/chromeos/cloud_upload/main.html +++ b/chrome/browser/resources/chromeos/cloud_upload/main.html
@@ -13,6 +13,6 @@ <script type="module" src="cloud_upload_dialog.js"></script> </head> <body> - <cloud-upload-dialog></cloud-upload-dialog> + <cloud-upload></cloud-upload> </body> </html> \ No newline at end of file
diff --git a/chrome/browser/resources/chromeos/cloud_upload/tsconfig_base.json b/chrome/browser/resources/chromeos/cloud_upload/tsconfig_base.json index b01690fe..0836c62 100644 --- a/chrome/browser/resources/chromeos/cloud_upload/tsconfig_base.json +++ b/chrome/browser/resources/chromeos/cloud_upload/tsconfig_base.json
@@ -2,7 +2,6 @@ "extends": "../../../../../tools/typescript/tsconfig_base.json", "compilerOptions": { "allowJs": true, - "importsNotUsedAsValues": "preserve", "typeRoots": [ "../../../../../third_party/node/node_modules/@types" ],
diff --git a/chrome/browser/resources/help_app/OWNERS b/chrome/browser/resources/help_app/OWNERS index 8ccf6d7..408e726 100644 --- a/chrome/browser/resources/help_app/OWNERS +++ b/chrome/browser/resources/help_app/OWNERS
@@ -1,2 +1 @@ achuith@chromium.org -carpenterr@chromium.org
diff --git a/chrome/browser/resources/identity_scope_approval_dialog/OWNERS b/chrome/browser/resources/identity_scope_approval_dialog/OWNERS index 5e319b1..fd467bd 100644 --- a/chrome/browser/resources/identity_scope_approval_dialog/OWNERS +++ b/chrome/browser/resources/identity_scope_approval_dialog/OWNERS
@@ -1,4 +1 @@ msarda@chromium.org - -# Original author, very slow on reviews as no longer working on Chromium. -courage@chromium.org
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/supported_links_item.html b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/supported_links_item.html index 6123cdac..8c70899 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/supported_links_item.html +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/supported_links_item.html
@@ -40,11 +40,15 @@ selected="[[getCurrentPref_(app)]]" on-selected-changed="onSupportedLinkPrefChanged_" disabled="[[disabled_]]"> - <cr-radio-button id="preferred" name="preferred"> - [[getPreferredLabel_(app)]] + <cr-radio-button + id="preferred" + name="preferred" + label="[[getPreferredLabel_(app)]]"> </cr-radio-button> - <cr-radio-button id="browser" name="browser"> - $i18n{appManagementIntentSharingOpenBrowserLabel} + <cr-radio-button + id="browser" + name="browser" + label="$i18n{appManagementIntentSharingOpenBrowserLabel}"> </cr-radio-button> <template is="dom-if" if="[[showOverlappingAppsWarning_]]"> <div id="overlap-warning">
diff --git a/chrome/browser/resources/settings/chromeos/os_route.js b/chrome/browser/resources/settings/chromeos/os_route.js index fac2101..4d6e1d8 100644 --- a/chrome/browser/resources/settings/chromeos/os_route.js +++ b/chrome/browser/resources/settings/chromeos/os_route.js
@@ -158,6 +158,14 @@ r.PERSONALIZATION = createSection( r.BASIC, routesMojomWebui.PERSONALIZATION_SECTION_PATH, Section.kPersonalization); + // Top level PERSONALIZATION section only contains a link to personalization + // hub if hub is enabled. The subpages should only be accessible if hub is + // off. + if (!loadTimeData.getBoolean('isPersonalizationHubEnabled')) { + r.CHANGE_PICTURE = createSubpage( + r.PERSONALIZATION, routesMojomWebui.CHANGE_PICTURE_SUBPAGE_PATH, + Subpage.kChangePicture); + } } // Search and Assistant section.
diff --git a/chrome/browser/resources/settings/chromeos/os_settings.gni b/chrome/browser/resources/settings/chromeos/os_settings.gni index 5b43c8b..b054eee 100644 --- a/chrome/browser/resources/settings/chromeos/os_settings.gni +++ b/chrome/browser/resources/settings/chromeos/os_settings.gni
@@ -117,6 +117,7 @@ "chromeos/os_settings_page/main_page_behavior.js", "chromeos/os_settings_routes.js", "chromeos/parental_controls_page/parental_controls_browser_proxy.js", + "chromeos/personalization_page/change_picture_browser_proxy.js", "chromeos/personalization_page/personalization_hub_browser_proxy.js", "chromeos/personalization_search_handler.js", "chromeos/pref_to_setting_metric_converter.js", @@ -326,6 +327,7 @@ "chromeos/os_settings_search_box/os_search_result_row.js", "chromeos/os_settings_search_box/os_settings_search_box.js", "chromeos/parental_controls_page/parental_controls_page.js", + "chromeos/personalization_page/change_picture.js", "chromeos/personalization_page/personalization_page.js", "chromeos/settings_scheduler_slider/settings_scheduler_slider.js", ]
diff --git a/chrome/browser/resources/settings/chromeos/os_settings.js b/chrome/browser/resources/settings/chromeos/os_settings.js index e00d775..a97f69e 100644 --- a/chrome/browser/resources/settings/chromeos/os_settings.js +++ b/chrome/browser/resources/settings/chromeos/os_settings.js
@@ -39,6 +39,7 @@ import './multidevice_page/multidevice_page.js'; import './nearby_share_page/nearby_share_receive_dialog.js'; import './nearby_share_page/nearby_share_subpage.js'; +import './personalization_page/change_picture.js'; import './personalization_page/personalization_page.js'; import './os_a11y_page/change_dictation_locale_dialog.js'; import './os_about_page/channel_switcher_dialog.js'; @@ -169,6 +170,7 @@ export {routes} from './os_route.js'; export {SearchEngine, SearchEnginesBrowserProxy, SearchEnginesBrowserProxyImpl, SearchEnginesInfo} from './os_search_page/search_engines_browser_proxy.js'; export {ParentalControlsBrowserProxy, ParentalControlsBrowserProxyImpl} from './parental_controls_page/parental_controls_browser_proxy.js'; +export {ChangePictureBrowserProxy, ChangePictureBrowserProxyImpl} from './personalization_page/change_picture_browser_proxy.js'; export {PersonalizationHubBrowserProxy, PersonalizationHubBrowserProxyImpl} from './personalization_page/personalization_hub_browser_proxy.js'; export {getPersonalizationSearchHandler, setPersonalizationSearchHandlerForTesting} from './personalization_search_handler.js'; export {getSettingsSearchHandler, setSettingsSearchHandlerForTesting} from './settings_search_handler.js';
diff --git a/chrome/browser/resources/settings/chromeos/personalization_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/personalization_page/BUILD.gn index 9d8ab26..80ecbe5 100644 --- a/chrome/browser/resources/settings/chromeos/personalization_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/personalization_page/BUILD.gn
@@ -10,11 +10,40 @@ closure_flags = os_settings_closure_flags is_polymer3 = true deps = [ + ":change_picture", + ":change_picture_browser_proxy", ":personalization_hub_browser_proxy", ":personalization_page", ] } +js_library("change_picture") { + deps = [ + ":change_picture_browser_proxy", + "..:deep_linking_behavior", + "..:metrics_recorder", + "..:os_route", + "..:route_observer_behavior", + "../..:router", + "//ash/webui/common/resources/cr_picture:cr_picture_list", + "//ash/webui/common/resources/cr_picture:cr_picture_pane", + "//ash/webui/common/resources/cr_picture:cr_picture_types", + "//ash/webui/common/resources/cr_picture:png", + "//third_party/polymer/v3_0/components-chromium/iron-selector:iron-selector", + "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", + "//ui/webui/resources/js:assert.m", + "//ui/webui/resources/js:i18n_behavior.m", + "//ui/webui/resources/js:load_time_data.m", + "//ui/webui/resources/js:util.m", + "//ui/webui/resources/js:web_ui_listener_behavior.m", + ] + externs_list = [ "//ui/webui/resources/cr_elements/cr_a11y_announcer/cr_a11y_announcer_externs.js" ] +} + +js_library("change_picture_browser_proxy") { + deps = [ "//ui/webui/resources/js:cr.m" ] +} + js_library("personalization_page") { deps = [ ":personalization_hub_browser_proxy", @@ -34,5 +63,8 @@ } html_to_js("web_components") { - js_files = [ "personalization_page.js" ] + js_files = [ + "change_picture.js", + "personalization_page.js", + ] }
diff --git a/chrome/browser/resources/settings/chromeos/personalization_page/change_picture.html b/chrome/browser/resources/settings/chromeos/personalization_page/change_picture.html new file mode 100644 index 0000000..3c2d96b --- /dev/null +++ b/chrome/browser/resources/settings/chromeos/personalization_page/change_picture.html
@@ -0,0 +1,98 @@ +<style include="settings-shared"> + :host { + /* #headerLine height + padding */ + --cr-settings-header-height: calc(62px + 1.34em); + --title-height: 2em; + --title-padding: 16px; + display: block; + min-height: 328px; + } + + #title { + height: var(--title-height); + margin-inline-start: 20px; + padding-top: var(--title-padding); + } + + #container { + align-items: flex-start; + display: flex; + margin-inline-start: 20px; + position: absolute; + top: calc(var(--cr-settings-header-height) + + var(--title-padding) + + var(--title-height)); + user-select: none; + } + + #picturePane { + --cr-picture-image-size: 192px; + flex-shrink: 0; + height: 288px; + margin-inline-end: 24px; + margin-top: 6px; + position: relative; + width: 288px; + } + + #sourceInfo { + color: var(--cros-text-color-disabled); + display: flex; + flex-direction: column; + margin-top: 20px; + } + + #pictureList { + /* TODO(reveman): Find a way to have height align to viewport + without using fixed position. */ + height: calc(100vh - + var(--cr-toolbar-height) - + var(--cr-toolbar-padding-top) - + var(--cr-settings-header-height) - + var(--title-padding) - + var(--title-height)); + margin-inline-end: 16px; + margin-top: 0; + min-height: 332px; + overflow-x: hidden; + overflow-y: auto; + position: relative; + } + +</style> +<div id="title">$i18n{changePicturePageDescription}</div> +<div id="container"> + <div> + <cr-picture-pane id="picturePane" + camera-present="[[cameraPresent_]]", + image-src="[[getImageSrc_(selectedItem_)]]" + image-type="[[getImageType_(selectedItem_)]]" + discard-image-label="$i18n{discardPhoto}" + preview-alt-text="$i18n{previewAltText}" + take-photo-label="$i18n{takePhoto}" + capture-video-label="$i18n{captureVideo}" + switch-mode-to-camera-label="$i18n{switchModeToCamera}" + switch-mode-to-video-label="$i18n{switchModeToVideo}" + camera-video-mode-enabled="[[cameraVideoModeEnabled_]]" + on-keys-pressed="onCameraPaneKeysPressed_"> + </cr-picture-pane> + <div id="sourceInfo" + hidden="[[!shouldShowSourceInfo_(selectedItem_, authorInfo_, websiteInfo_)]]"> + [[authorInfo_]] + <a href="[[websiteInfo_]]" target="_blank"> + [[websiteInfo_]] + </a> + </div> + </div> + <cr-picture-list id="pictureList" + hidden="[[!currentDefaultImages_]]" + camera-present="[[cameraPresent_]]" + default-images="[[currentDefaultImages_]]" + selected-item="{{selectedItem_}}" + choose-file-label="$i18n{chooseFile}" + old-image-label="[[oldImageLabel_]]" + profile-image-label="$i18n{profilePhoto}" + take-photo-label="$i18n{takePhoto}" + capture-video-label="$i18n{captureVideo}"> + </cr-picture-list> +</div>
diff --git a/chrome/browser/resources/settings/chromeos/personalization_page/change_picture.js b/chrome/browser/resources/settings/chromeos/personalization_page/change_picture.js new file mode 100644 index 0000000..24c6463 --- /dev/null +++ b/chrome/browser/resources/settings/chromeos/personalization_page/change_picture.js
@@ -0,0 +1,405 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/** + * @fileoverview + * 'settings-change-picture' is the settings subpage containing controls to + * edit a ChromeOS user's picture. + */ +import 'chrome://resources/ash/common/cr_picture/cr_picture_list.js'; +import 'chrome://resources/ash/common/cr_picture/cr_picture_pane.js'; +import '../../settings_shared.css.js'; + +import {CrPicture} from 'chrome://resources/ash/common/cr_picture/cr_picture_types.js'; +import {isEncodedPngDataUrlAnimated} from 'chrome://resources/ash/common/cr_picture/png.js'; +import {getInstance as getAnnouncerInstance} from 'chrome://resources/cr_elements/cr_a11y_announcer/cr_a11y_announcer.js'; +import {assert, assertNotReached} from 'chrome://resources/js/assert.m.js'; +import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/js/i18n_behavior.m.js'; +import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; +import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +import {loadTimeData} from '../../i18n_setup.js'; +import {Setting} from '../../mojom-webui/setting.mojom-webui.js'; +import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; +import {recordSettingChange} from '../metrics_recorder.js'; +import {routes} from '../os_route.js'; +import {RouteObserverBehavior, RouteObserverBehaviorInterface} from '../route_observer_behavior.js'; + +import {ChangePictureBrowserProxy, ChangePictureBrowserProxyImpl, DefaultImage} from './change_picture_browser_proxy.js'; + +/** + * @constructor + * @extends {PolymerElement} + * @implements {DeepLinkingBehaviorInterface} + * @implements {RouteObserverBehaviorInterface} + * @implements {I18nBehaviorInterface} + * @implements {WebUIListenerBehaviorInterface} + */ +const SettingsChangePictureElementBase = mixinBehaviors( + [ + DeepLinkingBehavior, + RouteObserverBehavior, + I18nBehavior, + WebUIListenerBehavior, + ], + PolymerElement); + +/** @polymer */ +class SettingsChangePictureElement extends SettingsChangePictureElementBase { + static get is() { + return 'settings-change-picture'; + } + + static get template() { + return html`{__html_template__}`; + } + + static get properties() { + return { + /** + * True if the user has a plugged-in webcam. + * @private {boolean} + */ + cameraPresent_: { + type: Boolean, + value: false, + }, + + /** + * The currently selected item. This property is bound to the + * iron-selector and never directly assigned. This may be undefined + * momentarily as the selection changes due to iron-selector + * implementation details. + * @private {?CrPicture.ImageElement} + */ + selectedItem_: { + type: Object, + value: null, + }, + + /** + * The current set of the default user images. + * @private {?Array<!DefaultImage>} + */ + currentDefaultImages_: { + type: Object, + value: null, + }, + + /** + * True when camera video mode is enabled. + * @private {boolean} + */ + cameraVideoModeEnabled_: { + type: Boolean, + value() { + return loadTimeData.getBoolean('changePictureVideoModeEnabled'); + }, + readOnly: true, + }, + + /** + * Author info of the default image. + * @private {string} + */ + authorInfo_: String, + + /** + * Website info of the default image. + * @private {string} + */ + websiteInfo_: String, + + /** @private */ + oldImageLabel_: String, + + /** + * Used by DeepLinkingBehavior to focus this page's deep links. + * @type {!Set<!Setting>} + */ + supportedSettingIds: { + type: Object, + value: () => new Set([Setting.kChangeDeviceAccountImage]), + }, + }; + } + + constructor() { + super(); + + /** @private {!ChangePictureBrowserProxy} */ + this.browserProxy_ = ChangePictureBrowserProxyImpl.getInstance(); + + /** @private {?CrPictureListElement} */ + this.pictureList_ = null; + + /** @private {boolean} */ + this.oldImagePending_ = false; + } + + /** @override */ + ready() { + super.ready(); + + this.pictureList_ = + /** @type {CrPictureListElement} */ (this.$.pictureList); + + this.addEventListener('discard-image', this.onDiscardImage_); + this.addEventListener('image-activate', (e) => { + this.onImageActivate_( + /** @type {!CustomEvent<!CrPicture.ImageElement>} */ (e)); + }); + this.addEventListener('focus-action', this.onFocusAction_); + this.addEventListener('photo-taken', (e) => { + this.onPhotoTaken_( + /** @type {!CustomEvent<{photoDataUrl: string}>} */ (e)); + }); + this.addEventListener('switch-mode', (e) => { + this.onSwitchMode_(/** @type {!CustomEvent<boolean>} */ (e)); + }); + } + + /** @override */ + connectedCallback() { + super.connectedCallback(); + + this.addWebUIListener( + 'default-images-changed', this.receiveDefaultImages_.bind(this)); + this.addWebUIListener( + 'selected-image-changed', this.receiveSelectedImage_.bind(this)); + this.addWebUIListener( + 'old-image-changed', this.receiveOldImage_.bind(this)); + this.addWebUIListener( + 'preview-deprecated-image', + this.receivePreviewDeprecatedImage_.bind(this)); + this.addWebUIListener( + 'profile-image-changed', this.receiveProfileImage_.bind(this)); + this.addWebUIListener( + 'camera-presence-changed', this.receiveCameraPresence_.bind(this)); + } + + /** + * Overridden from DeepLinkingBehavior. + * @param {!Setting} settingId + * @return {boolean} + */ + beforeDeepLinkAttempt(settingId) { + assert(settingId === Setting.kChangeDeviceAccountImage); + + this.pictureList_.setFocus(); + return false; + } + + + /** @protected */ + currentRouteChanged(newRoute) { + if (newRoute === routes.CHANGE_PICTURE) { + this.browserProxy_.initialize(); + this.browserProxy_.requestSelectedImage(); + this.pictureList_.setFocus(); + this.attemptDeepLink(); + } else { + // Ensure we deactivate the camera when we navigate away. + this.selectedItem_ = null; + } + } + + /** + * Handler for the 'default-images-changed' event. + * @param {{current_default_images: !Array<!DefaultImage>}} info + * @private + */ + receiveDefaultImages_(info) { + this.currentDefaultImages_ = info.current_default_images; + } + + /** + * Handler for the 'selected-image-changed' event. Is only called with + * default images. + * @param {string} imageUrl + * @private + */ + receiveSelectedImage_(imageUrl) { + this.pictureList_.setSelectedImageUrl(imageUrl); + } + + /** + * Handler for the 'old-image-changed' event. The Old image is any selected + * non-profile and non-default image. It can be from the camera or a file. + * When this method is called, the Old image becomes the selected image. + * @param {string} imageUrl + * @private + */ + receiveOldImage_(imageUrl) { + this.oldImageLabel_ = this.i18n( + isEncodedPngDataUrlAnimated(imageUrl) ? 'oldVideo' : 'oldPhoto'); + this.oldImagePending_ = false; + this.pictureList_.setOldImageUrl(imageUrl); + } + + /** + * Handler for the 'preview-deprecated-image' event. + * When this method is called, preview the deprecated default image in + * picturePane while do not show in the pictureList. + * Also set the source info for the deprecated image. + * @param {!{url: string, author: string, website: string}} imageInfo + * @private + */ + receivePreviewDeprecatedImage_(imageInfo) { + this.$.picturePane.previewDeprecatedImage(imageInfo.url); + this.authorInfo_ = + imageInfo.author ? this.i18n('authorCreditText', imageInfo.author) : ''; + this.websiteInfo_ = imageInfo.website; + this.selectedItem_ = null; + } + + /** + * Whether the source info should be shown. + * @param {CrPicture.ImageElement} selectedItem + * @param {string} authorInfo + * @param {string} websiteInfo + * @private + */ + shouldShowSourceInfo_(selectedItem, authorInfo, websiteInfo) { + return !selectedItem && (authorInfo || websiteInfo); + } + + /** + * Handler for the 'profile-image-changed' event. + * @param {string} imageUrl + * @param {boolean} selected + * @private + */ + receiveProfileImage_(imageUrl, selected) { + this.pictureList_.setProfileImageUrl(imageUrl, selected); + } + + /** + * Handler for the 'camera-presence-changed' event. + * @param {boolean} cameraPresent + * @private + */ + receiveCameraPresence_(cameraPresent) { + this.cameraPresent_ = cameraPresent; + } + + /** + * Selects an image element. + * @param {!CrPicture.ImageElement} image + * @private + */ + selectImage_(image) { + switch (image.dataset.type) { + case CrPicture.SelectionTypes.CAMERA: + /** CrPicturePaneElement */ (this.$.picturePane).takePhoto(); + break; + case CrPicture.SelectionTypes.FILE: + this.browserProxy_.chooseFile(); + recordSettingChange(); + break; + case CrPicture.SelectionTypes.PROFILE: + this.browserProxy_.selectProfileImage(); + recordSettingChange(); + break; + case CrPicture.SelectionTypes.OLD: + this.browserProxy_.selectOldImage(); + recordSettingChange(); + break; + case CrPicture.SelectionTypes.DEFAULT: + this.browserProxy_.selectDefaultImage(image.dataset.url); + recordSettingChange(); + break; + default: + assertNotReached('Selected unknown image type'); + } + } + + /** + * Handler for when an image is activated. + * @param {!CustomEvent<!CrPicture.ImageElement>} event + * @private + */ + onImageActivate_(event) { + this.selectImage_(event.detail); + } + + /** Focus the action button in the picture pane. */ + onFocusAction_() { + /** CrPicturePaneElement */ (this.$.picturePane).focusActionButton(); + } + + /** + * @param {!CustomEvent<{photoDataUrl: string}>} event + * @private + */ + onPhotoTaken_(event) { + this.oldImagePending_ = true; + this.browserProxy_.photoTaken(event.detail.photoDataUrl); + this.pictureList_.setOldImageUrl(event.detail.photoDataUrl); + this.pictureList_.setFocus(); + getAnnouncerInstance().announce( + loadTimeData.getString('photoCaptureAccessibleText')); + } + + /** + * @param {!CustomEvent<boolean>} event + * @private + */ + onSwitchMode_(event) { + const videomode = event.detail; + getAnnouncerInstance().announce(this.i18n( + videomode ? 'videoModeAccessibleText' : 'photoModeAccessibleText')); + } + + /** + * Callback the iron-a11y-keys "keys-pressed" event bubbles up from the + * cr-camera-pane. + * @param {!CustomEvent<!{key: string, keyboardEvent: Object}>} event + * @private + */ + onCameraPaneKeysPressed_(event) { + this.$.pictureList.focus(); + this.$.pictureList.onKeysPressed(event); + } + + /** @private */ + onDiscardImage_() { + // Prevent image from being discarded if old image is pending. + if (this.oldImagePending_) { + return; + } + this.pictureList_.setOldImageUrl(CrPicture.kDefaultImageUrl); + // Revert to profile image as we don't know what last used default image is. + this.browserProxy_.selectProfileImage(); + + const event = new CustomEvent('iron-announce', { + bubbles: true, + composed: true, + detail: {text: this.i18n('photoDiscardAccessibleText')}, + }); + this.dispatchEvent(event); + } + + /** + * @param {CrPicture.ImageElement} selectedItem + * @return {string} + * @private + */ + getImageSrc_(selectedItem) { + return (selectedItem && selectedItem.dataset.url) || ''; + } + + /** + * @param {CrPicture.ImageElement} selectedItem + * @return {string} + * @private + */ + getImageType_(selectedItem) { + return (selectedItem && selectedItem.dataset.type) || + CrPicture.SelectionTypes.NONE; + } +} + +customElements.define( + SettingsChangePictureElement.is, SettingsChangePictureElement);
diff --git a/chrome/browser/resources/settings/chromeos/personalization_page/change_picture_browser_proxy.js b/chrome/browser/resources/settings/chromeos/personalization_page/change_picture_browser_proxy.js new file mode 100644 index 0000000..c6cff981 --- /dev/null +++ b/chrome/browser/resources/settings/chromeos/personalization_page/change_picture_browser_proxy.js
@@ -0,0 +1,115 @@ +// 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. + +/** + * An object describing a default image. + * @typedef {{ + * author: (string|undefined), + * index: number, + * title: (string|undefined), + * url: string, + * website: (string|undefined) + * }} + */ +export let DefaultImage; + +/** @interface */ +export class ChangePictureBrowserProxy { + /** + * Retrieves the initial set of default images, profile image, etc. As a + * response, the C++ sends these WebUIListener events: + * 'default-images-changed', 'profile-image-changed', 'old-image-changed', + * and 'selected-image-changed' + */ + initialize() {} + + /** + * Sets the user image to one of the default images. As a response, the C++ + * sends the 'default-images-changed' WebUIListener event. + * @param {string} imageUrl + */ + selectDefaultImage(imageUrl) {} + + /** + * Sets the user image to the 'old' image. As a response, the C++ sends the + * 'old-image-changed' WebUIListener event. + */ + selectOldImage() {} + + /** + * Sets the user image to the profile image. As a response, the C++ sends + * the 'profile-image-changed' WebUIListener event. + */ + selectProfileImage() {} + + /** + * Provides the taken photo as a data URL to the C++ and sets the user + * image to the 'old' image. As a response, the C++ sends the + * 'old-image-changed' WebUIListener event. + * @param {string} photoDataUrl + */ + photoTaken(photoDataUrl) {} + + /** + * Requests a file chooser to select a new user image. No response is + * expected. + */ + chooseFile() {} + + /** Requests the currently selected image. */ + requestSelectedImage() {} +} + +/** @type {?ChangePictureBrowserProxy} */ +let instance = null; + +/** + * @implements {ChangePictureBrowserProxy} + */ +export class ChangePictureBrowserProxyImpl { + /** @return {!ChangePictureBrowserProxy} */ + static getInstance() { + return instance || (instance = new ChangePictureBrowserProxyImpl()); + } + + /** @param {!ChangePictureBrowserProxy} obj */ + static setInstanceForTesting(obj) { + instance = obj; + } + + /** @override */ + initialize() { + chrome.send('onChangePicturePageInitialized'); + } + + /** @override */ + selectDefaultImage(imageUrl) { + chrome.send('selectImage', [imageUrl, 'default']); + } + + /** @override */ + selectOldImage() { + chrome.send('selectImage', ['', 'old']); + } + + /** @override */ + selectProfileImage() { + chrome.send('selectImage', ['', 'profile']); + } + + /** @override */ + photoTaken(photoDataUrl) { + chrome.send('photoTaken', [photoDataUrl]); + } + + /** @override */ + chooseFile() { + chrome.send('chooseFile'); + } + + /** @override */ + requestSelectedImage() { + chrome.send('requestSelectedImage'); + } +}
diff --git a/chrome/browser/resources/settings/chromeos/personalization_page/personalization_page.html b/chrome/browser/resources/settings/chromeos/personalization_page/personalization_page.html index ffb20436..23731f2 100644 --- a/chrome/browser/resources/settings/chromeos/personalization_page/personalization_page.html +++ b/chrome/browser/resources/settings/chromeos/personalization_page/personalization_page.html
@@ -9,6 +9,19 @@ on-click="openPersonalizationHub_"> </cr-link-row> </template> + + <template is="dom-if" if="[[!isPersonalizationHubEnabled_]]"> + <cr-link-row id="changePictureRow" + label="$i18n{changePictureTitle}" + on-click="navigateToChangePicture_" + role-description="$i18n{subpageArrowRoleDescription}"> + </cr-link-row> + </template> </div> + <template is="dom-if" route-path="/changePicture"> + <settings-subpage page-title="$i18n{changePictureTitle}"> + <settings-change-picture></settings-change-picture> + </settings-subpage> + </template> </settings-animated-pages>
diff --git a/chrome/browser/resources/settings/chromeos/personalization_page/personalization_page.js b/chrome/browser/resources/settings/chromeos/personalization_page/personalization_page.js index c515f74e..06f039f6 100644 --- a/chrome/browser/resources/settings/chromeos/personalization_page/personalization_page.js +++ b/chrome/browser/resources/settings/chromeos/personalization_page/personalization_page.js
@@ -7,10 +7,12 @@ * personalization settings. */ import 'chrome://resources/cr_elements/cr_link_row/cr_link_row.js'; +import './change_picture.js'; import '../../settings_page/settings_animated_pages.js'; import '../../settings_page/settings_subpage.js'; import '../../settings_shared.css.js'; +import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/js/i18n_behavior.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {loadTimeData} from '../../i18n_setup.js'; @@ -26,10 +28,11 @@ * @constructor * @extends {PolymerElement} * @implements {DeepLinkingBehaviorInterface} + * @implements {I18nBehaviorInterface} * @implements {RouteObserverBehaviorInterface} */ const SettingsPersonalizationPageElementBase = mixinBehaviors( - [DeepLinkingBehavior, RouteObserverBehavior], PolymerElement); + [DeepLinkingBehavior, I18nBehavior, RouteObserverBehavior], PolymerElement); /** @polymer */ class SettingsPersonalizationPageElement extends @@ -63,6 +66,10 @@ type: Object, value() { const map = new Map(); + if (routes.CHANGE_PICTURE) { + map.set(routes.CHANGE_PICTURE.path, '#changePictureRow'); + } + return map; }, }, @@ -104,6 +111,11 @@ openPersonalizationHub_() { this.personalizationHubBrowserProxy_.openPersonalizationHub(); } + + /** @private */ + navigateToChangePicture_() { + Router.getInstance().navigateTo(routes.CHANGE_PICTURE); + } } customElements.define(
diff --git a/chrome/browser/storage_access_api/api_browsertest.cc b/chrome/browser/storage_access_api/api_browsertest.cc index 2ae771b..803cb96f 100644 --- a/chrome/browser/storage_access_api/api_browsertest.cc +++ b/chrome/browser/storage_access_api/api_browsertest.cc
@@ -5,6 +5,7 @@ #include "base/bind.h" #include "base/callback_helpers.h" #include "base/path_service.h" +#include "base/strings/strcat.h" #include "base/strings/stringprintf.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h" @@ -45,6 +46,11 @@ namespace { +constexpr char kHostA[] = "a.test"; +constexpr char kHostB[] = "b.test"; +constexpr char kHostC[] = "c.test"; +constexpr char kHostD[] = "d.test"; + constexpr char kUseCounterHistogram[] = "Blink.UseCounter.Features"; enum class TestType { kFrame, kWorker }; @@ -93,24 +99,29 @@ host_resolver()->AddRule("*", "127.0.0.1"); base::FilePath path; base::PathService::Get(content::DIR_TEST_DATA, &path); + https_server_.SetSSLConfig(net::EmbeddedTestServer::CERT_TEST_NAMES); https_server_.ServeFilesFromDirectory(path); https_server_.AddDefaultHandlers(GetChromeTestDataDir()); ASSERT_TRUE(https_server_.Start()); } void SetUpCommandLine(base::CommandLine* command_line) override { - // HTTPS server only serves a valid cert for localhost, so this is needed - // to load pages from other hosts without an error. - command_line->AppendSwitch(switches::kIgnoreCertificateErrors); // TODO(fivedots): Remove this switch once Storage Foundation is enabled // by default. command_line->AppendSwitchASCII(switches::kEnableBlinkFeatures, "StorageFoundationAPI"); } + void SetCrossSiteCookieOnHost(const std::string& host) { + GURL host_url = GetURL(host); + std::string cookie = base::StrCat({"cross-site=", host}); + content::SetCookie(browser()->profile(), host_url, + base::StrCat({cookie, ";SameSite=None;Secure"})); + ASSERT_EQ(content::GetCookies(browser()->profile(), host_url), cookie); + } + GURL GetURL(const std::string& host) { - GURL url(https_server_.GetURL(host, "/")); - return url; + return https_server_.GetURL(host, "/"); } void SetBlockThirdPartyCookies(bool value) { @@ -209,24 +220,16 @@ SetBlockThirdPartyCookies(true); base::HistogramTester histogram_tester; - // Set a cookie on `b.com`. - content::SetCookie(browser()->profile(), https_server().GetURL("b.com", "/"), - "thirdparty=1;SameSite=None;Secure"); - ASSERT_EQ(content::GetCookies(browser()->profile(), GetURL("b.com")), - "thirdparty=1"); + // Set cross-site cookies on all hosts. + SetCrossSiteCookieOnHost(kHostA); + SetCrossSiteCookieOnHost(kHostB); + SetCrossSiteCookieOnHost(kHostC); + SetCrossSiteCookieOnHost(kHostD); - // Set a cookie on othersite.com. - content::SetCookie(browser()->profile(), - https_server().GetURL("othersite.com", "/"), - "thirdparty=other;SameSite=None;Secure"); - ASSERT_EQ(content::GetCookies(browser()->profile(), GetURL("othersite.com")), - "thirdparty=other"); + NavigateToPageWithFrame(kHostA); - NavigateToPageWithFrame("a.com"); - - // Allow all requests for b.com to have cookie access from a.com. - // On the other hand, othersite.com does not have an exception set for it. - NavigateFrameTo("b.com", "/echoheader?cookie"); + // Allow all requests for kHostB to have cookie access from a.test. + NavigateFrameTo(kHostB, "/echoheader?cookie"); EXPECT_EQ(GetFrameContent(), "None"); EXPECT_EQ(ReadCookiesViaJS(GetFrame()), ""); EXPECT_FALSE(storage::test::HasStorageAccessForFrame(GetFrame())); @@ -235,13 +238,13 @@ // Navigate iframe to a cross-site, cookie-reading endpoint, and verify that // the cookie is sent: - NavigateFrameTo("b.com", "/echoheader?cookie"); - EXPECT_EQ(GetFrameContent(), "thirdparty=1"); - EXPECT_EQ(ReadCookiesViaJS(GetFrame()), "thirdparty=1"); + NavigateFrameTo(kHostB, "/echoheader?cookie"); + EXPECT_EQ(GetFrameContent(), "cross-site=b.test"); + EXPECT_EQ(ReadCookiesViaJS(GetFrame()), "cross-site=b.test"); EXPECT_TRUE(storage::test::HasStorageAccessForFrame(GetFrame())); - // Navigate iframe to othersite.com and verify that the cookie is not sent. - NavigateFrameTo("othersite.com", "/echoheader?cookie"); + // Navigate iframe to c.test and verify that the cookie is not sent. + NavigateFrameTo(kHostC, "/echoheader?cookie"); EXPECT_EQ(GetFrameContent(), "None"); EXPECT_EQ(ReadCookiesViaJS(GetFrame()), ""); EXPECT_FALSE(storage::test::HasStorageAccessForFrame(GetFrame())); @@ -249,14 +252,14 @@ // Navigate iframe to a cross-site frame with a frame, and navigate _that_ // frame to a cross-site page that echos the cookie header, and verify that // the cookie is sent: - NavigateFrameTo("b.com", "/iframe.html"); - NavigateNestedFrameTo("b.com", "/echoheader?cookie"); - EXPECT_EQ(GetNestedFrameContent(), "thirdparty=1"); - EXPECT_EQ(ReadCookiesViaJS(GetNestedFrame()), "thirdparty=1"); + NavigateFrameTo(kHostB, "/iframe.html"); + NavigateNestedFrameTo(kHostB, "/echoheader?cookie"); + EXPECT_EQ(GetNestedFrameContent(), "cross-site=b.test"); + EXPECT_EQ(ReadCookiesViaJS(GetNestedFrame()), "cross-site=b.test"); EXPECT_TRUE(storage::test::HasStorageAccessForFrame(GetNestedFrame())); - // Navigate nested iframe to othersite.com and verify that the cookie is not + // Navigate nested iframe to c.test and verify that the cookie is not // sent. - NavigateNestedFrameTo("othersite.com", "/echoheader?cookie"); + NavigateNestedFrameTo(kHostC, "/echoheader?cookie"); EXPECT_EQ(GetNestedFrameContent(), "None"); EXPECT_EQ(ReadCookiesViaJS(GetNestedFrame()), ""); EXPECT_FALSE(storage::test::HasStorageAccessForFrame(GetNestedFrame())); @@ -264,25 +267,25 @@ // Navigate iframe to a cross-site frame with a frame, and navigate _that_ // frame to a distinct cross-site page that echos the cookie header, and // verify that the cookie is sent: - NavigateFrameTo("c.com", "/iframe.html"); - NavigateNestedFrameTo("b.com", "/echoheader?cookie"); - EXPECT_EQ(GetNestedFrameContent(), "thirdparty=1"); - EXPECT_EQ(ReadCookiesViaJS(GetNestedFrame()), "thirdparty=1"); + NavigateFrameTo(kHostC, "/iframe.html"); + NavigateNestedFrameTo(kHostB, "/echoheader?cookie"); + EXPECT_EQ(GetNestedFrameContent(), "cross-site=b.test"); + EXPECT_EQ(ReadCookiesViaJS(GetNestedFrame()), "cross-site=b.test"); EXPECT_TRUE(storage::test::HasStorageAccessForFrame(GetNestedFrame())); - // Navigate nested iframe to othersite.com and verify that the cookie is not + // Navigate nested iframe to c.test and verify that the cookie is not // sent. - NavigateNestedFrameTo("othersite.com", "/echoheader?cookie"); + NavigateNestedFrameTo(kHostC, "/echoheader?cookie"); EXPECT_EQ(GetNestedFrameContent(), "None"); EXPECT_EQ(ReadCookiesViaJS(GetNestedFrame()), ""); EXPECT_FALSE(storage::test::HasStorageAccessForFrame(GetNestedFrame())); - // Navigate our top level to d.com and verify that all requests for b.com are - // now blocked in that context. - NavigateToPageWithFrame("d.com"); + // Navigate our top level to kHostD and verify that all requests for kHostB + // are now blocked in that context. + NavigateToPageWithFrame(kHostD); // Navigate iframe to a cross-site, cookie-reading endpoint, and verify that // the cookie is blocked: - NavigateFrameTo("b.com", "/echoheader?cookie"); + NavigateFrameTo(kHostB, "/echoheader?cookie"); EXPECT_EQ(GetFrameContent(), "None"); EXPECT_EQ(ReadCookiesViaJS(GetFrame()), ""); EXPECT_FALSE(storage::test::HasStorageAccessForFrame(GetFrame())); @@ -290,8 +293,8 @@ // Navigate iframe to a cross-site frame with a frame, and navigate _that_ // frame to a cross-site page that echos the cookie header, and verify that // the cookie is blocked: - NavigateFrameTo("b.com", "/iframe.html"); - NavigateNestedFrameTo("b.com", "/echoheader?cookie"); + NavigateFrameTo(kHostB, "/iframe.html"); + NavigateNestedFrameTo(kHostB, "/echoheader?cookie"); EXPECT_EQ(GetNestedFrameContent(), "None"); EXPECT_EQ(ReadCookiesViaJS(GetNestedFrame()), ""); EXPECT_FALSE(storage::test::HasStorageAccessForFrame(GetNestedFrame())); @@ -299,8 +302,8 @@ // Navigate iframe to a cross-site frame with a frame, and navigate _that_ // frame to a distinct cross-site page that echos the cookie header, and // verify that the cookie is blocked: - NavigateFrameTo("c.com", "/iframe.html"); - NavigateNestedFrameTo("b.com", "/echoheader?cookie"); + NavigateFrameTo(kHostC, "/iframe.html"); + NavigateNestedFrameTo(kHostB, "/echoheader?cookie"); EXPECT_EQ(GetNestedFrameContent(), "None"); EXPECT_EQ(ReadCookiesViaJS(GetNestedFrame()), ""); EXPECT_FALSE(storage::test::HasStorageAccessForFrame(GetNestedFrame())); @@ -325,29 +328,27 @@ ThirdPartyCookiesIFrameThirdPartyExceptions) { SetBlockThirdPartyCookies(true); - // Set a cookie on `b.com`. - content::SetCookie(browser()->profile(), https_server().GetURL("b.com", "/"), + // Set a cookie on `kHostB`. + content::SetCookie(browser()->profile(), GetURL(kHostB), "thirdparty=1;SameSite=None;Secure"); - ASSERT_EQ(content::GetCookies(browser()->profile(), GetURL("b.com")), + ASSERT_EQ(content::GetCookies(browser()->profile(), GetURL(kHostB)), "thirdparty=1"); - NavigateToPageWithFrame("a.com"); - NavigateFrameTo("b.com", "/echoheader?cookie"); + NavigateToPageWithFrame(kHostA); + NavigateFrameTo(kHostB, "/echoheader?cookie"); EXPECT_FALSE(storage::test::HasStorageAccessForFrame(GetFrame())); EXPECT_TRUE(storage::test::RequestStorageAccessForFrame(GetFrame())); EXPECT_TRUE(storage::test::HasStorageAccessForFrame(GetFrame())); - // Block all cookies with a user setting for b.com. - auto cookie_settings = - CookieSettingsFactory::GetForProfile(browser()->profile()); - GURL url = https_server().GetURL("b.com", "/"); - cookie_settings->SetCookieSetting(url, ContentSetting::CONTENT_SETTING_BLOCK); + // Block all cookies with a user setting for kHostB. + CookieSettingsFactory::GetForProfile(browser()->profile()) + ->SetCookieSetting(GetURL(kHostB), ContentSetting::CONTENT_SETTING_BLOCK); EXPECT_FALSE(storage::test::HasStorageAccessForFrame(GetFrame())); // Navigate iframe to a cross-site, cookie-reading endpoint, and verify that // the cookie is blocked: - NavigateFrameTo("b.com", "/echoheader?cookie"); + NavigateFrameTo(kHostB, "/echoheader?cookie"); EXPECT_EQ(GetFrameContent(), "None"); EXPECT_EQ(ReadCookiesViaJS(GetFrame()), ""); EXPECT_FALSE(storage::test::HasStorageAccessForFrame(GetFrame())); @@ -355,8 +356,8 @@ // Navigate iframe to a cross-site frame with a frame, and navigate _that_ // frame to a cross-site page that echos the cookie header, and verify that // the cookie is blocked: - NavigateFrameTo("b.com", "/iframe.html"); - NavigateNestedFrameTo("b.com", "/echoheader?cookie"); + NavigateFrameTo(kHostB, "/iframe.html"); + NavigateNestedFrameTo(kHostB, "/echoheader?cookie"); EXPECT_EQ(GetNestedFrameContent(), "None"); EXPECT_EQ(ReadCookiesViaJS(GetNestedFrame()), ""); EXPECT_FALSE(storage::test::HasStorageAccessForFrame(GetNestedFrame())); @@ -364,8 +365,8 @@ // Navigate iframe to a cross-site frame with a frame, and navigate _that_ // frame to a distinct cross-site page that echos the cookie header, and // verify that the cookie is blocked: - NavigateFrameTo("c.com", "/iframe.html"); - NavigateNestedFrameTo("b.com", "/echoheader?cookie"); + NavigateFrameTo(kHostC, "/iframe.html"); + NavigateNestedFrameTo(kHostB, "/echoheader?cookie"); EXPECT_EQ(GetNestedFrameContent(), "None"); EXPECT_EQ(ReadCookiesViaJS(GetNestedFrame()), ""); EXPECT_FALSE(storage::test::HasStorageAccessForFrame(GetNestedFrame())); @@ -376,14 +377,14 @@ ThirdPartyGrantsDeletedAccess) { SetBlockThirdPartyCookies(true); - // Set a cookie on `b.com`. - content::SetCookie(browser()->profile(), https_server().GetURL("b.com", "/"), + // Set a cookie on `kHostB`. + content::SetCookie(browser()->profile(), GetURL(kHostB), "thirdparty=1;SameSite=None;Secure"); - ASSERT_EQ(content::GetCookies(browser()->profile(), GetURL("b.com")), + ASSERT_EQ(content::GetCookies(browser()->profile(), GetURL(kHostB)), "thirdparty=1"); - NavigateToPageWithFrame("a.com"); - NavigateFrameTo("b.com", "/echoheader?cookie"); + NavigateToPageWithFrame(kHostA); + NavigateFrameTo(kHostB, "/echoheader?cookie"); EXPECT_FALSE(storage::test::HasStorageAccessForFrame(GetFrame())); EXPECT_TRUE(storage::test::RequestStorageAccessForFrame(GetFrame())); @@ -391,7 +392,7 @@ // Navigate iframe to a cross-site, cookie-reading endpoint, and verify that // the cookie is sent: - NavigateFrameTo("b.com", "/echoheader?cookie"); + NavigateFrameTo(kHostB, "/echoheader?cookie"); EXPECT_EQ(GetFrameContent(), "thirdparty=1"); EXPECT_EQ(ReadCookiesViaJS(GetFrame()), "thirdparty=1"); EXPECT_TRUE(storage::test::HasStorageAccessForFrame(GetFrame())); @@ -401,7 +402,7 @@ HostContentSettingsMapFactory::GetForProfile(browser()->profile()); settings_map->ClearSettingsForOneType(ContentSettingsType::STORAGE_ACCESS); - NavigateFrameTo("b.com", "/echoheader?cookie"); + NavigateFrameTo(kHostB, "/echoheader?cookie"); EXPECT_EQ(GetFrameContent(), "None"); EXPECT_EQ(ReadCookiesViaJS(GetFrame()), ""); EXPECT_FALSE(storage::test::HasStorageAccessForFrame(GetFrame())); @@ -410,11 +411,11 @@ IN_PROC_BROWSER_TEST_P(StorageAccessAPIBrowserTest, OpaqueOriginRejects) { SetBlockThirdPartyCookies(true); - NavigateToPageWithFrame("a.com"); + NavigateToPageWithFrame(kHostA); ASSERT_TRUE(ExecuteScript( GetPrimaryMainFrame(), "document.querySelector('iframe').sandbox='allow-scripts';")); - NavigateFrameTo("b.com", "/echoheader?cookie"); + NavigateFrameTo(kHostB, "/echoheader?cookie"); EXPECT_FALSE(storage::test::HasStorageAccessForFrame(GetFrame())); EXPECT_FALSE(storage::test::RequestStorageAccessForFrame(GetFrame())); @@ -425,11 +426,11 @@ MissingSandboxTokenRejects) { SetBlockThirdPartyCookies(true); - NavigateToPageWithFrame("a.com"); + NavigateToPageWithFrame(kHostA); ASSERT_TRUE(ExecuteScript(GetPrimaryMainFrame(), "document.querySelector('iframe').sandbox='allow-" "scripts allow-same-origin';")); - NavigateFrameTo("b.com", "/echoheader?cookie"); + NavigateFrameTo(kHostB, "/echoheader?cookie"); EXPECT_FALSE(storage::test::HasStorageAccessForFrame(GetFrame())); EXPECT_FALSE(storage::test::RequestStorageAccessForFrame(GetFrame())); @@ -439,12 +440,12 @@ IN_PROC_BROWSER_TEST_P(StorageAccessAPIBrowserTest, SandboxTokenResolves) { SetBlockThirdPartyCookies(true); - NavigateToPageWithFrame("a.com"); + NavigateToPageWithFrame(kHostA); ASSERT_TRUE(ExecuteScript( GetPrimaryMainFrame(), "document.querySelector('iframe').sandbox='allow-scripts " "allow-same-origin allow-storage-access-by-user-activation';")); - NavigateFrameTo("b.com", "/echoheader?cookie"); + NavigateFrameTo(kHostB, "/echoheader?cookie"); EXPECT_FALSE(storage::test::HasStorageAccessForFrame(GetFrame())); EXPECT_TRUE(storage::test::RequestStorageAccessForFrame(GetFrame())); @@ -456,19 +457,19 @@ ThirdPartyGrantsExpireOverIPC) { SetBlockThirdPartyCookies(true); - // Set a cookie on `b.com` and `c.com`. - content::SetCookie(browser()->profile(), https_server().GetURL("b.com", "/"), + // Set a cookie on `kHostB` and `kHostC`. + content::SetCookie(browser()->profile(), GetURL(kHostB), "thirdparty=b;SameSite=None;Secure"); - ASSERT_EQ(content::GetCookies(browser()->profile(), GetURL("b.com")), + ASSERT_EQ(content::GetCookies(browser()->profile(), GetURL(kHostB)), "thirdparty=b"); - content::SetCookie(browser()->profile(), https_server().GetURL("c.com", "/"), + content::SetCookie(browser()->profile(), GetURL(kHostC), "thirdparty=c;SameSite=None;Secure"); - ASSERT_EQ(content::GetCookies(browser()->profile(), GetURL("c.com")), + ASSERT_EQ(content::GetCookies(browser()->profile(), GetURL(kHostC)), "thirdparty=c"); - NavigateToPageWithFrame("a.com"); - NavigateFrameTo("b.com", "/iframe.html"); - NavigateNestedFrameTo("c.com", "/echoheader?cookie"); + NavigateToPageWithFrame(kHostA); + NavigateFrameTo(kHostB, "/iframe.html"); + NavigateNestedFrameTo(kHostC, "/echoheader?cookie"); EXPECT_FALSE(storage::test::HasStorageAccessForFrame(GetFrame())); EXPECT_FALSE(storage::test::HasStorageAccessForFrame(GetNestedFrame())); @@ -477,11 +478,11 @@ HostContentSettingsMap* settings_map = HostContentSettingsMapFactory::GetForProfile(browser()->profile()); settings_map->SetContentSettingDefaultScope( - GetURL("b.com"), GetURL("a.com"), ContentSettingsType::STORAGE_ACCESS, + GetURL(kHostB), GetURL(kHostA), ContentSettingsType::STORAGE_ACCESS, CONTENT_SETTING_ALLOW, {expiration_time, content_settings::SessionModel::UserSession}); settings_map->SetContentSettingDefaultScope( - GetURL("c.com"), GetURL("a.com"), ContentSettingsType::STORAGE_ACCESS, + GetURL(kHostC), GetURL(kHostA), ContentSettingsType::STORAGE_ACCESS, CONTENT_SETTING_ALLOW, {expiration_time, content_settings::SessionModel::UserSession}); @@ -490,13 +491,13 @@ // cannot be properly mocked in a browser test. ContentSettingsForOneType settings; settings.emplace_back( - ContentSettingsPattern::FromURLNoWildcard(GetURL("b.com")), - ContentSettingsPattern::FromURLNoWildcard(GetURL("a.com")), + ContentSettingsPattern::FromURLNoWildcard(GetURL(kHostB)), + ContentSettingsPattern::FromURLNoWildcard(GetURL(kHostA)), base::Value(CONTENT_SETTING_ALLOW), "preference", /*incognito=*/false, expiration_time); settings.emplace_back( - ContentSettingsPattern::FromURLNoWildcard(GetURL("c.com")), - ContentSettingsPattern::FromURLNoWildcard(GetURL("a.com")), + ContentSettingsPattern::FromURLNoWildcard(GetURL(kHostC)), + ContentSettingsPattern::FromURLNoWildcard(GetURL(kHostA)), base::Value(CONTENT_SETTING_ALLOW), "preference", /*incognito=*/false, base::Time()); @@ -509,8 +510,8 @@ EXPECT_FALSE(storage::test::HasStorageAccessForFrame(GetFrame())); EXPECT_TRUE(storage::test::HasStorageAccessForFrame(GetNestedFrame())); - NavigateFrameTo("b.com", "/iframe.html"); - NavigateNestedFrameTo("c.com", "/echoheader?cookie"); + NavigateFrameTo(kHostB, "/iframe.html"); + NavigateNestedFrameTo(kHostC, "/echoheader?cookie"); EXPECT_FALSE(storage::test::HasStorageAccessForFrame(GetFrame())); EXPECT_TRUE(storage::test::HasStorageAccessForFrame(GetNestedFrame())); EXPECT_EQ(GetNestedFrameContent(), "thirdparty=c"); @@ -519,7 +520,7 @@ IN_PROC_BROWSER_TEST_P(StorageAccessAPIBrowserTest, RsaForSiteDisabledByDefault) { - NavigateToPageWithFrame("a.com"); + NavigateToPageWithFrame(kHostA); // Ensure that the proposed extension is not available unless explicitly // enabled. EXPECT_TRUE(EvalJs(GetPrimaryMainFrame(), @@ -575,8 +576,8 @@ // party pair requested on. IN_PROC_BROWSER_TEST_P(StorageAccessAPIStorageBrowserTest, ThirdPartyIFrameStorageRequestsAccess) { - NavigateToPageWithFrame("a.com"); - NavigateFrameTo("b.com", "/browsing_data/site_data.html"); + NavigateToPageWithFrame(kHostA); + NavigateFrameTo(kHostB, "/browsing_data/site_data.html"); ExpectStorage(GetFrame(), false); SetStorage(GetFrame()); @@ -584,26 +585,26 @@ SetBlockThirdPartyCookies(true); - NavigateToPageWithFrame("a.com"); - NavigateFrameTo("b.com", "/browsing_data/site_data.html"); + NavigateToPageWithFrame(kHostA); + NavigateFrameTo(kHostB, "/browsing_data/site_data.html"); ExpectStorage(GetFrame(), false); EXPECT_FALSE(storage::test::HasStorageAccessForFrame(GetFrame())); - // Allow all requests to b.com on a.com to access storage. + // Allow all requests to kHostB on kHostA to access storage. EXPECT_TRUE(storage::test::RequestStorageAccessForFrame(GetFrame())); EXPECT_TRUE(storage::test::HasStorageAccessForFrame(GetFrame())); - NavigateToPageWithFrame("a.com"); - NavigateFrameTo("b.com", "/browsing_data/site_data.html"); + NavigateToPageWithFrame(kHostA); + NavigateFrameTo(kHostB, "/browsing_data/site_data.html"); ExpectStorage(GetFrame(), DoesPermissionGrantStorage()); EXPECT_TRUE(storage::test::HasStorageAccessForFrame(GetFrame())); } IN_PROC_BROWSER_TEST_P(StorageAccessAPIStorageBrowserTest, NestedThirdPartyIFrameStorage) { - NavigateToPageWithFrame("a.com"); - NavigateFrameTo("b.com", "/iframe.html"); - NavigateNestedFrameTo("c.com", "/browsing_data/site_data.html"); + NavigateToPageWithFrame(kHostA); + NavigateFrameTo(kHostB, "/iframe.html"); + NavigateNestedFrameTo(kHostC, "/browsing_data/site_data.html"); ExpectStorage(GetNestedFrame(), false); SetStorage(GetNestedFrame()); @@ -611,19 +612,19 @@ SetBlockThirdPartyCookies(true); - NavigateToPageWithFrame("a.com"); - NavigateFrameTo("b.com", "/iframe.html"); - NavigateNestedFrameTo("c.com", "/browsing_data/site_data.html"); + NavigateToPageWithFrame(kHostA); + NavigateFrameTo(kHostB, "/iframe.html"); + NavigateNestedFrameTo(kHostC, "/browsing_data/site_data.html"); ExpectStorage(GetNestedFrame(), false); EXPECT_FALSE(storage::test::HasStorageAccessForFrame(GetNestedFrame())); - // Allow all requests to b.com on a.com to access storage. + // Allow all requests to kHostB on kHostA to access storage. EXPECT_TRUE(storage::test::RequestStorageAccessForFrame(GetNestedFrame())); EXPECT_TRUE(storage::test::HasStorageAccessForFrame(GetNestedFrame())); - NavigateToPageWithFrame("a.com"); - NavigateFrameTo("b.com", "/iframe.html"); - NavigateNestedFrameTo("c.com", "/browsing_data/site_data.html"); + NavigateToPageWithFrame(kHostA); + NavigateFrameTo(kHostB, "/iframe.html"); + NavigateNestedFrameTo(kHostC, "/browsing_data/site_data.html"); ExpectStorage(GetNestedFrame(), DoesPermissionGrantStorage()); EXPECT_TRUE(storage::test::HasStorageAccessForFrame(GetNestedFrame())); } @@ -631,8 +632,8 @@ // Test third-party cookie blocking of features that allow to communicate // between tabs such as SharedWorkers. IN_PROC_BROWSER_TEST_P(StorageAccessAPIStorageBrowserTest, MultiTabTest) { - NavigateToPageWithFrame("a.com"); - NavigateFrameTo("b.com", "/browsing_data/site_data.html"); + NavigateToPageWithFrame(kHostA); + NavigateFrameTo(kHostB, "/browsing_data/site_data.html"); storage::test::ExpectCrossTabInfoForFrame(GetFrame(), false); storage::test::SetCrossTabInfoForFrame(GetFrame()); @@ -640,25 +641,25 @@ EXPECT_TRUE(storage::test::HasStorageAccessForFrame(GetFrame())); // Create a second tab to test communication between tabs. - NavigateToNewTabWithFrame("a.com"); - NavigateFrameTo("b.com", "/browsing_data/site_data.html"); + NavigateToNewTabWithFrame(kHostA); + NavigateFrameTo(kHostB, "/browsing_data/site_data.html"); storage::test::ExpectCrossTabInfoForFrame(GetFrame(), true); EXPECT_TRUE(storage::test::HasStorageAccessForFrame(GetFrame())); SetBlockThirdPartyCookies(true); - NavigateToPageWithFrame("a.com"); - NavigateFrameTo("b.com", "/browsing_data/site_data.html"); + NavigateToPageWithFrame(kHostA); + NavigateFrameTo(kHostB, "/browsing_data/site_data.html"); storage::test::ExpectCrossTabInfoForFrame(GetFrame(), false); EXPECT_FALSE(storage::test::HasStorageAccessForFrame(GetFrame())); - // Allow all requests to b.com to access cookies. - // Allow all requests to b.com on a.com to access storage. + // Allow all requests to kHostB to access cookies. + // Allow all requests to kHostB on kHostA to access storage. EXPECT_TRUE(storage::test::RequestStorageAccessForFrame(GetFrame())); EXPECT_TRUE(storage::test::HasStorageAccessForFrame(GetFrame())); - NavigateToPageWithFrame("a.com"); - NavigateFrameTo("b.com", "/browsing_data/site_data.html"); + NavigateToPageWithFrame(kHostA); + NavigateFrameTo(kHostB, "/browsing_data/site_data.html"); storage::test::ExpectCrossTabInfoForFrame(GetFrame(), DoesPermissionGrantStorage()); EXPECT_TRUE(storage::test::HasStorageAccessForFrame(GetFrame())); @@ -694,17 +695,17 @@ SetBlockThirdPartyCookies(true); base::HistogramTester histogram_tester; - NavigateToPageWithFrame("a.com"); + NavigateToPageWithFrame(kHostA); // Asserting very basic behavior while the extension is being implemented. EXPECT_FALSE(storage::test::RequestStorageAccessForSite( GetFrame(), "https://asdf.example")); EXPECT_FALSE( storage::test::RequestStorageAccessForSite(GetFrame(), "mattwashere")); - EXPECT_TRUE(storage::test::RequestStorageAccessForSite(GetPrimaryMainFrame(), - "https://a.com")); - EXPECT_FALSE( - storage::test::RequestStorageAccessForSite(GetFrame(), "https://a.com")); + EXPECT_TRUE(storage::test::RequestStorageAccessForSite( + GetPrimaryMainFrame(), base::StrCat({"https://", kHostA}))); + EXPECT_FALSE(storage::test::RequestStorageAccessForSite( + GetFrame(), base::StrCat({"https://", kHostA}))); } INSTANTIATE_TEST_CASE_P(/* no prefix */, @@ -750,7 +751,7 @@ IN_PROC_BROWSER_TEST_P( StorageAccessAPIForSiteExtensionExplicitlyDisabledBrowserTest, RsaForSiteNotPresentOnDocumentWhenExplicitlyDisabled) { - NavigateToPageWithFrame("a.com"); + NavigateToPageWithFrame(kHostA); // Ensure that the proposed extension is not available unless explicitly // enabled. EXPECT_TRUE(EvalJs(GetPrimaryMainFrame(),
diff --git a/chrome/browser/sync/sync_service_factory_unittest.cc b/chrome/browser/sync/sync_service_factory_unittest.cc index 18551ca..067e316 100644 --- a/chrome/browser/sync/sync_service_factory_unittest.cc +++ b/chrome/browser/sync/sync_service_factory_unittest.cc
@@ -84,7 +84,7 @@ // Returns the collection of default datatypes. syncer::ModelTypeSet DefaultDatatypes() { - static_assert(40 == syncer::GetNumModelTypes(), + static_assert(41 == syncer::GetNumModelTypes(), "When adding a new type, you probably want to add it here as " "well (assuming it is already enabled)."); @@ -143,6 +143,7 @@ datatypes.Put(syncer::AUTOFILL_WALLET_METADATA); datatypes.Put(syncer::AUTOFILL_WALLET_OFFER); datatypes.Put(syncer::BOOKMARKS); + // TODO(crbug.com/1348294): Add CONTACT_INFO once it has a controller. datatypes.Put(syncer::DEVICE_INFO); if (base::FeatureList::IsEnabled(syncer::kSyncEnableHistoryDataType)) { datatypes.Put(syncer::HISTORY);
diff --git a/chrome/browser/sync/test/integration/single_client_standalone_transport_sync_test.cc b/chrome/browser/sync/test/integration/single_client_standalone_transport_sync_test.cc index 4d2fc5f3..5e56fcf 100644 --- a/chrome/browser/sync/test/integration/single_client_standalone_transport_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_standalone_transport_sync_test.cc
@@ -28,7 +28,7 @@ namespace { syncer::ModelTypeSet AllowedTypesInStandaloneTransportMode() { - static_assert(40 == syncer::GetNumModelTypes(), + static_assert(41 == syncer::GetNumModelTypes(), "Add new types below if they run in transport mode"); // Only some special allowlisted types (and control types) are allowed in // standalone transport mode.
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index e1b1491..8ed33b8 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -2914,6 +2914,8 @@ "webui/settings/chromeos/bluetooth_handler.h", "webui/settings/chromeos/bluetooth_section.cc", "webui/settings/chromeos/bluetooth_section.h", + "webui/settings/chromeos/change_picture_handler.cc", + "webui/settings/chromeos/change_picture_handler.h", "webui/settings/chromeos/constants/constants_util.cc", "webui/settings/chromeos/constants/constants_util.h", "webui/settings/chromeos/constants/routes_util.cc",
diff --git a/chrome/browser/ui/ash/arc_open_url_delegate_impl.cc b/chrome/browser/ui/ash/arc_open_url_delegate_impl.cc index 72a4237..bd07d94 100644 --- a/chrome/browser/ui/ash/arc_open_url_delegate_impl.cc +++ b/chrome/browser/ui/ash/arc_open_url_delegate_impl.cc
@@ -78,6 +78,8 @@ chromeos::settings::mojom::kBluetoothDevicesSubpagePath}, {ChromePage::BLUETOOTHDEVICES, chromeos::settings::mojom::kBluetoothDevicesSubpagePath}, + {ChromePage::CHANGEPICTURE, + chromeos::settings::mojom::kChangePictureSubpagePath}, {ChromePage::CUPSPRINTERS, chromeos::settings::mojom::kPrintingDetailsSubpagePath}, {ChromePage::DATETIME, chromeos::settings::mojom::kDateAndTimeSectionPath},
diff --git a/chrome/browser/ui/ash/arc_open_url_delegate_impl_browsertest.cc b/chrome/browser/ui/ash/arc_open_url_delegate_impl_browsertest.cc index d40e563..ad31eceb 100644 --- a/chrome/browser/ui/ash/arc_open_url_delegate_impl_browsertest.cc +++ b/chrome/browser/ui/ash/arc_open_url_delegate_impl_browsertest.cc
@@ -306,6 +306,9 @@ base_url.Resolve( chromeos::settings::mojom::kBluetoothDevicesSubpagePath)); TestOpenOSSettingsChromePage( + ChromePage::CHANGEPICTURE, + base_url.Resolve(chromeos::settings::mojom::kChangePictureSubpagePath)); + TestOpenOSSettingsChromePage( ChromePage::CUPSPRINTERS, base_url.Resolve(chromeos::settings::mojom::kPrintingDetailsSubpagePath)); TestOpenOSSettingsChromePage(
diff --git a/chrome/browser/ui/ash/ash_shell_init.cc b/chrome/browser/ui/ash/ash_shell_init.cc index 37a6ecd..39c65b7 100644 --- a/chrome/browser/ui/ash/ash_shell_init.cc +++ b/chrome/browser/ui/ash/ash_shell_init.cc
@@ -26,8 +26,7 @@ shell_init_params.local_state = g_browser_process->local_state(); shell_init_params.keyboard_ui_factory = std::make_unique<ChromeKeyboardUIFactory>(); - shell_init_params.dbus_bus = - chromeos::DBusThreadManager::Get()->GetSystemBus(); + shell_init_params.dbus_bus = ash::DBusThreadManager::Get()->GetSystemBus(); ash::Shell::CreateInstance(std::move(shell_init_params)); }
diff --git a/chrome/browser/ui/ash/system_web_apps/system_web_app_ui_utils.h b/chrome/browser/ui/ash/system_web_apps/system_web_app_ui_utils.h index 895ae57..a7d45c8 100644 --- a/chrome/browser/ui/ash/system_web_apps/system_web_app_ui_utils.h +++ b/chrome/browser/ui/ash/system_web_apps/system_web_app_ui_utils.h
@@ -20,8 +20,6 @@ namespace ash { -class WebAppProvider; - // Returns the system app type for the given App ID. absl::optional<SystemWebAppType> GetSystemWebAppTypeForAppId( Profile* profile, @@ -83,12 +81,6 @@ // executing). Useful for testing SWA launch behaviors. void FlushSystemWebAppLaunchesForTesting(Profile* profile); -// Utility function to set up launch files and launch directory as appropriate. -void SetLaunchFiles(bool should_include_launch_directory, - const apps::AppLaunchParams& params, - content::WebContents* web_contents, - WebAppProvider* provider); - // Implementation of LaunchSystemWebApp. Do not use this before discussing your // use case with the System Web Apps team. //
diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index 7bb9847d..8932e8a8 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc
@@ -138,7 +138,6 @@ #if BUILDFLAG(IS_WIN) #include "base/i18n/rtl.h" -#include "chrome/browser/browser_process.h" #endif using base::ASCIIToUTF16;
diff --git a/chrome/browser/ui/browser_dialogs.h b/chrome/browser/ui/browser_dialogs.h index 0e21a9e9..ac6c50e 100644 --- a/chrome/browser/ui/browser_dialogs.h +++ b/chrome/browser/ui/browser_dialogs.h
@@ -25,11 +25,6 @@ #include "ui/base/models/dialog_model.h" #include "ui/gfx/native_widget_types.h" -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \ - (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS)) -#include "chrome/browser/web_applications/web_app_id.h" -#endif - class Browser; class GURL; class LoginHandler;
diff --git a/chrome/browser/ui/browser_tab_strip_model_delegate_browsertest.cc b/chrome/browser/ui/browser_tab_strip_model_delegate_browsertest.cc index 0cec9ee..bed98173 100644 --- a/chrome/browser/ui/browser_tab_strip_model_delegate_browsertest.cc +++ b/chrome/browser/ui/browser_tab_strip_model_delegate_browsertest.cc
@@ -5,7 +5,6 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" -#include "chrome/browser/ui/browser_tab_strip_model_delegate.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_utils.h" #include "chrome/test/base/in_process_browser_test.h"
diff --git a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm index b1695e58..dc92291 100644 --- a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm +++ b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm
@@ -589,28 +589,20 @@ // Test that the colored frames have the correct color when active and inactive. // Disabled; https://crbug.com/1322741. -IN_PROC_BROWSER_TEST_F(NativeAppWindowCocoaBrowserTest, FrameColor) { - EXPECT_EQ(NSApp.activationPolicy, NSApplicationActivationPolicyAccessory); - +IN_PROC_BROWSER_TEST_F(NativeAppWindowCocoaBrowserTest, DISABLED_FrameColor) { // The hex values indicate an RGB color. When we get the NSColor later, the // components are CGFloats in the range [0, 1]. extensions::AppWindow* app_window = CreateTestAppWindow( "{\"frame\": {\"color\": \"#FF0000\", \"inactiveColor\": \"#0000FF\"}}"); NSWindow* ns_window = app_window->GetNativeWindow().GetNativeNSWindow(); - // No color correction in the default case. [ns_window setColorSpace:[NSColorSpace sRGBColorSpace]]; - // Make sure the window is inactive before color sampling. - ui::test::ScopedFakeNSWindowFocus fake_focus; - [ns_window resignMainWindow]; - [ns_window resignKeyWindow]; + int half_width = NSWidth([ns_window frame]) / 2; NSBitmapImageRep* bitmap = ScreenshotNSWindow(ns_window); - // The window is currently inactive so it should be blue (#0000FF). We are - // assuming the Light appearance is being used. + // The window is currently inactive so it should be blue (#0000FF). NSColor* expected_color = ColorInBitmapColorSpace(0xFF0000FF, bitmap); - int half_width = NSWidth([ns_window frame]) / 2; NSColor* color = [bitmap colorAtX:half_width y:5]; CGFloat expected_components[4], color_components[4]; [expected_color getComponents:expected_components]; @@ -619,12 +611,11 @@ EXPECT_NEAR(expected_components[1], color_components[1], 0.01); EXPECT_NEAR(expected_components[2], color_components[2], 0.01); - // Activate the window. + ui::test::ScopedFakeNSWindowFocus fake_focus; [ns_window makeMainWindow]; bitmap = ScreenshotNSWindow(ns_window); - // The window is now active so it should be red (#FF0000). Again, this is - // assuming the Light appearance is being used. + // The window is now active so it should be red (#FF0000). expected_color = ColorInBitmapColorSpace(0xFFFF0000, bitmap); color = [bitmap colorAtX:half_width y:5]; [expected_color getComponents:expected_components];
diff --git a/chrome/browser/ui/color/tools/dump_colors.cc b/chrome/browser/ui/color/tools/dump_colors.cc index fd86e27..3ff6433 100644 --- a/chrome/browser/ui/color/tools/dump_colors.cc +++ b/chrome/browser/ui/color/tools/dump_colors.cc
@@ -32,10 +32,6 @@ // .inc file serves to undefine the macros the first inclusion defined. #include "ui/color/color_id_macros.inc" -#if BUILDFLAG(IS_MAC) -#include "ui/color/color_mixers.h" -#endif - // Longest color name, plus a space. Currently, "SK_ColorTRANSPARENT ". constexpr size_t kColorColumnWidth = 19 + 1;
diff --git a/chrome/browser/ui/hats/trust_safety_sentiment_service_browsertest.cc b/chrome/browser/ui/hats/trust_safety_sentiment_service_browsertest.cc index a71cb3e..299731e2 100644 --- a/chrome/browser/ui/hats/trust_safety_sentiment_service_browsertest.cc +++ b/chrome/browser/ui/hats/trust_safety_sentiment_service_browsertest.cc
@@ -9,7 +9,6 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/hats/hats_service_factory.h" #include "chrome/browser/ui/hats/mock_hats_service.h" -#include "chrome/browser/ui/hats/trust_safety_sentiment_service.h" #include "chrome/browser/ui/hats/trust_safety_sentiment_service_factory.h" #include "chrome/browser/ui/page_info/page_info_dialog.h" #include "chrome/browser/ui/views/page_info/page_info_bubble_view.h"
diff --git a/chrome/browser/ui/managed_ui.cc b/chrome/browser/ui/managed_ui.cc index d472aa2..035b6a5 100644 --- a/chrome/browser/ui/managed_ui.cc +++ b/chrome/browser/ui/managed_ui.cc
@@ -28,7 +28,6 @@ #include "chrome/browser/ash/login/demo_mode/demo_session.h" #include "chrome/browser/ash/policy/core/browser_policy_connector_ash.h" #include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" -#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part.h" #include "ui/chromeos/devicetype_utils.h" #else
diff --git a/chrome/browser/ui/page_info/chrome_page_info_delegate.cc b/chrome/browser/ui/page_info/chrome_page_info_delegate.cc index 873b8c11..cbe2597ab 100644 --- a/chrome/browser/ui/page_info/chrome_page_info_delegate.cc +++ b/chrome/browser/ui/page_info/chrome_page_info_delegate.cc
@@ -38,10 +38,6 @@ #include "content/public/common/content_features.h" #include "url/origin.h" -#if BUILDFLAG(FULL_SAFE_BROWSING) -#include "chrome/browser/safe_browsing/chrome_password_protection_service.h" -#endif - #if BUILDFLAG(IS_CHROMEOS_ASH) #include "chrome/browser/ui/webui/settings/ash/app_management/app_management_uma.h" #endif
diff --git a/chrome/browser/ui/page_info/chrome_page_info_ui_delegate.cc b/chrome/browser/ui/page_info/chrome_page_info_ui_delegate.cc index 53bc206..9016ff3 100644 --- a/chrome/browser/ui/page_info/chrome_page_info_ui_delegate.cc +++ b/chrome/browser/ui/page_info/chrome_page_info_ui_delegate.cc
@@ -33,7 +33,6 @@ #include "chrome/browser/extensions/window_controller_list.h" #include "chrome/browser/page_info/about_this_site_service_factory.h" #include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/page_info/about_this_site_side_panel.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/web_applications/web_app_ui_utils.h"
diff --git a/chrome/browser/ui/sharing_hub/sharing_hub_bubble_controller_chromeos_impl.cc b/chrome/browser/ui/sharing_hub/sharing_hub_bubble_controller_chromeos_impl.cc index df9b019..a53d73a 100644 --- a/chrome/browser/ui/sharing_hub/sharing_hub_bubble_controller_chromeos_impl.cc +++ b/chrome/browser/ui/sharing_hub/sharing_hub_bubble_controller_chromeos_impl.cc
@@ -22,7 +22,6 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) #include "chrome/browser/sharesheet/sharesheet_service.h" #include "chrome/browser/sharesheet/sharesheet_service_factory.h" -#include "components/services/app_service/public/cpp/intent_util.h" #endif // BUILDFLAG(IS_CHROMEOS_ASH) #if BUILDFLAG(IS_CHROMEOS_LACROS)
diff --git a/chrome/browser/ui/tab_helpers.cc b/chrome/browser/ui/tab_helpers.cc index fdcb0eb..b597938 100644 --- a/chrome/browser/ui/tab_helpers.cc +++ b/chrome/browser/ui/tab_helpers.cc
@@ -172,7 +172,6 @@ #include "chrome/browser/ui/ui_features.h" #include "components/accuracy_tips/accuracy_web_contents_observer.h" #include "components/commerce/content/browser/hint/commerce_hint_tab_helper.h" -#include "components/commerce/core/commerce_feature_list.h" #include "components/omnibox/browser/omnibox_field_trial.h" #include "components/web_modal/web_contents_modal_dialog_manager.h" #include "components/zoom/zoom_controller.h"
diff --git a/chrome/browser/ui/tab_sharing/OWNERS b/chrome/browser/ui/tab_sharing/OWNERS index 3ba0bf2..fb25f6d 100644 --- a/chrome/browser/ui/tab_sharing/OWNERS +++ b/chrome/browser/ui/tab_sharing/OWNERS
@@ -1,3 +1,2 @@ -marinaciocea@chromium.org guidou@chromium.org eladalon@chromium.org
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_views.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_views.cc index 2c0f470..6dc39ea 100644 --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_views.cc +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_views.cc
@@ -19,7 +19,6 @@ #if BUILDFLAG(IS_LINUX) #include "chrome/browser/ui/views/frame/browser_frame_view_layout_linux.h" #include "chrome/browser/ui/views/frame/browser_frame_view_layout_linux_native.h" -#include "chrome/browser/ui/views/frame/browser_frame_view_linux.h" #include "chrome/browser/ui/views/frame/browser_frame_view_linux_native.h" #include "chrome/browser/ui/views/frame/desktop_browser_frame_aura_linux.h" #include "chrome/browser/ui/web_applications/app_browser_controller.h"
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index f19af5dd..97574a8 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -291,9 +291,6 @@ #undef LoadAccelerators #endif -#include "chrome/browser/ui/sync/one_click_signin_links_delegate_impl.h" -#include "chrome/browser/ui/views/sync/one_click_signin_dialog_view.h" - #if BUILDFLAG(ENABLE_WEBUI_TAB_STRIP) #include "chrome/browser/ui/views/frame/webui_tab_strip_container_view.h" #endif // BUILDFLAG(ENABLE_WEBUI_TAB_STRIP)
diff --git a/chrome/browser/ui/views/frame/immersive_mode_controller_chromeos.cc b/chrome/browser/ui/views/frame/immersive_mode_controller_chromeos.cc index 23e9171a..2b1a48a 100644 --- a/chrome/browser/ui/views/frame/immersive_mode_controller_chromeos.cc +++ b/chrome/browser/ui/views/frame/immersive_mode_controller_chromeos.cc
@@ -30,7 +30,6 @@ #if !BUILDFLAG(IS_CHROMEOS_LACROS) #include "chrome/browser/ui/ash/window_pin_util.h" -#include "chromeos/ui/base/window_state_type.h" #else #include "chrome/browser/ui/lacros/window_properties.h" #endif
diff --git a/chrome/browser/ui/views/location_bar/custom_tab_bar_view.cc b/chrome/browser/ui/views/location_bar/custom_tab_bar_view.cc index 3374a9d..21a2bd2 100644 --- a/chrome/browser/ui/views/location_bar/custom_tab_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/custom_tab_bar_view.cc
@@ -56,8 +56,6 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) #include "chromeos/ui/base/chromeos_ui_constants.h" -#else -#include "chrome/browser/themes/theme_properties.h" #endif namespace {
diff --git a/chrome/browser/ui/views/location_bar/selected_keyword_view_interactive_uitest.cc b/chrome/browser/ui/views/location_bar/selected_keyword_view_interactive_uitest.cc index 404e0ee..4430f61 100644 --- a/chrome/browser/ui/views/location_bar/selected_keyword_view_interactive_uitest.cc +++ b/chrome/browser/ui/views/location_bar/selected_keyword_view_interactive_uitest.cc
@@ -8,7 +8,6 @@ #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" -#include "chrome/browser/ui/views/location_bar/selected_keyword_view.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h" #include "chrome/test/base/interactive_test_utils.h" #include "content/public/test/browser_test.h"
diff --git a/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_dialog.cc b/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_dialog.cc index 8d2bdf36..3bcdc12 100644 --- a/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_dialog.cc +++ b/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_dialog.cc
@@ -59,7 +59,7 @@ std::string CloudUploadDialog::GetDialogArgs() const { base::DictionaryValue args; - args.SetKey("path", base::Value(file_url_.path().BaseName().value())); + args.SetKey("fileName", base::Value(file_url_.path().BaseName().value())); std::string json; base::JSONWriter::Write(args, &json); return json;
diff --git a/chrome/browser/ui/webui/settings/chromeos/change_picture_handler.cc b/chrome/browser/ui/webui/settings/chromeos/change_picture_handler.cc new file mode 100644 index 0000000..3837a29 --- /dev/null +++ b/chrome/browser/ui/webui/settings/chromeos/change_picture_handler.cc
@@ -0,0 +1,417 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/webui/settings/chromeos/change_picture_handler.h" + +#include <memory> +#include <utility> + +#include "base/base64.h" +#include "base/bind.h" +#include "base/callback_helpers.h" +#include "base/command_line.h" +#include "base/metrics/histogram_functions.h" +#include "base/metrics/histogram_macros.h" +#include "base/no_destructor.h" +#include "base/path_service.h" +#include "base/strings/string_util.h" +#include "base/strings/utf_string_conversions.h" +#include "base/task/thread_pool.h" +#include "base/values.h" +#include "chrome/browser/ash/accessibility/accessibility_manager.h" +#include "chrome/browser/ash/camera_presence_notifier.h" +#include "chrome/browser/ash/login/users/avatar/user_image_manager.h" +#include "chrome/browser/ash/login/users/chrome_user_manager.h" +#include "chrome/browser/ash/login/users/default_user_image/default_user_images.h" +#include "chrome/browser/ash/profiles/profile_helper.h" +#include "chrome/browser/ash/web_applications/personalization_app/personalization_app_manager.h" +#include "chrome/browser/ash/web_applications/personalization_app/personalization_app_manager_factory.h" +#include "chrome/browser/ui/browser_finder.h" +#include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/chrome_select_file_policy.h" +#include "chrome/common/chrome_paths.h" +#include "chrome/common/chrome_switches.h" +#include "chrome/common/url_constants.h" +#include "chrome/grit/browser_resources.h" +#include "chrome/grit/generated_resources.h" +#include "chromeos/ash/components/audio/sounds.h" +#include "components/user_manager/user.h" +#include "components/user_manager/user_image/user_image.h" +#include "components/user_manager/user_manager.h" +#include "content/public/browser/browser_context.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/browser/web_contents.h" +#include "content/public/browser/web_ui.h" +#include "content/public/common/url_constants.h" +#include "net/base/data_url.h" +#include "services/audio/public/cpp/sounds/sounds_manager.h" +#include "third_party/skia/include/core/SkBitmap.h" +#include "ui/base/l10n/l10n_util.h" +#include "ui/base/resource/resource_bundle.h" +#include "ui/base/webui/web_ui_util.h" +#include "ui/views/widget/widget.h" +#include "url/gurl.h" + +namespace chromeos { +namespace settings { +namespace { + +using ::ash::AccessibilityManager; +using ::ash::PlaySoundOption; +using ::content::BrowserThread; + +} // namespace + +ChangePictureHandler::ChangePictureHandler() + : previous_image_index_(user_manager::User::USER_IMAGE_INVALID), + camera_presence_notifier_( + base::BindRepeating(&ChangePictureHandler::SetCameraPresent, + base::Unretained(this))) { + ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); + audio::SoundsManager* manager = audio::SoundsManager::Get(); + manager->Initialize(static_cast<int>(Sound::kObjectDelete), + bundle.GetRawDataResource(IDR_SOUND_OBJECT_DELETE_WAV)); + manager->Initialize(static_cast<int>(Sound::kCameraSnap), + bundle.GetRawDataResource(IDR_SOUND_CAMERA_SNAP_WAV)); +} + +ChangePictureHandler::~ChangePictureHandler() { + if (IsJavascriptAllowed()) { + ::ash::personalization_app::PersonalizationAppManagerFactory:: + GetForBrowserContext(web_ui()->GetWebContents()->GetBrowserContext()) + ->MaybeStartHatsTimer( + ::ash::personalization_app::HatsSurveyType::kAvatar); + } +} + +void ChangePictureHandler::RegisterMessages() { + web_ui()->RegisterMessageCallback( + "chooseFile", base::BindRepeating(&ChangePictureHandler::HandleChooseFile, + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "photoTaken", base::BindRepeating(&ChangePictureHandler::HandlePhotoTaken, + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "discardPhoto", + base::BindRepeating(&ChangePictureHandler::HandleDiscardPhoto, + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "onChangePicturePageInitialized", + base::BindRepeating(&ChangePictureHandler::HandlePageInitialized, + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "selectImage", + base::BindRepeating(&ChangePictureHandler::HandleSelectImage, + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "requestSelectedImage", + base::BindRepeating(&ChangePictureHandler::HandleRequestSelectedImage, + base::Unretained(this))); +} + +void ChangePictureHandler::OnJavascriptAllowed() { + user_manager_observation_.Observe(user_manager::UserManager::Get()); + camera_presence_notifier_.Start(); +} + +void ChangePictureHandler::OnJavascriptDisallowed() { + DCHECK(user_manager_observation_.IsObservingSource( + user_manager::UserManager::Get())); + user_manager_observation_.Reset(); + + camera_presence_notifier_.Stop(); + + user_image_file_selector_.reset(); +} + +void ChangePictureHandler::SendDefaultImages() { + base::Value::Dict result; + result.Set("current_default_images", + default_user_image::GetCurrentImageSetAsListValue()); + FireWebUIListener("default-images-changed", result); +} + +void ChangePictureHandler::HandleChooseFile(const base::Value::List& args) { + DCHECK(args.empty()); + user_image_file_selector_ = + std::make_unique<ash::UserImageFileSelector>(web_ui()); + user_image_file_selector_->SelectFile( + base::BindOnce(&ChangePictureHandler::FileSelected, + weak_ptr_factory_.GetWeakPtr()), + base::BindOnce(&ChangePictureHandler::FileSelectionCanceled, + weak_ptr_factory_.GetWeakPtr())); +} + +void ChangePictureHandler::HandleDiscardPhoto(const base::Value::List& args) { + DCHECK(args.empty()); + AccessibilityManager::Get()->PlayEarcon( + Sound::kObjectDelete, PlaySoundOption::kOnlyIfSpokenFeedbackEnabled); +} + +void ChangePictureHandler::HandlePhotoTaken(const base::Value::List& args) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + AccessibilityManager::Get()->PlayEarcon( + Sound::kCameraSnap, PlaySoundOption::kOnlyIfSpokenFeedbackEnabled); + + if (args.size() != 1 || !args[0].is_string()) + NOTREACHED(); + const std::string& image_url = args[0].GetString(); + DCHECK(!image_url.empty()); + + std::string raw_data; + base::StringPiece url(image_url); + const char kDataUrlPrefix[] = "data:image/png;base64,"; + const size_t kDataUrlPrefixLength = std::size(kDataUrlPrefix) - 1; + if (!base::StartsWith(url, kDataUrlPrefix) || + !base::Base64Decode(url.substr(kDataUrlPrefixLength), &raw_data)) { + LOG(WARNING) << "Invalid image URL"; + return; + } + + // Use |raw_data| as image but first verify that it can be decoded. + user_photo_ = gfx::ImageSkia(); + std::vector<unsigned char> photo_data(raw_data.begin(), raw_data.end()); + user_photo_data_ = base::RefCountedBytes::TakeVector(&photo_data); + + ImageDecoder::Cancel(this); + ImageDecoder::Start(this, std::move(raw_data)); +} + +void ChangePictureHandler::HandlePageInitialized( + const base::Value::List& args) { + DCHECK(args.empty()); + + AllowJavascript(); + + SendDefaultImages(); + SendSelectedImage(); + UpdateProfileImage(); +} + +void ChangePictureHandler::SendSelectedImage() { + const user_manager::User* user = GetUser(); + DCHECK(user->GetAccountId().is_valid()); + + previous_image_index_ = user->image_index(); + switch (previous_image_index_) { + case user_manager::User::USER_IMAGE_EXTERNAL: { + // User has image from camera/file, record it and add to the image list. + previous_image_ = user->GetImage(); + previous_image_format_ = user->image_format(); + if (previous_image_format_ == user_manager::UserImage::FORMAT_PNG && + user->has_image_bytes()) { + previous_image_bytes_ = user->image_bytes(); + SendOldImage(webui::GetPngDataUrl(previous_image_bytes_->front(), + previous_image_bytes_->size())); + } else { + previous_image_bytes_ = nullptr; + DCHECK(previous_image_.IsThreadSafe()); + // Post a task because GetBitmapDataUrl does PNG encoding, which is + // slow for large images. + base::ThreadPool::PostTaskAndReplyWithResult( + FROM_HERE, {base::TaskPriority::USER_BLOCKING}, + base::BindOnce(&webui::GetBitmapDataUrl, *previous_image_.bitmap()), + base::BindOnce(&ChangePictureHandler::SendOldImage, + weak_ptr_factory_.GetWeakPtr())); + } + break; + } + case user_manager::User::USER_IMAGE_PROFILE: { + // User has their Profile image as the current image. + SendProfileImage(user->GetImage(), true); + break; + } + default: { + if (default_user_image::IsInCurrentImageSet(previous_image_index_)) { + // User has image from the current set of default images. + base::Value image_url( + default_user_image::GetDefaultImageUrl(previous_image_index_) + .spec()); + FireWebUIListener("selected-image-changed", image_url); + } else { + // User has a deprecated default image, send it for preview. + previous_image_ = user->GetImage(); + previous_image_bytes_ = nullptr; + previous_image_format_ = user_manager::UserImage::FORMAT_UNKNOWN; + + base::Value::Dict result; + result.Set("url", + default_user_image::GetDefaultImageUrl(previous_image_index_) + .spec()); + auto source_info = + default_user_image::GetDeprecatedDefaultImageSourceInfo( + previous_image_index_); + if (source_info.has_value()) { + result.Set("author", std::move(source_info.value().author)); + result.Set("website", source_info.value().website.spec()); + } + FireWebUIListener("preview-deprecated-image", result); + } + } + } +} + +void ChangePictureHandler::SendProfileImage(const gfx::ImageSkia& image, + bool should_select) { + base::Value data_url(webui::GetBitmapDataUrl(*image.bitmap())); + base::Value select(should_select); + FireWebUIListener("profile-image-changed", data_url, select); +} + +void ChangePictureHandler::UpdateProfileImage() { + auto* user_image_manager = + ChromeUserManager::Get()->GetUserImageManager(GetUser()->GetAccountId()); + // If we have a downloaded profile image and haven't sent it in + // |SendSelectedImage|, send it now (without selecting). + if (previous_image_index_ != user_manager::User::USER_IMAGE_PROFILE && + !user_image_manager->DownloadedProfileImage().isNull()) { + SendProfileImage(user_image_manager->DownloadedProfileImage(), false); + } + user_image_manager->DownloadProfileImage(); +} + +void ChangePictureHandler::SendOldImage(std::string&& image_url) { + FireWebUIListener("old-image-changed", base::Value(image_url)); +} + +void ChangePictureHandler::HandleSelectImage(const base::Value::List& args) { + if (args.size() != 2 || !args[0].is_string() || !args[1].is_string()) { + NOTREACHED(); + return; + } + const std::string& image_url = args[0].GetString(); + const std::string& image_type = args[1].GetString(); + // |image_url| may be empty unless |image_type| is "default". + DCHECK(!image_type.empty()); + + auto* user_image_manager = + ChromeUserManager::Get()->GetUserImageManager(GetUser()->GetAccountId()); + bool waiting_for_camera_photo = false; + + // Track the index of previous selected message to be compared with the index + // of the new image. + int previous_image_index = GetUser()->image_index(); + + if (image_type == "old") { + // Previous image (from camera or manually uploaded) re-selected. + DCHECK(!previous_image_.isNull()); + std::unique_ptr<user_manager::UserImage> user_image; + if (previous_image_format_ == user_manager::UserImage::FORMAT_PNG && + previous_image_bytes_) { + user_image = std::make_unique<user_manager::UserImage>( + previous_image_, previous_image_bytes_, previous_image_format_); + user_image->MarkAsSafe(); + } else { + user_image = user_manager::UserImage::CreateAndEncode( + previous_image_, user_manager::UserImage::FORMAT_JPEG); + } + user_image_manager->SaveUserImage(std::move(user_image)); + + VLOG(1) << "Selected old user image"; + } else if (image_type == "default") { + int image_index = user_manager::User::USER_IMAGE_INVALID; + if (default_user_image::IsDefaultImageUrl(image_url, &image_index)) { + // One of the default user images. + user_image_manager->SaveUserDefaultImageIndex(image_index); + + VLOG(1) << "Selected default user image: " << image_index; + } else { + LOG(WARNING) << "Invalid image_url for default image type: " << image_url; + } + } else if (image_type == "profile") { + // Profile image selected. Could be previous (old) user image. + user_image_manager->SaveUserImageFromProfileImage(); + } else { + NOTREACHED() << "Unexpected image type: " << image_type; + } + + int image_index = GetUser()->image_index(); + // `previous_image_index` is used instead of `previous_image_index_` as the + // latter has the same value of `image_index` after new image is selected. + if (previous_image_index != image_index) { + ash::UserImageManager::RecordUserImageChanged( + ash::UserImageManager::ImageIndexToHistogramIndex(image_index)); + } + + // Ignore the result of the previous decoding if it's no longer needed. + if (!waiting_for_camera_photo) + ImageDecoder::Cancel(this); +} + +void ChangePictureHandler::HandleRequestSelectedImage( + const base::Value::List& args) { + SendSelectedImage(); +} + +void ChangePictureHandler::FileSelected(const base::FilePath& path) { + auto* user_image_manager = + ChromeUserManager::Get()->GetUserImageManager(GetUser()->GetAccountId()); + + // Log an impression if image is selected from a file. + ash::UserImageManager::RecordUserImageChanged( + default_user_image::kHistogramImageExternal); + + user_image_manager->SaveUserImageFromFile(path); + VLOG(1) << "Selected image from file"; +} + +void ChangePictureHandler::FileSelectionCanceled() { + SendSelectedImage(); +} + +void ChangePictureHandler::SetImageFromCamera( + const gfx::ImageSkia& photo, + base::RefCountedBytes* photo_bytes) { + std::unique_ptr<user_manager::UserImage> user_image = + std::make_unique<user_manager::UserImage>( + photo, photo_bytes, user_manager::UserImage::FORMAT_PNG); + user_image->MarkAsSafe(); + ChromeUserManager::Get() + ->GetUserImageManager(GetUser()->GetAccountId()) + ->SaveUserImage(std::move(user_image)); + + // Log an impression if image is taken from photo. + ash::UserImageManager::RecordUserImageChanged( + default_user_image::kHistogramImageFromCamera); + VLOG(1) << "Selected camera photo"; +} + +void ChangePictureHandler::SetCameraPresent(bool present) { + FireWebUIListener("camera-presence-changed", base::Value(present)); +} + +void ChangePictureHandler::OnUserImageChanged(const user_manager::User& user) { + // Not initialized yet. + if (previous_image_index_ == user_manager::User::USER_IMAGE_INVALID) + return; + SendSelectedImage(); +} + +void ChangePictureHandler::OnUserProfileImageUpdated( + const user_manager::User& user, + const gfx::ImageSkia& profile_image) { + // User profile image has been updated. + SendProfileImage(profile_image, false); +} + +void ChangePictureHandler::OnImageDecoded(const SkBitmap& decoded_image) { + user_photo_ = gfx::ImageSkia::CreateFrom1xBitmap(decoded_image); + SetImageFromCamera(user_photo_, user_photo_data_.get()); +} + +void ChangePictureHandler::OnDecodeImageFailed() { + NOTREACHED() << "Failed to decode PNG image from WebUI"; +} + +const user_manager::User* ChangePictureHandler::GetUser() { + Profile* profile = Profile::FromWebUI(web_ui()); + const user_manager::User* user = + ProfileHelper::Get()->GetUserByProfile(profile); + if (!user) + return user_manager::UserManager::Get()->GetActiveUser(); + return user; +} + +} // namespace settings +} // namespace chromeos
diff --git a/chrome/browser/ui/webui/settings/chromeos/change_picture_handler.h b/chrome/browser/ui/webui/settings/chromeos/change_picture_handler.h new file mode 100644 index 0000000..275a877 --- /dev/null +++ b/chrome/browser/ui/webui/settings/chromeos/change_picture_handler.h
@@ -0,0 +1,136 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CHANGE_PICTURE_HANDLER_H_ +#define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CHANGE_PICTURE_HANDLER_H_ + +#include "base/memory/weak_ptr.h" +#include "base/scoped_observation.h" +#include "chrome/browser/ash/camera_presence_notifier.h" +#include "chrome/browser/ash/login/users/avatar/user_image_file_selector.h" +#include "chrome/browser/image_decoder/image_decoder.h" +#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" +#include "components/user_manager/user_manager.h" +#include "ui/gfx/image/image_skia.h" + +namespace user_manager { +class User; +} + +namespace chromeos { + +namespace settings { + +// ChromeOS user image settings page UI handler. +class ChangePictureHandler : public ::settings::SettingsPageUIHandler, + public user_manager::UserManager::Observer, + public ImageDecoder::ImageRequest { + public: + ChangePictureHandler(); + + ChangePictureHandler(const ChangePictureHandler&) = delete; + ChangePictureHandler& operator=(const ChangePictureHandler&) = delete; + + ~ChangePictureHandler() override; + + // WebUIMessageHandler implementation. + void RegisterMessages() override; + void OnJavascriptAllowed() override; + void OnJavascriptDisallowed() override; + + private: + friend class ChangePictureHandlerTest; + + // Sends list of available default images to the page. + void SendDefaultImages(); + + // Sends current selection to the page. + void SendSelectedImage(); + + // Sends the profile image to the page. If |should_select| is true then + // the profile image element is selected. + void SendProfileImage(const gfx::ImageSkia& image, bool should_select); + + // Starts profile image update and shows the last downloaded profile image, + // if any, on the page. Shouldn't be called before |SendProfileImage|. + void UpdateProfileImage(); + + // Sends the previous user image from camera or file to the page. + void SendOldImage(std::string&& image_url); + + // Updates UI with camera presence state. + void SetCameraPresent(bool present); + + // Opens a file selection dialog to choose user image from file. + void HandleChooseFile(const base::Value::List& args); + + // Handles photo taken with WebRTC UI. + void HandlePhotoTaken(const base::Value::List& args); + + // Handles 'discard-photo' button click. + void HandleDiscardPhoto(const base::Value::List& args); + + // Gets the list of available user images and sends it to the page. + void HandleGetAvailableImages(const base::Value::List& args); + + // Handles page initialized event. + void HandlePageInitialized(const base::Value::List& args); + + // Selects one of the available images as user's. + void HandleSelectImage(const base::Value::List& args); + + // Requests the currently selected image. + void HandleRequestSelectedImage(const base::Value::List& args); + + void FileSelected(const base::FilePath& path); + + void FileSelectionCanceled(); + + // user_manager::UserManager::Observer implementation. + void OnUserImageChanged(const user_manager::User& user) override; + void OnUserProfileImageUpdated(const user_manager::User& user, + const gfx::ImageSkia& profile_image) override; + + // Sets user image to photo taken from camera. + void SetImageFromCamera(const gfx::ImageSkia& photo, + base::RefCountedBytes* image_bytes); + + // Overriden from ImageDecoder::ImageRequest: + void OnImageDecoded(const SkBitmap& decoded_image) override; + void OnDecodeImageFailed() override; + + // Returns user related to current WebUI. If this user doesn't exist, + // returns active user. + const user_manager::User* GetUser(); + + // Previous user image from camera/file and its data URL. + gfx::ImageSkia previous_image_; + scoped_refptr<base::RefCountedBytes> previous_image_bytes_; + user_manager::UserImage::ImageFormat previous_image_format_ = + user_manager::UserImage::FORMAT_UNKNOWN; + + // Index of the previous user image. + int previous_image_index_; + + // Last user photo, if taken. + gfx::ImageSkia user_photo_; + + // Data for |user_photo_|. + scoped_refptr<base::RefCountedBytes> user_photo_data_; + + base::ScopedObservation<user_manager::UserManager, + user_manager::UserManager::Observer> + user_manager_observation_{this}; + + ash::CameraPresenceNotifier camera_presence_notifier_; + + std::unique_ptr<ash::UserImageFileSelector> user_image_file_selector_; + + base::WeakPtrFactory<ChangePictureHandler> weak_ptr_factory_{this}; +}; + +} // namespace settings +} // namespace chromeos + +#endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_CHANGE_PICTURE_HANDLER_H_
diff --git a/chrome/browser/ui/webui/settings/chromeos/change_picture_handler_unittest.cc b/chrome/browser/ui/webui/settings/chromeos/change_picture_handler_unittest.cc new file mode 100644 index 0000000..bc0832c --- /dev/null +++ b/chrome/browser/ui/webui/settings/chromeos/change_picture_handler_unittest.cc
@@ -0,0 +1,301 @@ +// 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/ui/webui/settings/chromeos/change_picture_handler.h" + +#include <memory> + +#include "base/files/file_path.h" +#include "base/test/metrics/histogram_tester.h" +#include "base/values.h" +#include "chrome/browser/ash/login/users/avatar/user_image_manager.h" +#include "chrome/browser/ash/login/users/default_user_image/default_user_images.h" +#include "chrome/browser/ash/login/users/fake_chrome_user_manager.h" +#include "chrome/browser/ash/profiles/profile_helper.h" +#include "chrome/browser/ash/web_applications/personalization_app/mock_personalization_app_manager.h" +#include "chrome/browser/ash/web_applications/personalization_app/personalization_app_manager.h" +#include "chrome/browser/ash/web_applications/personalization_app/personalization_app_manager_factory.h" +#include "chrome/test/base/testing_browser_process.h" +#include "chrome/test/base/testing_profile_manager.h" +#include "components/user_manager/scoped_user_manager.h" +#include "components/user_manager/user_manager.h" +#include "content/public/browser/audio_service.h" +#include "content/public/browser/browser_context.h" +#include "content/public/browser/web_contents.h" +#include "content/public/test/browser_task_environment.h" +#include "content/public/test/test_web_ui.h" +#include "services/audio/public/cpp/sounds/sounds_manager.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/skia/include/core/SkBitmap.h" + +namespace chromeos { +namespace settings { + +namespace { + +std::unique_ptr<KeyedService> MakeMockPersonalizationAppManager( + content::BrowserContext* context) { + return std::make_unique<::testing::NiceMock< + ::ash::personalization_app::MockPersonalizationAppManager>>(); +} + +} // namespace + +class ChangePictureHandlerTest : public testing::Test { + public: + ChangePictureHandlerTest() + : profile_manager_(TestingBrowserProcess::GetGlobal()), + user_manager_enabler_(std::make_unique<ash::FakeChromeUserManager>()) {} + ~ChangePictureHandlerTest() override = default; + + void SetUp() override { + audio::SoundsManager::Create(content::GetAudioServiceStreamFactoryBinder()); + + ASSERT_TRUE(profile_manager_.SetUp()); + account_id_ = AccountId::FromUserEmail("lala@example.com"); + + user_manager::User* user = GetFakeUserManager()->AddUser(account_id_); + + testing_profile_ = profile_manager_.CreateTestingProfile( + account_id_.GetUserEmail(), + {{ash::personalization_app::PersonalizationAppManagerFactory:: + GetInstance(), + base::BindRepeating(&MakeMockPersonalizationAppManager)}}); + + ProfileHelper::Get()->SetUserToProfileMappingForTesting(user, + testing_profile_); + + // Note that user profiles are created after user login in reality. + GetFakeUserManager()->LoginUser(account_id_); + GetFakeUserManager()->UserLoggedIn(account_id_, user->username_hash(), + /*browser_restart=*/false, + /*is_child=*/false); + + web_ui_ = std::make_unique<content::TestWebUI>(); + web_contents_ = content::WebContents::Create( + content::WebContents::CreateParams(testing_profile_)); + web_ui_->set_web_contents(web_contents_.get()); + + handler_ = std::make_unique<ChangePictureHandler>(); + handler_->set_web_ui(web_ui_.get()); + handler_->AllowJavascript(); + handler_->RegisterMessages(); + + request_ = handler_.get(); + } + + void TearDown() override { + request_ = nullptr; + handler_.reset(); + web_contents_.reset(); + web_ui_.reset(); + GetFakeUserManager()->Shutdown(); + testing_profile_ = nullptr; + profile_manager_.DeleteAllTestingProfiles(); + audio::SoundsManager::Shutdown(); + } + + content::TestWebUI* web_ui() { return web_ui_.get(); } + + ash::FakeChromeUserManager* GetFakeUserManager() const { + return static_cast<ash::FakeChromeUserManager*>( + user_manager::UserManager::Get()); + } + + const base::HistogramTester& histogram_tester() const { + return histogram_tester_; + } + + void SelectNewDefaultImage(int default_image_index) { + base::Value::List args; + args.Append( + default_user_image::GetDefaultImageUrl(default_image_index).spec()); + args.Append("default"); + + web_ui_->HandleReceivedMessage("selectImage", args); + } + + void SelectProfileImage() { + base::Value::List args; + args.Append("empty url"); + args.Append("profile"); + + web_ui_->HandleReceivedMessage("selectImage", args); + } + + void SelectImageFromFile(const base::FilePath& path) { + handler_->FileSelected(path); + } + + void CancelFileSelection() { handler_->FileSelectionCanceled(); } + + void OnCameraImageDecoded() { + SkBitmap bitmap; + bitmap.allocN32Pixels(1, 1); + + std::vector<unsigned char> data; + data.push_back('a'); + handler_->user_photo_data_ = base::RefCountedBytes::TakeVector(&data); + + request_->OnImageDecoded(bitmap); + } + + ash::UserImageManager* GetUserImageManager() { + return GetFakeUserManager()->GetUserImageManager(account_id_); + } + + void ResetHandler() { handler_.reset(); } + + ChangePictureHandler* handler() { return handler_.get(); } + + ::testing::NiceMock< + ::ash::personalization_app::MockPersonalizationAppManager>* + MockPersonalizationAppManager() { + return static_cast<::testing::NiceMock< + ::ash::personalization_app::MockPersonalizationAppManager>*>( + ::ash::personalization_app::PersonalizationAppManagerFactory:: + GetForBrowserContext( + web_ui()->GetWebContents()->GetBrowserContext())); + } + + private: + content::BrowserTaskEnvironment task_environment_{ + content::BrowserTaskEnvironment::REAL_IO_THREAD}; + std::unique_ptr<content::TestWebUI> web_ui_; + std::unique_ptr<content::WebContents> web_contents_; + std::unique_ptr<ChangePictureHandler> handler_; + base::HistogramTester histogram_tester_; + AccountId account_id_; + TestingProfile* testing_profile_; + TestingProfileManager profile_manager_; + user_manager::ScopedUserManager user_manager_enabler_; + ImageDecoder::ImageRequest* request_; +}; + +TEST_F(ChangePictureHandlerTest, + ShouldSendUmaMetricWhenNewDefaultImageIsSelected) { + const int default_image_index = + default_user_image::GetRandomDefaultImageIndex(); + SelectNewDefaultImage(default_image_index); + + auto* user_image_manager = GetUserImageManager(); + + histogram_tester().ExpectBucketCount( + ash::UserImageManager::kUserImageChangedHistogramName, + user_image_manager->ImageIndexToHistogramIndex(default_image_index), 1); +} + +TEST_F(ChangePictureHandlerTest, + ShouldNotSendUmaMetricWhenDefaultImageIsReselected) { + const int default_image_index = + default_user_image::GetRandomDefaultImageIndex(); + auto* user_image_manager = GetUserImageManager(); + + SelectNewDefaultImage(default_image_index); + histogram_tester().ExpectBucketCount( + ash::UserImageManager::kUserImageChangedHistogramName, + user_image_manager->ImageIndexToHistogramIndex(default_image_index), 1); + + // Selecting the same default image should not log another impression. + SelectNewDefaultImage(default_image_index); + histogram_tester().ExpectBucketCount( + ash::UserImageManager::kUserImageChangedHistogramName, + user_image_manager->ImageIndexToHistogramIndex(default_image_index), 1); +} + +TEST_F(ChangePictureHandlerTest, ShoulSendUmaMetricWhenProfileImageIsSelected) { + const int default_image_index = + default_user_image::GetRandomDefaultImageIndex(); + auto* user_image_manager = GetUserImageManager(); + + // User selects a new default image. + SelectNewDefaultImage(default_image_index); + histogram_tester().ExpectBucketCount( + ash::UserImageManager::kUserImageChangedHistogramName, + user_image_manager->ImageIndexToHistogramIndex(default_image_index), 1); + + // User selects the profile image. + SelectProfileImage(); + histogram_tester().ExpectBucketCount( + ash::UserImageManager::kUserImageChangedHistogramName, + user_image_manager->ImageIndexToHistogramIndex( + user_manager::User::USER_IMAGE_PROFILE), + 1); +} + +TEST_F(ChangePictureHandlerTest, + ShoulNotSendUmaMetricWhenProfileImageIsReselected) { + auto* user_image_manager = GetUserImageManager(); + // User has profile image by default, thus reselecting profile does not log an + // impression + SelectProfileImage(); + histogram_tester().ExpectBucketCount( + ash::UserImageManager::kUserImageChangedHistogramName, + user_image_manager->ImageIndexToHistogramIndex( + user_manager::User::USER_IMAGE_PROFILE), + 0); +} + +TEST_F(ChangePictureHandlerTest, + ShouldSendUmaMetricWhenImageIsSelectedFromFile) { + auto* user_image_manager = GetUserImageManager(); + + const base::FilePath base_file_path("/this/is/a/test/directory/Base Name"); + const base::FilePath dir_path = base_file_path.AppendASCII("dir1"); + const base::FilePath file_path = dir_path.AppendASCII("file1.txt"); + SelectImageFromFile(file_path); + + histogram_tester().ExpectBucketCount( + ash::UserImageManager::kUserImageChangedHistogramName, + user_image_manager->ImageIndexToHistogramIndex( + user_manager::User::USER_IMAGE_EXTERNAL), + 1); +} + +TEST_F(ChangePictureHandlerTest, ShouldSendUmaMetricWhenCameraImageIsDecoded) { + // Camera image is decoded + OnCameraImageDecoded(); + histogram_tester().ExpectBucketCount( + ash::UserImageManager::kUserImageChangedHistogramName, + default_user_image::kHistogramImageFromCamera, 1); +} + +TEST_F(ChangePictureHandlerTest, + ShouldSelectTheCurrentUserImageIfFileSelectionIsCanceled) { + // keep the current call size so we can check what happened after our test + // method call. + auto number_of_calls_before_cancel = web_ui()->call_data().size(); + CancelFileSelection(); + // reset back to previous profile image. + EXPECT_EQ(web_ui() + ->call_data() + .at(number_of_calls_before_cancel) + ->arg1() + ->GetString(), + "profile-image-changed"); +} + +TEST_F(ChangePictureHandlerTest, CallsMaybeStartHatsTimerOnDestruction) { + EXPECT_CALL( + *MockPersonalizationAppManager(), + MaybeStartHatsTimer(::ash::personalization_app::HatsSurveyType::kAvatar)) + .Times(1); + + ResetHandler(); +} + +TEST_F(ChangePictureHandlerTest, + DoesNotCallMaybeStartHatsTimerOnDestructionIfJavascriptDisallowed) { + handler()->DisallowJavascript(); + + EXPECT_CALL( + *MockPersonalizationAppManager(), + MaybeStartHatsTimer(::ash::personalization_app::HatsSurveyType::kAvatar)) + .Times(0); + + ResetHandler(); +} + +} // namespace settings +} // namespace chromeos
diff --git a/chrome/browser/ui/webui/settings/chromeos/constants/routes.mojom b/chrome/browser/ui/webui/settings/chromeos/constants/routes.mojom index 7e2c220..3fe3d92 100644 --- a/chrome/browser/ui/webui/settings/chromeos/constants/routes.mojom +++ b/chrome/browser/ui/webui/settings/chromeos/constants/routes.mojom
@@ -79,7 +79,7 @@ kAudio = 408, // Personalization section. - // 500 was used for kChangePicture. Do not reuse. + kChangePicture = 500, // 501 was used for kAmbientMode. Do not reuse. // Note: Value 502 was for deprecated kAmbientModePhotos. Do not reuse. // 503 was used for kAmbientModeGooglePhotosAlbum. Do not reuse. @@ -205,6 +205,7 @@ // Personalization section. const string kPersonalizationSectionPath = "personalization"; +const string kChangePictureSubpagePath = "changePicture"; // Search and Assistant section. const string kSearchAndAssistantSectionPath = "osSearch";
diff --git a/chrome/browser/ui/webui/settings/chromeos/constants/routes_util.cc b/chrome/browser/ui/webui/settings/chromeos/constants/routes_util.cc index 4f61db7a..26201d1 100644 --- a/chrome/browser/ui/webui/settings/chromeos/constants/routes_util.cc +++ b/chrome/browser/ui/webui/settings/chromeos/constants/routes_util.cc
@@ -60,6 +60,7 @@ // Personalization section. chromeos::settings::mojom::kPersonalizationSectionPath, + chromeos::settings::mojom::kChangePictureSubpagePath, // Search and Assistant section. chromeos::settings::mojom::kSearchAndAssistantSectionPath,
diff --git a/chrome/browser/ui/webui/settings/chromeos/constants/setting.mojom b/chrome/browser/ui/webui/settings/chromeos/constants/setting.mojom index 756a56b..e5b6a1c 100644 --- a/chrome/browser/ui/webui/settings/chromeos/constants/setting.mojom +++ b/chrome/browser/ui/webui/settings/chromeos/constants/setting.mojom
@@ -144,7 +144,7 @@ kOpenWallpaper = 500, // 501 was used for kAmbientModeOnOff. Do not reuse. // 502 was used for kAmbientModeSource. Do not reuse. - // 503 was used for kChangeDeviceAccountImage. Do not reuse. + kChangeDeviceAccountImage = 503, // Note: Values 504, 505, and 506 were for deprecated // kAmbientModeUpdatePhotosContainers, kDarkModeOnOff and // kDarkModeThemed respectively.
diff --git a/chrome/browser/ui/webui/settings/chromeos/personalization_section.cc b/chrome/browser/ui/webui/settings/chromeos/personalization_section.cc index 91bf454..d4669efa 100644 --- a/chrome/browser/ui/webui/settings/chromeos/personalization_section.cc +++ b/chrome/browser/ui/webui/settings/chromeos/personalization_section.cc
@@ -8,6 +8,7 @@ #include "base/no_destructor.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/settings/ash/search/search_tag_registry.h" +#include "chrome/browser/ui/webui/settings/chromeos/change_picture_handler.h" #include "chrome/browser/ui/webui/settings/chromeos/os_settings_features_util.h" #include "chrome/browser/ui/webui/settings/chromeos/personalization_hub_handler.h" #include "chrome/common/chrome_features.h" @@ -39,6 +40,17 @@ {.setting = mojom::Setting::kOpenWallpaper}, {IDS_OS_SETTINGS_TAG_CHANGE_WALLPAPER_ALT1, IDS_OS_SETTINGS_TAG_CHANGE_WALLPAPER_ALT2, SearchConcept::kAltTagEnd}}, + {IDS_OS_SETTINGS_TAG_CHANGE_DEVICE_ACCOUNT_IMAGE, + mojom::kChangePictureSubpagePath, + mojom::SearchResultIcon::kAvatar, + mojom::SearchResultDefaultRank::kMedium, + mojom::SearchResultType::kSetting, + {.setting = mojom::Setting::kChangeDeviceAccountImage}, + {IDS_OS_SETTINGS_TAG_CHANGE_DEVICE_ACCOUNT_IMAGE_ALT1, + IDS_OS_SETTINGS_TAG_CHANGE_DEVICE_ACCOUNT_IMAGE_ALT2, + IDS_OS_SETTINGS_TAG_CHANGE_DEVICE_ACCOUNT_IMAGE_ALT3, + IDS_OS_SETTINGS_TAG_CHANGE_DEVICE_ACCOUNT_IMAGE_ALT4, + SearchConcept::kAltTagEnd}}, }); return *tags; } @@ -103,6 +115,8 @@ } void PersonalizationSection::AddHandlers(content::WebUI* web_ui) { + web_ui->AddMessageHandler( + std::make_unique<chromeos::settings::ChangePictureHandler>()); if (ash::features::IsPersonalizationHubEnabled()) { web_ui->AddMessageHandler( std::make_unique<chromeos::settings::PersonalizationHubHandler>()); @@ -134,6 +148,14 @@ void PersonalizationSection::RegisterHierarchy( HierarchyGenerator* generator) const { generator->RegisterTopLevelSetting(mojom::Setting::kOpenWallpaper); + + // Change picture. + generator->RegisterTopLevelSubpage( + IDS_OS_SETTINGS_CHANGE_PICTURE_TITLE, mojom::Subpage::kChangePicture, + mojom::SearchResultIcon::kAvatar, mojom::SearchResultDefaultRank::kMedium, + mojom::kChangePictureSubpagePath); + generator->RegisterNestedSetting(mojom::Setting::kChangeDeviceAccountImage, + mojom::Subpage::kChangePicture); } } // namespace settings
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index f4e53f2..2259fcd 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-main-1661125664-a4d78e7c5fe8a84686282d78cdf857ace60aadb7.profdata +chrome-linux-main-1661147815-d915342c6e308db896b7c502d8127c9294613966.profdata
diff --git a/chrome/build/mac-arm.pgo.txt b/chrome/build/mac-arm.pgo.txt index 45274194..bc7d3e3 100644 --- a/chrome/build/mac-arm.pgo.txt +++ b/chrome/build/mac-arm.pgo.txt
@@ -1 +1 @@ -chrome-mac-arm-main-1661104277-820f9300024ebb843d5d204c5c252df830dcd4f8.profdata +chrome-mac-arm-main-1661147815-8adce9ad2756b8541fbf6a7a50c530135537e19f.profdata
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index 77998d5..6125737 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-main-1661104277-7991b145d7fbc693cad582235e1601cd8b45839c.profdata +chrome-mac-main-1661147815-7f3afc44ff1ce285d22d9dcaf86e1d9bc9f40184.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index 3d46fee..a48fbd1 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1661115352-348059e71f0ed1f4b2911d5c49cfec18f4c5695b.profdata +chrome-win32-main-1661147815-3e5a7ff1ef773abbc842c4786d06466afd45adba.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 704d8d5..c685139 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1661115352-a2a650c3314bbe068765a60232552e7220881102.profdata +chrome-win64-main-1661147815-7b7442896c53936deb710b1509349974e912b106.profdata
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc index 6ed1cf6..b6e18ebd 100644 --- a/chrome/common/chrome_features.cc +++ b/chrome/common/chrome_features.cc
@@ -275,6 +275,11 @@ #endif }; +// Runs diagnostics during start up to measure how broken web app icons are to +// feed into metrics. +const base::Feature kDesktopPWAsIconHealthChecks{ + "DesktopPWAsIconHealthChecks", base::FEATURE_ENABLED_BY_DEFAULT}; + // Adds a user settings that allows PWAs to be opened with a tab strip. const base::Feature kDesktopPWAsTabStripSettings{ "DesktopPWAsTabStripSettings", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/chrome/common/chrome_features.h b/chrome/common/chrome_features.h index 63f0ccb5..bda15eb8 100644 --- a/chrome/common/chrome_features.h +++ b/chrome/common/chrome_features.h
@@ -195,6 +195,9 @@ extern const base::Feature kDesktopPWAsFlashAppNameInsteadOfOrigin; COMPONENT_EXPORT(CHROME_FEATURES) +extern const base::Feature kDesktopPWAsIconHealthChecks; + +COMPONENT_EXPORT(CHROME_FEATURES) extern const base::Feature kDesktopPWAsRunOnOsLogin; COMPONENT_EXPORT(CHROME_FEATURES)
diff --git a/chrome/services/sharing/nearby/test_support/mock_webrtc_dependencies.h b/chrome/services/sharing/nearby/test_support/mock_webrtc_dependencies.h index ef1a31e2..36939a8b 100644 --- a/chrome/services/sharing/nearby/test_support/mock_webrtc_dependencies.h +++ b/chrome/services/sharing/nearby/test_support/mock_webrtc_dependencies.h
@@ -38,6 +38,15 @@ bool enable_mdns, network::mojom::P2PSocketManager::GetHostAddressCallback callback), (override)); + MOCK_METHOD( + void, + GetHostAddressWithFamily, + (const std::string& host_name, + int address_family, + bool enable_mdns, + network::mojom::P2PSocketManager::GetHostAddressWithFamilyCallback + callback), + (override)); MOCK_METHOD(void, CreateSocket, (network::P2PSocketType type,
diff --git a/chrome/test/data/webui/BUILD.gn b/chrome/test/data/webui/BUILD.gn index b207e02c..a9676d5c 100644 --- a/chrome/test/data/webui/BUILD.gn +++ b/chrome/test/data/webui/BUILD.gn
@@ -227,6 +227,7 @@ sources = [ "chromeos/ash_common/ash_common_browsertest.js", + "chromeos/cloud_upload/cloud_upload_browsertest.js", "chromeos/crostini_installer_browsertest.js", "chromeos/crostini_upgrader_browsertest.js", "chromeos/diagnostics/diagnostics_browsertest.js", @@ -573,12 +574,14 @@ if (is_chromeos_ash) { input_files += [ "test_store.js" ] deps += [ + "chromeos/cloud_upload:build_grdp", "chromeos/manage_mirrorsync:build_grdp", "chromeos/personalization_app:build_grdp", "//ui/file_manager:build_tests_gen_grdp", "//ui/file_manager:build_tests_grdp", ] grdp_files += [ + "$target_gen_dir/chromeos/cloud_upload/resources.grdp", "$target_gen_dir/chromeos/personalization_app/resources.grdp", "$target_gen_dir/chromeos/manage_mirrorsync/resources.grdp", "$root_gen_dir/ui/file_manager/tests_resources.grdp",
diff --git a/chrome/test/data/webui/chromeos/cloud_upload/.gitignore b/chrome/test/data/webui/chromeos/cloud_upload/.gitignore new file mode 100644 index 0000000..ec7fda7 --- /dev/null +++ b/chrome/test/data/webui/chromeos/cloud_upload/.gitignore
@@ -0,0 +1,2 @@ +# Generated from ash/webui/personalization_app/tools/gen_tsconfig.py +tsconfig.json
diff --git a/chrome/test/data/webui/chromeos/cloud_upload/BUILD.gn b/chrome/test/data/webui/chromeos/cloud_upload/BUILD.gn new file mode 100644 index 0000000..a7c26ba --- /dev/null +++ b/chrome/test/data/webui/chromeos/cloud_upload/BUILD.gn
@@ -0,0 +1,33 @@ +# Copyright 2022 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//tools/typescript/ts_library.gni") +import("//ui/webui/resources/tools/generate_grd.gni") + +ts_library("build_ts") { + root_dir = "." + out_dir = "$target_gen_dir/tsc" + tsconfig_base = "tsconfig_base.json" + in_files = [ "cloud_upload_app_test.ts" ] + path_mappings = [ + "chrome://cloud-upload/*|" + rebase_path( + "$root_gen_dir/chrome/browser/resources/chromeos/cloud_upload/tsc/*", + target_gen_dir), + "chrome://webui-test/*|" + + rebase_path("$root_gen_dir/chrome/test/data/webui/tsc/*", + target_gen_dir), + ] + composite = true + deps = [ "//chrome/browser/resources/chromeos/cloud_upload:build_ts" ] +} + +generate_grd("build_grdp") { + grd_prefix = "webui_chromeos_cloud_upload" + out_grd = "$target_gen_dir/resources.grdp" + + deps = [ ":build_ts" ] + manifest_files = + filter_include(get_target_outputs(":build_ts"), [ "*.manifest" ]) + resource_path_prefix = "chromeos/cloud_upload" +}
diff --git a/chrome/test/data/webui/chromeos/cloud_upload/DIR_METADATA b/chrome/test/data/webui/chromeos/cloud_upload/DIR_METADATA new file mode 100644 index 0000000..e9400b87 --- /dev/null +++ b/chrome/test/data/webui/chromeos/cloud_upload/DIR_METADATA
@@ -0,0 +1 @@ +mixins: "//ui/file_manager/COMMON_METADATA"
diff --git a/chrome/test/data/webui/chromeos/cloud_upload/OWNERS b/chrome/test/data/webui/chromeos/cloud_upload/OWNERS new file mode 100644 index 0000000..73220a8 --- /dev/null +++ b/chrome/test/data/webui/chromeos/cloud_upload/OWNERS
@@ -0,0 +1 @@ +file://ui/file_manager/OWNERS
diff --git a/chrome/test/data/webui/chromeos/cloud_upload/cloud_upload_app_test.ts b/chrome/test/data/webui/chromeos/cloud_upload/cloud_upload_app_test.ts new file mode 100644 index 0000000..564f7157 --- /dev/null +++ b/chrome/test/data/webui/chromeos/cloud_upload/cloud_upload_app_test.ts
@@ -0,0 +1,133 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'chrome://cloud-upload/cloud_upload_dialog.js'; + +import {PageHandlerRemote, UserAction} from 'chrome://cloud-upload/cloud_upload.mojom-webui.js'; +import {CloudUploadBrowserProxy} from 'chrome://cloud-upload/cloud_upload_browser_proxy.js'; +import {CloudUploadElement} from 'chrome://cloud-upload/cloud_upload_dialog.js'; +import {assertDeepEquals, assertEquals} from 'chrome://webui-test/chai_assert.js'; +import {TestBrowserProxy} from 'chrome://webui-test/test_browser_proxy.js'; + +/** + * A test CloudUploadBrowserProxy implementation that enables to mock various + * mojo responses. + */ +class CloudUploadTestBrowserProxy implements CloudUploadBrowserProxy { + handler: PageHandlerRemote&TestBrowserProxy; + + constructor() { + this.handler = TestBrowserProxy.fromClass(PageHandlerRemote); + } + + getDialogArguments() { + return JSON.stringify({fileName: 'file.docx'}); + } +} + +/** + * Wait for `f` to evaluate to true. Evaluation interval is 100ms, throws an + * error if the 5s timeout is reached. + */ +async function waitFor(f: () => boolean) { + return new Promise((resolve, reject) => { + const intervalId = setInterval(() => { + if (f()) { + clearInterval(intervalId); + clearTimeout(timeoutId); + resolve(undefined); + } + }, 100); + + const timeoutId = setTimeout(() => { + clearInterval(intervalId); + reject(new Error('waitFor has timed out')); + }, 5000); + }); +} + +suite('<cloud-upload>', () => { + /* Holds the <cloud-upload> app. */ + let container: HTMLDivElement; + /* The <cloud-upload> app. */ + let cloudUploadApp: CloudUploadElement; + /* The BrowserProxy element to make assertions on when mojo methods are + called. */ + let testProxy: CloudUploadTestBrowserProxy; + /* Upload path, response from the `getUploadPath` mojo method. */ + const uploadPath = '/from Chromebook'; + + /** + * Runs prior to all the tests running, attaches a div to enable isolated + * clearing and attaching of the web component. + */ + suiteSetup(() => { + container = document.createElement('div'); + document.body.appendChild(container); + testProxy = new CloudUploadTestBrowserProxy(); + CloudUploadBrowserProxy.setInstance(testProxy); + }); + + /** + * Runs before each test. + */ + setup(() => { + // Sets `getUploadPath` to return the 'from Chromebook' static string. + // Called on <cloud-upload>'s connectedCallback. + testProxy.handler.setResultFor('getUploadPath', { + uploadPath: { + path: uploadPath, + }, + }); + // Creates and attaches the <cloud-upload> element to the DOM tree. + cloudUploadApp = + document.createElement('cloud-upload') as CloudUploadElement; + container.appendChild(cloudUploadApp); + }); + + /** + * Runs after each test. Removes all elements from the <div> that holds + * the <cloud-upload> component. + */ + teardown(() => { + container.innerHTML = ''; + testProxy.handler.reset(); + }); + + /** + * Tests that the upload path is correctly displayed when the <cloud-upload> + * element is attached. + */ + test('Upload location', async () => { + const uploadLocationElement = cloudUploadApp.$('#upload-location'); + // Wait for the #upload-location element (initially empty) to update. + await waitFor(() => !!uploadLocationElement.innerText); + assertEquals( + `Upload location: ${uploadPath}`, uploadLocationElement.innerText); + }); + + /** + * Tests that clicking the upload button triggers the right `respondAndClose` + * mojo request. + */ + test('Upload button', async () => { + cloudUploadApp.$('#upload-button').click(); + await testProxy.handler.whenCalled('respondAndClose'); + assertEquals(1, testProxy.handler.getCallCount('respondAndClose')); + assertDeepEquals( + [UserAction.kUpload], testProxy.handler.getArgs('respondAndClose')); + }); + + /** + * Tests that clicking the cancel button triggers the right `respondAndClose` + * mojo request. + */ + test('Cancel button', async () => { + cloudUploadApp.$('#cancel-button').click(); + await testProxy.handler.whenCalled('respondAndClose'); + assertEquals(1, testProxy.handler.getCallCount('respondAndClose')); + assertDeepEquals( + [UserAction.kCancel], testProxy.handler.getArgs('respondAndClose')); + }); +});
diff --git a/chrome/test/data/webui/chromeos/cloud_upload/cloud_upload_browsertest.js b/chrome/test/data/webui/chromeos/cloud_upload/cloud_upload_browsertest.js new file mode 100644 index 0000000..f244679c --- /dev/null +++ b/chrome/test/data/webui/chromeos/cloud_upload/cloud_upload_browsertest.js
@@ -0,0 +1,26 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/** + * @fileoverview Test suite for chrome://cloud-upload. Tests the entire page + * instead of individual components. + */ + +GEN_INCLUDE(['//chrome/test/data/webui/polymer_browser_test_base.js']); + +GEN('#include "ash/constants/ash_features.h"'); +GEN('#include "content/public/test/browser_test.h"'); + +var CloudUploadAppBrowserTest = class extends PolymerTest { + get browsePreload() { + return 'chrome://cloud-upload/test_loader.html?module=chromeos/' + + 'cloud_upload/cloud_upload_app_test.js'; + } + + get featureList() { + return {enabled: ['ash::features::kUploadOfficeToCloud']}; + } +}; + +TEST_F('CloudUploadAppBrowserTest', 'All', () => mocha.run());
diff --git a/chrome/test/data/webui/chromeos/cloud_upload/tsconfig_base.json b/chrome/test/data/webui/chromeos/cloud_upload/tsconfig_base.json new file mode 100644 index 0000000..6938348 --- /dev/null +++ b/chrome/test/data/webui/chromeos/cloud_upload/tsconfig_base.json
@@ -0,0 +1,10 @@ +{ + "extends": "../../../../../../tools/typescript/tsconfig_base.json", + "compilerOptions": { + "allowJs": true, + "typeRoots": [ + "../../../../../../third_party/node/node_modules/@types" + ], + "types": ["mocha"] + } +}
diff --git a/chrome/test/data/webui/settings/chromeos/os_settings_v3_browsertest.js b/chrome/test/data/webui/settings/chromeos/os_settings_v3_browsertest.js index 399a967..e7ef248e 100644 --- a/chrome/test/data/webui/settings/chromeos/os_settings_v3_browsertest.js +++ b/chrome/test/data/webui/settings/chromeos/os_settings_v3_browsertest.js
@@ -420,6 +420,7 @@ ['OSSettingsMenu', 'os_settings_menu_test.js'], ['ParentalControlsPage', 'parental_controls_page_test.js'], ['PeoplePage', 'os_people_page_test.js'], + ['PeoplePageChangePicture', 'people_page_change_picture_test.js'], ['PeoplePageQuickUnlock', 'quick_unlock_authenticate_browsertest_chromeos.js'], [ 'PersonalizationPage',
diff --git a/chrome/test/data/webui/settings/chromeos/people_page_change_picture_test.js b/chrome/test/data/webui/settings/chromeos/people_page_change_picture_test.js new file mode 100644 index 0000000..467016c --- /dev/null +++ b/chrome/test/data/webui/settings/chromeos/people_page_change_picture_test.js
@@ -0,0 +1,403 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import {ChangePictureBrowserProxyImpl, routes} from 'chrome://os-settings/chromeos/os_settings.js'; +import {CrPicture} from 'chrome://resources/ash/common/cr_picture/cr_picture_types.js'; +import {webUIListenerCallback} from 'chrome://resources/js/cr.m.js'; +import {pressAndReleaseKeyOn} from 'chrome://resources/polymer/v3_0/iron-test-helpers/mock-interactions.js'; +import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +import {assertEquals, assertFalse, assertTrue} from '../../chai_assert.js'; +import {TestBrowserProxy} from '../../test_browser_proxy.js'; + +/** @implements {ChangePictureBrowserProxy} */ +class TestChangePictureBrowserProxy extends TestBrowserProxy { + constructor() { + super([ + 'initialize', + 'selectDefaultImage', + 'selectOldImage', + 'selectProfileImage', + 'photoTaken', + 'chooseFile', + 'requestSelectedImage', + ]); + } + + /** @override */ + initialize() { + webUIListenerCallback( + 'profile-image-changed', 'fake-profile-image-url', + false /* selected */); + + const fakeCurrentDefaultImages = [ + { + index: 2, + title: 'Title2', + url: 'chrome://foo/2.png', + }, + { + index: 3, + title: 'Title3', + url: 'chrome://foo/3.png', + }, + ]; + webUIListenerCallback('default-images-changed', { + current_default_images: fakeCurrentDefaultImages, + }); + + this.methodCalled('initialize'); + } + + /** @override */ + selectDefaultImage(imageUrl) { + webUIListenerCallback('selected-image-changed', imageUrl); + this.methodCalled('selectDefaultImage', imageUrl); + } + + /** @override */ + selectOldImage() { + webUIListenerCallback('old-image-changed', { + url: 'fake-old-image.jpg', + index: 1, + }); + this.methodCalled('selectOldImage'); + } + + /** @override */ + selectProfileImage() { + webUIListenerCallback( + 'profile-image-changed', 'fake-profile-image-url', true /* selected */); + this.methodCalled('selectProfileImage'); + } + + /** @override */ + photoTaken() { + this.methodCalled('photoTaken'); + } + + /** @override */ + chooseFile() { + this.methodCalled('chooseFile'); + } + + /** @override */ + requestSelectedImage() { + this.methodCalled('requestSelectedImage'); + } +} + +suite('ChangePictureTests', function() { + let changePicture = null; + let browserProxy = null; + let crPicturePane = null; + let crPictureList = null; + + const LEFT_KEY_CODE = 37; + const RIGHT_KEY_CODE = 39; + + /** + * @return {Array<HTMLElement>} Traverses the DOM tree to find the lowest + * level active element and returns an array of the node path down the + * tree, skipping shadow roots. + */ + function getActiveElementPath() { + let node = document.activeElement; + const path = []; + while (node) { + path.push(node); + node = (node.shadowRoot || node).activeElement; + } + return path; + } + + + suiteSetup(function() { + loadTimeData.overrideValues({ + profilePhoto: 'Fake Profile Photo description', + }); + }); + + setup(async function() { + browserProxy = new TestChangePictureBrowserProxy(); + ChangePictureBrowserProxyImpl.setInstanceForTesting(browserProxy); + PolymerTest.clearBody(); + changePicture = document.createElement('settings-change-picture'); + document.body.appendChild(changePicture); + + crPicturePane = changePicture.shadowRoot.querySelector('cr-picture-pane'); + assertTrue(!!crPicturePane); + + crPictureList = changePicture.shadowRoot.querySelector('cr-picture-list'); + assertTrue(!!crPictureList); + + changePicture.currentRouteChanged(routes.CHANGE_PICTURE); + + await browserProxy.whenCalled('initialize'); + flush(); + }); + + teardown(function() { + changePicture.remove(); + }); + + test('TraverseCameraIconUsingArrows', function() { + // Force the camera to be present. + webUIListenerCallback('camera-presence-changed', true); + flush(); + assertTrue(crPictureList.cameraPresent); + + // Click camera icon. + const cameraImage = crPictureList.$.cameraImage; + cameraImage.click(); + flush(); + + assertTrue(crPictureList.cameraSelected_); + const crCamera = crPicturePane.shadowRoot.querySelector('#camera'); + assertTrue(!!crCamera); + + // Mock camera's video stream beginning to play. + crCamera.$.cameraVideo.dispatchEvent(new Event('canplay')); + flush(); + + // "Take photo" button should be active. + let activeElementPath = getActiveElementPath(); + assertTrue(activeElementPath.includes(crPicturePane)); + assertFalse(activeElementPath.includes(crPictureList)); + + // Press 'Right' key on active element. + pressAndReleaseKeyOn(activeElementPath.pop(), RIGHT_KEY_CODE); + flush(); + + // A profile picture open should be active. + activeElementPath = getActiveElementPath(); + assertFalse(crPictureList.cameraSelected_); + assertFalse(activeElementPath.includes(crPicturePane)); + assertTrue(activeElementPath.includes(crPictureList)); + + // Press 'Left' key on active element. + pressAndReleaseKeyOn(activeElementPath.pop(), LEFT_KEY_CODE); + flush(); + + // Mock camera's video stream beginning to play. + crCamera.$.cameraVideo.dispatchEvent(new Event('canplay')); + flush(); + + // "Take photo" button should be active again. + activeElementPath = getActiveElementPath(); + assertTrue(crPictureList.cameraSelected_); + assertTrue(activeElementPath.includes(crPicturePane)); + assertFalse(activeElementPath.includes(crPictureList)); + }); + + test('ChangePictureSelectCamera', async function() { + // Force the camera to be absent, even if it's actually present. + webUIListenerCallback('camera-presence-changed', false); + flush(); + + await new Promise(function(resolve) { + changePicture.async(resolve); + }); + let camera = crPicturePane.shadowRoot.querySelector('#camera'); + assertFalse(crPicturePane.cameraPresent); + assertFalse(crPicturePane.cameraActive_); + assertFalse(!!camera && camera.hidden); + + webUIListenerCallback('camera-presence-changed', true); + flush(); + await new Promise(function(resolve) { + changePicture.async(resolve); + }); + camera = crPicturePane.shadowRoot.querySelector('#camera'); + assertTrue(crPicturePane.cameraPresent); + assertFalse(crPicturePane.cameraActive_); + assertFalse(!!camera && camera.hidden); + + const cameraImage = crPictureList.$.cameraImage; + cameraImage.click(); + flush(); + await new Promise(function(resolve) { + changePicture.async(resolve); + }); + camera = crPicturePane.shadowRoot.querySelector('#camera'); + assertTrue(crPicturePane.cameraActive_); + assertTrue(!!camera && !camera.hidden); + assertEquals( + CrPicture.SelectionTypes.CAMERA, + changePicture.selectedItem_.dataset.type); + const discard = crPicturePane.shadowRoot.querySelector('#discard'); + assertTrue(!discard || discard.hidden); + + // Ensure that the camera is deactivated if user navigates away. + changePicture.currentRouteChanged(routes.BASIC); + await new Promise(function(resolve) { + changePicture.async(resolve); + }); + assertFalse(crPicturePane.cameraActive_); + }); + + test('ChangePictureProfileImage', async function() { + const profileImage = crPictureList.$.profileImage; + assertTrue(!!profileImage); + + assertEquals(null, changePicture.selectedItem_); + profileImage.click(); + + await browserProxy.whenCalled('selectProfileImage'); + flush(); + + assertEquals( + CrPicture.SelectionTypes.PROFILE, + changePicture.selectedItem_.dataset.type); + assertFalse(crPicturePane.cameraActive_); + const discard = crPicturePane.shadowRoot.querySelector('#discard'); + assertTrue(!discard || discard.hidden); + + // Ensure that the selection is restored after navigating away and + // then back to the subpage. + changePicture.currentRouteChanged(routes.BASIC); + changePicture.currentRouteChanged(routes.CHANGE_PICTURE); + assertEquals(null, changePicture.selectedItem_); + }); + + test('ChangePictureDeprecatedImage', async function() { + webUIListenerCallback( + 'preview-deprecated-image', {url: 'fake-old-image.jpg'}); + flush(); + + // Expect the deprecated image is presented in picture pane. + assertEquals(CrPicture.SelectionTypes.DEPRECATED, crPicturePane.imageType); + const image = crPicturePane.shadowRoot.querySelector('#image'); + assertTrue(!!image); + assertFalse(image.hidden); + const discard = crPicturePane.shadowRoot.querySelector('#discard'); + assertTrue(!!discard); + assertTrue(discard.hidden); + }); + + test('ChangePictureDeprecatedImageWithSourceInfo', async function() { + const fakeAuthor = 'FakeAuthor'; + const fakeWebsite = 'http://foo1.com'; + webUIListenerCallback('preview-deprecated-image', { + url: 'fake-old-image.jpg', + author: fakeAuthor, + website: fakeWebsite, + }); + flush(); + + // Expect the deprecated image is presented in picture pane. + assertEquals(CrPicture.SelectionTypes.DEPRECATED, crPicturePane.imageType); + const image = crPicturePane.shadowRoot.querySelector('#image'); + assertTrue(!!image); + assertFalse(image.hidden); + const discard = crPicturePane.shadowRoot.querySelector('#discard'); + assertTrue(!!discard); + assertTrue(discard.hidden); + const sourceInfo = changePicture.shadowRoot.querySelector('#sourceInfo'); + assertTrue(!!sourceInfo); + assertFalse(sourceInfo.hidden); + assertEquals(changePicture.authorInfo_, 'Photo by ' + fakeAuthor); + assertEquals(changePicture.websiteInfo_, fakeWebsite); + }); + + test('ChangePictureFileImage', async function() { + assertFalse(!!changePicture.selectedItem_); + + // By default there is no old image and the element is hidden. + const oldImage = crPictureList.$.oldImage; + assertTrue(!!oldImage); + assertTrue(oldImage.hidden); + + webUIListenerCallback('old-image-changed', 'file-image.jpg'); + flush(); + + await new Promise(function(resolve) { + changePicture.async(resolve); + }); + assertTrue(!!changePicture.selectedItem_); + // Expect the old image to be selected once an old image is sent via + // the native interface. + assertEquals( + CrPicture.SelectionTypes.OLD, changePicture.selectedItem_.dataset.type); + assertFalse(oldImage.hidden); + assertFalse(crPicturePane.cameraActive_); + const discard = crPicturePane.shadowRoot.querySelector('#discard'); + assertTrue(!!discard); + assertFalse(discard.hidden); + // Ensure the file image does not show the source info. + const sourceInfo = changePicture.shadowRoot.querySelector('#sourceInfo'); + assertTrue(!sourceInfo || sourceInfo.hidden); + }); + + test('ChangePictureSelectFirstDefaultImage', async function() { + const firstDefaultImage = + crPictureList.shadowRoot.querySelector('img[data-type="default"]'); + assertTrue(!!firstDefaultImage); + + firstDefaultImage.click(); + + let imageUrl = await browserProxy.whenCalled('selectDefaultImage'); + assertEquals('chrome://foo/2.png', imageUrl); + + flush(); + assertEquals( + CrPicture.SelectionTypes.DEFAULT, + changePicture.selectedItem_.dataset.type); + assertEquals(firstDefaultImage, changePicture.selectedItem_); + assertFalse(crPicturePane.cameraActive_); + const discard = crPicturePane.shadowRoot.querySelector('#discard'); + assertTrue(!discard || discard.hidden); + + // Now verify that arrow keys actually select the new image. + browserProxy.resetResolver('selectDefaultImage'); + pressAndReleaseKeyOn(changePicture.selectedItem_, RIGHT_KEY_CODE); + imageUrl = await browserProxy.whenCalled('selectDefaultImage'); + assertEquals('chrome://foo/3.png', imageUrl); + }); + + test('ChangePictureRestoreImageAfterDiscard', async function() { + const firstDefaultImage = + crPictureList.shadowRoot.querySelector('img[data-type="default"]'); + assertTrue(!!firstDefaultImage); + + firstDefaultImage.click(); + + await browserProxy.whenCalled('selectDefaultImage'); + flush(); + assertEquals(firstDefaultImage, changePicture.selectedItem_); + + webUIListenerCallback('old-image-changed', 'fake-old-image.jpg'); + + flush(); + assertEquals( + CrPicture.SelectionTypes.OLD, changePicture.selectedItem_.dataset.type); + + const discardButton = + crPicturePane.shadowRoot.querySelector('#discard cr-icon-button'); + assertTrue(!!discardButton); + discardButton.click(); + + flush(); + const profileImage = crPictureList.$.profileImage; + assertTrue(!!profileImage); + assertEquals(profileImage, changePicture.selectedItem_); + }); + + test('ChangePictureImagePendingStateCheck', async function() { + // oldImagePending_ should be false when no camera photo pending. + assertFalse(changePicture.oldImagePending_); + assertEquals(crPictureList.oldImageUrl_, ''); + // Simulate photo taken event. + crPicturePane.fire('photo-taken', {photoDataUrl: 'camera-image.jpg'}); + flush(); + // oldImagePending_ should be true due to pending camera image. + assertTrue(changePicture.oldImagePending_); + + webUIListenerCallback('old-image-changed', 'camera-image.jpg'); + flush(); + // oldImagePending_ should be false after the image has been received. + assertFalse(changePicture.oldImagePending_); + assertEquals(crPictureList.oldImageUrl_, 'camera-image.jpg'); + }); +});
diff --git a/chrome/test/data/webui/settings/chromeos/personalization_page_test.js b/chrome/test/data/webui/settings/chromeos/personalization_page_test.js index 5b33db4..9f3074e 100644 --- a/chrome/test/data/webui/settings/chromeos/personalization_page_test.js +++ b/chrome/test/data/webui/settings/chromeos/personalization_page_test.js
@@ -52,4 +52,34 @@ personalizationPage.remove(); Router.getInstance().resetRouteForTesting(); }); + + test('changePicture', function() { + const row = + personalizationPage.shadowRoot.getElementById('changePictureRow'); + assertTrue(!!row); + row.click(); + assertEquals(routes.CHANGE_PICTURE, Router.getInstance().getCurrentRoute()); + }); + + test('Deep link to change account picture', async () => { + const params = new URLSearchParams(); + params.append('settingId', '503'); + Router.getInstance().navigateTo(routes.CHANGE_PICTURE, params); + + flush(); + + await waitAfterNextRender(personalizationPage); + + const changePicturePage = + personalizationPage.shadowRoot.querySelector('settings-change-picture'); + assertTrue(!!changePicturePage); + const deepLinkElement = + changePicturePage.shadowRoot.querySelector('#pictureList') + .shadowRoot.querySelector('#selector') + .$$('[class="iron-selected"]'); + await waitAfterNextRender(deepLinkElement); + assertEquals( + deepLinkElement, getDeepActiveElement(), + 'Account picture elem should be focused for settingId=503.'); + }); });
diff --git a/chrome/utility/BUILD.gn b/chrome/utility/BUILD.gn index 696cd26..b03a0ec 100644 --- a/chrome/utility/BUILD.gn +++ b/chrome/utility/BUILD.gn
@@ -202,7 +202,7 @@ deps += [ "//chromeos/ash/services/assistant/audio_decoder:lib", "//chromeos/ash/services/assistant/public/mojom", - "//chromeos/services/libassistant", + "//chromeos/ash/services/libassistant", "//chromeos/services/libassistant/public/mojom", ] }
diff --git a/chrome/utility/DEPS b/chrome/utility/DEPS index ec55fddd..2debe7f 100644 --- a/chrome/utility/DEPS +++ b/chrome/utility/DEPS
@@ -35,8 +35,8 @@ "+chromeos/ash/components/trash_service/public/mojom", "+chromeos/ash/services/assistant", "+chromeos/ash/services/assistant/audio_decoder", + "+chromeos/ash/services/libassistant/libassistant_service.h", "+chromeos/components/quick_answers/public", - "+chromeos/services/libassistant/libassistant_service.h", "+chromeos/services/tts", "+components/crash/core/common/crash_keys.h", "+components/device_signals/core/common/mojom",
diff --git a/chrome/utility/services.cc b/chrome/utility/services.cc index de86afdf..a371010 100644 --- a/chrome/utility/services.cc +++ b/chrome/utility/services.cc
@@ -134,7 +134,7 @@ #if BUILDFLAG(ENABLE_CROS_LIBASSISTANT) #include "chromeos/ash/services/assistant/audio_decoder/assistant_audio_decoder_factory.h" // nogncheck -#include "chromeos/services/libassistant/libassistant_service.h" // nogncheck +#include "chromeos/ash/services/libassistant/libassistant_service.h" // nogncheck #endif // BUILDFLAG(ENABLE_CROS_LIBASSISTANT) #endif // BUILDFLAG(IS_CHROMEOS_ASH)
diff --git a/chromecast/bindings/OWNERS b/chromecast/bindings/OWNERS index 3520a47..bdd6d98 100644 --- a/chromecast/bindings/OWNERS +++ b/chromecast/bindings/OWNERS
@@ -1,4 +1,2 @@ -derekjchow@chromium.org lijiawei@chromium.org -maclellant@chromium.org kmarshall@chromium.org
diff --git a/chromeos/ash/components/attestation/BUILD.gn b/chromeos/ash/components/attestation/BUILD.gn index 243ad1c..9d98bbf 100644 --- a/chromeos/ash/components/attestation/BUILD.gn +++ b/chromeos/ash/components/attestation/BUILD.gn
@@ -14,6 +14,7 @@ "//chromeos/ash/components/cryptohome", "//chromeos/ash/components/dbus/attestation", "//chromeos/ash/components/dbus/attestation:attestation_proto", + "//chromeos/ash/components/dbus/constants", "//chromeos/dbus/common", "//components/account_id", "//crypto", @@ -42,7 +43,7 @@ deps = [ "//base/test:test_support", "//chromeos/ash/components/dbus/attestation:attestation_proto", - "//chromeos/dbus/constants:constants", + "//chromeos/ash/components/dbus/constants", "//components/account_id", "//net", "//testing/gmock", @@ -66,6 +67,7 @@ "//chromeos/ash/components/dbus:test_support", "//chromeos/ash/components/dbus/attestation", "//chromeos/ash/components/dbus/attestation:attestation_proto", + "//chromeos/ash/components/dbus/constants", "//components/account_id", "//testing/gmock", "//testing/gtest",
diff --git a/chromeos/ash/components/attestation/DEPS b/chromeos/ash/components/attestation/DEPS index f76c9a18..251e5d48 100644 --- a/chromeos/ash/components/attestation/DEPS +++ b/chromeos/ash/components/attestation/DEPS
@@ -3,7 +3,7 @@ include_rules = [ "+base", "+chromeos/ash/components/cryptohome", - "+chromeos/ash/components/dbus/attestation", + "+chromeos/ash/components/dbus", "+chromeos/dbus", "+components/account_id", "+crypto",
diff --git a/chromeos/ash/components/attestation/attestation_flow.cc b/chromeos/ash/components/attestation/attestation_flow.cc index f5b1983..8cf2b64 100644 --- a/chromeos/ash/components/attestation/attestation_flow.cc +++ b/chromeos/ash/components/attestation/attestation_flow.cc
@@ -18,7 +18,7 @@ #include "chromeos/ash/components/dbus/attestation/attestation_ca.pb.h" #include "chromeos/ash/components/dbus/attestation/attestation_client.h" #include "chromeos/ash/components/dbus/attestation/interface.pb.h" -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" #include "components/account_id/account_id.h" #include "third_party/abseil-cpp/absl/types/optional.h"
diff --git a/chromeos/ash/components/attestation/attestation_flow.h b/chromeos/ash/components/attestation/attestation_flow.h index 623d2e03..360667a 100644 --- a/chromeos/ash/components/attestation/attestation_flow.h +++ b/chromeos/ash/components/attestation/attestation_flow.h
@@ -14,8 +14,8 @@ #include "base/time/time.h" #include "base/timer/timer.h" #include "chromeos/ash/components/dbus/attestation/interface.pb.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" #include "chromeos/dbus/common/dbus_method_call_status.h" -#include "chromeos/dbus/constants/attestation_constants.h" #include "third_party/cros_system_api/dbus/service_constants.h" class AccountId;
diff --git a/chromeos/ash/components/attestation/attestation_flow_adaptive.cc b/chromeos/ash/components/attestation/attestation_flow_adaptive.cc index 6a32a1e8..2a6c596 100644 --- a/chromeos/ash/components/attestation/attestation_flow_adaptive.cc +++ b/chromeos/ash/components/attestation/attestation_flow_adaptive.cc
@@ -8,7 +8,7 @@ #include <utility> #include "base/logging.h" -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" namespace ash { namespace attestation {
diff --git a/chromeos/ash/components/attestation/attestation_flow_adaptive.h b/chromeos/ash/components/attestation/attestation_flow_adaptive.h index 5210130..f0a4044 100644 --- a/chromeos/ash/components/attestation/attestation_flow_adaptive.h +++ b/chromeos/ash/components/attestation/attestation_flow_adaptive.h
@@ -15,7 +15,7 @@ #include "chromeos/ash/components/attestation/attestation_flow_status_reporter.h" #include "chromeos/ash/components/attestation/attestation_flow_type_decider.h" #include "chromeos/ash/components/dbus/attestation/interface.pb.h" -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" #include "components/account_id/account_id.h" namespace ash {
diff --git a/chromeos/ash/components/attestation/attestation_flow_integrated.cc b/chromeos/ash/components/attestation/attestation_flow_integrated.cc index 3c114be..a2d6201 100644 --- a/chromeos/ash/components/attestation/attestation_flow_integrated.cc +++ b/chromeos/ash/components/attestation/attestation_flow_integrated.cc
@@ -18,7 +18,7 @@ #include "chromeos/ash/components/cryptohome/cryptohome_parameters.h" #include "chromeos/ash/components/dbus/attestation/attestation_client.h" #include "chromeos/ash/components/dbus/attestation/interface.pb.h" -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" #include "chromeos/dbus/constants/dbus_switches.h" #include "components/account_id/account_id.h" #include "third_party/abseil-cpp/absl/types/optional.h"
diff --git a/chromeos/ash/components/attestation/attestation_flow_integrated.h b/chromeos/ash/components/attestation/attestation_flow_integrated.h index ff349c3c..e07675d 100644 --- a/chromeos/ash/components/attestation/attestation_flow_integrated.h +++ b/chromeos/ash/components/attestation/attestation_flow_integrated.h
@@ -15,8 +15,8 @@ #include "base/timer/timer.h" #include "chromeos/ash/components/attestation/attestation_flow.h" #include "chromeos/ash/components/dbus/attestation/interface.pb.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" #include "chromeos/dbus/common/dbus_method_call_status.h" -#include "chromeos/dbus/constants/attestation_constants.h" #include "third_party/cros_system_api/dbus/service_constants.h" class AccountId;
diff --git a/chromeos/ash/components/attestation/attestation_flow_integrated_unittest.cc b/chromeos/ash/components/attestation/attestation_flow_integrated_unittest.cc index c772456..ab7b514b 100644 --- a/chromeos/ash/components/attestation/attestation_flow_integrated_unittest.cc +++ b/chromeos/ash/components/attestation/attestation_flow_integrated_unittest.cc
@@ -22,7 +22,7 @@ #include "chromeos/ash/components/cryptohome/cryptohome_parameters.h" #include "chromeos/ash/components/dbus/attestation/attestation_client.h" #include "chromeos/ash/components/dbus/attestation/interface.pb.h" -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" #include "chromeos/dbus/constants/dbus_switches.h" #include "components/account_id/account_id.h" #include "testing/gmock/include/gmock/gmock.h"
diff --git a/chromeos/ash/components/attestation/attestation_flow_utils.cc b/chromeos/ash/components/attestation/attestation_flow_utils.cc index 71663892..6272ba1 100644 --- a/chromeos/ash/components/attestation/attestation_flow_utils.cc +++ b/chromeos/ash/components/attestation/attestation_flow_utils.cc
@@ -7,7 +7,7 @@ #include <string> #include "base/notreached.h" -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" namespace ash { namespace attestation {
diff --git a/chromeos/ash/components/attestation/attestation_flow_utils.h b/chromeos/ash/components/attestation/attestation_flow_utils.h index 6acf35d..cd4a997 100644 --- a/chromeos/ash/components/attestation/attestation_flow_utils.h +++ b/chromeos/ash/components/attestation/attestation_flow_utils.h
@@ -8,7 +8,7 @@ #include <string> #include "base/component_export.h" -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" namespace ash { namespace attestation {
diff --git a/chromeos/ash/components/attestation/attestation_flow_utils_unittest.cc b/chromeos/ash/components/attestation/attestation_flow_utils_unittest.cc index c42b5b6e..3f72b2a 100644 --- a/chromeos/ash/components/attestation/attestation_flow_utils_unittest.cc +++ b/chromeos/ash/components/attestation/attestation_flow_utils_unittest.cc
@@ -6,7 +6,7 @@ #include <string> -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" #include "testing/gtest/include/gtest/gtest.h" namespace ash {
diff --git a/chromeos/ash/components/attestation/fake_attestation_flow.cc b/chromeos/ash/components/attestation/fake_attestation_flow.cc index 34b9de7..f33d1fc8 100644 --- a/chromeos/ash/components/attestation/fake_attestation_flow.cc +++ b/chromeos/ash/components/attestation/fake_attestation_flow.cc
@@ -9,7 +9,7 @@ #include "base/bind.h" #include "base/threading/thread_task_runner_handle.h" -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" #include "components/account_id/account_id.h" namespace ash {
diff --git a/chromeos/ash/components/audio/cras_audio_handler.cc b/chromeos/ash/components/audio/cras_audio_handler.cc index 4606234..848b4d26 100644 --- a/chromeos/ash/components/audio/cras_audio_handler.cc +++ b/chromeos/ash/components/audio/cras_audio_handler.cc
@@ -1918,7 +1918,8 @@ return ClientType::VM_TERMINA; } else if (client_type_str == "CRAS_CLIENT_TYPE_CHROME") { return ClientType::CHROME; - } else if (client_type_str == "CRAS_CLIENT_TYPE_ARC") { + } else if (client_type_str == "CRAS_CLIENT_TYPE_ARC" || + client_type_str == "CRAS_CLIENT_TYPE_ARCVM") { return ClientType::ARC; } else if (client_type_str == "CRAS_CLIENT_TYPE_BOREALIS") { return ClientType::VM_BOREALIS;
diff --git a/chromeos/ash/components/cros_elements/OWNERS b/chromeos/ash/components/cros_elements/OWNERS index 4c12938..0d5501a 100644 --- a/chromeos/ash/components/cros_elements/OWNERS +++ b/chromeos/ash/components/cros_elements/OWNERS
@@ -1,3 +1,3 @@ qjw@chromium.org -zafzal@google.org +zafzal@google.com meredithl@chromium.org
diff --git a/chromeos/ash/components/cryptohome/BUILD.gn b/chromeos/ash/components/cryptohome/BUILD.gn index c87467eb..687c9c7 100644 --- a/chromeos/ash/components/cryptohome/BUILD.gn +++ b/chromeos/ash/components/cryptohome/BUILD.gn
@@ -13,11 +13,11 @@ deps = [ "//ash/components/login/auth/public:challenge_response_key", "//base", + "//chromeos/ash/components/dbus/constants", "//chromeos/ash/components/dbus/cryptohome", "//chromeos/ash/components/dbus/cryptohome:cryptohome_proto", "//chromeos/ash/components/dbus/userdataauth:userdataauth", "//chromeos/ash/components/dbus/userdataauth:userdataauth_proto", - "//chromeos/dbus/common", "//components/account_id", "//components/device_event_log", "//components/user_manager",
diff --git a/chromeos/ash/components/cryptohome/cryptohome_util.cc b/chromeos/ash/components/cryptohome/cryptohome_util.cc index 71a6932..8cf5a8b48 100644 --- a/chromeos/ash/components/cryptohome/cryptohome_util.cc +++ b/chromeos/ash/components/cryptohome/cryptohome_util.cc
@@ -14,9 +14,9 @@ #include "chromeos/ash/components/cryptohome/common_types.h" #include "chromeos/ash/components/cryptohome/cryptohome_parameters.h" #include "chromeos/ash/components/cryptohome/userdataauth_util.h" +#include "chromeos/ash/components/dbus/constants/cryptohome_key_delegate_constants.h" #include "chromeos/ash/components/dbus/cryptohome/key.pb.h" #include "chromeos/ash/components/dbus/cryptohome/rpc.pb.h" -#include "chromeos/dbus/constants/cryptohome_key_delegate_constants.h" #include "components/device_event_log/device_event_log.h" #include "third_party/cros_system_api/dbus/service_constants.h"
diff --git a/chromeos/ash/components/dbus/constants/BUILD.gn b/chromeos/ash/components/dbus/constants/BUILD.gn new file mode 100644 index 0000000..6fd42c5 --- /dev/null +++ b/chromeos/ash/components/dbus/constants/BUILD.gn
@@ -0,0 +1,19 @@ +# Copyright 2022 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/chromeos/ui_mode.gni") + +assert(is_chromeos_ash, "Non-ChromeOS builds must not depend on //chromeos/ash") + +component("constants") { + output_name = "ash_dbus_constants" + defines = [ "IS_ASH_DBUS_CONSTANTS_IMPL" ] + deps = [ "//base" ] + sources = [ + "attestation_constants.cc", + "attestation_constants.h", + "cryptohome_key_delegate_constants.cc", + "cryptohome_key_delegate_constants.h", + ] +}
diff --git a/chromeos/dbus/constants/attestation_constants.cc b/chromeos/ash/components/dbus/constants/attestation_constants.cc similarity index 76% rename from chromeos/dbus/constants/attestation_constants.cc rename to chromeos/ash/components/dbus/constants/attestation_constants.cc index fec9dca..b6c910c 100644 --- a/chromeos/dbus/constants/attestation_constants.cc +++ b/chromeos/ash/components/dbus/constants/attestation_constants.cc
@@ -2,10 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/dbus/constants/attestation_constants.h" +#include "chromeos/ash/components/dbus/constants/attestation_constants.h" -namespace chromeos { -namespace attestation { +namespace ash::attestation { const char kEnterpriseMachineKey[] = "attest-ent-machine"; const char kEnterpriseEnrollmentKey[] = "attest-ent-enrollment"; @@ -14,5 +13,4 @@ const char kSoftBindKey[] = "attest-soft-bind"; const char kDeviceSetupKey[] = "attest-device-setup"; -} // namespace attestation -} // namespace chromeos +} // namespace ash::attestation
diff --git a/chromeos/dbus/constants/attestation_constants.h b/chromeos/ash/components/dbus/constants/attestation_constants.h similarity index 63% rename from chromeos/dbus/constants/attestation_constants.h rename to chromeos/ash/components/dbus/constants/attestation_constants.h index c5feaafc..a6e70917 100644 --- a/chromeos/dbus/constants/attestation_constants.h +++ b/chromeos/ash/components/dbus/constants/attestation_constants.h
@@ -2,13 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_DBUS_CONSTANTS_ATTESTATION_CONSTANTS_H_ -#define CHROMEOS_DBUS_CONSTANTS_ATTESTATION_CONSTANTS_H_ +#ifndef CHROMEOS_ASH_COMPONENTS_DBUS_CONSTANTS_ATTESTATION_CONSTANTS_H_ +#define CHROMEOS_ASH_COMPONENTS_DBUS_CONSTANTS_ATTESTATION_CONSTANTS_H_ #include "base/component_export.h" -namespace chromeos { -namespace attestation { +namespace ash::attestation { enum VerifiedAccessType { DEFAULT_VA, // The default Verified Access server. @@ -74,65 +73,39 @@ // A key name for the Enterprise Machine Key. This key should always be stored // as a DEVICE_KEY. -COMPONENT_EXPORT(CHROMEOS_DBUS_CONSTANTS) +COMPONENT_EXPORT(ASH_DBUS_CONSTANTS) extern const char kEnterpriseMachineKey[]; // A key name for the Enterprise Enrollmnent Key. This key should always be // stored as a DEVICE_KEY. -COMPONENT_EXPORT(CHROMEOS_DBUS_CONSTANTS) +COMPONENT_EXPORT(ASH_DBUS_CONSTANTS) extern const char kEnterpriseEnrollmentKey[]; // A key name for the Enterprise User Key. This key should always be stored as // a USER_KEY. -COMPONENT_EXPORT(CHROMEOS_DBUS_CONSTANTS) +COMPONENT_EXPORT(ASH_DBUS_CONSTANTS) extern const char kEnterpriseUserKey[]; // The key name prefix for content protection keys. This prefix must be // appended with an origin-specific identifier to form the final key name. -COMPONENT_EXPORT(CHROMEOS_DBUS_CONSTANTS) +COMPONENT_EXPORT(ASH_DBUS_CONSTANTS) extern const char kContentProtectionKeyPrefix[]; // The key name for the soft bind key. This key should always be stored as a // USER_KEY. -COMPONENT_EXPORT(CHROMEOS_DBUS_CONSTANTS) +COMPONENT_EXPORT(ASH_DBUS_CONSTANTS) extern const char kSoftBindKey[]; // The key name for the device setup certificate. This key should always be // stored as a DEVICE_KEY. -COMPONENT_EXPORT(CHROMEOS_DBUS_CONSTANTS) +COMPONENT_EXPORT(ASH_DBUS_CONSTANTS) extern const char kDeviceSetupKey[]; -} // namespace attestation -} // namespace chromeos +} // namespace ash::attestation -// TODO(https://crbug.com/1164001): remove before finalizing ChromeOS -// source migration. -namespace ash { -namespace attestation { -using ::chromeos::attestation::ATTESTATION_SERVER_BAD_REQUEST_FAILURE; -using ::chromeos::attestation::ATTESTATION_SUCCESS; -using ::chromeos::attestation::ATTESTATION_UNSPECIFIED_FAILURE; -using ::chromeos::attestation::AttestationCertificateProfile; -using ::chromeos::attestation::AttestationKeyType; -using ::chromeos::attestation::AttestationStatus; -using ::chromeos::attestation::DEFAULT_PCA; -using ::chromeos::attestation::kContentProtectionKeyPrefix; -using ::chromeos::attestation::kDeviceSetupKey; -using ::chromeos::attestation::kEnterpriseEnrollmentKey; -using ::chromeos::attestation::kEnterpriseMachineKey; -using ::chromeos::attestation::kEnterpriseUserKey; -using ::chromeos::attestation::KEY_DEVICE; -using ::chromeos::attestation::KEY_USER; -using ::chromeos::attestation::kSoftBindKey; -using ::chromeos::attestation::PrivacyCAType; -using ::chromeos::attestation::PROFILE_CONTENT_PROTECTION_CERTIFICATE; -using ::chromeos::attestation::PROFILE_DEVICE_SETUP_CERTIFICATE; -using ::chromeos::attestation::PROFILE_ENTERPRISE_ENROLLMENT_CERTIFICATE; -using ::chromeos::attestation::PROFILE_ENTERPRISE_MACHINE_CERTIFICATE; -using ::chromeos::attestation::PROFILE_ENTERPRISE_USER_CERTIFICATE; -using ::chromeos::attestation::PROFILE_SOFT_BIND_CERTIFICATE; -using ::chromeos::attestation::TEST_PCA; -} // namespace attestation -} // namespace ash +// TODO(https://crbug.com/1164001): remove when the migration is finished. +namespace chromeos::attestation { +using ::ash::attestation::KEY_DEVICE; +} -#endif // CHROMEOS_DBUS_CONSTANTS_ATTESTATION_CONSTANTS_H_ +#endif // CHROMEOS_ASH_COMPONENTS_DBUS_CONSTANTS_ATTESTATION_CONSTANTS_H_
diff --git a/chromeos/dbus/constants/cryptohome_key_delegate_constants.cc b/chromeos/ash/components/dbus/constants/cryptohome_key_delegate_constants.cc similarity index 82% rename from chromeos/dbus/constants/cryptohome_key_delegate_constants.cc rename to chromeos/ash/components/dbus/constants/cryptohome_key_delegate_constants.cc index 2d4bdcc9..09b5a82 100644 --- a/chromeos/dbus/constants/cryptohome_key_delegate_constants.cc +++ b/chromeos/ash/components/dbus/constants/cryptohome_key_delegate_constants.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/dbus/constants/cryptohome_key_delegate_constants.h" +#include "chromeos/ash/components/dbus/constants/cryptohome_key_delegate_constants.h" namespace cryptohome {
diff --git a/chromeos/dbus/constants/cryptohome_key_delegate_constants.h b/chromeos/ash/components/dbus/constants/cryptohome_key_delegate_constants.h similarity index 66% rename from chromeos/dbus/constants/cryptohome_key_delegate_constants.h rename to chromeos/ash/components/dbus/constants/cryptohome_key_delegate_constants.h index d5b8602..6c00f67 100644 --- a/chromeos/dbus/constants/cryptohome_key_delegate_constants.h +++ b/chromeos/ash/components/dbus/constants/cryptohome_key_delegate_constants.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_DBUS_CONSTANTS_CRYPTOHOME_KEY_DELEGATE_CONSTANTS_H_ -#define CHROMEOS_DBUS_CONSTANTS_CRYPTOHOME_KEY_DELEGATE_CONSTANTS_H_ +#ifndef CHROMEOS_ASH_COMPONENTS_DBUS_CONSTANTS_CRYPTOHOME_KEY_DELEGATE_CONSTANTS_H_ +#define CHROMEOS_ASH_COMPONENTS_DBUS_CONSTANTS_CRYPTOHOME_KEY_DELEGATE_CONSTANTS_H_ #include "base/component_export.h" @@ -14,11 +14,11 @@ // definition in the Chrome OS repo in // src/platform2/cryptohome/dbus_bindings/ // org.chromium.CryptohomeKeyDelegateInterface.xml . -COMPONENT_EXPORT(CHROMEOS_DBUS_CONSTANTS) +COMPONENT_EXPORT(ASH_DBUS_CONSTANTS) extern const char kCryptohomeKeyDelegateServiceName[]; -COMPONENT_EXPORT(CHROMEOS_DBUS_CONSTANTS) +COMPONENT_EXPORT(ASH_DBUS_CONSTANTS) extern const char kCryptohomeKeyDelegateServicePath[]; } // namespace cryptohome -#endif // CHROMEOS_DBUS_CONSTANTS_CRYPTOHOME_KEY_DELEGATE_CONSTANTS_H_ +#endif // CHROMEOS_ASH_COMPONENTS_DBUS_CONSTANTS_CRYPTOHOME_KEY_DELEGATE_CONSTANTS_H_
diff --git a/chromeos/ash/components/dbus/dbus_thread_manager.cc b/chromeos/ash/components/dbus/dbus_thread_manager.cc index e984721e..11c12f1 100644 --- a/chromeos/ash/components/dbus/dbus_thread_manager.cc +++ b/chromeos/ash/components/dbus/dbus_thread_manager.cc
@@ -9,7 +9,7 @@ #include "base/logging.h" -namespace chromeos { +namespace ash { static DBusThreadManager* g_dbus_thread_manager = nullptr; @@ -23,9 +23,9 @@ g_dbus_thread_manager = new DBusThreadManager(); if (!g_dbus_thread_manager->IsUsingFakes()) - VLOG(1) << "DBusThreadManager initialized for ChromeOS"; + VLOG(1) << "ash::DBusThreadManager initialized for ChromeOS"; else - VLOG(1) << "DBusThreadManager created for testing"; + VLOG(1) << "ash::DBusThreadManager created for testing"; } // static @@ -52,4 +52,4 @@ return g_dbus_thread_manager; } -} // namespace chromeos +} // namespace ash
diff --git a/chromeos/ash/components/dbus/dbus_thread_manager.h b/chromeos/ash/components/dbus/dbus_thread_manager.h index 654d107..878ad6f0 100644 --- a/chromeos/ash/components/dbus/dbus_thread_manager.h +++ b/chromeos/ash/components/dbus/dbus_thread_manager.h
@@ -8,11 +8,11 @@ #include "base/component_export.h" #include "chromeos/dbus/init/dbus_thread_manager_base.h" -namespace chromeos { +namespace ash { // Ash implementation of DBusThreadManagerBase. class COMPONENT_EXPORT(ASH_DBUS) DBusThreadManager - : public DBusThreadManagerBase { + : public chromeos::DBusThreadManagerBase { public: // Sets the global instance. Must be called before any calls to Get(). // We explicitly initialize and shut down the global object, rather than @@ -36,11 +36,6 @@ ~DBusThreadManager() override; }; -} // namespace chromeos - -// TODO(https://crbug.com/1164001): remove after moved to ash. -namespace ash { -using ::chromeos::DBusThreadManager; -} +} // namespace ash #endif // CHROMEOS_ASH_COMPONENTS_DBUS_DBUS_THREAD_MANAGER_H_
diff --git a/chromeos/ash/components/dbus/dbus_thread_manager_unittest.cc b/chromeos/ash/components/dbus/dbus_thread_manager_unittest.cc index 5f288b4..7b4fec58 100644 --- a/chromeos/ash/components/dbus/dbus_thread_manager_unittest.cc +++ b/chromeos/ash/components/dbus/dbus_thread_manager_unittest.cc
@@ -6,7 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" -namespace chromeos { +namespace ash { TEST(DBusThreadManagerTest, Initialize) { DBusThreadManager::Initialize(); @@ -22,4 +22,4 @@ EXPECT_FALSE(DBusThreadManager::IsInitialized()); } -} // namespace chromeos +} // namespace ash
diff --git a/chromeos/ash/components/disks/disk_mount_manager.cc b/chromeos/ash/components/disks/disk_mount_manager.cc index 0bcbe91..44f8dbc 100644 --- a/chromeos/ash/components/disks/disk_mount_manager.cc +++ b/chromeos/ash/components/disks/disk_mount_manager.cc
@@ -332,17 +332,21 @@ // DiskMountManager override. // Corresponding disk should be added to the manager before this is called. bool AddMountPointForTest(const MountPoint& mount_point) override { - if (mount_points_.find(mount_point.mount_path) != mount_points_.end()) { - LOG(ERROR) << "Attempt to add a duplicate mount point"; - return false; - } if (mount_point.mount_type == MountType::kDevice && - disks_.find(mount_point.source_path) == disks_.end()) { - LOG(ERROR) << "Device mount points must have a disk entry"; + disks_.count(mount_point.source_path) == 0) { + LOG(ERROR) << "Device mount point '" << mount_point.mount_path + << "' should have a disk entry '" << mount_point.source_path + << "'"; return false; } - mount_points_.insert(mount_point); + const auto [it, ok] = mount_points_.insert(mount_point); + if (!ok) { + LOG(ERROR) << "Attempt to add a duplicate mount point '" + << mount_point.mount_path << "'"; + return false; + } + return true; } @@ -454,9 +458,9 @@ // CrosDisksClient::Observer override. void OnMountCompleted(const MountEntry& entry) override { - auto iter = deferred_mount_events_.find(entry.source_path); - if (iter != deferred_mount_events_.end()) { - iter->second.push_back(entry); + if (const auto it = deferred_mount_events_.find(entry.source_path); + it != deferred_mount_events_.end()) { + it->second.push_back(entry); return; } @@ -538,25 +542,25 @@ if (error == MountError::kPathNotMounted || error == MountError::kInvalidPath) { // The path was already unmounted by something else. + LOG(ERROR) << "Cannot unmount '" << mount_path << "': " << error; error = MountError::kNone; } - if (const MountPoints::const_iterator mp_it = + if (const MountPoints::const_iterator mount_point = mount_points_.find(mount_path); - mp_it != mount_points_.end()) { - const MountPoint& mp = *mp_it; - NotifyMountStatusUpdate(UNMOUNTING, error, mp); + mount_point != mount_points_.end()) { + NotifyMountStatusUpdate(UNMOUNTING, error, *mount_point); if (error == MountError::kNone) { - if (const Disks::iterator disk_it = disks_.find(mp.source_path); - disk_it != disks_.end()) { - Disk* const disk = disk_it->get(); - DCHECK(disk); - disk->clear_mount_path(); - disk->set_mounted(false); + if (const Disks::const_iterator disk = + disks_.find(mount_point->source_path); + disk != disks_.end()) { + DCHECK(*disk); + (*disk)->clear_mount_path(); + (*disk)->set_mounted(false); } - mount_points_.erase(mp_it); + mount_points_.erase(mount_point); } }
diff --git a/chromeos/ash/services/BUILD.gn b/chromeos/ash/services/BUILD.gn index 28f2f6b..e148539 100644 --- a/chromeos/ash/services/BUILD.gn +++ b/chromeos/ash/services/BUILD.gn
@@ -3,6 +3,7 @@ # found in the LICENSE file. import("//build/config/chromeos/ui_mode.gni") +import("//chromeos/ash/components/assistant/assistant.gni") assert(is_chromeos_ash) @@ -19,4 +20,8 @@ "//chromeos/ash/services/cros_healthd/private/cpp:unit_tests", "//chromeos/ash/services/cros_healthd/public/cpp:unit_tests", ] + + if (enable_cros_libassistant) { + deps += [ "//chromeos/ash/services/libassistant:unit_tests" ] + } }
diff --git a/chromeos/ash/services/assistant/BUILD.gn b/chromeos/ash/services/assistant/BUILD.gn index 324b598..28d43f9 100644 --- a/chromeos/ash/services/assistant/BUILD.gn +++ b/chromeos/ash/services/assistant/BUILD.gn
@@ -79,8 +79,8 @@ if (enable_cros_libassistant) { deps += [ "//chromeos/ash/services/assistant/public/cpp", - "//chromeos/services/libassistant", - "//chromeos/services/libassistant:loader", + "//chromeos/ash/services/libassistant", + "//chromeos/ash/services/libassistant:loader", ] } else { sources +=
diff --git a/chromeos/ash/services/assistant/libassistant_service_host_impl.cc b/chromeos/ash/services/assistant/libassistant_service_host_impl.cc index fcd4299..1bd9ea5d 100644 --- a/chromeos/ash/services/assistant/libassistant_service_host_impl.cc +++ b/chromeos/ash/services/assistant/libassistant_service_host_impl.cc
@@ -12,7 +12,7 @@ #if BUILDFLAG(ENABLE_CROS_LIBASSISTANT) #include "chromeos/ash/services/assistant/public/cpp/assistant_browser_delegate.h" #include "chromeos/ash/services/assistant/public/cpp/features.h" -#include "chromeos/services/libassistant/libassistant_service.h" +#include "chromeos/ash/services/libassistant/libassistant_service.h" #include "chromeos/services/libassistant/public/mojom/service.mojom-forward.h" #endif // BUILDFLAG(ENABLE_CROS_LIBASSISTANT)
diff --git a/chromeos/services/libassistant/BUILD.gn b/chromeos/ash/services/libassistant/BUILD.gn similarity index 95% rename from chromeos/services/libassistant/BUILD.gn rename to chromeos/ash/services/libassistant/BUILD.gn index b5bc1da..0d165220 100644 --- a/chromeos/services/libassistant/BUILD.gn +++ b/chromeos/ash/services/libassistant/BUILD.gn
@@ -3,8 +3,10 @@ # found in the LICENSE file. import("//build/buildflag_header.gni") +import("//build/config/chromeos/ui_mode.gni") import("//chromeos/ash/components/assistant/assistant.gni") +assert(is_chromeos_ash, "Non ChromeOS builds must not depend on //chromeos/ash") assert(enable_cros_libassistant) component("constants") { @@ -146,10 +148,6 @@ ":audio", ":callback_utils", ":constants", - "./grpc:assistant_client", - "./grpc:grpc_service", - "./grpc/external_services:grpc_services_initializer", - "./grpc/external_services:grpc_services_observer", "//build/util:chromium_git_revision", "//chromeos/ash/components/assistant:buildflags", "//chromeos/ash/components/dbus", @@ -162,6 +160,10 @@ "//chromeos/assistant/internal:support", "//chromeos/assistant/internal/proto:assistant", "//chromeos/dbus/power", + "//chromeos/services/libassistant/grpc:assistant_client", + "//chromeos/services/libassistant/grpc:grpc_service", + "//chromeos/services/libassistant/grpc/external_services:grpc_services_initializer", + "//chromeos/services/libassistant/grpc/external_services:grpc_services_observer", "//chromeos/services/libassistant/public/mojom", "//chromeos/services/network_config/public/cpp", "//chromeos/strings:strings_grit",
diff --git a/chromeos/ash/services/libassistant/DEPS b/chromeos/ash/services/libassistant/DEPS new file mode 100644 index 0000000..e414dc3 --- /dev/null +++ b/chromeos/ash/services/libassistant/DEPS
@@ -0,0 +1,19 @@ +include_rules = [ + "+ash/public/mojom", + "+chromeos/ash/services/assistant/public", + "+chromeos/services/assistant/public", + "+chromeos/services/network_config/public/mojom", + "+libassistant", + "+media/audio", + "+media/base", + "+media/mojo/mojom", + "+sandbox/linux/syscall_broker/broker_command.h", + "+sandbox/linux/syscall_broker/broker_file_permission.h", + "+sandbox/policy/linux/sandbox_linux.h", + "+services/audio/public", + "+services/device/public/mojom", + "+services/media_session/public/mojom", + "+services/network/public", + "+services/network/test", + "+ui/base", +]
diff --git a/chromeos/ash/services/libassistant/DIR_METADATA b/chromeos/ash/services/libassistant/DIR_METADATA new file mode 100644 index 0000000..5ba0efa --- /dev/null +++ b/chromeos/ash/services/libassistant/DIR_METADATA
@@ -0,0 +1 @@ +mixins: "//chromeos/ash/components/assistant/COMMON_METADATA"
diff --git a/chromeos/ash/services/libassistant/OWNERS b/chromeos/ash/services/libassistant/OWNERS new file mode 100644 index 0000000..1d47cb4 --- /dev/null +++ b/chromeos/ash/services/libassistant/OWNERS
@@ -0,0 +1,3 @@ +file://chromeos/ash/components/assistant/OWNERS + +per-file libassistant_sandbox_hook.*=file://sandbox/linux/OWNERS
diff --git a/chromeos/services/libassistant/abortable_task_list.cc b/chromeos/ash/services/libassistant/abortable_task_list.cc similarity index 93% rename from chromeos/services/libassistant/abortable_task_list.cc rename to chromeos/ash/services/libassistant/abortable_task_list.cc index dc7602b..0da2ae63 100644 --- a/chromeos/services/libassistant/abortable_task_list.cc +++ b/chromeos/ash/services/libassistant/abortable_task_list.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/abortable_task_list.h" +#include "chromeos/ash/services/libassistant/abortable_task_list.h" #include <algorithm>
diff --git a/chromeos/services/libassistant/abortable_task_list.h b/chromeos/ash/services/libassistant/abortable_task_list.h similarity index 87% rename from chromeos/services/libassistant/abortable_task_list.h rename to chromeos/ash/services/libassistant/abortable_task_list.h index c63cc04..ad2de86 100644 --- a/chromeos/services/libassistant/abortable_task_list.h +++ b/chromeos/ash/services/libassistant/abortable_task_list.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_ABORTABLE_TASK_LIST_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_ABORTABLE_TASK_LIST_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_ABORTABLE_TASK_LIST_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_ABORTABLE_TASK_LIST_H_ #include <memory> #include <vector> @@ -52,4 +52,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_ABORTABLE_TASK_LIST_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_ABORTABLE_TASK_LIST_H_
diff --git a/chromeos/services/libassistant/audio/audio_device_owner.cc b/chromeos/ash/services/libassistant/audio/audio_device_owner.cc similarity index 98% rename from chromeos/services/libassistant/audio/audio_device_owner.cc rename to chromeos/ash/services/libassistant/audio/audio_device_owner.cc index d76b077..e7c0190 100644 --- a/chromeos/services/libassistant/audio/audio_device_owner.cc +++ b/chromeos/ash/services/libassistant/audio/audio_device_owner.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/audio/audio_device_owner.h" +#include "chromeos/ash/services/libassistant/audio/audio_device_owner.h" #include <algorithm> #include <utility>
diff --git a/chromeos/services/libassistant/audio/audio_device_owner.h b/chromeos/ash/services/libassistant/audio/audio_device_owner.h similarity index 94% rename from chromeos/services/libassistant/audio/audio_device_owner.h rename to chromeos/ash/services/libassistant/audio/audio_device_owner.h index 8a37121..0fc5c14f 100644 --- a/chromeos/services/libassistant/audio/audio_device_owner.h +++ b/chromeos/ash/services/libassistant/audio/audio_device_owner.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_AUDIO_DEVICE_OWNER_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_AUDIO_DEVICE_OWNER_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_AUDIO_DEVICE_OWNER_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_AUDIO_DEVICE_OWNER_H_ #include <memory> #include <string> @@ -110,4 +110,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_AUDIO_DEVICE_OWNER_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_AUDIO_DEVICE_OWNER_H_
diff --git a/chromeos/services/libassistant/audio/audio_input_impl.cc b/chromeos/ash/services/libassistant/audio/audio_input_impl.cc similarity index 98% rename from chromeos/services/libassistant/audio/audio_input_impl.cc rename to chromeos/ash/services/libassistant/audio/audio_input_impl.cc index ca66073..1ad58804 100644 --- a/chromeos/services/libassistant/audio/audio_input_impl.cc +++ b/chromeos/ash/services/libassistant/audio/audio_input_impl.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/audio/audio_input_impl.h" +#include "chromeos/ash/services/libassistant/audio/audio_input_impl.h" #include <cstdint> #include <utility> @@ -18,8 +18,8 @@ #include "base/timer/timer.h" #include "chromeos/ash/services/assistant/public/cpp/assistant_browser_delegate.h" #include "chromeos/ash/services/assistant/public/cpp/features.h" +#include "chromeos/ash/services/libassistant/audio/audio_input_stream.h" #include "chromeos/assistant/internal/libassistant/shared_headers.h" -#include "chromeos/services/libassistant/audio/audio_input_stream.h" #include "media/audio/audio_device_description.h" #include "media/base/audio_parameters.h" #include "media/base/audio_sample_types.h"
diff --git a/chromeos/services/libassistant/audio/audio_input_impl.h b/chromeos/ash/services/libassistant/audio/audio_input_impl.h similarity index 95% rename from chromeos/services/libassistant/audio/audio_input_impl.h rename to chromeos/ash/services/libassistant/audio/audio_input_impl.h index 920dd14..bec3b5c 100644 --- a/chromeos/services/libassistant/audio/audio_input_impl.h +++ b/chromeos/ash/services/libassistant/audio/audio_input_impl.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_AUDIO_INPUT_IMPL_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_AUDIO_INPUT_IMPL_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_AUDIO_INPUT_IMPL_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_AUDIO_INPUT_IMPL_H_ #include <memory> #include <string> @@ -140,4 +140,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_AUDIO_INPUT_IMPL_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_AUDIO_INPUT_IMPL_H_
diff --git a/chromeos/services/libassistant/audio/audio_input_provider_impl.cc b/chromeos/ash/services/libassistant/audio/audio_input_provider_impl.cc similarity index 90% rename from chromeos/services/libassistant/audio/audio_input_provider_impl.cc rename to chromeos/ash/services/libassistant/audio/audio_input_provider_impl.cc index f3f4efa..a78717a 100644 --- a/chromeos/services/libassistant/audio/audio_input_provider_impl.cc +++ b/chromeos/ash/services/libassistant/audio/audio_input_provider_impl.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/audio/audio_input_provider_impl.h" +#include "chromeos/ash/services/libassistant/audio/audio_input_provider_impl.h" #include "base/time/time.h" #include "chromeos/ash/services/assistant/public/cpp/features.h"
diff --git a/chromeos/services/libassistant/audio/audio_input_provider_impl.h b/chromeos/ash/services/libassistant/audio/audio_input_provider_impl.h similarity index 73% rename from chromeos/services/libassistant/audio/audio_input_provider_impl.h rename to chromeos/ash/services/libassistant/audio/audio_input_provider_impl.h index 6d4f9af..2be954b6 100644 --- a/chromeos/services/libassistant/audio/audio_input_provider_impl.h +++ b/chromeos/ash/services/libassistant/audio/audio_input_provider_impl.h
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_AUDIO_INPUT_PROVIDER_IMPL_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_AUDIO_INPUT_PROVIDER_IMPL_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_AUDIO_INPUT_PROVIDER_IMPL_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_AUDIO_INPUT_PROVIDER_IMPL_H_ #include <cstdint> +#include "chromeos/ash/services/libassistant/audio/audio_input_impl.h" #include "chromeos/assistant/internal/libassistant/shared_headers.h" -#include "chromeos/services/libassistant/audio/audio_input_impl.h" namespace chromeos { namespace libassistant { @@ -31,4 +31,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_AUDIO_INPUT_PROVIDER_IMPL_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_AUDIO_INPUT_PROVIDER_IMPL_H_
diff --git a/chromeos/services/libassistant/audio/audio_input_stream.cc b/chromeos/ash/services/libassistant/audio/audio_input_stream.cc similarity index 93% rename from chromeos/services/libassistant/audio/audio_input_stream.cc rename to chromeos/ash/services/libassistant/audio/audio_input_stream.cc index 7ea3be0..6cf33db 100644 --- a/chromeos/services/libassistant/audio/audio_input_stream.cc +++ b/chromeos/ash/services/libassistant/audio/audio_input_stream.cc
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/audio/audio_input_stream.h" +#include "chromeos/ash/services/libassistant/audio/audio_input_stream.h" #include "base/notreached.h" -#include "chromeos/services/libassistant/buildflags.h" +#include "chromeos/ash/services/libassistant/buildflags.h" #include "chromeos/services/libassistant/public/mojom/audio_input_controller.mojom.h" #include "chromeos/services/libassistant/public/mojom/platform_delegate.mojom.h" #if BUILDFLAG(ENABLE_FAKE_ASSISTANT_MICROPHONE) -#include "chromeos/services/libassistant/audio/fake_input_device.h" +#include "chromeos/ash/services/libassistant/audio/fake_input_device.h" #endif // BUILDFLAG(ENABLE_FAKE_ASSISTANT_MICROPHONE) namespace chromeos {
diff --git a/chromeos/services/libassistant/audio/audio_input_stream.h b/chromeos/ash/services/libassistant/audio/audio_input_stream.h similarity index 89% rename from chromeos/services/libassistant/audio/audio_input_stream.h rename to chromeos/ash/services/libassistant/audio/audio_input_stream.h index 8718b2fd5..2fcaeeab 100644 --- a/chromeos/services/libassistant/audio/audio_input_stream.h +++ b/chromeos/ash/services/libassistant/audio/audio_input_stream.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_AUDIO_INPUT_STREAM_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_AUDIO_INPUT_STREAM_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_AUDIO_INPUT_STREAM_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_AUDIO_INPUT_STREAM_H_ #include <string> @@ -57,4 +57,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_AUDIO_INPUT_STREAM_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_AUDIO_INPUT_STREAM_H_
diff --git a/chromeos/services/libassistant/audio/audio_media_data_source.cc b/chromeos/ash/services/libassistant/audio/audio_media_data_source.cc similarity index 96% rename from chromeos/services/libassistant/audio/audio_media_data_source.cc rename to chromeos/ash/services/libassistant/audio/audio_media_data_source.cc index 3cdc0e5..f6ce7c5 100644 --- a/chromeos/services/libassistant/audio/audio_media_data_source.cc +++ b/chromeos/ash/services/libassistant/audio/audio_media_data_source.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/audio/audio_media_data_source.h" +#include "chromeos/ash/services/libassistant/audio/audio_media_data_source.h" #include <algorithm>
diff --git a/chromeos/services/libassistant/audio/audio_media_data_source.h b/chromeos/ash/services/libassistant/audio/audio_media_data_source.h similarity index 89% rename from chromeos/services/libassistant/audio/audio_media_data_source.h rename to chromeos/ash/services/libassistant/audio/audio_media_data_source.h index 90bed174..9b5d338d 100644 --- a/chromeos/services/libassistant/audio/audio_media_data_source.h +++ b/chromeos/ash/services/libassistant/audio/audio_media_data_source.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_AUDIO_MEDIA_DATA_SOURCE_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_AUDIO_MEDIA_DATA_SOURCE_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_AUDIO_MEDIA_DATA_SOURCE_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_AUDIO_MEDIA_DATA_SOURCE_H_ #include <vector> @@ -63,4 +63,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_AUDIO_MEDIA_DATA_SOURCE_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_AUDIO_MEDIA_DATA_SOURCE_H_
diff --git a/chromeos/services/libassistant/audio/audio_output_provider_impl.cc b/chromeos/ash/services/libassistant/audio/audio_output_provider_impl.cc similarity index 98% rename from chromeos/services/libassistant/audio/audio_output_provider_impl.cc rename to chromeos/ash/services/libassistant/audio/audio_output_provider_impl.cc index b1b517b..7bc3e2c 100644 --- a/chromeos/services/libassistant/audio/audio_output_provider_impl.cc +++ b/chromeos/ash/services/libassistant/audio/audio_output_provider_impl.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/audio/audio_output_provider_impl.h" +#include "chromeos/ash/services/libassistant/audio/audio_output_provider_impl.h" #include <algorithm> #include <utility> @@ -12,8 +12,8 @@ #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" #include "chromeos/ash/services/assistant/public/mojom/assistant_audio_decoder.mojom.h" +#include "chromeos/ash/services/libassistant/audio/audio_stream_handler.h" #include "chromeos/assistant/internal/libassistant/shared_headers.h" -#include "chromeos/services/libassistant/audio/audio_stream_handler.h" #include "chromeos/services/libassistant/public/mojom/platform_delegate.mojom.h" #include "media/audio/audio_device_description.h"
diff --git a/chromeos/services/libassistant/audio/audio_output_provider_impl.h b/chromeos/ash/services/libassistant/audio/audio_output_provider_impl.h similarity index 90% rename from chromeos/services/libassistant/audio/audio_output_provider_impl.h rename to chromeos/ash/services/libassistant/audio/audio_output_provider_impl.h index 853efe4..ae39147 100644 --- a/chromeos/services/libassistant/audio/audio_output_provider_impl.h +++ b/chromeos/ash/services/libassistant/audio/audio_output_provider_impl.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_AUDIO_OUTPUT_PROVIDER_IMPL_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_AUDIO_OUTPUT_PROVIDER_IMPL_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_AUDIO_OUTPUT_PROVIDER_IMPL_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_AUDIO_OUTPUT_PROVIDER_IMPL_H_ #include <memory> #include <string> @@ -15,10 +15,10 @@ #include "base/task/single_thread_task_runner.h" #include "chromeos/ash/services/assistant/public/cpp/assistant_service.h" #include "chromeos/ash/services/assistant/public/mojom/assistant_audio_decoder.mojom.h" +#include "chromeos/ash/services/libassistant/audio/audio_device_owner.h" +#include "chromeos/ash/services/libassistant/audio/audio_input_impl.h" +#include "chromeos/ash/services/libassistant/audio/volume_control_impl.h" #include "chromeos/assistant/internal/libassistant/shared_headers.h" -#include "chromeos/services/libassistant/audio/audio_device_owner.h" -#include "chromeos/services/libassistant/audio/audio_input_impl.h" -#include "chromeos/services/libassistant/audio/volume_control_impl.h" #include "chromeos/services/libassistant/public/mojom/audio_output_delegate.mojom.h" #include "chromeos/services/libassistant/public/mojom/platform_delegate.mojom-forward.h" #include "media/mojo/mojom/audio_stream_factory.mojom.h" @@ -123,4 +123,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_AUDIO_OUTPUT_PROVIDER_IMPL_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_AUDIO_OUTPUT_PROVIDER_IMPL_H_
diff --git a/chromeos/services/libassistant/audio/audio_output_provider_impl_unittest.cc b/chromeos/ash/services/libassistant/audio/audio_output_provider_impl_unittest.cc similarity index 98% rename from chromeos/services/libassistant/audio/audio_output_provider_impl_unittest.cc rename to chromeos/ash/services/libassistant/audio/audio_output_provider_impl_unittest.cc index f30da0e..01bf9a2 100644 --- a/chromeos/services/libassistant/audio/audio_output_provider_impl_unittest.cc +++ b/chromeos/ash/services/libassistant/audio/audio_output_provider_impl_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/audio/audio_output_provider_impl.h" +#include "chromeos/ash/services/libassistant/audio/audio_output_provider_impl.h" #include <memory> #include <utility> @@ -16,8 +16,8 @@ #include "base/test/task_environment.h" #include "base/threading/thread.h" #include "base/time/time.h" +#include "chromeos/ash/services/libassistant/test_support/fake_platform_delegate.h" #include "chromeos/assistant/internal/libassistant/shared_headers.h" -#include "chromeos/services/libassistant/test_support/fake_platform_delegate.h" #include "media/base/audio_bus.h" #include "media/base/bind_to_current_loop.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/services/libassistant/audio/audio_stream_handler.cc b/chromeos/ash/services/libassistant/audio/audio_stream_handler.cc similarity index 97% rename from chromeos/services/libassistant/audio/audio_stream_handler.cc rename to chromeos/ash/services/libassistant/audio/audio_stream_handler.cc index fa790052..2ff736c 100644 --- a/chromeos/services/libassistant/audio/audio_stream_handler.cc +++ b/chromeos/ash/services/libassistant/audio/audio_stream_handler.cc
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/audio/audio_stream_handler.h" +#include "chromeos/ash/services/libassistant/audio/audio_stream_handler.h" #include "base/bind.h" -#include "chromeos/services/libassistant/audio/audio_media_data_source.h" +#include "chromeos/ash/services/libassistant/audio/audio_media_data_source.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h"
diff --git a/chromeos/services/libassistant/audio/audio_stream_handler.h b/chromeos/ash/services/libassistant/audio/audio_stream_handler.h similarity index 94% rename from chromeos/services/libassistant/audio/audio_stream_handler.h rename to chromeos/ash/services/libassistant/audio/audio_stream_handler.h index 3a489e5..289d2202 100644 --- a/chromeos/services/libassistant/audio/audio_stream_handler.h +++ b/chromeos/ash/services/libassistant/audio/audio_stream_handler.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_AUDIO_STREAM_HANDLER_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_AUDIO_STREAM_HANDLER_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_AUDIO_STREAM_HANDLER_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_AUDIO_STREAM_HANDLER_H_ #include "base/synchronization/lock.h" #include "base/task/single_thread_task_runner.h" @@ -104,4 +104,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_AUDIO_STREAM_HANDLER_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_AUDIO_STREAM_HANDLER_H_
diff --git a/chromeos/services/libassistant/audio/fake_input_device.cc b/chromeos/ash/services/libassistant/audio/fake_input_device.cc similarity index 98% rename from chromeos/services/libassistant/audio/fake_input_device.cc rename to chromeos/ash/services/libassistant/audio/fake_input_device.cc index ee73bb0..12b7b27 100644 --- a/chromeos/services/libassistant/audio/fake_input_device.cc +++ b/chromeos/ash/services/libassistant/audio/fake_input_device.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/audio/fake_input_device.h" +#include "chromeos/ash/services/libassistant/audio/fake_input_device.h" #include <cstdint> #include <memory>
diff --git a/chromeos/services/libassistant/audio/fake_input_device.h b/chromeos/ash/services/libassistant/audio/fake_input_device.h similarity index 74% rename from chromeos/services/libassistant/audio/fake_input_device.h rename to chromeos/ash/services/libassistant/audio/fake_input_device.h index 10e4a09c..68a5062 100644 --- a/chromeos/services/libassistant/audio/fake_input_device.h +++ b/chromeos/ash/services/libassistant/audio/fake_input_device.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_FAKE_INPUT_DEVICE_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_FAKE_INPUT_DEVICE_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_FAKE_INPUT_DEVICE_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_FAKE_INPUT_DEVICE_H_ #include "base/memory/scoped_refptr.h" @@ -22,4 +22,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_FAKE_INPUT_DEVICE_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_FAKE_INPUT_DEVICE_H_
diff --git a/chromeos/services/libassistant/audio/volume_control_impl.cc b/chromeos/ash/services/libassistant/audio/volume_control_impl.cc similarity index 97% rename from chromeos/services/libassistant/audio/volume_control_impl.cc rename to chromeos/ash/services/libassistant/audio/volume_control_impl.cc index 3825b26..62e1c0d 100644 --- a/chromeos/services/libassistant/audio/volume_control_impl.cc +++ b/chromeos/ash/services/libassistant/audio/volume_control_impl.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/audio/volume_control_impl.h" +#include "chromeos/ash/services/libassistant/audio/volume_control_impl.h" #include <utility>
diff --git a/chromeos/services/libassistant/audio/volume_control_impl.h b/chromeos/ash/services/libassistant/audio/volume_control_impl.h similarity index 91% rename from chromeos/services/libassistant/audio/volume_control_impl.h rename to chromeos/ash/services/libassistant/audio/volume_control_impl.h index 94419a3..edaa35c 100644 --- a/chromeos/services/libassistant/audio/volume_control_impl.h +++ b/chromeos/ash/services/libassistant/audio/volume_control_impl.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_VOLUME_CONTROL_IMPL_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_VOLUME_CONTROL_IMPL_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_VOLUME_CONTROL_IMPL_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_VOLUME_CONTROL_IMPL_H_ #include "ash/public/mojom/assistant_volume_control.mojom.h" #include "chromeos/assistant/internal/libassistant/shared_headers.h" @@ -63,4 +63,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_VOLUME_CONTROL_IMPL_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_VOLUME_CONTROL_IMPL_H_
diff --git a/chromeos/services/libassistant/audio_input_controller.cc b/chromeos/ash/services/libassistant/audio_input_controller.cc similarity index 96% rename from chromeos/services/libassistant/audio_input_controller.cc rename to chromeos/ash/services/libassistant/audio_input_controller.cc index 8d4acbf..3fe5594 100644 --- a/chromeos/services/libassistant/audio_input_controller.cc +++ b/chromeos/ash/services/libassistant/audio_input_controller.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/audio_input_controller.h" +#include "chromeos/ash/services/libassistant/audio_input_controller.h" #include "base/notreached.h"
diff --git a/chromeos/services/libassistant/audio_input_controller.h b/chromeos/ash/services/libassistant/audio_input_controller.h similarity index 83% rename from chromeos/services/libassistant/audio_input_controller.h rename to chromeos/ash/services/libassistant/audio_input_controller.h index aa935a74..6630fad 100644 --- a/chromeos/services/libassistant/audio_input_controller.h +++ b/chromeos/ash/services/libassistant/audio_input_controller.h
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_INPUT_CONTROLLER_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_INPUT_CONTROLLER_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_INPUT_CONTROLLER_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_INPUT_CONTROLLER_H_ -#include "chromeos/services/libassistant/audio/audio_input_provider_impl.h" -#include "chromeos/services/libassistant/conversation_state_listener_impl.h" +#include "chromeos/ash/services/libassistant/audio/audio_input_provider_impl.h" +#include "chromeos/ash/services/libassistant/conversation_state_listener_impl.h" #include "chromeos/services/libassistant/public/mojom/audio_input_controller.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" @@ -56,4 +56,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_INPUT_CONTROLLER_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_INPUT_CONTROLLER_H_
diff --git a/chromeos/services/libassistant/audio_input_controller_unittest.cc b/chromeos/ash/services/libassistant/audio_input_controller_unittest.cc similarity index 97% rename from chromeos/services/libassistant/audio_input_controller_unittest.cc rename to chromeos/ash/services/libassistant/audio_input_controller_unittest.cc index b248568..e11039a9 100644 --- a/chromeos/services/libassistant/audio_input_controller_unittest.cc +++ b/chromeos/ash/services/libassistant/audio_input_controller_unittest.cc
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/audio_input_controller.h" +#include "chromeos/ash/services/libassistant/audio_input_controller.h" #include "base/test/gtest_util.h" #include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" #include "chromeos/ash/services/assistant/public/cpp/features.h" -#include "chromeos/services/libassistant/audio/audio_input_impl.h" +#include "chromeos/ash/services/libassistant/audio/audio_input_impl.h" +#include "chromeos/ash/services/libassistant/test_support/fake_platform_delegate.h" #include "chromeos/services/libassistant/public/mojom/audio_input_controller.mojom.h" -#include "chromeos/services/libassistant/test_support/fake_platform_delegate.h" #include "media/audio/audio_device_description.h" #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/remote.h"
diff --git a/chromeos/services/libassistant/authentication_state_observer_unittest.cc b/chromeos/ash/services/libassistant/authentication_state_observer_unittest.cc similarity index 96% rename from chromeos/services/libassistant/authentication_state_observer_unittest.cc rename to chromeos/ash/services/libassistant/authentication_state_observer_unittest.cc index c72b930..e13c7f70 100644 --- a/chromeos/services/libassistant/authentication_state_observer_unittest.cc +++ b/chromeos/ash/services/libassistant/authentication_state_observer_unittest.cc
@@ -3,12 +3,12 @@ // found in the LICENSE file. #include "base/test/task_environment.h" +#include "chromeos/ash/services/libassistant/libassistant_service.h" +#include "chromeos/ash/services/libassistant/test_support/libassistant_service_tester.h" #include "chromeos/assistant/internal/internal_util.h" #include "chromeos/assistant/internal/libassistant/shared_headers.h" #include "chromeos/assistant/internal/test_support/fake_assistant_manager_internal.h" -#include "chromeos/services/libassistant/libassistant_service.h" #include "chromeos/services/libassistant/public/mojom/authentication_state_observer.mojom.h" -#include "chromeos/services/libassistant/test_support/libassistant_service_tester.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/services/libassistant/callback_utils.h b/chromeos/ash/services/libassistant/callback_utils.h similarity index 96% rename from chromeos/services/libassistant/callback_utils.h rename to chromeos/ash/services/libassistant/callback_utils.h index 908bc82..9a4a9f66 100644 --- a/chromeos/services/libassistant/callback_utils.h +++ b/chromeos/ash/services/libassistant/callback_utils.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_CALLBACK_UTILS_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_CALLBACK_UTILS_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_CALLBACK_UTILS_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_CALLBACK_UTILS_H_ #include <functional> #include <utility> @@ -166,4 +166,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_CALLBACK_UTILS_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_CALLBACK_UTILS_H_
diff --git a/chromeos/services/libassistant/chromium_api_delegate.cc b/chromeos/ash/services/libassistant/chromium_api_delegate.cc similarity index 91% rename from chromeos/services/libassistant/chromium_api_delegate.cc rename to chromeos/ash/services/libassistant/chromium_api_delegate.cc index a561ed37..9a85c53 100644 --- a/chromeos/services/libassistant/chromium_api_delegate.cc +++ b/chromeos/ash/services/libassistant/chromium_api_delegate.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/chromium_api_delegate.h" +#include "chromeos/ash/services/libassistant/chromium_api_delegate.h" #include <utility>
diff --git a/chromeos/services/libassistant/chromium_api_delegate.h b/chromeos/ash/services/libassistant/chromium_api_delegate.h similarity index 80% rename from chromeos/services/libassistant/chromium_api_delegate.h rename to chromeos/ash/services/libassistant/chromium_api_delegate.h index 55b7d29..442c6aa 100644 --- a/chromeos/services/libassistant/chromium_api_delegate.h +++ b/chromeos/ash/services/libassistant/chromium_api_delegate.h
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_CHROMIUM_API_DELEGATE_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_CHROMIUM_API_DELEGATE_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_CHROMIUM_API_DELEGATE_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_CHROMIUM_API_DELEGATE_H_ #include <memory> +#include "chromeos/ash/services/libassistant/chromium_http_connection.h" #include "chromeos/assistant/internal/libassistant/shared_headers.h" -#include "chromeos/services/libassistant/chromium_http_connection.h" namespace network { class PendingSharedURLLoaderFactory; @@ -42,4 +42,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_CHROMIUM_API_DELEGATE_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_CHROMIUM_API_DELEGATE_H_
diff --git a/chromeos/services/libassistant/chromium_http_connection.cc b/chromeos/ash/services/libassistant/chromium_http_connection.cc similarity index 99% rename from chromeos/services/libassistant/chromium_http_connection.cc rename to chromeos/ash/services/libassistant/chromium_http_connection.cc index 6b2e46eb..dd082c12 100644 --- a/chromeos/services/libassistant/chromium_http_connection.cc +++ b/chromeos/ash/services/libassistant/chromium_http_connection.cc
@@ -4,7 +4,7 @@ // The file comes from Google Home(cast) implementation. -#include "chromeos/services/libassistant/chromium_http_connection.h" +#include "chromeos/ash/services/libassistant/chromium_http_connection.h" #include <algorithm> #include <memory>
diff --git a/chromeos/services/libassistant/chromium_http_connection.h b/chromeos/ash/services/libassistant/chromium_http_connection.h similarity index 95% rename from chromeos/services/libassistant/chromium_http_connection.h rename to chromeos/ash/services/libassistant/chromium_http_connection.h index 8ef6eb1..8b683e6 100644 --- a/chromeos/services/libassistant/chromium_http_connection.h +++ b/chromeos/ash/services/libassistant/chromium_http_connection.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_CHROMIUM_HTTP_CONNECTION_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_CHROMIUM_HTTP_CONNECTION_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_CHROMIUM_HTTP_CONNECTION_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_CHROMIUM_HTTP_CONNECTION_H_ #include <stdint.h> @@ -154,4 +154,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_CHROMIUM_HTTP_CONNECTION_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_CHROMIUM_HTTP_CONNECTION_H_
diff --git a/chromeos/services/libassistant/constants.cc b/chromeos/ash/services/libassistant/constants.cc similarity index 90% rename from chromeos/services/libassistant/constants.cc rename to chromeos/ash/services/libassistant/constants.cc index 4665fa1..a51a7b2 100644 --- a/chromeos/services/libassistant/constants.cc +++ b/chromeos/ash/services/libassistant/constants.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/constants.h" +#include "chromeos/ash/services/libassistant/constants.h" #include "base/files/file_util.h"
diff --git a/chromeos/services/libassistant/constants.h b/chromeos/ash/services/libassistant/constants.h similarity index 78% rename from chromeos/services/libassistant/constants.h rename to chromeos/ash/services/libassistant/constants.h index e08ea61b..c8032936 100644 --- a/chromeos/services/libassistant/constants.h +++ b/chromeos/ash/services/libassistant/constants.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_CONSTANTS_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_CONSTANTS_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_CONSTANTS_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_CONSTANTS_H_ #include "base/component_export.h" #include "base/files/file_path.h" @@ -22,4 +22,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_CONSTANTS_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_CONSTANTS_H_
diff --git a/chromeos/services/libassistant/conversation_controller.cc b/chromeos/ash/services/libassistant/conversation_controller.cc similarity index 99% rename from chromeos/services/libassistant/conversation_controller.cc rename to chromeos/ash/services/libassistant/conversation_controller.cc index 7c65a94..e076a20 100644 --- a/chromeos/services/libassistant/conversation_controller.cc +++ b/chromeos/ash/services/libassistant/conversation_controller.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/conversation_controller.h" +#include "chromeos/ash/services/libassistant/conversation_controller.h" #include <memory> @@ -11,13 +11,13 @@ #include "base/thread_annotations.h" #include "base/threading/sequenced_task_runner_handle.h" #include "chromeos/ash/services/assistant/public/cpp/features.h" +#include "chromeos/ash/services/libassistant/util.h" #include "chromeos/assistant/internal/internal_util.h" #include "chromeos/assistant/internal/libassistant/shared_headers.h" #include "chromeos/assistant/internal/proto/shared/proto/v2/delegate/event_handler_interface.pb.h" #include "chromeos/assistant/internal/proto/shared/proto/v2/internal_options.pb.h" #include "chromeos/services/libassistant/grpc/assistant_client.h" #include "chromeos/services/libassistant/public/mojom/conversation_controller.mojom.h" -#include "chromeos/services/libassistant/util.h" #include "chromeos/strings/grit/chromeos_strings.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "ui/base/l10n/l10n_util.h"
diff --git a/chromeos/services/libassistant/conversation_controller.h b/chromeos/ash/services/libassistant/conversation_controller.h similarity index 96% rename from chromeos/services/libassistant/conversation_controller.h rename to chromeos/ash/services/libassistant/conversation_controller.h index 84a4d593..21c9b9c5 100644 --- a/chromeos/services/libassistant/conversation_controller.h +++ b/chromeos/ash/services/libassistant/conversation_controller.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_CONVERSATION_CONTROLLER_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_CONVERSATION_CONTROLLER_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_CONVERSATION_CONTROLLER_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_CONVERSATION_CONTROLLER_H_ #include <memory> @@ -142,4 +142,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_CONVERSATION_CONTROLLER_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_CONVERSATION_CONTROLLER_H_
diff --git a/chromeos/services/libassistant/conversation_controller_unittest.cc b/chromeos/ash/services/libassistant/conversation_controller_unittest.cc similarity index 95% rename from chromeos/services/libassistant/conversation_controller_unittest.cc rename to chromeos/ash/services/libassistant/conversation_controller_unittest.cc index fbf8b120..c8985c31 100644 --- a/chromeos/services/libassistant/conversation_controller_unittest.cc +++ b/chromeos/ash/services/libassistant/conversation_controller_unittest.cc
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/conversation_controller.h" +#include "chromeos/ash/services/libassistant/conversation_controller.h" #include "base/run_loop.h" #include "base/test/task_environment.h" #include "chromeos/ash/components/assistant/test_support/expect_utils.h" -#include "chromeos/services/libassistant/test_support/fake_assistant_client.h" +#include "chromeos/ash/services/libassistant/test_support/fake_assistant_client.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/services/libassistant/conversation_observer_unittest.cc b/chromeos/ash/services/libassistant/conversation_observer_unittest.cc similarity index 97% rename from chromeos/services/libassistant/conversation_observer_unittest.cc rename to chromeos/ash/services/libassistant/conversation_observer_unittest.cc index 32062a9..5f1f76d 100644 --- a/chromeos/services/libassistant/conversation_observer_unittest.cc +++ b/chromeos/ash/services/libassistant/conversation_observer_unittest.cc
@@ -5,15 +5,15 @@ #include <memory> #include "base/test/task_environment.h" +#include "chromeos/ash/services/libassistant/conversation_controller.h" +#include "chromeos/ash/services/libassistant/libassistant_service.h" +#include "chromeos/ash/services/libassistant/test_support/libassistant_service_tester.h" #include "chromeos/assistant/internal/action/cros_action_module.h" #include "chromeos/assistant/internal/libassistant/shared_headers.h" #include "chromeos/assistant/internal/test_support/fake_assistant_manager.h" #include "chromeos/assistant/internal/test_support/fake_assistant_manager_internal.h" -#include "chromeos/services/libassistant/conversation_controller.h" -#include "chromeos/services/libassistant/libassistant_service.h" #include "chromeos/services/libassistant/public/cpp/android_app_info.h" #include "chromeos/services/libassistant/public/mojom/conversation_observer.mojom.h" -#include "chromeos/services/libassistant/test_support/libassistant_service_tester.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/services/libassistant/conversation_state_listener_impl.cc b/chromeos/ash/services/libassistant/conversation_state_listener_impl.cc similarity index 97% rename from chromeos/services/libassistant/conversation_state_listener_impl.cc rename to chromeos/ash/services/libassistant/conversation_state_listener_impl.cc index 0af79fd..f2887f7 100644 --- a/chromeos/services/libassistant/conversation_state_listener_impl.cc +++ b/chromeos/ash/services/libassistant/conversation_state_listener_impl.cc
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/conversation_state_listener_impl.h" +#include "chromeos/ash/services/libassistant/conversation_state_listener_impl.h" #include "chromeos/ash/services/assistant/public/cpp/assistant_enums.h" +#include "chromeos/ash/services/libassistant/audio_input_controller.h" #include "chromeos/assistant/internal/libassistant/shared_headers.h" -#include "chromeos/services/libassistant/audio_input_controller.h" #include "chromeos/services/libassistant/grpc/assistant_client.h" #include "chromeos/services/libassistant/public/mojom/conversation_observer.mojom.h" #include "chromeos/services/libassistant/public/mojom/speech_recognition_observer.mojom.h"
diff --git a/chromeos/services/libassistant/conversation_state_listener_impl.h b/chromeos/ash/services/libassistant/conversation_state_listener_impl.h similarity index 91% rename from chromeos/services/libassistant/conversation_state_listener_impl.h rename to chromeos/ash/services/libassistant/conversation_state_listener_impl.h index 003dbca2..88ad8ce 100644 --- a/chromeos/services/libassistant/conversation_state_listener_impl.h +++ b/chromeos/ash/services/libassistant/conversation_state_listener_impl.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_CONVERSATION_STATE_LISTENER_IMPL_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_CONVERSATION_STATE_LISTENER_IMPL_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_CONVERSATION_STATE_LISTENER_IMPL_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_CONVERSATION_STATE_LISTENER_IMPL_H_ #include "base/sequence_checker.h" #include "chromeos/assistant/internal/libassistant/shared_headers.h" @@ -78,4 +78,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_CONVERSATION_STATE_LISTENER_IMPL_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_CONVERSATION_STATE_LISTENER_IMPL_H_
diff --git a/chromeos/services/libassistant/device_settings_controller.cc b/chromeos/ash/services/libassistant/device_settings_controller.cc similarity index 98% rename from chromeos/services/libassistant/device_settings_controller.cc rename to chromeos/ash/services/libassistant/device_settings_controller.cc index 666b2e0..c9da7b3 100644 --- a/chromeos/services/libassistant/device_settings_controller.cc +++ b/chromeos/ash/services/libassistant/device_settings_controller.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/device_settings_controller.h" +#include "chromeos/ash/services/libassistant/device_settings_controller.h" #include <algorithm> #include <memory> @@ -10,13 +10,13 @@ #include "base/logging.h" #include "base/memory/weak_ptr.h" +#include "chromeos/ash/services/libassistant/util.h" #include "chromeos/assistant/internal/internal_util.h" #include "chromeos/assistant/internal/libassistant/shared_headers.h" #include "chromeos/assistant/internal/proto/shared/proto/device_args.pb.h" #include "chromeos/assistant/internal/proto/shared/proto/v2/internal_options.pb.h" #include "chromeos/services/libassistant/grpc/assistant_client.h" #include "chromeos/services/libassistant/public/mojom/device_settings_delegate.mojom.h" -#include "chromeos/services/libassistant/util.h" namespace client_op = ::assistant::api::client_op;
diff --git a/chromeos/services/libassistant/device_settings_controller.h b/chromeos/ash/services/libassistant/device_settings_controller.h similarity index 92% rename from chromeos/services/libassistant/device_settings_controller.h rename to chromeos/ash/services/libassistant/device_settings_controller.h index 98cc1e6f..cc83553 100644 --- a/chromeos/services/libassistant/device_settings_controller.h +++ b/chromeos/ash/services/libassistant/device_settings_controller.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_DEVICE_SETTINGS_CONTROLLER_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_DEVICE_SETTINGS_CONTROLLER_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_DEVICE_SETTINGS_CONTROLLER_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_DEVICE_SETTINGS_CONTROLLER_H_ #include <memory> #include <string> @@ -81,4 +81,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_DEVICE_SETTINGS_CONTROLLER_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_DEVICE_SETTINGS_CONTROLLER_H_
diff --git a/chromeos/services/libassistant/device_settings_controller_unittest.cc b/chromeos/ash/services/libassistant/device_settings_controller_unittest.cc similarity index 98% rename from chromeos/services/libassistant/device_settings_controller_unittest.cc rename to chromeos/ash/services/libassistant/device_settings_controller_unittest.cc index 0fa3e32..ce7edd06 100644 --- a/chromeos/services/libassistant/device_settings_controller_unittest.cc +++ b/chromeos/ash/services/libassistant/device_settings_controller_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/device_settings_controller.h" +#include "chromeos/ash/services/libassistant/device_settings_controller.h" #include <memory> #include <utility>
diff --git a/chromeos/services/libassistant/display_connection.cc b/chromeos/ash/services/libassistant/display_connection.cc similarity index 98% rename from chromeos/services/libassistant/display_connection.cc rename to chromeos/ash/services/libassistant/display_connection.cc index f11c1198..8f1886b 100644 --- a/chromeos/services/libassistant/display_connection.cc +++ b/chromeos/ash/services/libassistant/display_connection.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/display_connection.h" +#include "chromeos/ash/services/libassistant/display_connection.h" #include <sstream>
diff --git a/chromeos/services/libassistant/display_connection.h b/chromeos/ash/services/libassistant/display_connection.h similarity index 93% rename from chromeos/services/libassistant/display_connection.h rename to chromeos/ash/services/libassistant/display_connection.h index c3fa1921..26addbb 100644 --- a/chromeos/services/libassistant/display_connection.h +++ b/chromeos/ash/services/libassistant/display_connection.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_DISPLAY_CONNECTION_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_DISPLAY_CONNECTION_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_DISPLAY_CONNECTION_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_DISPLAY_CONNECTION_H_ #include <string> @@ -84,4 +84,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_DISPLAY_CONNECTION_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_DISPLAY_CONNECTION_H_
diff --git a/chromeos/services/libassistant/display_controller.cc b/chromeos/ash/services/libassistant/display_controller.cc similarity index 96% rename from chromeos/services/libassistant/display_controller.cc rename to chromeos/ash/services/libassistant/display_controller.cc index 0d04e33..966610a 100644 --- a/chromeos/services/libassistant/display_controller.cc +++ b/chromeos/ash/services/libassistant/display_controller.cc
@@ -2,19 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/display_controller.h" +#include "chromeos/ash/services/libassistant/display_controller.h" #include <memory> #include "base/threading/sequenced_task_runner_handle.h" #include "chromeos/ash/services/assistant/public/cpp/features.h" +#include "chromeos/ash/services/libassistant/display_connection.h" +#include "chromeos/ash/services/libassistant/util.h" #include "chromeos/assistant/internal/internal_util.h" #include "chromeos/assistant/internal/libassistant/shared_headers.h" #include "chromeos/assistant/internal/proto/shared/proto/v2/internal_options.pb.h" -#include "chromeos/services/libassistant/display_connection.h" #include "chromeos/services/libassistant/grpc/assistant_client.h" #include "chromeos/services/libassistant/public/mojom/speech_recognition_observer.mojom.h" -#include "chromeos/services/libassistant/util.h" namespace chromeos { namespace libassistant {
diff --git a/chromeos/services/libassistant/display_controller.h b/chromeos/ash/services/libassistant/display_controller.h similarity index 94% rename from chromeos/services/libassistant/display_controller.h rename to chromeos/ash/services/libassistant/display_controller.h index 61956cb7..9786c4ff 100644 --- a/chromeos/services/libassistant/display_controller.h +++ b/chromeos/ash/services/libassistant/display_controller.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_DISPLAY_CONTROLLER_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_DISPLAY_CONTROLLER_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_DISPLAY_CONTROLLER_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_DISPLAY_CONTROLLER_H_ #include "base/sequence_checker.h" #include "base/task/sequenced_task_runner.h" @@ -98,4 +98,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_DISPLAY_CONTROLLER_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_DISPLAY_CONTROLLER_H_
diff --git a/chromeos/services/libassistant/display_controller_unittest.cc b/chromeos/ash/services/libassistant/display_controller_unittest.cc similarity index 95% rename from chromeos/services/libassistant/display_controller_unittest.cc rename to chromeos/ash/services/libassistant/display_controller_unittest.cc index 5d8e3b49..e419b4e 100644 --- a/chromeos/services/libassistant/display_controller_unittest.cc +++ b/chromeos/ash/services/libassistant/display_controller_unittest.cc
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/display_controller.h" +#include "chromeos/ash/services/libassistant/display_controller.h" #include "base/run_loop.h" #include "base/test/task_environment.h" #include "chromeos/ash/components/assistant/test_support/expect_utils.h" +#include "chromeos/ash/services/libassistant/test_support/fake_assistant_client.h" #include "chromeos/services/libassistant/grpc/assistant_client.h" #include "chromeos/services/libassistant/public/mojom/speech_recognition_observer.mojom.h" -#include "chromeos/services/libassistant/test_support/fake_assistant_client.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/services/libassistant/fake_auth_provider.cc b/chromeos/ash/services/libassistant/fake_auth_provider.cc similarity index 95% rename from chromeos/services/libassistant/fake_auth_provider.cc rename to chromeos/ash/services/libassistant/fake_auth_provider.cc index a949f915..bab50c9 100644 --- a/chromeos/services/libassistant/fake_auth_provider.cc +++ b/chromeos/ash/services/libassistant/fake_auth_provider.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/fake_auth_provider.h" +#include "chromeos/ash/services/libassistant/fake_auth_provider.h" namespace chromeos { namespace libassistant {
diff --git a/chromeos/services/libassistant/fake_auth_provider.h b/chromeos/ash/services/libassistant/fake_auth_provider.h similarity index 88% rename from chromeos/services/libassistant/fake_auth_provider.h rename to chromeos/ash/services/libassistant/fake_auth_provider.h index 592f085..9cd5250 100644 --- a/chromeos/services/libassistant/fake_auth_provider.h +++ b/chromeos/ash/services/libassistant/fake_auth_provider.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_FAKE_AUTH_PROVIDER_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_FAKE_AUTH_PROVIDER_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_FAKE_AUTH_PROVIDER_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_FAKE_AUTH_PROVIDER_H_ #include "chromeos/assistant/internal/libassistant/shared_headers.h" @@ -48,4 +48,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_FAKE_AUTH_PROVIDER_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_FAKE_AUTH_PROVIDER_H_
diff --git a/chromeos/services/libassistant/file_provider_impl.cc b/chromeos/ash/services/libassistant/file_provider_impl.cc similarity index 96% rename from chromeos/services/libassistant/file_provider_impl.cc rename to chromeos/ash/services/libassistant/file_provider_impl.cc index 5c00579..5dad1e0 100644 --- a/chromeos/services/libassistant/file_provider_impl.cc +++ b/chromeos/ash/services/libassistant/file_provider_impl.cc
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/file_provider_impl.h" +#include "chromeos/ash/services/libassistant/file_provider_impl.h" #include "base/files/file_util.h" #include "chromeos/ash/grit/ash_resources.h" -#include "chromeos/services/libassistant/util.h" +#include "chromeos/ash/services/libassistant/util.h" #include "ui/base/resource/resource_bundle.h" namespace chromeos {
diff --git a/chromeos/services/libassistant/file_provider_impl.h b/chromeos/ash/services/libassistant/file_provider_impl.h similarity index 85% rename from chromeos/services/libassistant/file_provider_impl.h rename to chromeos/ash/services/libassistant/file_provider_impl.h index a8966bf..f0f97b810 100644 --- a/chromeos/services/libassistant/file_provider_impl.h +++ b/chromeos/ash/services/libassistant/file_provider_impl.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_FILE_PROVIDER_IMPL_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_FILE_PROVIDER_IMPL_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_FILE_PROVIDER_IMPL_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_FILE_PROVIDER_IMPL_H_ #include <string> @@ -39,4 +39,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_FILE_PROVIDER_IMPL_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_FILE_PROVIDER_IMPL_H_
diff --git a/chromeos/services/libassistant/libassistant_factory.h b/chromeos/ash/services/libassistant/libassistant_factory.h similarity index 82% rename from chromeos/services/libassistant/libassistant_factory.h rename to chromeos/ash/services/libassistant/libassistant_factory.h index 03d1d40..50f456c1 100644 --- a/chromeos/services/libassistant/libassistant_factory.h +++ b/chromeos/ash/services/libassistant/libassistant_factory.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_LIBASSISTANT_FACTORY_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_LIBASSISTANT_FACTORY_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_LIBASSISTANT_FACTORY_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_LIBASSISTANT_FACTORY_H_ #include <memory> #include <string> @@ -35,4 +35,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_LIBASSISTANT_FACTORY_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_LIBASSISTANT_FACTORY_H_
diff --git a/chromeos/services/libassistant/libassistant_loader_impl.cc b/chromeos/ash/services/libassistant/libassistant_loader_impl.cc similarity index 98% rename from chromeos/services/libassistant/libassistant_loader_impl.cc rename to chromeos/ash/services/libassistant/libassistant_loader_impl.cc index 0216b6fd..34f3b81 100644 --- a/chromeos/services/libassistant/libassistant_loader_impl.cc +++ b/chromeos/ash/services/libassistant/libassistant_loader_impl.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/libassistant_loader_impl.h" +#include "chromeos/ash/services/libassistant/libassistant_loader_impl.h" #include "base/bind.h" #include "base/callback_helpers.h"
diff --git a/chromeos/services/libassistant/libassistant_loader_impl.h b/chromeos/ash/services/libassistant/libassistant_loader_impl.h similarity index 94% rename from chromeos/services/libassistant/libassistant_loader_impl.h rename to chromeos/ash/services/libassistant/libassistant_loader_impl.h index 248629e0..62a32e9 100644 --- a/chromeos/services/libassistant/libassistant_loader_impl.h +++ b/chromeos/ash/services/libassistant/libassistant_loader_impl.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_LIBASSISTANT_LOADER_IMPL_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_LIBASSISTANT_LOADER_IMPL_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_LIBASSISTANT_LOADER_IMPL_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_LIBASSISTANT_LOADER_IMPL_H_ #include "base/component_export.h" #include "base/gtest_prod_util.h"
diff --git a/chromeos/services/libassistant/libassistant_loader_impl_unittest.cc b/chromeos/ash/services/libassistant/libassistant_loader_impl_unittest.cc similarity index 96% rename from chromeos/services/libassistant/libassistant_loader_impl_unittest.cc rename to chromeos/ash/services/libassistant/libassistant_loader_impl_unittest.cc index 396b88a43..30df095 100644 --- a/chromeos/services/libassistant/libassistant_loader_impl_unittest.cc +++ b/chromeos/ash/services/libassistant/libassistant_loader_impl_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/libassistant_loader_impl.h" +#include "chromeos/ash/services/libassistant/libassistant_loader_impl.h" #include "base/bind.h" #include "base/callback_helpers.h"
diff --git a/chromeos/services/libassistant/libassistant_sandbox_hook.cc b/chromeos/ash/services/libassistant/libassistant_sandbox_hook.cc similarity index 94% rename from chromeos/services/libassistant/libassistant_sandbox_hook.cc rename to chromeos/ash/services/libassistant/libassistant_sandbox_hook.cc index f9126d48..a010dfd1 100644 --- a/chromeos/services/libassistant/libassistant_sandbox_hook.cc +++ b/chromeos/ash/services/libassistant/libassistant_sandbox_hook.cc
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/libassistant_sandbox_hook.h" +#include "chromeos/ash/services/libassistant/libassistant_sandbox_hook.h" #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/system/sys_info.h" -#include "chromeos/services/libassistant/constants.h" +#include "chromeos/ash/services/libassistant/constants.h" #include "sandbox/linux/syscall_broker/broker_command.h" #include "sandbox/linux/syscall_broker/broker_file_permission.h" #include "sandbox/policy/linux/sandbox_linux.h"
diff --git a/chromeos/services/libassistant/libassistant_sandbox_hook.h b/chromeos/ash/services/libassistant/libassistant_sandbox_hook.h similarity index 64% rename from chromeos/services/libassistant/libassistant_sandbox_hook.h rename to chromeos/ash/services/libassistant/libassistant_sandbox_hook.h index d3c3f32..917f71b 100644 --- a/chromeos/services/libassistant/libassistant_sandbox_hook.h +++ b/chromeos/ash/services/libassistant/libassistant_sandbox_hook.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_LIBASSISTANT_SANDBOX_HOOK_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_LIBASSISTANT_SANDBOX_HOOK_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_LIBASSISTANT_SANDBOX_HOOK_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_LIBASSISTANT_SANDBOX_HOOK_H_ #include "sandbox/policy/linux/sandbox_linux.h" @@ -15,4 +15,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_LIBASSISTANT_SANDBOX_HOOK_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_LIBASSISTANT_SANDBOX_HOOK_H_
diff --git a/chromeos/services/libassistant/libassistant_service.cc b/chromeos/ash/services/libassistant/libassistant_service.cc similarity index 96% rename from chromeos/services/libassistant/libassistant_service.cc rename to chromeos/ash/services/libassistant/libassistant_service.cc index 724a5d2..c5b8112 100644 --- a/chromeos/services/libassistant/libassistant_service.cc +++ b/chromeos/ash/services/libassistant/libassistant_service.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/libassistant_service.h" +#include "chromeos/ash/services/libassistant/libassistant_service.h" #include <memory> #include <utility> @@ -11,9 +11,9 @@ #include "base/logging.h" #include "base/memory/ptr_util.h" #include "chromeos/ash/services/assistant/public/cpp/features.h" +#include "chromeos/ash/services/libassistant/libassistant_factory.h" +#include "chromeos/ash/services/libassistant/libassistant_loader_impl.h" #include "chromeos/assistant/internal/libassistant/shared_headers.h" -#include "chromeos/services/libassistant/libassistant_factory.h" -#include "chromeos/services/libassistant/libassistant_loader_impl.h" #include "chromeos/services/libassistant/public/mojom/speech_recognition_observer.mojom.h" namespace chromeos {
diff --git a/chromeos/services/libassistant/libassistant_service.h b/chromeos/ash/services/libassistant/libassistant_service.h similarity index 78% rename from chromeos/services/libassistant/libassistant_service.h rename to chromeos/ash/services/libassistant/libassistant_service.h index f2f2520c..f849fa1 100644 --- a/chromeos/services/libassistant/libassistant_service.h +++ b/chromeos/ash/services/libassistant/libassistant_service.h
@@ -2,26 +2,26 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_LIBASSISTANT_SERVICE_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_LIBASSISTANT_SERVICE_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_LIBASSISTANT_SERVICE_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_LIBASSISTANT_SERVICE_H_ #include <memory> #include "base/component_export.h" -#include "chromeos/services/libassistant/audio_input_controller.h" -#include "chromeos/services/libassistant/conversation_controller.h" -#include "chromeos/services/libassistant/conversation_state_listener_impl.h" -#include "chromeos/services/libassistant/device_settings_controller.h" -#include "chromeos/services/libassistant/display_controller.h" -#include "chromeos/services/libassistant/libassistant_factory.h" -#include "chromeos/services/libassistant/media_controller.h" -#include "chromeos/services/libassistant/platform_api.h" +#include "chromeos/ash/services/libassistant/audio_input_controller.h" +#include "chromeos/ash/services/libassistant/conversation_controller.h" +#include "chromeos/ash/services/libassistant/conversation_state_listener_impl.h" +#include "chromeos/ash/services/libassistant/device_settings_controller.h" +#include "chromeos/ash/services/libassistant/display_controller.h" +#include "chromeos/ash/services/libassistant/libassistant_factory.h" +#include "chromeos/ash/services/libassistant/media_controller.h" +#include "chromeos/ash/services/libassistant/platform_api.h" +#include "chromeos/ash/services/libassistant/service_controller.h" +#include "chromeos/ash/services/libassistant/settings_controller.h" +#include "chromeos/ash/services/libassistant/speaker_id_enrollment_controller.h" +#include "chromeos/ash/services/libassistant/timer_controller.h" #include "chromeos/services/libassistant/public/mojom/notification_delegate.mojom-forward.h" #include "chromeos/services/libassistant/public/mojom/service.mojom.h" -#include "chromeos/services/libassistant/service_controller.h" -#include "chromeos/services/libassistant/settings_controller.h" -#include "chromeos/services/libassistant/speaker_id_enrollment_controller.h" -#include "chromeos/services/libassistant/timer_controller.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/remote_set.h" @@ -102,4 +102,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_LIBASSISTANT_SERVICE_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_LIBASSISTANT_SERVICE_H_
diff --git a/chromeos/services/libassistant/media_controller.cc b/chromeos/ash/services/libassistant/media_controller.cc similarity index 98% rename from chromeos/services/libassistant/media_controller.cc rename to chromeos/ash/services/libassistant/media_controller.cc index 2724ae1..8dcaa585 100644 --- a/chromeos/services/libassistant/media_controller.cc +++ b/chromeos/ash/services/libassistant/media_controller.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/media_controller.h" +#include "chromeos/ash/services/libassistant/media_controller.h" #include "base/strings/string_util.h" #include "base/threading/sequenced_task_runner_handle.h"
diff --git a/chromeos/services/libassistant/media_controller.h b/chromeos/ash/services/libassistant/media_controller.h similarity index 89% rename from chromeos/services/libassistant/media_controller.h rename to chromeos/ash/services/libassistant/media_controller.h index 93e4140..00b9ad80 100644 --- a/chromeos/services/libassistant/media_controller.h +++ b/chromeos/ash/services/libassistant/media_controller.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_MEDIA_CONTROLLER_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_MEDIA_CONTROLLER_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_MEDIA_CONTROLLER_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_MEDIA_CONTROLLER_H_ #include "chromeos/assistant/internal/proto/shared/proto/v2/device_state_event.pb.h" #include "chromeos/services/libassistant/grpc/assistant_client_observer.h" @@ -46,4 +46,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_MEDIA_CONTROLLER_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_MEDIA_CONTROLLER_H_
diff --git a/chromeos/services/libassistant/media_controller_unittest.cc b/chromeos/ash/services/libassistant/media_controller_unittest.cc similarity index 97% rename from chromeos/services/libassistant/media_controller_unittest.cc rename to chromeos/ash/services/libassistant/media_controller_unittest.cc index 21a42f7..8487b1b 100644 --- a/chromeos/services/libassistant/media_controller_unittest.cc +++ b/chromeos/ash/services/libassistant/media_controller_unittest.cc
@@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/media_controller.h" +#include "chromeos/ash/services/libassistant/media_controller.h" #include "base/strings/stringprintf.h" #include "base/test/task_environment.h" +#include "chromeos/ash/services/libassistant/test_support/fake_assistant_client.h" +#include "chromeos/ash/services/libassistant/test_support/libassistant_service_tester.h" #include "chromeos/assistant/internal/libassistant/shared_headers.h" #include "chromeos/assistant/internal/test_support/fake_assistant_manager.h" #include "chromeos/assistant/internal/util_headers.h" #include "chromeos/services/libassistant/public/mojom/media_controller.mojom.h" -#include "chromeos/services/libassistant/test_support/fake_assistant_client.h" -#include "chromeos/services/libassistant/test_support/libassistant_service_tester.h" #include "mojo/public/cpp/bindings/remote.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/services/libassistant/network_provider_impl.cc b/chromeos/ash/services/libassistant/network_provider_impl.cc similarity index 96% rename from chromeos/services/libassistant/network_provider_impl.cc rename to chromeos/ash/services/libassistant/network_provider_impl.cc index 0237ede..cbac68f 100644 --- a/chromeos/services/libassistant/network_provider_impl.cc +++ b/chromeos/ash/services/libassistant/network_provider_impl.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/network_provider_impl.h" +#include "chromeos/ash/services/libassistant/network_provider_impl.h" #include <algorithm> #include <vector>
diff --git a/chromeos/services/libassistant/network_provider_impl.h b/chromeos/ash/services/libassistant/network_provider_impl.h similarity index 88% rename from chromeos/services/libassistant/network_provider_impl.h rename to chromeos/ash/services/libassistant/network_provider_impl.h index d5ea044..187ecc7 100644 --- a/chromeos/services/libassistant/network_provider_impl.h +++ b/chromeos/ash/services/libassistant/network_provider_impl.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_NETWORK_PROVIDER_IMPL_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_NETWORK_PROVIDER_IMPL_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_NETWORK_PROVIDER_IMPL_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_NETWORK_PROVIDER_IMPL_H_ #include <vector> @@ -49,4 +49,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_NETWORK_PROVIDER_IMPL_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_NETWORK_PROVIDER_IMPL_H_
diff --git a/chromeos/services/libassistant/network_provider_impl_unittest.cc b/chromeos/ash/services/libassistant/network_provider_impl_unittest.cc similarity index 95% rename from chromeos/services/libassistant/network_provider_impl_unittest.cc rename to chromeos/ash/services/libassistant/network_provider_impl_unittest.cc index 59cb851..8b4066ef 100644 --- a/chromeos/services/libassistant/network_provider_impl_unittest.cc +++ b/chromeos/ash/services/libassistant/network_provider_impl_unittest.cc
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/network_provider_impl.h" +#include "chromeos/ash/services/libassistant/network_provider_impl.h" #include <utility> #include <vector> #include "base/test/task_environment.h" -#include "chromeos/services/libassistant/test_support/fake_platform_delegate.h" +#include "chromeos/ash/services/libassistant/test_support/fake_platform_delegate.h" #include "chromeos/services/network_config/public/mojom/cros_network_config.mojom-forward.h" #include "chromeos/services/network_config/public/mojom/network_types.mojom-forward.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/services/libassistant/notification_delegate_unittest.cc b/chromeos/ash/services/libassistant/notification_delegate_unittest.cc similarity index 98% rename from chromeos/services/libassistant/notification_delegate_unittest.cc rename to chromeos/ash/services/libassistant/notification_delegate_unittest.cc index cc52291..6c1123c 100644 --- a/chromeos/services/libassistant/notification_delegate_unittest.cc +++ b/chromeos/ash/services/libassistant/notification_delegate_unittest.cc
@@ -3,12 +3,12 @@ // found in the LICENSE file. #include "base/test/task_environment.h" +#include "chromeos/ash/services/libassistant/test_support/libassistant_service_tester.h" #include "chromeos/assistant/internal/action/cros_action_module.h" #include "chromeos/assistant/internal/libassistant/shared_headers.h" #include "chromeos/assistant/internal/test_support/fake_assistant_manager_internal.h" #include "chromeos/services/libassistant/public/cpp/assistant_notification.h" #include "chromeos/services/libassistant/public/mojom/notification_delegate.mojom-forward.h" -#include "chromeos/services/libassistant/test_support/libassistant_service_tester.h" #include "testing/gmock/include/gmock/gmock.h" namespace chromeos {
diff --git a/chromeos/services/libassistant/platform_api.cc b/chromeos/ash/services/libassistant/platform_api.cc similarity index 86% rename from chromeos/services/libassistant/platform_api.cc rename to chromeos/ash/services/libassistant/platform_api.cc index 2db2b955..d5e0e72 100644 --- a/chromeos/services/libassistant/platform_api.cc +++ b/chromeos/ash/services/libassistant/platform_api.cc
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/platform_api.h" +#include "chromeos/ash/services/libassistant/platform_api.h" #include "base/check.h" #include "chromeos/ash/services/assistant/public/cpp/features.h" -#include "chromeos/services/libassistant/audio/audio_output_provider_impl.h" -#include "chromeos/services/libassistant/fake_auth_provider.h" -#include "chromeos/services/libassistant/file_provider_impl.h" -#include "chromeos/services/libassistant/power_manager_provider_impl.h" -#include "chromeos/services/libassistant/system_provider_impl.h" +#include "chromeos/ash/services/libassistant/audio/audio_output_provider_impl.h" +#include "chromeos/ash/services/libassistant/fake_auth_provider.h" +#include "chromeos/ash/services/libassistant/file_provider_impl.h" +#include "chromeos/ash/services/libassistant/power_manager_provider_impl.h" +#include "chromeos/ash/services/libassistant/system_provider_impl.h" #include "media/audio/audio_device_description.h" namespace chromeos {
diff --git a/chromeos/services/libassistant/platform_api.h b/chromeos/ash/services/libassistant/platform_api.h similarity index 90% rename from chromeos/services/libassistant/platform_api.h rename to chromeos/ash/services/libassistant/platform_api.h index 92e3fee..71a10ff 100644 --- a/chromeos/services/libassistant/platform_api.h +++ b/chromeos/ash/services/libassistant/platform_api.h
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_PLATFORM_API_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_PLATFORM_API_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_PLATFORM_API_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_PLATFORM_API_H_ #include <memory> +#include "chromeos/ash/services/libassistant/network_provider_impl.h" #include "chromeos/assistant/internal/libassistant/shared_headers.h" #include "chromeos/services/libassistant/grpc/assistant_client_observer.h" -#include "chromeos/services/libassistant/network_provider_impl.h" #include "chromeos/services/libassistant/public/mojom/audio_output_delegate.mojom.h" #include "chromeos/services/libassistant/public/mojom/platform_delegate.mojom.h" #include "mojo/public/cpp/bindings/pending_remote.h" @@ -66,4 +66,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_PLATFORM_API_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_PLATFORM_API_H_
diff --git a/chromeos/services/libassistant/power_manager_provider_impl.cc b/chromeos/ash/services/libassistant/power_manager_provider_impl.cc similarity index 98% rename from chromeos/services/libassistant/power_manager_provider_impl.cc rename to chromeos/ash/services/libassistant/power_manager_provider_impl.cc index 61dabec..5d20a0c 100644 --- a/chromeos/services/libassistant/power_manager_provider_impl.cc +++ b/chromeos/ash/services/libassistant/power_manager_provider_impl.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/power_manager_provider_impl.h" +#include "chromeos/ash/services/libassistant/power_manager_provider_impl.h" #include "base/logging.h" #include "base/strings/string_number_conversions.h"
diff --git a/chromeos/services/libassistant/power_manager_provider_impl.h b/chromeos/ash/services/libassistant/power_manager_provider_impl.h similarity index 95% rename from chromeos/services/libassistant/power_manager_provider_impl.h rename to chromeos/ash/services/libassistant/power_manager_provider_impl.h index c3efd0d..6813c9e 100644 --- a/chromeos/services/libassistant/power_manager_provider_impl.h +++ b/chromeos/ash/services/libassistant/power_manager_provider_impl.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_POWER_MANAGER_PROVIDER_IMPL_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_POWER_MANAGER_PROVIDER_IMPL_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_POWER_MANAGER_PROVIDER_IMPL_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_POWER_MANAGER_PROVIDER_IMPL_H_ #include <map> #include <memory> @@ -120,4 +120,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_POWER_MANAGER_PROVIDER_IMPL_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_POWER_MANAGER_PROVIDER_IMPL_H_
diff --git a/chromeos/services/libassistant/power_manager_provider_impl_unittest.cc b/chromeos/ash/services/libassistant/power_manager_provider_impl_unittest.cc similarity index 97% rename from chromeos/services/libassistant/power_manager_provider_impl_unittest.cc rename to chromeos/ash/services/libassistant/power_manager_provider_impl_unittest.cc index 06da6e6..432e290e 100644 --- a/chromeos/services/libassistant/power_manager_provider_impl_unittest.cc +++ b/chromeos/ash/services/libassistant/power_manager_provider_impl_unittest.cc
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/power_manager_provider_impl.h" +#include "chromeos/ash/services/libassistant/power_manager_provider_impl.h" #include "base/run_loop.h" #include "base/test/task_environment.h" +#include "chromeos/ash/services/libassistant/test_support/fake_platform_delegate.h" #include "chromeos/dbus/power/fake_power_manager_client.h" -#include "chromeos/services/libassistant/test_support/fake_platform_delegate.h" #include "services/device/public/cpp/test/test_wake_lock_provider.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/services/libassistant/service_controller.cc b/chromeos/ash/services/libassistant/service_controller.cc similarity index 97% rename from chromeos/services/libassistant/service_controller.cc rename to chromeos/ash/services/libassistant/service_controller.cc index 68ddcd2..2ef0fb1 100644 --- a/chromeos/services/libassistant/service_controller.cc +++ b/chromeos/ash/services/libassistant/service_controller.cc
@@ -2,20 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/service_controller.h" +#include "chromeos/ash/services/libassistant/service_controller.h" #include <memory> #include "base/bind.h" #include "base/check.h" #include "chromeos/ash/services/assistant/public/cpp/features.h" +#include "chromeos/ash/services/libassistant/chromium_api_delegate.h" +#include "chromeos/ash/services/libassistant/libassistant_factory.h" +#include "chromeos/ash/services/libassistant/settings_controller.h" +#include "chromeos/ash/services/libassistant/util.h" #include "chromeos/assistant/internal/internal_util.h" #include "chromeos/assistant/internal/libassistant/shared_headers.h" -#include "chromeos/services/libassistant/chromium_api_delegate.h" #include "chromeos/services/libassistant/grpc/assistant_client.h" -#include "chromeos/services/libassistant/libassistant_factory.h" -#include "chromeos/services/libassistant/settings_controller.h" -#include "chromeos/services/libassistant/util.h" #include "services/network/public/cpp/cross_thread_pending_shared_url_loader_factory.h" #include "services/network/public/cpp/wrapper_shared_url_loader_factory.h"
diff --git a/chromeos/services/libassistant/service_controller.h b/chromeos/ash/services/libassistant/service_controller.h similarity index 95% rename from chromeos/services/libassistant/service_controller.h rename to chromeos/ash/services/libassistant/service_controller.h index 8c09bac..0acdf2d5 100644 --- a/chromeos/services/libassistant/service_controller.h +++ b/chromeos/ash/services/libassistant/service_controller.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_SERVICE_CONTROLLER_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_SERVICE_CONTROLLER_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_SERVICE_CONTROLLER_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_SERVICE_CONTROLLER_H_ #include "base/component_export.h" #include "base/memory/weak_ptr.h" @@ -104,4 +104,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_SERVICE_CONTROLLER_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_SERVICE_CONTROLLER_H_
diff --git a/chromeos/services/libassistant/service_controller_unittest.cc b/chromeos/ash/services/libassistant/service_controller_unittest.cc similarity index 98% rename from chromeos/services/libassistant/service_controller_unittest.cc rename to chromeos/ash/services/libassistant/service_controller_unittest.cc index ff62027..288b7e9 100644 --- a/chromeos/services/libassistant/service_controller_unittest.cc +++ b/chromeos/ash/services/libassistant/service_controller_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/service_controller.h" +#include "chromeos/ash/services/libassistant/service_controller.h" #include <memory> @@ -12,14 +12,14 @@ #include "base/test/gtest_util.h" #include "base/test/scoped_path_override.h" #include "base/test/task_environment.h" +#include "chromeos/ash/services/libassistant/settings_controller.h" +#include "chromeos/ash/services/libassistant/test_support/fake_libassistant_factory.h" #include "chromeos/assistant/internal/libassistant/shared_headers.h" #include "chromeos/assistant/internal/test_support/fake_assistant_manager.h" #include "chromeos/assistant/internal/test_support/fake_assistant_manager_internal.h" #include "chromeos/services/libassistant/grpc/assistant_client_observer.h" #include "chromeos/services/libassistant/public/mojom/service_controller.mojom.h" #include "chromeos/services/libassistant/public/mojom/settings_controller.mojom.h" -#include "chromeos/services/libassistant/settings_controller.h" -#include "chromeos/services/libassistant/test_support/fake_libassistant_factory.h" #include "mojo/public/cpp/bindings/receiver.h" #include "services/network/public/cpp/shared_url_loader_factory.h" #include "services/network/test/test_url_loader_factory.h"
diff --git a/chromeos/services/libassistant/settings_controller.cc b/chromeos/ash/services/libassistant/settings_controller.cc similarity index 98% rename from chromeos/services/libassistant/settings_controller.cc rename to chromeos/ash/services/libassistant/settings_controller.cc index 0bc8db33..75aa287 100644 --- a/chromeos/services/libassistant/settings_controller.cc +++ b/chromeos/ash/services/libassistant/settings_controller.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/settings_controller.h" +#include "chromeos/ash/services/libassistant/settings_controller.h" #include <algorithm> #include <memory> @@ -12,12 +12,12 @@ #include "chromeos/ash/services/assistant/public/cpp/features.h" #include "chromeos/ash/services/assistant/public/proto/assistant_device_settings_ui.pb.h" #include "chromeos/ash/services/assistant/public/proto/settings_ui.pb.h" +#include "chromeos/ash/services/libassistant/callback_utils.h" #include "chromeos/assistant/internal/internal_util.h" #include "chromeos/assistant/internal/proto/assistant/display_connection.pb.h" #include "chromeos/assistant/internal/proto/shared/proto/settings_ui.pb.h" #include "chromeos/assistant/internal/proto/shared/proto/v2/config_settings_interface.pb.h" #include "chromeos/assistant/internal/proto/shared/proto/v2/display_interface.pb.h" -#include "chromeos/services/libassistant/callback_utils.h" #include "chromeos/services/libassistant/grpc/assistant_client.h" #include "chromeos/services/libassistant/grpc/utils/settings_utils.h" #include "third_party/icu/source/common/unicode/locid.h"
diff --git a/chromeos/services/libassistant/settings_controller.h b/chromeos/ash/services/libassistant/settings_controller.h similarity index 92% rename from chromeos/services/libassistant/settings_controller.h rename to chromeos/ash/services/libassistant/settings_controller.h index 6b1e9729..592635d 100644 --- a/chromeos/services/libassistant/settings_controller.h +++ b/chromeos/ash/services/libassistant/settings_controller.h
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_SETTINGS_CONTROLLER_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_SETTINGS_CONTROLLER_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_SETTINGS_CONTROLLER_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_SETTINGS_CONTROLLER_H_ #include <string> #include "third_party/abseil-cpp/absl/types/optional.h" -#include "chromeos/services/libassistant/abortable_task_list.h" +#include "chromeos/ash/services/libassistant/abortable_task_list.h" #include "chromeos/services/libassistant/grpc/assistant_client_observer.h" #include "chromeos/services/libassistant/public/mojom/settings_controller.mojom.h" #include "mojo/public/cpp/bindings/receiver.h" @@ -87,4 +87,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_SETTINGS_CONTROLLER_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_SETTINGS_CONTROLLER_H_
diff --git a/chromeos/services/libassistant/settings_controller_unittest.cc b/chromeos/ash/services/libassistant/settings_controller_unittest.cc similarity index 98% rename from chromeos/services/libassistant/settings_controller_unittest.cc rename to chromeos/ash/services/libassistant/settings_controller_unittest.cc index b9fe39e4..3b95113 100644 --- a/chromeos/services/libassistant/settings_controller_unittest.cc +++ b/chromeos/ash/services/libassistant/settings_controller_unittest.cc
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/settings_controller.h" +#include "chromeos/ash/services/libassistant/settings_controller.h" #include "base/test/mock_callback.h" #include "base/test/task_environment.h" +#include "chromeos/ash/services/libassistant/test_support/fake_assistant_client.h" #include "chromeos/assistant/internal/test_support/fake_assistant_manager.h" #include "chromeos/assistant/internal/test_support/fake_assistant_manager_internal.h" -#include "chromeos/services/libassistant/test_support/fake_assistant_client.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/icu/source/common/unicode/locid.h"
diff --git a/chromeos/services/libassistant/speaker_id_enrollment_controller.cc b/chromeos/ash/services/libassistant/speaker_id_enrollment_controller.cc similarity index 98% rename from chromeos/services/libassistant/speaker_id_enrollment_controller.cc rename to chromeos/ash/services/libassistant/speaker_id_enrollment_controller.cc index aa72cb0..03b2321 100644 --- a/chromeos/services/libassistant/speaker_id_enrollment_controller.cc +++ b/chromeos/ash/services/libassistant/speaker_id_enrollment_controller.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/speaker_id_enrollment_controller.h" +#include "chromeos/ash/services/libassistant/speaker_id_enrollment_controller.h" #include "base/scoped_observation.h" #include "chromeos/assistant/internal/libassistant/shared_headers.h"
diff --git a/chromeos/services/libassistant/speaker_id_enrollment_controller.h b/chromeos/ash/services/libassistant/speaker_id_enrollment_controller.h similarity index 87% rename from chromeos/services/libassistant/speaker_id_enrollment_controller.h rename to chromeos/ash/services/libassistant/speaker_id_enrollment_controller.h index 5f2e8b5c..faf51e9 100644 --- a/chromeos/services/libassistant/speaker_id_enrollment_controller.h +++ b/chromeos/ash/services/libassistant/speaker_id_enrollment_controller.h
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_SPEAKER_ID_ENROLLMENT_CONTROLLER_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_SPEAKER_ID_ENROLLMENT_CONTROLLER_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_SPEAKER_ID_ENROLLMENT_CONTROLLER_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_SPEAKER_ID_ENROLLMENT_CONTROLLER_H_ -#include "chromeos/services/libassistant/abortable_task_list.h" +#include "chromeos/ash/services/libassistant/abortable_task_list.h" #include "chromeos/services/libassistant/grpc/assistant_client_observer.h" #include "chromeos/services/libassistant/public/mojom/audio_input_controller.mojom-forward.h" #include "chromeos/services/libassistant/public/mojom/speaker_id_enrollment_controller.mojom.h" @@ -61,4 +61,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_SPEAKER_ID_ENROLLMENT_CONTROLLER_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_SPEAKER_ID_ENROLLMENT_CONTROLLER_H_
diff --git a/chromeos/services/libassistant/speaker_id_enrollment_controller_unittest.cc b/chromeos/ash/services/libassistant/speaker_id_enrollment_controller_unittest.cc similarity index 97% rename from chromeos/services/libassistant/speaker_id_enrollment_controller_unittest.cc rename to chromeos/ash/services/libassistant/speaker_id_enrollment_controller_unittest.cc index 0043ca7..f4841f5 100644 --- a/chromeos/services/libassistant/speaker_id_enrollment_controller_unittest.cc +++ b/chromeos/ash/services/libassistant/speaker_id_enrollment_controller_unittest.cc
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/speaker_id_enrollment_controller.h" +#include "chromeos/ash/services/libassistant/speaker_id_enrollment_controller.h" #include "base/test/mock_callback.h" #include "base/test/task_environment.h" +#include "chromeos/ash/services/libassistant/test_support/libassistant_service_tester.h" #include "chromeos/assistant/internal/libassistant/shared_headers.h" #include "chromeos/assistant/internal/test_support/fake_assistant_manager_internal.h" -#include "chromeos/services/libassistant/test_support/libassistant_service_tester.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/services/libassistant/speech_recognition_observer_unittest.cc b/chromeos/ash/services/libassistant/speech_recognition_observer_unittest.cc similarity index 96% rename from chromeos/services/libassistant/speech_recognition_observer_unittest.cc rename to chromeos/ash/services/libassistant/speech_recognition_observer_unittest.cc index 5220660..e34fcdb 100644 --- a/chromeos/services/libassistant/speech_recognition_observer_unittest.cc +++ b/chromeos/ash/services/libassistant/speech_recognition_observer_unittest.cc
@@ -3,14 +3,14 @@ // found in the LICENSE file. #include "base/test/task_environment.h" +#include "chromeos/ash/services/libassistant/libassistant_service.h" +#include "chromeos/ash/services/libassistant/test_support/libassistant_service_tester.h" #include "chromeos/assistant/internal/internal_util.h" #include "chromeos/assistant/internal/libassistant/shared_headers.h" #include "chromeos/assistant/internal/proto/assistant/display_connection.pb.h" #include "chromeos/assistant/internal/test_support/fake_assistant_manager.h" #include "chromeos/assistant/internal/test_support/fake_assistant_manager_internal.h" -#include "chromeos/services/libassistant/libassistant_service.h" #include "chromeos/services/libassistant/public/mojom/speech_recognition_observer.mojom.h" -#include "chromeos/services/libassistant/test_support/libassistant_service_tester.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/services/libassistant/system_provider_impl.cc b/chromeos/ash/services/libassistant/system_provider_impl.cc similarity index 94% rename from chromeos/services/libassistant/system_provider_impl.cc rename to chromeos/ash/services/libassistant/system_provider_impl.cc index 1f47f206..0a281d8 100644 --- a/chromeos/services/libassistant/system_provider_impl.cc +++ b/chromeos/ash/services/libassistant/system_provider_impl.cc
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/system_provider_impl.h" +#include "chromeos/ash/services/libassistant/system_provider_impl.h" #include <utility> #include "base/bind.h" #include "base/strings/string_util.h" #include "base/system/sys_info.h" -#include "chromeos/services/libassistant/power_manager_provider_impl.h" +#include "chromeos/ash/services/libassistant/power_manager_provider_impl.h" namespace chromeos { namespace libassistant {
diff --git a/chromeos/services/libassistant/system_provider_impl.h b/chromeos/ash/services/libassistant/system_provider_impl.h similarity index 91% rename from chromeos/services/libassistant/system_provider_impl.h rename to chromeos/ash/services/libassistant/system_provider_impl.h index 0bd7a683..d453f91 100644 --- a/chromeos/services/libassistant/system_provider_impl.h +++ b/chromeos/ash/services/libassistant/system_provider_impl.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_SYSTEM_PROVIDER_IMPL_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_SYSTEM_PROVIDER_IMPL_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_SYSTEM_PROVIDER_IMPL_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_SYSTEM_PROVIDER_IMPL_H_ #include <memory> #include <string> @@ -59,4 +59,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_SYSTEM_PROVIDER_IMPL_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_SYSTEM_PROVIDER_IMPL_H_
diff --git a/chromeos/services/libassistant/system_provider_impl_unittest.cc b/chromeos/ash/services/libassistant/system_provider_impl_unittest.cc similarity index 93% rename from chromeos/services/libassistant/system_provider_impl_unittest.cc rename to chromeos/ash/services/libassistant/system_provider_impl_unittest.cc index f27704c..9099ccd 100644 --- a/chromeos/services/libassistant/system_provider_impl_unittest.cc +++ b/chromeos/ash/services/libassistant/system_provider_impl_unittest.cc
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/system_provider_impl.h" +#include "chromeos/ash/services/libassistant/system_provider_impl.h" #include <memory> #include <utility> #include "base/test/task_environment.h" -#include "chromeos/services/libassistant/power_manager_provider_impl.h" -#include "chromeos/services/libassistant/test_support/fake_platform_delegate.h" +#include "chromeos/ash/services/libassistant/power_manager_provider_impl.h" +#include "chromeos/ash/services/libassistant/test_support/fake_platform_delegate.h" #include "mojo/public/cpp/bindings/receiver.h" #include "services/device/public/mojom/battery_monitor.mojom.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/services/libassistant/test_support/fake_assistant_client.cc b/chromeos/ash/services/libassistant/test_support/fake_assistant_client.cc similarity index 98% rename from chromeos/services/libassistant/test_support/fake_assistant_client.cc rename to chromeos/ash/services/libassistant/test_support/fake_assistant_client.cc index 4243bd1..861a1ec 100644 --- a/chromeos/services/libassistant/test_support/fake_assistant_client.cc +++ b/chromeos/ash/services/libassistant/test_support/fake_assistant_client.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/test_support/fake_assistant_client.h" +#include "chromeos/ash/services/libassistant/test_support/fake_assistant_client.h" #include "base/callback.h" #include "base/test/bind.h"
diff --git a/chromeos/services/libassistant/test_support/fake_assistant_client.h b/chromeos/ash/services/libassistant/test_support/fake_assistant_client.h similarity index 95% rename from chromeos/services/libassistant/test_support/fake_assistant_client.h rename to chromeos/ash/services/libassistant/test_support/fake_assistant_client.h index 3b9ccc3..96484e6 100644 --- a/chromeos/services/libassistant/test_support/fake_assistant_client.h +++ b/chromeos/ash/services/libassistant/test_support/fake_assistant_client.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_TEST_SUPPORT_FAKE_ASSISTANT_CLIENT_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_TEST_SUPPORT_FAKE_ASSISTANT_CLIENT_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_TEST_SUPPORT_FAKE_ASSISTANT_CLIENT_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_TEST_SUPPORT_FAKE_ASSISTANT_CLIENT_H_ #include "chromeos/assistant/internal/test_support/fake_assistant_manager.h" #include "chromeos/assistant/internal/test_support/fake_assistant_manager_internal.h" @@ -116,4 +116,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_TEST_SUPPORT_FAKE_ASSISTANT_CLIENT_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_TEST_SUPPORT_FAKE_ASSISTANT_CLIENT_H_
diff --git a/chromeos/services/libassistant/test_support/fake_libassistant_factory.cc b/chromeos/ash/services/libassistant/test_support/fake_libassistant_factory.cc similarity index 96% rename from chromeos/services/libassistant/test_support/fake_libassistant_factory.cc rename to chromeos/ash/services/libassistant/test_support/fake_libassistant_factory.cc index 747d3e5..0ad4b60c 100644 --- a/chromeos/services/libassistant/test_support/fake_libassistant_factory.cc +++ b/chromeos/ash/services/libassistant/test_support/fake_libassistant_factory.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/test_support/fake_libassistant_factory.h" +#include "chromeos/ash/services/libassistant/test_support/fake_libassistant_factory.h" #include "chromeos/assistant/internal/test_support/fake_assistant_manager.h" #include "chromeos/assistant/internal/test_support/fake_assistant_manager_internal.h"
diff --git a/chromeos/services/libassistant/test_support/fake_libassistant_factory.h b/chromeos/ash/services/libassistant/test_support/fake_libassistant_factory.h similarity index 82% rename from chromeos/services/libassistant/test_support/fake_libassistant_factory.h rename to chromeos/ash/services/libassistant/test_support/fake_libassistant_factory.h index 4d7e555..3fedb91 100644 --- a/chromeos/services/libassistant/test_support/fake_libassistant_factory.h +++ b/chromeos/ash/services/libassistant/test_support/fake_libassistant_factory.h
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_TEST_SUPPORT_FAKE_LIBASSISTANT_FACTORY_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_TEST_SUPPORT_FAKE_LIBASSISTANT_FACTORY_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_TEST_SUPPORT_FAKE_LIBASSISTANT_FACTORY_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_TEST_SUPPORT_FAKE_LIBASSISTANT_FACTORY_H_ -#include "chromeos/services/libassistant/libassistant_factory.h" +#include "chromeos/ash/services/libassistant/libassistant_factory.h" #include "base/component_export.h" @@ -48,4 +48,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_TEST_SUPPORT_FAKE_LIBASSISTANT_FACTORY_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_TEST_SUPPORT_FAKE_LIBASSISTANT_FACTORY_H_
diff --git a/chromeos/services/libassistant/test_support/fake_platform_delegate.cc b/chromeos/ash/services/libassistant/test_support/fake_platform_delegate.cc similarity index 91% rename from chromeos/services/libassistant/test_support/fake_platform_delegate.cc rename to chromeos/ash/services/libassistant/test_support/fake_platform_delegate.cc index 5efdd781..affe428 100644 --- a/chromeos/services/libassistant/test_support/fake_platform_delegate.cc +++ b/chromeos/ash/services/libassistant/test_support/fake_platform_delegate.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/test_support/fake_platform_delegate.h" +#include "chromeos/ash/services/libassistant/test_support/fake_platform_delegate.h" namespace chromeos { namespace assistant {
diff --git a/chromeos/services/libassistant/test_support/fake_platform_delegate.h b/chromeos/ash/services/libassistant/test_support/fake_platform_delegate.h similarity index 90% rename from chromeos/services/libassistant/test_support/fake_platform_delegate.h rename to chromeos/ash/services/libassistant/test_support/fake_platform_delegate.h index 60d4dfb7..307bec5 100644 --- a/chromeos/services/libassistant/test_support/fake_platform_delegate.h +++ b/chromeos/ash/services/libassistant/test_support/fake_platform_delegate.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_TEST_SUPPORT_FAKE_PLATFORM_DELEGATE_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_TEST_SUPPORT_FAKE_PLATFORM_DELEGATE_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_TEST_SUPPORT_FAKE_PLATFORM_DELEGATE_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_TEST_SUPPORT_FAKE_PLATFORM_DELEGATE_H_ #include "chromeos/services/libassistant/public/mojom/platform_delegate.mojom.h" @@ -66,4 +66,4 @@ } // namespace assistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_TEST_SUPPORT_FAKE_PLATFORM_DELEGATE_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_TEST_SUPPORT_FAKE_PLATFORM_DELEGATE_H_
diff --git a/chromeos/services/libassistant/test_support/libassistant_service_tester.cc b/chromeos/ash/services/libassistant/test_support/libassistant_service_tester.cc similarity index 94% rename from chromeos/services/libassistant/test_support/libassistant_service_tester.cc rename to chromeos/ash/services/libassistant/test_support/libassistant_service_tester.cc index 48d40e167..8976f50 100644 --- a/chromeos/services/libassistant/test_support/libassistant_service_tester.cc +++ b/chromeos/ash/services/libassistant/test_support/libassistant_service_tester.cc
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/test_support/libassistant_service_tester.h" +#include "chromeos/ash/services/libassistant/test_support/libassistant_service_tester.h" #include "base/base_paths.h" +#include "chromeos/ash/services/libassistant/service_controller.h" +#include "chromeos/ash/services/libassistant/test_support/fake_libassistant_factory.h" #include "chromeos/services/libassistant/public/mojom/notification_delegate.mojom-forward.h" -#include "chromeos/services/libassistant/service_controller.h" -#include "chromeos/services/libassistant/test_support/fake_libassistant_factory.h" #include "services/network/test/test_url_loader_factory.h" namespace chromeos {
diff --git a/chromeos/services/libassistant/test_support/libassistant_service_tester.h b/chromeos/ash/services/libassistant/test_support/libassistant_service_tester.h similarity index 92% rename from chromeos/services/libassistant/test_support/libassistant_service_tester.h rename to chromeos/ash/services/libassistant/test_support/libassistant_service_tester.h index 135d54a..84a268f 100644 --- a/chromeos/services/libassistant/test_support/libassistant_service_tester.h +++ b/chromeos/ash/services/libassistant/test_support/libassistant_service_tester.h
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_TEST_SUPPORT_LIBASSISTANT_SERVICE_TESTER_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_TEST_SUPPORT_LIBASSISTANT_SERVICE_TESTER_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_TEST_SUPPORT_LIBASSISTANT_SERVICE_TESTER_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_TEST_SUPPORT_LIBASSISTANT_SERVICE_TESTER_H_ #include "base/test/scoped_path_override.h" +#include "chromeos/ash/services/libassistant/libassistant_service.h" #include "chromeos/assistant/internal/test_support/fake_assistant_manager.h" #include "chromeos/assistant/internal/test_support/fake_assistant_manager_internal.h" -#include "chromeos/services/libassistant/libassistant_service.h" #include "chromeos/services/libassistant/public/mojom/audio_input_controller.mojom.h" #include "chromeos/services/libassistant/public/mojom/audio_output_delegate.mojom-forward.h" #include "chromeos/services/libassistant/public/mojom/conversation_controller.mojom.h" @@ -98,4 +98,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_TEST_SUPPORT_LIBASSISTANT_SERVICE_TESTER_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_TEST_SUPPORT_LIBASSISTANT_SERVICE_TESTER_H_
diff --git a/chromeos/services/libassistant/timer_controller.cc b/chromeos/ash/services/libassistant/timer_controller.cc similarity index 98% rename from chromeos/services/libassistant/timer_controller.cc rename to chromeos/ash/services/libassistant/timer_controller.cc index b1125dac..667a29e 100644 --- a/chromeos/services/libassistant/timer_controller.cc +++ b/chromeos/ash/services/libassistant/timer_controller.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/timer_controller.h" +#include "chromeos/ash/services/libassistant/timer_controller.h" #include "base/thread_annotations.h" #include "build/buildflag.h"
diff --git a/chromeos/services/libassistant/timer_controller.h b/chromeos/ash/services/libassistant/timer_controller.h similarity index 90% rename from chromeos/services/libassistant/timer_controller.h rename to chromeos/ash/services/libassistant/timer_controller.h index d2a3eb7..31421e7 100644 --- a/chromeos/services/libassistant/timer_controller.h +++ b/chromeos/ash/services/libassistant/timer_controller.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_TIMER_CONTROLLER_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_TIMER_CONTROLLER_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_TIMER_CONTROLLER_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_TIMER_CONTROLLER_H_ #include <string> @@ -54,4 +54,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_TIMER_CONTROLLER_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_TIMER_CONTROLLER_H_
diff --git a/chromeos/services/libassistant/timer_controller_unittest.cc b/chromeos/ash/services/libassistant/timer_controller_unittest.cc similarity index 97% rename from chromeos/services/libassistant/timer_controller_unittest.cc rename to chromeos/ash/services/libassistant/timer_controller_unittest.cc index 5f8bd6b..8ac0cf40 100644 --- a/chromeos/services/libassistant/timer_controller_unittest.cc +++ b/chromeos/ash/services/libassistant/timer_controller_unittest.cc
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/timer_controller.h" +#include "chromeos/ash/services/libassistant/timer_controller.h" #include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" #include "chromeos/ash/services/assistant/public/cpp/features.h" +#include "chromeos/ash/services/libassistant/test_support/fake_assistant_client.h" #include "chromeos/assistant/internal/libassistant/shared_headers.h" #include "chromeos/assistant/internal/test_support/fake_alarm_timer_manager.h" #include "chromeos/assistant/internal/test_support/fake_assistant_manager.h" #include "chromeos/services/libassistant/public/mojom/timer_controller.mojom-forward.h" -#include "chromeos/services/libassistant/test_support/fake_assistant_client.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/services/libassistant/util.cc b/chromeos/ash/services/libassistant/util.cc similarity index 99% rename from chromeos/services/libassistant/util.cc rename to chromeos/ash/services/libassistant/util.cc index ff2792b..e5c333d7 100644 --- a/chromeos/services/libassistant/util.cc +++ b/chromeos/ash/services/libassistant/util.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/libassistant/util.h" +#include "chromeos/ash/services/libassistant/util.h" #include "base/command_line.h" #include "base/files/file_util.h" @@ -15,10 +15,10 @@ #include "chromeos/ash/components/assistant/buildflags.h" #include "chromeos/ash/services/assistant/public/cpp/features.h" #include "chromeos/ash/services/assistant/public/cpp/switches.h" +#include "chromeos/ash/services/libassistant/constants.h" #include "chromeos/assistant/internal/internal_constants.h" #include "chromeos/assistant/internal/internal_util.h" #include "chromeos/assistant/internal/util_headers.h" -#include "chromeos/services/libassistant/constants.h" #include "chromeos/services/libassistant/public/cpp/android_app_info.h" #include "chromeos/version/version_loader.h"
diff --git a/chromeos/services/libassistant/util.h b/chromeos/ash/services/libassistant/util.h similarity index 93% rename from chromeos/services/libassistant/util.h rename to chromeos/ash/services/libassistant/util.h index 61ab09c..65ee57a 100644 --- a/chromeos/services/libassistant/util.h +++ b/chromeos/ash/services/libassistant/util.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_LIBASSISTANT_UTIL_H_ -#define CHROMEOS_SERVICES_LIBASSISTANT_UTIL_H_ +#ifndef CHROMEOS_ASH_SERVICES_LIBASSISTANT_UTIL_H_ +#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_UTIL_H_ #include <string> @@ -77,4 +77,4 @@ } // namespace libassistant } // namespace chromeos -#endif // CHROMEOS_SERVICES_LIBASSISTANT_UTIL_H_ +#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_UTIL_H_
diff --git a/chromeos/dbus/constants/BUILD.gn b/chromeos/dbus/constants/BUILD.gn index c61bb40..54e447c8 100644 --- a/chromeos/dbus/constants/BUILD.gn +++ b/chromeos/dbus/constants/BUILD.gn
@@ -9,10 +9,6 @@ defines = [ "IS_CHROMEOS_DBUS_CONSTANTS_IMPL" ] deps = [ "//base" ] sources = [ - "attestation_constants.cc", - "attestation_constants.h", - "cryptohome_key_delegate_constants.cc", - "cryptohome_key_delegate_constants.h", "dbus_paths.cc", "dbus_paths.h", "dbus_switches.cc",
diff --git a/chromeos/services/BUILD.gn b/chromeos/services/BUILD.gn index ca5e251..3248e2e8 100644 --- a/chromeos/services/BUILD.gn +++ b/chromeos/services/BUILD.gn
@@ -27,9 +27,6 @@ ] if (enable_cros_libassistant) { - deps += [ - "//chromeos/services/libassistant:unit_tests", - "//chromeos/services/libassistant/grpc:unit_tests", - ] + deps += [ "//chromeos/services/libassistant/grpc:unit_tests" ] } }
diff --git a/chromeos/services/libassistant/grpc/BUILD.gn b/chromeos/services/libassistant/grpc/BUILD.gn index e1ae1d21..2e0dc0b 100644 --- a/chromeos/services/libassistant/grpc/BUILD.gn +++ b/chromeos/services/libassistant/grpc/BUILD.gn
@@ -22,11 +22,11 @@ deps = [ ":grpc_service", ":libassistant_client", - "../:callback_utils", "external_services:grpc_services_initializer", "external_services:grpc_services_observer", "//base", "//chromeos/ash/services/assistant/public/cpp", + "//chromeos/ash/services/libassistant:callback_utils", "//chromeos/assistant/internal", "//chromeos/assistant/internal:libassistant_shared_headers", ]
diff --git a/chromeos/services/libassistant/grpc/assistant_client_impl.cc b/chromeos/services/libassistant/grpc/assistant_client_impl.cc index b77853db..9c6e9928 100644 --- a/chromeos/services/libassistant/grpc/assistant_client_impl.cc +++ b/chromeos/services/libassistant/grpc/assistant_client_impl.cc
@@ -14,6 +14,7 @@ #include "base/notreached.h" #include "base/threading/sequenced_task_runner_handle.h" #include "chromeos/ash/services/assistant/public/cpp/features.h" +#include "chromeos/ash/services/libassistant/callback_utils.h" #include "chromeos/assistant/internal/grpc_transport/request_utils.h" #include "chromeos/assistant/internal/internal_constants.h" #include "chromeos/assistant/internal/internal_util.h" @@ -26,7 +27,6 @@ #include "chromeos/assistant/internal/proto/shared/proto/v2/experiment_interface.pb.h" #include "chromeos/assistant/internal/proto/shared/proto/v2/query_interface.pb.h" #include "chromeos/assistant/internal/proto/shared/proto/v2/speaker_id_enrollment_interface.pb.h" -#include "chromeos/services/libassistant/callback_utils.h" #include "chromeos/services/libassistant/grpc/assistant_client_v1.h" #include "chromeos/services/libassistant/grpc/external_services/action_service.h" #include "chromeos/services/libassistant/grpc/grpc_libassistant_client.h"
diff --git a/chromeos/services/libassistant/grpc/assistant_client_v1.cc b/chromeos/services/libassistant/grpc/assistant_client_v1.cc index 4abf0b7..e58fa44 100644 --- a/chromeos/services/libassistant/grpc/assistant_client_v1.cc +++ b/chromeos/services/libassistant/grpc/assistant_client_v1.cc
@@ -14,6 +14,7 @@ #include "base/synchronization/lock.h" #include "base/time/time.h" #include "chromeos/ash/services/assistant/public/cpp/features.h" +#include "chromeos/ash/services/libassistant/callback_utils.h" #include "chromeos/assistant/internal/grpc_transport/request_utils.h" #include "chromeos/assistant/internal/internal_util.h" #include "chromeos/assistant/internal/libassistant/shared_headers.h" @@ -26,7 +27,6 @@ #include "chromeos/assistant/internal/proto/shared/proto/v2/display_interface.pb.h" #include "chromeos/assistant/internal/proto/shared/proto/v2/speaker_id_enrollment_event.pb.h" #include "chromeos/assistant/internal/proto/shared/proto/v2/speaker_id_enrollment_interface.pb.h" -#include "chromeos/services/libassistant/callback_utils.h" #include "chromeos/services/libassistant/grpc/assistant_client.h" #include "chromeos/services/libassistant/grpc/utils/media_status_utils.h" #include "chromeos/services/libassistant/grpc/utils/settings_utils.h"
diff --git a/chromeos/services/libassistant/grpc/external_services/BUILD.gn b/chromeos/services/libassistant/grpc/external_services/BUILD.gn index 1402847..9f6920ba 100644 --- a/chromeos/services/libassistant/grpc/external_services/BUILD.gn +++ b/chromeos/services/libassistant/grpc/external_services/BUILD.gn
@@ -19,9 +19,9 @@ ":grpc_services_observer", ":heartbeat_event_handler_driver", "//base", + "//chromeos/ash/services/libassistant:callback_utils", "//chromeos/assistant/internal", "//chromeos/assistant/internal:libassistant_shared_headers", - "//chromeos/services/libassistant:callback_utils", "//chromeos/services/libassistant/grpc:grpc_client", "//chromeos/services/libassistant/grpc:grpc_service", "//chromeos/services/libassistant/grpc:grpc_util",
diff --git a/chromeos/services/libassistant/grpc/external_services/action_service.cc b/chromeos/services/libassistant/grpc/external_services/action_service.cc index 80c7c72..b27cf5f7 100644 --- a/chromeos/services/libassistant/grpc/external_services/action_service.cc +++ b/chromeos/services/libassistant/grpc/external_services/action_service.cc
@@ -6,9 +6,9 @@ #include "base/memory/ptr_util.h" #include "base/strings/string_number_conversions.h" +#include "chromeos/ash/services/libassistant/callback_utils.h" #include "chromeos/assistant/internal/grpc_transport/request_utils.h" #include "chromeos/assistant/internal/internal_constants.h" -#include "chromeos/services/libassistant/callback_utils.h" #include "chromeos/services/libassistant/grpc/external_services/action_args.h" #include "chromeos/services/libassistant/grpc/grpc_libassistant_client.h"
diff --git a/components/autofill_assistant/OWNERS b/components/autofill_assistant/OWNERS index d66751d..65b54ce 100644 --- a/components/autofill_assistant/OWNERS +++ b/components/autofill_assistant/OWNERS
@@ -2,3 +2,4 @@ arbesser@google.com fga@google.com hluca@google.com +sergiovila@google.com
diff --git a/components/cast_channel/cast_socket.h b/components/cast_channel/cast_socket.h index f3d0c88a..53f4da04 100644 --- a/components/cast_channel/cast_socket.h +++ b/components/cast_channel/cast_socket.h
@@ -22,6 +22,7 @@ #include "components/cast_channel/cast_channel_enum.h" #include "components/cast_channel/cast_transport.h" #include "mojo/public/cpp/bindings/remote.h" +#include "mojo/public/cpp/system/data_pipe.h" #include "net/base/completion_once_callback.h" #include "net/base/io_buffer.h" #include "net/base/ip_endpoint.h"
diff --git a/components/chromeos_camera/OWNERS b/components/chromeos_camera/OWNERS index cb465fc..ad7c16eb 100644 --- a/components/chromeos_camera/OWNERS +++ b/components/chromeos_camera/OWNERS
@@ -3,5 +3,4 @@ wtlee@chromium.org # Chromium-specific owners -chfremer@chromium.org mcasas@chromium.org
diff --git a/components/gcm_driver/android/OWNERS b/components/gcm_driver/android/OWNERS index 69b0ace..02b971fe 100644 --- a/components/gcm_driver/android/OWNERS +++ b/components/gcm_driver/android/OWNERS
@@ -1,2 +1 @@ -johnme@chromium.org mvanouwerkerk@chromium.org
diff --git a/components/grpc_support/OWNERS b/components/grpc_support/OWNERS index cbf0090..fb59c70 100644 --- a/components/grpc_support/OWNERS +++ b/components/grpc_support/OWNERS
@@ -1,3 +1 @@ -gcasto@chromium.org -xyzzyz@chromium.org file://net/OWNERS
diff --git a/components/sync/base/model_type.cc b/components/sync/base/model_type.cc index e5b636a..55b59d9c 100644 --- a/components/sync/base/model_type.cc +++ b/components/sync/base/model_type.cc
@@ -166,6 +166,9 @@ "printers_authorization_servers", "Printers Authorization Servers", sync_pb::EntitySpecifics::kPrintersAuthorizationServerFieldNumber, ModelTypeForHistograms::kPrintersAuthorizationServers}, + {CONTACT_INFO, "CONTACT_INFO", "contact_info", "Contact Info", + sync_pb::EntitySpecifics::kContactInfoFieldNumber, + ModelTypeForHistograms::kContactInfo}, // ---- Proxy types ---- {PROXY_TABS, "", "", "Proxy tabs", -1, ModelTypeForHistograms::kProxyTabs}, // ---- Control Types ---- @@ -177,11 +180,11 @@ static_assert(std::size(kModelTypeInfoMap) == GetNumModelTypes(), "kModelTypeInfoMap should have GetNumModelTypes() elements"); -static_assert(40 == syncer::GetNumModelTypes(), +static_assert(41 == syncer::GetNumModelTypes(), "When adding a new type, update enum SyncModelTypes in enums.xml " "and suffix SyncModelType in histograms.xml."); -static_assert(40 == syncer::GetNumModelTypes(), +static_assert(41 == syncer::GetNumModelTypes(), "When adding a new type, update kAllocatorDumpNameAllowlist in " "base/trace_event/memory_infra_background_allowlist.cc."); @@ -309,6 +312,9 @@ case HISTORY: specifics->mutable_history(); break; + case CONTACT_INFO: + specifics->mutable_contact_info(); + break; } } @@ -328,7 +334,7 @@ } ModelType GetModelTypeFromSpecifics(const sync_pb::EntitySpecifics& specifics) { - static_assert(40 == syncer::GetNumModelTypes(), + static_assert(41 == syncer::GetNumModelTypes(), "When adding new protocol types, the following type lookup " "logic must be updated."); if (specifics.has_bookmark()) @@ -407,6 +413,8 @@ return HISTORY; if (specifics.has_printers_authorization_server()) return PRINTERS_AUTHORIZATION_SERVERS; + if (specifics.has_contact_info()) + return CONTACT_INFO; // This client version doesn't understand |specifics|. DVLOG(1) << "Unknown datatype in sync proto."; @@ -414,13 +422,15 @@ } ModelTypeSet EncryptableUserTypes() { - static_assert(40 == syncer::GetNumModelTypes(), + static_assert(41 == syncer::GetNumModelTypes(), "If adding an unencryptable type, remove from " "encryptable_user_types below."); ModelTypeSet encryptable_user_types = UserTypes(); // Wallet data is not encrypted since it actually originates on the server. encryptable_user_types.Remove(AUTOFILL_WALLET_DATA); encryptable_user_types.Remove(AUTOFILL_WALLET_OFFER); + // Similarly, contact info is not encrypted since it originates on the server. + encryptable_user_types.Remove(CONTACT_INFO); // Commit-only types are never encrypted since they are consumed server-side. encryptable_user_types.RemoveAll(CommitOnlyTypes()); // Other types that are never encrypted because consumed server-side.
diff --git a/components/sync/base/model_type.h b/components/sync/base/model_type.h index 29a038f..a16cda1 100644 --- a/components/sync/base/model_type.h +++ b/components/sync/base/model_type.h
@@ -138,6 +138,8 @@ HISTORY, // Trusted Authorization Servers for printers. ChromeOS only. PRINTERS_AUTHORIZATION_SERVERS, + // Contact information from the Google Address Storage. + CONTACT_INFO, // Proxy types are excluded from the sync protocol, but are still considered // real user types. By convention, we prefix them with 'PROXY_' to distinguish @@ -236,7 +238,8 @@ kWorkspaceDesk = 50, kHistory = 51, kPrintersAuthorizationServers = 52, - kMaxValue = kPrintersAuthorizationServers + kContactInfo = 53, + kMaxValue = kContactInfo }; // Used to mark the type of EntitySpecifics that has no actual data. @@ -259,7 +262,7 @@ ARC_PACKAGE, PRINTERS, READING_LIST, USER_EVENTS, NIGORI, USER_CONSENTS, SEND_TAB_TO_SELF, SECURITY_EVENTS, WEB_APPS, WIFI_CONFIGURATIONS, OS_PREFERENCES, OS_PRIORITY_PREFERENCES, SHARING_MESSAGE, WORKSPACE_DESK, - HISTORY, PRINTERS_AUTHORIZATION_SERVERS); + HISTORY, PRINTERS_AUTHORIZATION_SERVERS, CONTACT_INFO); } // These are the normal user-controlled types. This is to distinguish from
diff --git a/components/sync/base/user_selectable_type.cc b/components/sync/base/user_selectable_type.cc index 070ec2e..89a0e6e 100644 --- a/components/sync/base/user_selectable_type.cc +++ b/components/sync/base/user_selectable_type.cc
@@ -39,7 +39,7 @@ constexpr char kWifiConfigurationsTypeName[] = "wifiConfigurations"; UserSelectableTypeInfo GetUserSelectableTypeInfo(UserSelectableType type) { - static_assert(40 == syncer::GetNumModelTypes(), + static_assert(41 == syncer::GetNumModelTypes(), "Almost always when adding a new ModelType, you must tie it to " "a UserSelectableType below (new or existing) so the user can " "disable syncing of that data. Today you must also update the " @@ -74,7 +74,7 @@ return {kAutofillTypeName, AUTOFILL, {AUTOFILL, AUTOFILL_PROFILE, AUTOFILL_WALLET_DATA, - AUTOFILL_WALLET_METADATA, AUTOFILL_WALLET_OFFER}}; + AUTOFILL_WALLET_METADATA, AUTOFILL_WALLET_OFFER, CONTACT_INFO}}; case UserSelectableType::kThemes: return {kThemesTypeName, THEMES, {THEMES}}; case UserSelectableType::kHistory:
diff --git a/components/sync/driver/sync_user_settings_impl.cc b/components/sync/driver/sync_user_settings_impl.cc index 3464152..7b76ede 100644 --- a/components/sync/driver/sync_user_settings_impl.cc +++ b/components/sync/driver/sync_user_settings_impl.cc
@@ -274,7 +274,7 @@ #endif types.RetainAll(registered_model_types_); - static_assert(40 == GetNumModelTypes(), + static_assert(41 == GetNumModelTypes(), "If adding a new sync data type, update the list below below if" " you want to disable the new data type for local sync."); types.PutAll(ControlTypes());
diff --git a/components/sync/engine/cycle/data_type_tracker.cc b/components/sync/engine/cycle/data_type_tracker.cc index 350938b..e45fe53b 100644 --- a/components/sync/engine/cycle/data_type_tracker.cc +++ b/components/sync/engine/cycle/data_type_tracker.cc
@@ -69,6 +69,7 @@ case AUTOFILL_WALLET_DATA: case AUTOFILL_WALLET_METADATA: case AUTOFILL_WALLET_OFFER: + case CONTACT_INFO: case THEMES: case TYPED_URLS: case EXTENSIONS: @@ -118,6 +119,7 @@ case PASSWORDS: // chrome.browsingData API. case AUTOFILL: // chrome.browsingData API. case AUTOFILL_PROFILE: // chrome.browsingData API. + case CONTACT_INFO: // chrome.browsingData API. // All the remaining types are not affected by any extension js API. case USER_EVENTS: case SESSIONS:
diff --git a/components/sync/nigori/nigori_state.cc b/components/sync/nigori/nigori_state.cc index 3511e1e..107490fa 100644 --- a/components/sync/nigori/nigori_state.cc +++ b/components/sync/nigori/nigori_state.cc
@@ -64,7 +64,7 @@ void UpdateNigoriSpecificsFromEncryptedTypes( ModelTypeSet encrypted_types, sync_pb::NigoriSpecifics* specifics) { - static_assert(40 == GetNumModelTypes(), + static_assert(41 == GetNumModelTypes(), "If adding an encryptable type, update handling below."); specifics->set_encrypt_bookmarks(encrypted_types.Has(BOOKMARKS)); specifics->set_encrypt_preferences(encrypted_types.Has(PREFERENCES));
diff --git a/components/sync/protocol/proto_value_conversions_unittest.cc b/components/sync/protocol/proto_value_conversions_unittest.cc index 89b707d..d194c20 100644 --- a/components/sync/protocol/proto_value_conversions_unittest.cc +++ b/components/sync/protocol/proto_value_conversions_unittest.cc
@@ -62,7 +62,7 @@ DEFINE_SPECIFICS_TO_VALUE_TEST(encrypted) -static_assert(40 == syncer::GetNumModelTypes(), +static_assert(41 == syncer::GetNumModelTypes(), "When adding a new field, add a DEFINE_SPECIFICS_TO_VALUE_TEST " "for your field below, and optionally a test for the specific " "conversions.");
diff --git a/components/sync/protocol/proto_visitors.h b/components/sync/protocol/proto_visitors.h index ef57381d..f8f574c 100644 --- a/components/sync/protocol/proto_visitors.h +++ b/components/sync/protocol/proto_visitors.h
@@ -534,7 +534,7 @@ } VISIT_PROTO_FIELDS(const sync_pb::EntitySpecifics& proto) { - static_assert(40 == GetNumModelTypes(), + static_assert(41 == GetNumModelTypes(), "When adding a new protocol type, you will likely need to add " "it here as well."); VISIT(encrypted);
diff --git a/components/unified_consent/OWNERS b/components/unified_consent/OWNERS index c71e983..fd467bd 100644 --- a/components/unified_consent/OWNERS +++ b/components/unified_consent/OWNERS
@@ -1,2 +1 @@ msarda@chromium.org -tangltom@chromium.org
diff --git a/content/browser/back_forward_cache_browsertest.h b/content/browser/back_forward_cache_browsertest.h index 83a8724..9e35467 100644 --- a/content/browser/back_forward_cache_browsertest.h +++ b/content/browser/back_forward_cache_browsertest.h
@@ -23,6 +23,7 @@ #include "content/public/test/content_mock_cert_verifier.h" #include "content/test/content_browser_test_utils_internal.h" #include "testing/gmock/include/gmock/gmock.h" +#include "third_party/blink/public/mojom/back_forward_cache_not_restored_reasons.mojom-blink.h" namespace content { @@ -142,6 +143,21 @@ MatchesDocumentResult(testing::Matcher<NotRestoredReasons> not_stored, BlockListedFeatures block_listed); + using ReasonsMatcher = testing::Matcher< + const blink::mojom::BackForwardCacheNotRestoredReasonsPtr&>; + using SameOriginMatcher = testing::Matcher< + const blink::mojom::SameOriginBfcacheNotRestoredDetailsPtr&>; + ReasonsMatcher MatchesNotRestoredReasons( + const testing::Matcher<bool>& blocked, + const SameOriginMatcher* same_origin_details); + SameOriginMatcher MatchesSameOriginDetails( + const testing::Matcher<std::string>& id, + const testing::Matcher<std::string>& name, + const testing::Matcher<std::string>& src, + const testing::Matcher<std::string>& url, + const std::vector<testing::Matcher<std::string>>& reasons, + const std::vector<ReasonsMatcher>& children); + // Access the tree result of NotRestoredReason for the last main frame // navigation. BackForwardCacheCanStoreTreeResult* GetTreeResult() {
diff --git a/content/browser/back_forward_cache_not_restored_reasons_browsertest.cc b/content/browser/back_forward_cache_not_restored_reasons_browsertest.cc new file mode 100644 index 0000000..5397415c --- /dev/null +++ b/content/browser/back_forward_cache_not_restored_reasons_browsertest.cc
@@ -0,0 +1,312 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/back_forward_cache_browsertest.h" + +#include "content/browser/renderer_host/navigation_request.h" +#include "content/browser/web_contents/web_contents_impl.h" +#include "content/public/test/browser_test.h" +#include "content/public/test/content_browser_test_utils.h" +#include "content/public/test/test_navigation_observer.h" +#include "content/shell/browser/shell.h" +#include "third_party/blink/public/common/features.h" +#include "third_party/blink/public/mojom/back_forward_cache_not_restored_reasons.mojom-blink.h" +namespace content { +using NotRestoredReason = BackForwardCacheMetrics::NotRestoredReason; +using NotRestoredReasons = + BackForwardCacheCanStoreDocumentResult::NotRestoredReasons; + +class BackForwardCacheBrowserTestWithNotRestoredReasons + : public BackForwardCacheBrowserTest { + protected: + void SetUpCommandLine(base::CommandLine* command_line) override { + EnableFeatureAndSetParams( + blink::features::kBackForwardCacheSendNotRestoredReasons, "", ""); + BackForwardCacheBrowserTest::SetUpCommandLine(command_line); + } +}; + +using ReasonsMatcher = testing::Matcher< + const blink::mojom::BackForwardCacheNotRestoredReasonsPtr&>; +using SameOriginMatcher = testing::Matcher< + const blink::mojom::SameOriginBfcacheNotRestoredDetailsPtr&>; +ReasonsMatcher BackForwardCacheBrowserTest::MatchesNotRestoredReasons( + const testing::Matcher<bool>& blocked, + const SameOriginMatcher* same_origin_details) { + return testing::Pointee(testing::AllOf( + testing::Field("blocked", + &blink::mojom::BackForwardCacheNotRestoredReasons::blocked, + blocked), + testing::Field( + "same_origin_details", + &blink::mojom::BackForwardCacheNotRestoredReasons:: + same_origin_details, + same_origin_details + ? *same_origin_details + : testing::Property( + "is_null", + &blink::mojom::SameOriginBfcacheNotRestoredDetailsPtr:: + is_null, + true)))); +} + +SameOriginMatcher BackForwardCacheBrowserTest::MatchesSameOriginDetails( + const testing::Matcher<std::string>& id, + const testing::Matcher<std::string>& name, + const testing::Matcher<std::string>& src, + const testing::Matcher<std::string>& url, + const std::vector<testing::Matcher<std::string>>& reasons, + const std::vector<ReasonsMatcher>& children) { + return testing::Pointee(testing::AllOf( + testing::Field( + "id", &blink::mojom::SameOriginBfcacheNotRestoredDetails::id, id), + testing::Field("name", + &blink::mojom::SameOriginBfcacheNotRestoredDetails::name, + name), + testing::Field( + "src", &blink::mojom::SameOriginBfcacheNotRestoredDetails::src, src), + testing::Field( + "url", &blink::mojom::SameOriginBfcacheNotRestoredDetails::url, url), + testing::Field( + "reasons", + &blink::mojom::SameOriginBfcacheNotRestoredDetails::reasons, + testing::UnorderedElementsAreArray(reasons)), + testing::Field( + "children", + &blink::mojom::SameOriginBfcacheNotRestoredDetails::children, + testing::ElementsAreArray(children)))); +} + +// NotRestoredReasons are not reported when the page is successfully restored +// from back/forward cache. +IN_PROC_BROWSER_TEST_F(BackForwardCacheBrowserTestWithNotRestoredReasons, + NotReportedWhenRestored) { + ASSERT_TRUE(embedded_test_server()->Start()); + GURL url_a(embedded_test_server()->GetURL("a.com", "/title1.html")); + GURL url_b(embedded_test_server()->GetURL("b.com", "/title1.html")); + // 1) Navigate to A. + ASSERT_TRUE(NavigateToURL(shell(), url_a)); + RenderFrameHostImplWrapper rfh_a(current_frame_host()); + + // 2) Navigate to B. + ASSERT_TRUE(NavigateToURL(shell(), url_b)); + + // 3) Navigate back. + ASSERT_TRUE(HistoryGoBack(web_contents())); + ExpectRestored(FROM_HERE); + // Expect that NotRestoredReasons are not reported at all. + EXPECT_TRUE(current_frame_host()->NotRestoredReasonsForTesting().is_null()); +} + +// NotRestoredReasons are reset after each navigation. +IN_PROC_BROWSER_TEST_F(BackForwardCacheBrowserTestWithNotRestoredReasons, + ReasonsResetForEachNavigation) { + ASSERT_TRUE(embedded_test_server()->Start()); + GURL url_a(embedded_test_server()->GetURL("a.com", "/title1.html")); + GURL url_b(embedded_test_server()->GetURL("b.com", "/title1.html")); + // 1) Navigate to A and use dummy blocking feature. + ASSERT_TRUE(NavigateToURL(shell(), url_a)); + RenderFrameHostImplWrapper rfh_a(current_frame_host()); + rfh_a->UseDummyStickyBackForwardCacheDisablingFeatureForTesting(); + std::string rfh_a_url = rfh_a->GetLastCommittedURL().spec(); + + // 2) Navigate to B. + ASSERT_TRUE(NavigateToURL(shell(), url_b)); + RenderFrameHostImplWrapper rfh_b(current_frame_host()); + + // 3) Navigate back. + ASSERT_TRUE(HistoryGoBack(web_contents())); + ExpectNotRestored({NotRestoredReason::kBlocklistedFeatures}, + {blink::scheduler::WebSchedulerTrackedFeature::kDummy}, {}, + {}, {}, FROM_HERE); + // Expect that NotRestoredReasons are reported. + auto rfh_a_details = MatchesSameOriginDetails( + /*id=*/"", /*name=*/"", /*src=*/"", + /*url=*/rfh_a_url, /*reasons=*/{"Dummy for testing"}, /*children=*/{}); + auto rfh_a_result = MatchesNotRestoredReasons( + /*blocked=*/true, &rfh_a_details); + EXPECT_THAT(current_frame_host()->NotRestoredReasonsForTesting(), + rfh_a_result); + EXPECT_TRUE(rfh_b->IsInBackForwardCache()); + + // 4) Navigate forward. + ASSERT_TRUE(HistoryGoForward(web_contents())); + ExpectRestored(FROM_HERE); + // Expect that NotRestoredReasons are not reported at all. + EXPECT_TRUE(current_frame_host()->NotRestoredReasonsForTesting().is_null()); +} + +// Frame attributes are only reported when the document is same origin with main +// document. Also test that the details for cross-origin subtree are masked. +IN_PROC_BROWSER_TEST_F(BackForwardCacheBrowserTestWithNotRestoredReasons, + FrameAttributesAreReportedIfSameOrigin) { + ASSERT_TRUE(embedded_test_server()->Start()); + GURL url_a(embedded_test_server()->GetURL( + "a.com", "/cross_site_iframe_factory.html?a(a,b(a))")); + GURL url_c(embedded_test_server()->GetURL("c.com", "/title1.html")); + // 1) Navigate to A(A,B(A)). + ASSERT_TRUE(NavigateToURL(shell(), url_a)); + // rfh_a_1(rfh_a_2,rfh_b(rfh_a_3)) + RenderFrameHostImplWrapper rfh_a_1(current_frame_host()); + RenderFrameHostImplWrapper rfh_a_2( + rfh_a_1->child_at(0)->current_frame_host()); + RenderFrameHostImplWrapper rfh_b(rfh_a_1->child_at(1)->current_frame_host()); + RenderFrameHostImplWrapper rfh_a_3(rfh_b->child_at(0)->current_frame_host()); + std::string rfh_a_1_url = rfh_a_1->GetLastCommittedURL().spec(); + std::string rfh_a_2_url = rfh_a_2->GetLastCommittedURL().spec(); + + rfh_a_3->UseDummyStickyBackForwardCacheDisablingFeatureForTesting(); + + // cross_site_iframe_factory.html gives frames ids but they are not globally + // unique, so replace them with unique ids so that there will be no + // duplicates. + EXPECT_TRUE(ExecJs(rfh_a_1.get(), R"( + let frames = document.getElementsByTagName('iframe'); + frames[0].id = 'rfh_a_2_id'; + frames[0].name = 'rfh_a_2_name'; + frames[1].id = 'rfh_b_id'; + frames[1].name = 'rfh_b_name'; + )")); + // 2) Navigate to C. + ASSERT_TRUE(NavigateToURL(shell(), url_c)); + + // 3) Navigate back. + ASSERT_TRUE(HistoryGoBack(web_contents())); + ExpectNotRestored({NotRestoredReason::kBlocklistedFeatures}, + {blink::scheduler::WebSchedulerTrackedFeature::kDummy}, {}, + {}, {}, FROM_HERE); + + // Expect that id and name are masked for |rfh_b|, but reported for |rfh_a_2|. + // Note that |rfh_a_3| is masked because it's a child of |rfh_b|. + auto rfh_a_2_details = MatchesSameOriginDetails( + /*id=*/"rfh_a_2_id", /*name=*/"rfh_a_2_name", /*src=*/rfh_a_2_url, + /*url=*/rfh_a_2_url, /*reasons=*/{}, /*children=*/{}); + auto rfh_b_result = MatchesNotRestoredReasons( + /*blocked=*/true, nullptr); + auto rfh_a_2_result = MatchesNotRestoredReasons( + /*blocked=*/false, &rfh_a_2_details); + auto rfh_a_1_details = MatchesSameOriginDetails( + /*id=*/"", /*name=*/"", /*src=*/"", /*url=*/rfh_a_1_url, + /*reasons=*/{}, + /*children=*/{rfh_a_2_result, rfh_b_result}); + auto rfh_a_1_result = MatchesNotRestoredReasons( + /*blocked=*/false, &rfh_a_1_details); + + EXPECT_THAT(current_frame_host()->NotRestoredReasonsForTesting(), + rfh_a_1_result); +} + +// All the blocking reasons should be reported including subframes'. +IN_PROC_BROWSER_TEST_F(BackForwardCacheBrowserTestWithNotRestoredReasons, + AllBlockingFramesAreReported) { + ASSERT_TRUE(embedded_test_server()->Start()); + GURL url_a(embedded_test_server()->GetURL( + "a.com", "/cross_site_iframe_factory.html?a(a,a(a))")); + GURL url_b(embedded_test_server()->GetURL("b.com", "/title1.html")); + // 1) Navigate to A(A,A(A)) and use dummy blocking feature in the main frame + // and subframes. + ASSERT_TRUE(NavigateToURL(shell(), url_a)); + // rfh_a_1(rfh_a_2, rfh_a_3(rfh_a_4)) + RenderFrameHostImplWrapper rfh_a_1(current_frame_host()); + RenderFrameHostImplWrapper rfh_a_2( + rfh_a_1->child_at(0)->current_frame_host()); + RenderFrameHostImplWrapper rfh_a_3( + rfh_a_1->child_at(1)->current_frame_host()); + RenderFrameHostImplWrapper rfh_a_4( + rfh_a_3->child_at(0)->current_frame_host()); + std::string rfh_a_1_url = rfh_a_1->GetLastCommittedURL().spec(); + std::string rfh_a_2_url = rfh_a_2->GetLastCommittedURL().spec(); + std::string rfh_a_3_url = rfh_a_3->GetLastCommittedURL().spec(); + std::string rfh_a_4_url = rfh_a_4->GetLastCommittedURL().spec(); + + rfh_a_1->UseDummyStickyBackForwardCacheDisablingFeatureForTesting(); + rfh_a_2->UseDummyStickyBackForwardCacheDisablingFeatureForTesting(); + rfh_a_4->UseDummyStickyBackForwardCacheDisablingFeatureForTesting(); + + // 2) Navigate to B. + ASSERT_TRUE(NavigateToURL(shell(), url_b)); + + // 3) Navigate back. + ASSERT_TRUE(HistoryGoBack(web_contents())); + ExpectNotRestored({NotRestoredReason::kBlocklistedFeatures}, + {blink::scheduler::WebSchedulerTrackedFeature::kDummy}, {}, + {}, {}, FROM_HERE); + + auto rfh_a_2_details = MatchesSameOriginDetails( + /*id=*/"child-0", /*name=*/"", /*src=*/rfh_a_2_url, /*url=*/rfh_a_2_url, + /*reasons=*/{"Dummy for testing"}, + /*children=*/{}); + auto rfh_a_2_result = MatchesNotRestoredReasons( + /*blocked=*/true, &rfh_a_2_details); + auto rfh_a_4_details = MatchesSameOriginDetails( + /*id=*/"child-0", /*name=*/"", /*src=*/rfh_a_4_url, /*url=*/rfh_a_4_url, + /*reasons=*/{"Dummy for testing"}, + /*children=*/{}); + auto rfh_a_4_result = MatchesNotRestoredReasons( + /*blocked=*/true, &rfh_a_4_details); + auto rfh_a_3_details = MatchesSameOriginDetails( + /*id=*/"child-1", /*name=*/"", /*src=*/rfh_a_3_url, /*url=*/rfh_a_3_url, + /*reasons=*/{}, /*children=*/ + {rfh_a_4_result}); + auto rfh_a_3_result = MatchesNotRestoredReasons( + /*blocked=*/false, &rfh_a_3_details); + auto rfh_a_1_details = MatchesSameOriginDetails( + /*id=*/"", /*name=*/"", /*src=*/"", /*url=*/rfh_a_1_url, + /*reasons=*/{"Dummy for testing"}, + /*children=*/{rfh_a_2_result, rfh_a_3_result}); + auto rfh_a_1_result = MatchesNotRestoredReasons( + /*blocked=*/true, &rfh_a_1_details); + EXPECT_THAT(current_frame_host()->NotRestoredReasonsForTesting(), + rfh_a_1_result); +} + +// NotRestoredReasons are not reported for same document navigation. +IN_PROC_BROWSER_TEST_F(BackForwardCacheBrowserTestWithNotRestoredReasons, + NotReportedForSameDocumentNavigation) { + ASSERT_TRUE(embedded_test_server()->Start()); + GURL url_a_1(embedded_test_server()->GetURL( + "a.com", "/accessibility/html/a-name.html")); + GURL url_a_2(embedded_test_server()->GetURL( + "a.com", "/accessibility/html/a-name.html#id")); + // 1) Navigate to A. + EXPECT_TRUE(NavigateToURL(shell(), url_a_1)); + // 2) Do a same-document navigation. + EXPECT_TRUE(NavigateToURL(shell(), url_a_2)); + // 3) Navigate back. + ASSERT_TRUE(HistoryGoBack(web_contents())); + ExpectOutcomeDidNotChange(FROM_HERE); + // Expect that NotRestoredReasons are not reported at all. + EXPECT_TRUE(current_frame_host()->NotRestoredReasonsForTesting().is_null()); +} + +// NotRestoredReasons are not reported for subframe navigation. +IN_PROC_BROWSER_TEST_F(BackForwardCacheBrowserTestWithNotRestoredReasons, + SubframeNavigationDoesNotRecordMetrics) { + ASSERT_TRUE(embedded_test_server()->Start()); + GURL url_a(embedded_test_server()->GetURL( + "a.com", "/cross_site_iframe_factory.html?a(b)")); + GURL url_c(embedded_test_server()->GetURL("c.com", "/title1.html")); + + // 1) Navigate to A(B). + EXPECT_TRUE(NavigateToURL(shell(), url_a)); + RenderFrameHostImplWrapper rfh_a(current_frame_host()); + + // 2) Navigate from B to C on the subframe. + EXPECT_TRUE(NavigateFrameToURL(rfh_a->child_at(0), url_c)); + EXPECT_EQ(url_c, + rfh_a->child_at(0)->current_frame_host()->GetLastCommittedURL()); + EXPECT_FALSE(rfh_a->IsInBackForwardCache()); + + // 4) Go back from C to B on the subframe. + ASSERT_TRUE(HistoryGoBack(web_contents())); + EXPECT_TRUE( + rfh_a->child_at(0)->current_frame_host()->GetLastCommittedURL().DomainIs( + "b.com")); + EXPECT_FALSE(rfh_a->IsInBackForwardCache()); + ExpectOutcomeDidNotChange(FROM_HERE); + // NotRestoredReasons are not recorded. + EXPECT_TRUE(current_frame_host()->NotRestoredReasonsForTesting().is_null()); +} + +} // namespace content
diff --git a/content/browser/hyphenation/OWNERS b/content/browser/hyphenation/OWNERS index bdb7149..087e311 100644 --- a/content/browser/hyphenation/OWNERS +++ b/content/browser/hyphenation/OWNERS
@@ -1,4 +1,3 @@ -eae@chromium.org drott@chromium.org kojii@chromium.org szager@chromium.org
diff --git a/content/browser/push_messaging/OWNERS b/content/browser/push_messaging/OWNERS index 7bdad6aa..81b3238 100644 --- a/content/browser/push_messaging/OWNERS +++ b/content/browser/push_messaging/OWNERS
@@ -6,7 +6,6 @@ # //chrome/browser/push_messaging/ # //third_party/blink/renderer/modules/push_messaging/ -johnme@chromium.org mvanouwerkerk@chromium.org peter@chromium.org rayankans@chromium.org
diff --git a/content/browser/renderer_host/back_forward_cache_can_store_document_result.cc b/content/browser/renderer_host/back_forward_cache_can_store_document_result.cc index caf93f8..ce1fb9b 100644 --- a/content/browser/renderer_host/back_forward_cache_can_store_document_result.cc +++ b/content/browser/renderer_host/back_forward_cache_can_store_document_result.cc
@@ -291,17 +291,24 @@ std::string BackForwardCacheCanStoreDocumentResult::ToString() const { if (CanStore()) return "Yes"; - std::vector<std::string> reason_strs; - for (BackForwardCacheMetrics::NotRestoredReason reason : not_restored_reasons_) { reason_strs.push_back(NotRestoredReasonToString(reason)); } - return "No: " + base::JoinString(reason_strs, ", "); } +std::vector<std::string> +BackForwardCacheCanStoreDocumentResult::GetStringReasons() const { + std::vector<std::string> reason_strs; + for (BackForwardCacheMetrics::NotRestoredReason reason : + not_restored_reasons_) { + reason_strs.push_back(NotRestoredReasonToReportString(reason)); + } + return reason_strs; +} + std::string BackForwardCacheCanStoreDocumentResult::NotRestoredReasonToString( BackForwardCacheMetrics::NotRestoredReason reason) const { using Reason = BackForwardCacheMetrics::NotRestoredReason; @@ -426,6 +433,72 @@ } } +std::string +BackForwardCacheCanStoreDocumentResult::NotRestoredReasonToReportString( + BackForwardCacheMetrics::NotRestoredReason reason) const { + using Reason = BackForwardCacheMetrics::NotRestoredReason; + + switch (reason) { + // TODO(crbug.com/1349223): Add string to all reasons. Be sure to mask + // extension related reasons so that its presence would not be visible to + // the API. + case Reason::kNotPrimaryMainFrame: + case Reason::kBackForwardCacheDisabled: + case Reason::kRelatedActiveContentsExist: + case Reason::kHTTPStatusNotOK: + case Reason::kSchemeNotHTTPOrHTTPS: + case Reason::kLoading: + case Reason::kWasGrantedMediaAccess: + case Reason::kDisableForRenderFrameHostCalled: + case Reason::kDomainNotAllowed: + case Reason::kHTTPMethodNotGET: + case Reason::kSubframeIsNavigating: + case Reason::kTimeout: + case Reason::kCacheLimit: + case Reason::kForegroundCacheLimit: + case Reason::kJavaScriptExecution: + case Reason::kRendererProcessKilled: + case Reason::kRendererProcessCrashed: + case Reason::kSchedulerTrackedFeatureUsed: + case Reason::kConflictingBrowsingInstance: + case Reason::kCacheFlushed: + case Reason::kServiceWorkerVersionActivation: + case Reason::kSessionRestored: + case Reason::kUnknown: + case Reason::kServiceWorkerPostMessage: + case Reason::kEnteredBackForwardCacheBeforeServiceWorkerHostAdded: + case Reason::kNotMostRecentNavigationEntry: + case Reason::kServiceWorkerClaim: + case Reason::kIgnoreEventAndEvict: + case Reason::kHaveInnerContents: + case Reason::kTimeoutPuttingInCache: + case Reason::kBackForwardCacheDisabledByLowMemory: + case Reason::kBackForwardCacheDisabledByCommandLine: + case Reason::kNavigationCancelledWhileRestoring: + case Reason::kNetworkRequestRedirected: + case Reason::kNetworkRequestTimeout: + case Reason::kNetworkExceedsBufferLimit: + case Reason::kUserAgentOverrideDiffers: + case Reason::kNetworkRequestDatapipeDrainedAsBytesConsumer: + case Reason::kBrowsingInstanceNotSwapped: + case Reason::kBackForwardCacheDisabledForDelegate: + case Reason::kUnloadHandlerExistsInMainFrame: + case Reason::kUnloadHandlerExistsInSubFrame: + case Reason::kServiceWorkerUnregistration: + case Reason::kCacheControlNoStore: + case Reason::kCacheControlNoStoreCookieModified: + case Reason::kCacheControlNoStoreHTTPOnlyCookieModified: + case Reason::kNoResponseHead: + case Reason::kErrorDocument: + case Reason::kFencedFramesEmbedder: + return "Other"; + // Return a matching string for blocklisted feature, so that we can test + // with a dummy feature in tests. + case Reason::kBlocklistedFeatures: + return DescribeFeatures(blocklisted_features_); + } +} + void BackForwardCacheCanStoreDocumentResult::No( BackForwardCacheMetrics::NotRestoredReason reason) { // Either |NoDueToFeatures()| or |NoDueToDisableForRenderFrameHostCalled|
diff --git a/content/browser/renderer_host/back_forward_cache_can_store_document_result.h b/content/browser/renderer_host/back_forward_cache_can_store_document_result.h index b38ebb5..b8944ad 100644 --- a/content/browser/renderer_host/back_forward_cache_can_store_document_result.h +++ b/content/browser/renderer_host/back_forward_cache_can_store_document_result.h
@@ -93,6 +93,7 @@ const std::set<ax::mojom::Event>& ax_events() const { return ax_events_; } std::string ToString() const; + std::vector<std::string> GetStringReasons() const; void WriteIntoTrace( perfetto::TracedProto< @@ -101,8 +102,12 @@ private: void AddNotRestoredReason(BackForwardCacheMetrics::NotRestoredReason reason); + // Returns a one-sentence of explanation for a NotRestoredReason. std::string NotRestoredReasonToString( BackForwardCacheMetrics::NotRestoredReason reason) const; + // Returns a name in string for a NotRestoredReason. + std::string NotRestoredReasonToReportString( + BackForwardCacheMetrics::NotRestoredReason reason) const; NotRestoredReasons not_restored_reasons_; BlockListedFeatures blocklisted_features_;
diff --git a/content/browser/renderer_host/back_forward_cache_impl.cc b/content/browser/renderer_host/back_forward_cache_impl.cc index dedbd6c..92a4902f 100644 --- a/content/browser/renderer_host/back_forward_cache_impl.cc +++ b/content/browser/renderer_host/back_forward_cache_impl.cc
@@ -1394,6 +1394,9 @@ children_(std::move(children)), is_same_origin_( rfh->GetLastCommittedOrigin().IsSameOriginWith(main_document_origin)), + id_(rfh->frame_tree_node()->html_id()), + name_(rfh->frame_tree_node()->html_name()), + src_(rfh->frame_tree_node()->html_src()), url_(rfh->GetLastCommittedURL()) {} BackForwardCacheCanStoreTreeResult::~BackForwardCacheCanStoreTreeResult() = @@ -1430,6 +1433,38 @@ return empty_tree; } +blink::mojom::BackForwardCacheNotRestoredReasonsPtr +BackForwardCacheCanStoreTreeResult::GetWebExposedNotRestoredReasons() { + blink::mojom::BackForwardCacheNotRestoredReasonsPtr not_restored_reasons = + blink::mojom::BackForwardCacheNotRestoredReasons::New(); + if (IsSameOrigin()) { + // Only include same_origin_details for documents that are same-origin with + // the main document. Stop recursion as soon as we hit a cross-origin + // document. + not_restored_reasons->same_origin_details = + blink::mojom::SameOriginBfcacheNotRestoredDetails::New(); + not_restored_reasons->same_origin_details->url = url_.spec(); + not_restored_reasons->same_origin_details->src = src_; + not_restored_reasons->same_origin_details->id = id_; + not_restored_reasons->same_origin_details->name = name_; + not_restored_reasons->same_origin_details->reasons = + GetDocumentResult().GetStringReasons(); + + not_restored_reasons->blocked = !GetDocumentResult().CanRestore(); + for (const auto& subtree : GetChildren()) { + not_restored_reasons->same_origin_details->children.push_back( + subtree->GetWebExposedNotRestoredReasons()); + } + } else { + // If the subtree's root document is cross-origin from the main frame + // document, report whether or not this entire subtree is blocking + // back/forward cache. + not_restored_reasons->blocked = + !GetDocumentResult().CanRestore() || !FlattenTree().CanRestore(); + } + return not_restored_reasons; +} + BackForwardCacheCanStoreDocumentResultWithTree:: BackForwardCacheCanStoreDocumentResultWithTree( BackForwardCacheCanStoreDocumentResult& flattened_reasons,
diff --git a/content/browser/renderer_host/back_forward_cache_impl.h b/content/browser/renderer_host/back_forward_cache_impl.h index 4c166d4..1bb5db0 100644 --- a/content/browser/renderer_host/back_forward_cache_impl.h +++ b/content/browser/renderer_host/back_forward_cache_impl.h
@@ -31,6 +31,7 @@ #include "content/public/common/content_features.h" #include "net/cookies/canonical_cookie.h" #include "services/network/public/mojom/cookie_manager.mojom.h" +#include "third_party/blink/public/mojom/back_forward_cache_not_restored_reasons.mojom.h" #include "third_party/blink/public/mojom/page/page.mojom.h" #include "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h" #include "url/gurl.h" @@ -563,6 +564,12 @@ return document_result_; } + // Populate NotRestoredReasons mojom struct based on the existing tree of + // reason to report to the renderer. This will not contain cross-origin + // subtree's information to avoid cross-origin information leak. + blink::mojom::BackForwardCacheNotRestoredReasonsPtr + GetWebExposedNotRestoredReasons(); + // Flatten the tree and return a flattened list of not restored reasons that // includes all the reasons in the tree. const BackForwardCacheCanStoreDocumentResult FlattenTree(); @@ -601,12 +608,13 @@ // See |IsSameOrigin| const bool is_same_origin_; - + // The id, name and src attribute of the frame owner of this subtree's root + // document. + const std::string id_; + const std::string name_; + const std::string src_; // See |GetUrl| const GURL url_; - - // TODO(crbug.com/1278620): Add the value of the id attribute of the iframe - // element. }; } // namespace content
diff --git a/content/browser/renderer_host/back_forward_cache_metrics.cc b/content/browser/renderer_host/back_forward_cache_metrics.cc index de27620..90c0315 100644 --- a/content/browser/renderer_host/back_forward_cache_metrics.cc +++ b/content/browser/renderer_host/back_forward_cache_metrics.cc
@@ -362,6 +362,11 @@ AddNotRestoredFlattenedReasonsToExistingResult(can_store.flattened_reasons); } +blink::mojom::BackForwardCacheNotRestoredReasonsPtr +BackForwardCacheMetrics::GetWebExposedNotRestoredReasons() { + return page_store_tree_result_->GetWebExposedNotRestoredReasons(); +} + void BackForwardCacheMetrics::UpdateNotRestoredReasonsForNavigation( NavigationRequest* navigation) { DCHECK(IsHistoryNavigation(navigation));
diff --git a/content/browser/renderer_host/back_forward_cache_metrics.h b/content/browser/renderer_host/back_forward_cache_metrics.h index 0f7c665..6f6f45b 100644 --- a/content/browser/renderer_host/back_forward_cache_metrics.h +++ b/content/browser/renderer_host/back_forward_cache_metrics.h
@@ -15,9 +15,11 @@ #include "base/time/time.h" #include "content/browser/renderer_host/should_swap_browsing_instance.h" #include "content/common/content_export.h" +#include "content/common/navigation_client.mojom.h" #include "content/public/browser/back_forward_cache.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h" +#include "third_party/blink/public/mojom/back_forward_cache_not_restored_reasons.mojom.h" namespace url { class Origin; @@ -228,6 +230,10 @@ void SetNotRestoredReasons( BackForwardCacheCanStoreDocumentResultWithTree& can_store); + // Populate and return the mojom struct from |page_store_tree_result_|. + blink::mojom::BackForwardCacheNotRestoredReasonsPtr + GetWebExposedNotRestoredReasons(); + // Exported for testing. // The DisabledReason's source and id combined to give a unique uint64. CONTENT_EXPORT static uint64_t MetricValue(BackForwardCache::DisabledReason);
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc index ac6f7e7..eae80e3 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -236,6 +236,7 @@ #include "third_party/blink/public/common/privacy_budget/identifiability_study_settings.h" #include "third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h" #include "third_party/blink/public/common/storage_key/storage_key.h" +#include "third_party/blink/public/mojom/back_forward_cache_not_restored_reasons.mojom.h" #include "third_party/blink/public/mojom/broadcastchannel/broadcast_channel.mojom.h" #include "third_party/blink/public/mojom/devtools/inspector_issue.mojom.h" #include "third_party/blink/public/mojom/frame/frame.mojom.h" @@ -5350,6 +5351,12 @@ void RenderFrameHostImpl::UpdateTargetURL( const GURL& url, blink::mojom::LocalMainFrameHost::UpdateTargetURLCallback callback) { + // Prerendering pages should not reach this code since the renderer only calls + // this when the mouse over the URL or keyboard focuses the URL. + if (lifecycle_state_ == LifecycleStateImpl::kPrerendering) { + mojo::ReportBadMessage("Unexpected UpdateTargetURL from renderer"); + return; + } delegate_->UpdateTargetURL(this, url); std::move(callback).Run(); } @@ -12236,6 +12243,27 @@ } } } + + blink::mojom::BackForwardCacheNotRestoredReasonsPtr not_restored_reasons; + // Only populate the web-exposed NotRestoredReasons when needed by the + // NotRestoredReasons API, i.e. for cross-document main frame history + // navigations that are not served by back/forward cache. + if (IsBackForwardCacheEnabled() && + base::FeatureList::IsEnabled( + blink::features::kBackForwardCacheSendNotRestoredReasons) && + navigation_request->IsInMainFrame() && + !navigation_request->IsServedFromBackForwardCache()) { + if (NavigationEntryImpl* entry = static_cast<NavigationEntryImpl*>( + navigation_request->GetNavigationEntry())) { + if (auto* metrics = entry->back_forward_cache_metrics()) { + not_restored_reasons = metrics->GetWebExposedNotRestoredReasons(); + } + } + } + // Save the last sent NotRestoredReasons value for testing, so that we can + // verify them in tests. + not_restored_reasons_for_testing_ = not_restored_reasons.Clone(); + commit_params->commit_sent = base::TimeTicks::Now(); navigation_client->CommitNavigation( std::move(common_params), std::move(commit_params), @@ -12246,7 +12274,7 @@ std::move(prefetch_loader_factory), devtools_navigation_token, permissions_policy, std::move(policy_container), std::move(code_cache_host), std::move(cookie_manager_info), - std::move(storage_info), + std::move(storage_info), std::move(not_restored_reasons), BuildCommitNavigationCallback(navigation_request)); base::UmaHistogramTimes( base::StrCat({"Navigation.SendCommitNavigationTime.",
diff --git a/content/browser/renderer_host/render_frame_host_impl.h b/content/browser/renderer_host/render_frame_host_impl.h index 6aff64d..80101615 100644 --- a/content/browser/renderer_host/render_frame_host_impl.h +++ b/content/browser/renderer_host/render_frame_host_impl.h
@@ -105,6 +105,7 @@ #include "third_party/blink/public/common/permissions_policy/permissions_policy.h" #include "third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h" #include "third_party/blink/public/common/storage_key/storage_key.h" +#include "third_party/blink/public/mojom/back_forward_cache_not_restored_reasons.mojom.h" #include "third_party/blink/public/mojom/bluetooth/web_bluetooth.mojom-forward.h" #include "third_party/blink/public/mojom/broadcastchannel/broadcast_channel.mojom.h" #include "third_party/blink/public/mojom/feature_observer/feature_observer.mojom-forward.h" @@ -513,6 +514,11 @@ // BackForwardCacheBrowserTest::AddBlocklistedFeature should be used. void UseDummyStickyBackForwardCacheDisablingFeatureForTesting(); + const blink::mojom::BackForwardCacheNotRestoredReasonsPtr& + NotRestoredReasonsForTesting() { + return not_restored_reasons_for_testing_; + } + // Returns the current WebPreferences for the WebContents associated with this // RenderFrameHost. Will create one if it does not exist (and update all the // renderers with the newly computed value). @@ -4191,6 +4197,11 @@ // stuck in pending deletion. bool do_not_delete_for_testing_ = false; + // Contains NotRestoredReasons for the navigation. Gets reset whenever + // |SendCommitNavigation()| is called. + blink::mojom::BackForwardCacheNotRestoredReasonsPtr + not_restored_reasons_for_testing_; + // Embedding token for the document in this RenderFrameHost. This differs from // |frame_token_| in that |frame_token_| has a lifetime matching that of the // corresponding RenderFrameHostImpl, and is intended to be used for IPCs for
diff --git a/content/browser/service_worker/service_worker_main_resource_loader.cc b/content/browser/service_worker/service_worker_main_resource_loader.cc index 98bdd538..b13efc1c 100644 --- a/content/browser/service_worker/service_worker_main_resource_loader.cc +++ b/content/browser/service_worker/service_worker_main_resource_loader.cc
@@ -357,6 +357,13 @@ response_head_->load_timing.service_worker_respond_with_settled = fetch_event_timing_->respond_with_settled_time; + // TODO(crbug.com/1342408): remove the following DCHECK if this is not + // in the culprit path. + // As far as I investigated, `response_start` should not be set + // while `service_worker_respond_with_settled` is set here. + // DCHECK to ensure my understanding is correct. + DCHECK(response_head_->response_start.is_null()); + // Make the navigated page inherit the SSLInfo from its controller service // worker's script. This affects the HTTPS padlock, etc, shown by the // browser. See https://crbug.com/392409 for details about this design.
diff --git a/content/browser/service_worker/service_worker_test_utils.cc b/content/browser/service_worker/service_worker_test_utils.cc index e04168e..58c69bf 100644 --- a/content/browser/service_worker/service_worker_test_utils.cc +++ b/content/browser/service_worker/service_worker_test_utils.cc
@@ -41,6 +41,7 @@ #include "third_party/blink/public/common/loader/throttling_url_loader.h" #include "third_party/blink/public/common/navigation/navigation_params.h" #include "third_party/blink/public/common/storage_key/storage_key.h" +#include "third_party/blink/public/mojom/back_forward_cache_not_restored_reasons.mojom-blink.h" #include "third_party/blink/public/mojom/loader/referrer.mojom.h" #include "third_party/blink/public/mojom/loader/transferrable_url_loader.mojom.h" #include "third_party/blink/public/mojom/service_worker/service_worker_registration_options.mojom.h" @@ -96,6 +97,7 @@ mojo::PendingRemote<blink::mojom::CodeCacheHost> code_cache_host, mojom::CookieManagerInfoPtr cookie_manager_info, mojom::StorageInfoPtr storage_info, + blink::mojom::BackForwardCacheNotRestoredReasonsPtr not_restored_reasons, CommitNavigationCallback callback) override { std::move(on_received_callback_).Run(std::move(container_info)); std::move(callback).Run(MinimalDidCommitNavigationLoadParams(), nullptr); @@ -257,6 +259,7 @@ base::UnguessableToken::Create(), std::vector<blink::ParsedPermissionsPolicyDeclaration>(), CreateStubPolicyContainer(), mojo::NullRemote(), nullptr, nullptr, + /*not_restored_reasons=*/nullptr, base::BindOnce( [](mojom::DidCommitProvisionalLoadParamsPtr validated_params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr
diff --git a/content/browser/tracing/cros_tracing_agent.cc b/content/browser/tracing/cros_tracing_agent.cc index 1143370..78645e2 100644 --- a/content/browser/tracing/cros_tracing_agent.cc +++ b/content/browser/tracing/cros_tracing_agent.cc
@@ -38,7 +38,7 @@ // |true| if tracing was started and |false| otherwise. void StartTracing(const std::string& config, SuccessCallback callback) { DCHECK(!is_tracing_); - if (!chromeos::DBusThreadManager::IsInitialized()) { + if (!ash::DBusThreadManager::IsInitialized()) { if (callback) std::move(callback).Run(/*success=*/false); return;
diff --git a/content/common/navigation_client.mojom b/content/common/navigation_client.mojom index 06d2109..c55bfc4 100644 --- a/content/common/navigation_client.mojom +++ b/content/common/navigation_client.mojom
@@ -13,6 +13,7 @@ import "services/network/public/mojom/url_loader.mojom"; import "services/network/public/mojom/url_loader_factory.mojom"; import "services/network/public/mojom/url_response_head.mojom"; +import "third_party/blink/public/mojom/back_forward_cache_not_restored_reasons.mojom"; import "third_party/blink/public/mojom/commit_result/commit_result.mojom"; import "third_party/blink/public/mojom/dom_storage/storage_area.mojom"; import "third_party/blink/public/mojom/frame/policy_container.mojom"; @@ -243,6 +244,9 @@ // browser. These may be null if the NavigationThreadingOptimizations feature // is disabled. |cookie_manager_info| may also be null for non HTTP/HTTPS // navigations, or if the origin is opaque. + // |not_restored_reasons| contain the reasons why this navigation is not + // served from back/forward cache if applicable. This is only sent for + // cross-document main frame history navigations. CommitNavigation( blink.mojom.CommonNavigationParams common_params, blink.mojom.CommitNavigationParams request_params, @@ -259,7 +263,8 @@ blink.mojom.PolicyContainer policy_container, pending_remote<blink.mojom.CodeCacheHost>? code_cache_host, CookieManagerInfo? cookie_manager_info, - StorageInfo? storage_info) + StorageInfo? storage_info, + blink.mojom.BackForwardCacheNotRestoredReasons? not_restored_reasons) => (DidCommitProvisionalLoadParams params, DidCommitProvisionalLoadInterfaceParams? interface_params);
diff --git a/content/public/browser/render_view_host.h b/content/public/browser/render_view_host.h index 2e4af84..e5931e1 100644 --- a/content/public/browser/render_view_host.h +++ b/content/public/browser/render_view_host.h
@@ -10,7 +10,6 @@ #include "content/public/common/drop_data.h" #include "content/public/common/page_zoom.h" #include "ipc/ipc_sender.h" -#include "mojo/public/cpp/system/core.h" #include "third_party/blink/public/common/page/drag_operation.h" #include "third_party/blink/public/mojom/frame/frame.mojom-forward.h"
diff --git a/content/public/test/browser_test_base.cc b/content/public/test/browser_test_base.cc index bb2781f..0521a8f 100644 --- a/content/public/test/browser_test_base.cc +++ b/content/public/test/browser_test_base.cc
@@ -276,7 +276,6 @@ #elif BUILDFLAG(IS_MAC) ui::test::EventGeneratorDelegate::SetFactoryFunction( base::BindRepeating(&views::test::CreateEventGeneratorDelegateMac)); - EnableNativeWindowActivation(); #endif }
diff --git a/content/public/test/browser_test_utils.h b/content/public/test/browser_test_utils.h index 5c7793a1..5c6d2d3 100644 --- a/content/public/test/browser_test_utils.h +++ b/content/public/test/browser_test_utils.h
@@ -2293,13 +2293,6 @@ [[nodiscard]] bool HistoryGoBack(WebContents* wc); [[nodiscard]] bool HistoryGoForward(WebContents* wc); -#if BUILDFLAG(IS_MAC) -// Grant native windows the ability to activate, allowing them to become key -// and/or main. This can be useful to enable when the process hosting the window -// is a standalone executable without an Info.plist. -bool EnableNativeWindowActivation(); -#endif // BUILDFLAG(IS_MAC) - } // namespace content #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_
diff --git a/content/public/test/browser_test_utils_mac.mm b/content/public/test/browser_test_utils_mac.mm deleted file mode 100644 index fabd386..0000000 --- a/content/public/test/browser_test_utils_mac.mm +++ /dev/null
@@ -1,24 +0,0 @@ -// Copyright 2022 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/public/test/browser_test_utils.h" - -#import <AppKit/AppKit.h> - -namespace content { - -bool EnableNativeWindowActivation() { - // Do not downgrade the activation policy. - if (NSApp.activationPolicy > NSApplicationActivationPolicyProhibited) { - return true; - } - - // NSApplicationActivationPolicyAccessory is the least permissive policy that - // still allows for programmatic activation. - return [NSApp setActivationPolicy:NSApplicationActivationPolicyAccessory] - ? true - : false; -} - -} // namespace content
diff --git a/content/renderer/navigation_client.cc b/content/renderer/navigation_client.cc index a809e54..c8d1327 100644 --- a/content/renderer/navigation_client.cc +++ b/content/renderer/navigation_client.cc
@@ -43,6 +43,7 @@ mojo::PendingRemote<blink::mojom::CodeCacheHost> code_cache_host, mojom::CookieManagerInfoPtr cookie_manager_info, mojom::StorageInfoPtr storage_info, + blink::mojom::BackForwardCacheNotRestoredReasonsPtr not_restored_reasons, CommitNavigationCallback callback) { DCHECK(blink::IsRequestDestinationFrame(common_params->request_destination)); @@ -60,7 +61,8 @@ std::move(prefetch_loader_factory), devtools_navigation_token, permissions_policy, std::move(policy_container), std::move(code_cache_host), std::move(cookie_manager_info), - std::move(storage_info), std::move(callback)); + std::move(storage_info), std::move(not_restored_reasons), + std::move(callback)); } void NavigationClient::CommitFailedNavigation(
diff --git a/content/renderer/navigation_client.h b/content/renderer/navigation_client.h index 8432f4db..0d5d7e7aa 100644 --- a/content/renderer/navigation_client.h +++ b/content/renderer/navigation_client.h
@@ -11,6 +11,7 @@ #include "mojo/public/cpp/bindings/associated_receiver.h" #include "mojo/public/cpp/bindings/pending_associated_receiver.h" #include "third_party/blink/public/common/permissions_policy/permissions_policy.h" +#include "third_party/blink/public/mojom/back_forward_cache_not_restored_reasons.mojom.h" namespace content { @@ -42,6 +43,7 @@ mojo::PendingRemote<blink::mojom::CodeCacheHost> code_cache_host, mojom::CookieManagerInfoPtr cookie_manager_info, mojom::StorageInfoPtr storage_info, + blink::mojom::BackForwardCacheNotRestoredReasonsPtr not_restored_reasons, CommitNavigationCallback callback) override; void CommitFailedNavigation( blink::mojom::CommonNavigationParamsPtr common_params,
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index 5a70dc2..e675234 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -2573,6 +2573,7 @@ mojo::PendingRemote<blink::mojom::CodeCacheHost> code_cache_host, mojom::CookieManagerInfoPtr cookie_manager_info, mojom::StorageInfoPtr storage_info, + blink::mojom::BackForwardCacheNotRestoredReasonsPtr not_restored_reasons, mojom::NavigationClient::CommitNavigationCallback commit_callback) { DCHECK(navigation_client_impl_); DCHECK(!blink::IsRendererDebugURL(common_params->url)); @@ -2621,7 +2622,7 @@ std::move(controller_service_worker_info), std::move(container_info), std::move(prefetch_loader_factory), std::move(code_cache_host), std::move(cookie_manager_info), std::move(storage_info), - std::move(document_state)); + std::move(document_state), std::move(not_restored_reasons)); // Handle a navigation that has a non-empty `data_url_as_string`, or perform // a "loadDataWithBaseURL" navigation, which is different from a normal data: @@ -2742,6 +2743,7 @@ mojom::CookieManagerInfoPtr cookie_manager_info, mojom::StorageInfoPtr storage_info, std::unique_ptr<DocumentState> document_state, + blink::mojom::BackForwardCacheNotRestoredReasonsPtr not_restored_reasons, std::unique_ptr<WebNavigationParams> navigation_params) { if (common_params->url.IsAboutSrcdoc()) { WebNavigationParams::FillStaticResponse(navigation_params.get(), @@ -2762,6 +2764,21 @@ if (commit_params->is_view_source) frame_->EnableViewSourceMode(true); + if (IsBackForwardCacheEnabled() && + base::FeatureList::IsEnabled( + blink::features::kBackForwardCacheSendNotRestoredReasons) && + IsMainFrame() && + common_params->navigation_type == + blink::mojom::NavigationType::HISTORY_DIFFERENT_DOCUMENT) { + DCHECK(not_restored_reasons); + // Save the Back/Forward Cache NotRestoredReasons struct to WebLocalFrame to + // report for PerformanceNavigationTiming API. + frame_->SetNotRestoredReasons(std::move(not_restored_reasons)); + // For cross-document main frame history navigations, |not_restored_reasons| + // should be populated and has blocking reasons. + DCHECK(frame_->HasBlockingReasons()); + } + // Note: this intentionally does not call |Detach()| before |reset()|. If // there is an active |MHTMLBodyLoaderClient|, the browser-side navigation // code is explicitly replacing it with a new navigation commit request.
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h index c8e8225..1e00126 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h
@@ -76,6 +76,7 @@ #include "third_party/blink/public/common/tokens/tokens.h" #include "third_party/blink/public/common/unique_name/unique_name_helper.h" #include "third_party/blink/public/mojom/autoplay/autoplay.mojom.h" +#include "third_party/blink/public/mojom/back_forward_cache_not_restored_reasons.mojom.h" #include "third_party/blink/public/mojom/browser_interface_broker.mojom.h" #include "third_party/blink/public/mojom/choosers/file_chooser.mojom.h" #include "third_party/blink/public/mojom/commit_result/commit_result.mojom.h" @@ -445,6 +446,7 @@ mojo::PendingRemote<blink::mojom::CodeCacheHost> code_cache_host, mojom::CookieManagerInfoPtr cookie_manager_info, mojom::StorageInfoPtr storage_info, + blink::mojom::BackForwardCacheNotRestoredReasonsPtr not_restored_reasons, mojom::NavigationClient::CommitNavigationCallback commit_callback); void CommitFailedNavigation( blink::mojom::CommonNavigationParamsPtr common_params, @@ -958,6 +960,7 @@ mojom::CookieManagerInfoPtr cookie_manager_info, mojom::StorageInfoPtr storage_info, std::unique_ptr<DocumentState> document_state, + blink::mojom::BackForwardCacheNotRestoredReasonsPtr not_restored_reasons, std::unique_ptr<blink::WebNavigationParams> navigation_params); // Decodes a data url for navigation commit.
diff --git a/content/renderer/service_worker/service_worker_subresource_loader.cc b/content/renderer/service_worker/service_worker_subresource_loader.cc index 3751674..0c6869b 100644 --- a/content/renderer/service_worker/service_worker_subresource_loader.cc +++ b/content/renderer/service_worker/service_worker_subresource_loader.cc
@@ -487,6 +487,17 @@ response_head_->load_timing.receive_headers_start; response_source_ = response->response_source; + // TODO(crbug.com/1342408): remove the following DCHECK if this is not + // in the culprit path. + // This DCHECK is for ensuring that the condition met before + // `ThrottlingURLLoader::OnReceiveResponse` is called via mojom. + // Expecting this is called by `ServiceWorkerSubresourceLoader::OnResponse` + // or `ServiceWorkerSubresourceLoader::OnResponseStream`, + // and `response_head_->load_timing.service_worker_respond_with_settled` + // has been set in `UpdateResponseTiming`. + DCHECK_LE(response_head_->load_timing.service_worker_respond_with_settled, + response_head_->response_start); + // Handle a redirect response. ComputeRedirectInfo returns non-null redirect // info if the given response is a redirect. redirect_info_ = blink::ServiceWorkerLoaderHelpers::ComputeRedirectInfo(
diff --git a/content/shell/browser/shell_browser_main_parts.cc b/content/shell/browser/shell_browser_main_parts.cc index b00a5b3..2f10ac3 100644 --- a/content/shell/browser/shell_browser_main_parts.cc +++ b/content/shell/browser/shell_browser_main_parts.cc
@@ -116,7 +116,7 @@ void ShellBrowserMainParts::PostCreateMainMessageLoop() { #if BUILDFLAG(IS_CHROMEOS_ASH) - chromeos::DBusThreadManager::Initialize(); + ash::DBusThreadManager::Initialize(); #elif BUILDFLAG(IS_CHROMEOS_LACROS) chromeos::LacrosDBusThreadManager::Initialize(); #endif @@ -212,7 +212,7 @@ #endif #if BUILDFLAG(IS_CHROMEOS_ASH) - chromeos::DBusThreadManager::Shutdown(); + ash::DBusThreadManager::Shutdown(); #elif BUILDFLAG(IS_CHROMEOS_LACROS) chromeos::LacrosDBusThreadManager::Shutdown(); #endif
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index 4330e25..fee4ee3 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -695,7 +695,6 @@ sources += [ "../browser/renderer_host/test_render_widget_host_view_mac_factory.h", "../browser/renderer_host/test_render_widget_host_view_mac_factory.mm", - "../public/test/browser_test_utils_mac.mm", "../public/test/text_input_test_utils_mac.mm", ] deps += [ @@ -1227,6 +1226,7 @@ "../browser/back_forward_cache_internal_browsertest.cc", "../browser/back_forward_cache_network_request_browsertest.cc", "../browser/back_forward_cache_no_store_browsertest.cc", + "../browser/back_forward_cache_not_restored_reasons_browsertest.cc", "../browser/background_sync/background_sync_base_browsertest.cc", "../browser/background_sync/background_sync_base_browsertest.h", "../browser/background_sync/one_shot_background_sync_browsertest.cc",
diff --git a/content/test/gpu/gpu_tests/test_expectations/pixel_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/pixel_expectations.txt index 6fa74c9..53c7f1ed 100644 --- a/content/test/gpu/gpu_tests/test_expectations/pixel_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/pixel_expectations.txt
@@ -353,10 +353,6 @@ # Failures in fuchsia-chrome browser crbug.com/1295076 [ fuchsia fuchsia-chrome ] Pixel_CanvasDisplaySRGBAccelerated2D [ Failure ] -# Crashes on gpu-fyi-win10-nvidia-rel-32 -crbug.com/1300670 [ win nvidia-0x2184 passthrough ] Pixel_WebGPUImportVideoFrameUnaccelerated [ Failure ] -crbug.com/1300670 [ win nvidia-0x2184 passthrough ] Pixel_WebGPUImportVideoFrameOffscreenCanvas [ Failure ] - # Pixel_Video_Media_Stream_Incompatible_Stride flakes with SkiaRenderer GL crbug.com/1213542 [ renderer-skia-gl linux nvidia-0x1cb3 ] Pixel_Video_Media_Stream_Incompatible_Stride [ RetryOnFailure ] crbug.com/1213542 [ renderer-skia-gl linux nvidia-0x2184 passthrough ] Pixel_Video_Media_Stream_Incompatible_Stride [ RetryOnFailure ]
diff --git a/content/test/test_render_frame.cc b/content/test/test_render_frame.cc index 8cba243..28e5ad9 100644 --- a/content/test/test_render_frame.cc +++ b/content/test/test_render_frame.cc
@@ -273,6 +273,7 @@ blink::mojom::PolicyContainerPolicies::New(), mock_policy_container_host.BindNewEndpointAndPassDedicatedRemote()), mojo::NullRemote() /* code_cache_host */, nullptr, nullptr, + /* not_restored_reasons */ nullptr, base::BindOnce(&MockFrameHost::DidCommitProvisionalLoad, base::Unretained(mock_frame_host_.get()))); }
diff --git a/content/utility/BUILD.gn b/content/utility/BUILD.gn index f6fe3ed..e6d0592 100644 --- a/content/utility/BUILD.gn +++ b/content/utility/BUILD.gn
@@ -113,8 +113,8 @@ ] } - if (enable_cros_libassistant) { - deps += [ "//chromeos/services/libassistant:sandbox_hook" ] + if (is_chromeos_ash && enable_cros_libassistant) { + deps += [ "//chromeos/ash/services/libassistant:sandbox_hook" ] } # PAC execution is done in process on Android.
diff --git a/content/utility/DEPS b/content/utility/DEPS index e9802ce4..1c23506 100644 --- a/content/utility/DEPS +++ b/content/utility/DEPS
@@ -6,7 +6,7 @@ "+content/public/utility", "+content/services", "+chromeos/ash/components/assistant/buildflags.h", - "+chromeos/services/libassistant", + "+chromeos/ash/services/libassistant", "+chromeos/services/tts", "+device/vr/buildflags", "+device/vr/public",
diff --git a/content/utility/utility_main.cc b/content/utility/utility_main.cc index 1382d3a..66fd849 100644 --- a/content/utility/utility_main.cc +++ b/content/utility/utility_main.cc
@@ -56,7 +56,7 @@ #include "chromeos/services/tts/tts_sandbox_hook.h" #if BUILDFLAG(ENABLE_CROS_LIBASSISTANT) -#include "chromeos/services/libassistant/libassistant_sandbox_hook.h" // nogncheck +#include "chromeos/ash/services/libassistant/libassistant_sandbox_hook.h" // nogncheck #endif // BUILDFLAG(ENABLE_CROS_LIBASSISTANT) #endif // BUILDFLAG(IS_CHROMEOS_ASH)
diff --git a/docs/clang_tidy.md b/docs/clang_tidy.md index 8a9773e..d6a95c6 100644 --- a/docs/clang_tidy.md +++ b/docs/clang_tidy.md
@@ -94,8 +94,19 @@ **Note** that the above command will use Chromium's top-level `.clang-tidy` file (or `.clang-tidy` files scattered throughout `third_party/`, depending on the -files we lint. In order to test a *new* check, you'll have to add it to -Chromium's top-level `.clang-tidy` file. +files we lint. In order to test a *new* check, it's recommended that you use +`tricium_clang_tidy_script.py`'s `--tidy_checks` flag. Usage of this looks like: + +``` +$ cd ${chromium}/src +$ ${chromium_build}/recipes/recipe_modules/tricium_clang_tidy/resources/tricium_clang_tidy_script.py \ + --base_path $PWD \ + --out_dir out/Linux \ + --findings_file all_findings.json \ + --clang_tidy_binary $PWD/third_party/llvm-build/Release+Asserts/bin/clang-tidy \ + --tidy_checks '-*,YOUR-NEW-CHECK-NAME-HERE' + --all +``` ### Ignoring a check
diff --git a/docs/contributing.md b/docs/contributing.md index b0f1288..c9d311ae 100644 --- a/docs/contributing.md +++ b/docs/contributing.md
@@ -172,8 +172,7 @@ ### Chromium-specific description tips - Links to previous CLs should be formatted as `https://crrev.com/c/NUMBER`, - which forwards to [Gitiles][cr-gitiles], rather than linking to the review at - <https://chromium-review.googlesource.com>. + which is slightly shorter than <https://chromium-review.googlesource.com>. - If there are instructions for testers to verify the change is correct, include them with the `Test:` tag: @@ -499,7 +498,6 @@ [core-principles]: https://www.chromium.org/developers/core-principles [corporate-cla]: https://cla.developers.google.com/about/google-corporate?csw=1 [cr-authors]: https://chromium.googlesource.com/chromium/src/+/HEAD/AUTHORS -[cr-gitiles]: https://chromium.googlesource.com/chromium/src/+/main/ [cr-styleguide]: https://chromium.googlesource.com/chromium/src/+/main/styleguide/styleguide.md [crbug-new]: https://bugs.chromium.org/p/chromium/issues/entry [crbug]: https://bugs.chromium.org/p/chromium/issues/list
diff --git a/extensions/shell/browser/shell_browser_main_parts.cc b/extensions/shell/browser/shell_browser_main_parts.cc index 07f028ea..9b87f33 100644 --- a/extensions/shell/browser/shell_browser_main_parts.cc +++ b/extensions/shell/browser/shell_browser_main_parts.cc
@@ -108,8 +108,8 @@ // Perform initialization of D-Bus objects here rather than in the below // helper classes so those classes' tests can initialize stub versions of the // D-Bus objects. - chromeos::DBusThreadManager::Initialize(); - dbus::Bus* bus = chromeos::DBusThreadManager::Get()->GetSystemBus(); + ash::DBusThreadManager::Initialize(); + dbus::Bus* bus = ash::DBusThreadManager::Get()->GetSystemBus(); #elif BUILDFLAG(IS_CHROMEOS_LACROS) chromeos::LacrosDBusThreadManager::Initialize(); dbus::Bus* bus = chromeos::LacrosDBusThreadManager::Get()->GetSystemBus(); @@ -315,7 +315,7 @@ #endif #if BUILDFLAG(IS_CHROMEOS_ASH) - chromeos::DBusThreadManager::Shutdown(); + ash::DBusThreadManager::Shutdown(); #elif BUILDFLAG(IS_CHROMEOS_LACROS) chromeos::LacrosDBusThreadManager::Shutdown(); #endif
diff --git a/extensions/shell/browser/shell_network_controller_chromeos.h b/extensions/shell/browser/shell_network_controller_chromeos.h index 94c9c843..9a910d30 100644 --- a/extensions/shell/browser/shell_network_controller_chromeos.h +++ b/extensions/shell/browser/shell_network_controller_chromeos.h
@@ -18,7 +18,7 @@ // Handles network-related tasks for app_shell on Chrome OS. class ShellNetworkController : public ash::NetworkStateHandlerObserver { public: - // This class must be instantiated after chromeos::DBusThreadManager and + // This class must be instantiated after ash::DBusThreadManager and // destroyed before it. explicit ShellNetworkController(const std::string& preferred_network_name);
diff --git a/gpu/command_buffer/service/shared_image/iosurface_image_backing_factory.mm b/gpu/command_buffer/service/shared_image/iosurface_image_backing_factory.mm index 173d473..fdf5fd6 100644 --- a/gpu/command_buffer/service/shared_image/iosurface_image_backing_factory.mm +++ b/gpu/command_buffer/service/shared_image/iosurface_image_backing_factory.mm
@@ -125,9 +125,11 @@ // copyTextureForBrowser. WGPUDawnTextureInternalUsageDescriptor internalDesc = {}; internalDesc.chain.sType = WGPUSType_DawnTextureInternalUsageDescriptor; - internalDesc.internalUsage = WGPUTextureUsage_CopySrc | - WGPUTextureUsage_RenderAttachment | - WGPUTextureUsage_TextureBinding; + internalDesc.internalUsage = + WGPUTextureUsage_CopySrc | WGPUTextureUsage_TextureBinding; + if (wgpu_format_ != WGPUTextureFormat_R8BG8Biplanar420Unorm) { + internalDesc.internalUsage |= WGPUTextureUsage_RenderAttachment; + } texture_descriptor.nextInChain = reinterpret_cast<WGPUChainedStruct*>(&internalDesc);
diff --git a/infra/config/subprojects/goma/OWNERS b/infra/config/subprojects/goma/OWNERS index f9b879b..5b7801c 100644 --- a/infra/config/subprojects/goma/OWNERS +++ b/infra/config/subprojects/goma/OWNERS
@@ -2,6 +2,4 @@ jojwang@google.com jwata@google.com tikuta@chromium.org -tikuta@google.com -ukai@chromium.org ukai@google.com
diff --git a/ios/chrome/browser/first_run/first_run.h b/ios/chrome/browser/first_run/first_run.h index a64e2f1..c3cac145 100644 --- a/ios/chrome/browser/first_run/first_run.h +++ b/ios/chrome/browser/first_run/first_run.h
@@ -47,7 +47,7 @@ // Creates the sentinel file that signals that chrome has been configured if // the file does not exist yet. Returns SENTINEL_RESULT_SUCCESS if the file - // was created. If SENTINEL_RESULT_FILE_ERROR is returned, |error| is set to + // was created. If SENTINEL_RESULT_FILE_ERROR is returned, `error` is set to // the file system error, if non-nil. static SentinelResult CreateSentinel(base::File::Error* error);
diff --git a/ios/chrome/browser/follow/follow_menu_updater.h b/ios/chrome/browser/follow/follow_menu_updater.h index fc68d5ab..2cc01339 100644 --- a/ios/chrome/browser/follow/follow_menu_updater.h +++ b/ios/chrome/browser/follow/follow_menu_updater.h
@@ -10,8 +10,8 @@ // Protocol defining a updater for follow menu item. @protocol FollowMenuUpdater -// Updates the follow menu item with follow |webPage|, |followed|, -// |domainName| and |enabled|. +// Updates the follow menu item with follow `webPage`, `followed`, +// `domainName` and `enabled`. - (void)updateFollowMenuItemWithWebPage:(WebPageURLs*)webPageURLs followed:(BOOL)followed domainName:(NSString*)domainName
diff --git a/ios/chrome/browser/follow/follow_util.h b/ios/chrome/browser/follow/follow_util.h index bcb72c3..71aa5bfe 100644 --- a/ios/chrome/browser/follow/follow_util.h +++ b/ios/chrome/browser/follow/follow_util.h
@@ -19,7 +19,7 @@ // Key used to store the date when showing the follow in-product help (IPH). extern NSString* const kFollowIPHDate; -// Returns the Follow action state for |webState|. +// Returns the Follow action state for `webState`. FollowActionState GetFollowActionState(web::WebState* webState); #pragma mark - For Follow IPH
diff --git a/ios/chrome/browser/history/domain_diversity_reporter_factory.mm b/ios/chrome/browser/history/domain_diversity_reporter_factory.mm index 22371e6b..f077dd5 100644 --- a/ios/chrome/browser/history/domain_diversity_reporter_factory.mm +++ b/ios/chrome/browser/history/domain_diversity_reporter_factory.mm
@@ -55,7 +55,7 @@ ios::HistoryServiceFactory::GetForBrowserState( chrome_browser_state, ServiceAccessType::EXPLICIT_ACCESS); - // Only build DomainDiversityReporter service with a valid |history_service|. + // Only build DomainDiversityReporter service with a valid `history_service`. if (!history_service) return nullptr;
diff --git a/ios/chrome/browser/history/history_tab_helper_unittest.mm b/ios/chrome/browser/history/history_tab_helper_unittest.mm index 6b4713c..25641e6 100644 --- a/ios/chrome/browser/history/history_tab_helper_unittest.mm +++ b/ios/chrome/browser/history/history_tab_helper_unittest.mm
@@ -39,7 +39,7 @@ HistoryTabHelper::CreateForWebState(&web_state_); } - // Queries the history service for information about the given |url| and + // Queries the history service for information about the given `url` and // returns the response. Spins the runloop until a response is received. void QueryURL(const GURL& url) { history::HistoryService* service = @@ -57,7 +57,7 @@ loop.Run(); } - // Adds an entry for the given |url| to the history database. + // Adds an entry for the given `url` to the history database. void AddVisitForURL(const GURL& url) { history::HistoryService* service = ios::HistoryServiceFactory::GetForBrowserState( @@ -73,7 +73,7 @@ web::FakeWebState web_state_; base::CancelableTaskTracker tracker_; - // Cached data from the last call to |QueryURL()|. + // Cached data from the last call to `QueryURL()`. history::URLRow latest_row_result_; };
diff --git a/ios/chrome/browser/infobars/confirm_infobar_metrics_recorder.h b/ios/chrome/browser/infobars/confirm_infobar_metrics_recorder.h index 6751f44..ecb2f08 100644 --- a/ios/chrome/browser/infobars/confirm_infobar_metrics_recorder.h +++ b/ios/chrome/browser/infobars/confirm_infobar_metrics_recorder.h
@@ -34,12 +34,12 @@ - (instancetype)init NS_UNAVAILABLE; -// Records histogram |event| for ConfirmInfobar of type |infobarConfirmType|. +// Records histogram `event` for ConfirmInfobar of type `infobarConfirmType`. + (void)recordConfirmInfobarEvent:(MobileMessagesConfirmInfobarEvents)event forInfobarConfirmType:(InfobarConfirmType)infobarConfirmType; -// Records the |duration| since the Infobar delegate was created until it was -// accepted for ConfirmInfobar of type |infobarConfirmType|. +// Records the `duration` since the Infobar delegate was created until it was +// accepted for ConfirmInfobar of type `infobarConfirmType`. + (void)recordConfirmAcceptTime:(NSTimeInterval)duration forInfobarConfirmType:(InfobarConfirmType)infobarConfirmType;
diff --git a/ios/chrome/browser/infobars/infobar_badge_tab_helper.h b/ios/chrome/browser/infobars/infobar_badge_tab_helper.h index 34492f65..1f8d0770 100644 --- a/ios/chrome/browser/infobars/infobar_badge_tab_helper.h +++ b/ios/chrome/browser/infobars/infobar_badge_tab_helper.h
@@ -32,16 +32,16 @@ ~InfobarBadgeTabHelper() override; - // Sets the InfobarBadgeTabHelperDelegate to |delegate|. + // Sets the InfobarBadgeTabHelperDelegate to `delegate`. void SetDelegate(id<InfobarBadgeTabHelperDelegate> delegate); // Updates Infobar for the case where the user is aware that they could access - // the infobar with |infobar_type| through a badge. + // the infobar with `infobar_type` through a badge. void UpdateBadgeForInfobarRead(InfobarType infobar_type); // Updates Infobar for the case where an Infobar banner of - // |infobar_type| was presented. + // `infobar_type` was presented. void UpdateBadgeForInfobarBannerPresented(InfobarType infobar_type); // Updates Infobar for the case where an Infobar banner of - // |infobar_type| was dismissed. + // `infobar_type` was dismissed. void UpdateBadgeForInfobarBannerDismissed(InfobarType infobar_type); // DEPRECATED: The accept state of an infobar is now stored directly in @@ -60,7 +60,7 @@ // activities. void RegisterInfobar(infobars::InfoBar* infobar); void UnregisterInfobar(infobars::InfoBar* infobar); - // Notifies the tab helper that an infobar with |type| was accepted or + // Notifies the tab helper that an infobar with `type` was accepted or // reverted. void OnInfobarAcceptanceStateChanged(InfobarType infobar_type, bool accepted); // Update the badges displayed in the location bar. @@ -109,7 +109,7 @@ // The owning tab helper. InfobarBadgeTabHelper* tab_helper_ = nullptr; - // The infobar acceptance observer for |tab_helper_|. Added to each infobar + // The infobar acceptance observer for `tab_helper_`. Added to each infobar // in the observed manager. InfobarAcceptanceObserver* infobar_accept_observer_ = nullptr; // Scoped observer that facilitates observing an InfoBarManager.
diff --git a/ios/chrome/browser/infobars/infobar_badge_tab_helper.mm b/ios/chrome/browser/infobars/infobar_badge_tab_helper.mm index ccdfdb3e..5ca4d6d 100644 --- a/ios/chrome/browser/infobars/infobar_badge_tab_helper.mm +++ b/ios/chrome/browser/infobars/infobar_badge_tab_helper.mm
@@ -12,7 +12,7 @@ #endif namespace { -// Returns |infobar|'s InfobarType. +// Returns `infobar`'s InfobarType. InfobarType GetInfobarType(infobars::InfoBar* infobar) { return static_cast<InfoBarIOS*>(infobar)->infobar_type(); }
diff --git a/ios/chrome/browser/infobars/infobar_badge_tab_helper_delegate.h b/ios/chrome/browser/infobars/infobar_badge_tab_helper_delegate.h index ececcf2f..4bad6d7 100644 --- a/ios/chrome/browser/infobars/infobar_badge_tab_helper_delegate.h +++ b/ios/chrome/browser/infobars/infobar_badge_tab_helper_delegate.h
@@ -17,7 +17,7 @@ // Delegate used by InfobarBadgeTabHelper to manage the Infobar badges. @protocol InfobarBadgeTabHelperDelegate -// Checks whether badge is supported for |infobarType|. +// Checks whether badge is supported for `infobarType`. - (BOOL)badgeSupportedForInfobarType:(InfobarType)infobarType; // Ask the delegate to rerender the infobar badges, as the list of badges and/or
diff --git a/ios/chrome/browser/infobars/infobar_ios.h b/ios/chrome/browser/infobars/infobar_ios.h index 738e0bd..62db03d76 100644 --- a/ios/chrome/browser/infobars/infobar_ios.h +++ b/ios/chrome/browser/infobars/infobar_ios.h
@@ -32,10 +32,10 @@ // Observer interface for objects interested in changes to InfoBarIOS. class Observer : public base::CheckedObserver { public: - // Called when |infobar|'s accepted() is set to a new value. + // Called when `infobar`'s accepted() is set to a new value. virtual void DidUpdateAcceptedState(InfoBarIOS* infobar) {} - // Called when |infobar| is destroyed. + // Called when `infobar` is destroyed. virtual void InfobarDestroyed(InfoBarIOS* infobar) {} };
diff --git a/ios/chrome/browser/infobars/infobar_manager_impl.h b/ios/chrome/browser/infobars/infobar_manager_impl.h index 9e783eed..a0a0de0 100644 --- a/ios/chrome/browser/infobars/infobar_manager_impl.h +++ b/ios/chrome/browser/infobars/infobar_manager_impl.h
@@ -24,7 +24,7 @@ ~InfoBarManagerImpl() override; - // Returns the |web_state_| tied to this InfobarManager. + // Returns the `web_state_` tied to this InfobarManager. web::WebState* web_state() const { return web_state_; } private: @@ -40,7 +40,7 @@ web::NavigationContext* navigation_context) override; void WebStateDestroyed(web::WebState* web_state) override; - // Opens a URL according to the specified |disposition|. + // Opens a URL according to the specified `disposition`. void OpenURL(const GURL& url, WindowOpenDisposition disposition) override; // The WebState this instance is observing. Will be null after
diff --git a/ios/chrome/browser/infobars/infobar_metrics_recorder.h b/ios/chrome/browser/infobars/infobar_metrics_recorder.h index 7a25fbb4..aeb49775 100644 --- a/ios/chrome/browser/infobars/infobar_metrics_recorder.h +++ b/ios/chrome/browser/infobars/infobar_metrics_recorder.h
@@ -78,23 +78,23 @@ @interface InfobarMetricsRecorder : NSObject // Designated initializer. InfobarMetricsRecorder will record metrics for -// |infobarType|. +// `infobarType`. - (instancetype)initWithType:(InfobarType)infobarType NS_DESIGNATED_INITIALIZER; - (instancetype)init NS_UNAVAILABLE; -// Records histogram for Banner |event|. +// Records histogram for Banner `event`. - (void)recordBannerEvent:(MobileMessagesBannerEvent)event; -// Records histogram for Banner |dismissType|. +// Records histogram for Banner `dismissType`. - (void)recordBannerDismissType:(MobileMessagesBannerDismissType)dismissType; // Records histogram for Banner On Screen duration. - (void)recordBannerOnScreenDuration:(double)duration; -// Records histogram for Modal |event|. +// Records histogram for Modal `event`. - (void)recordModalEvent:(MobileMessagesModalEvent)event; -// Records histogram for Badge Tapped in |state|. +// Records histogram for Badge Tapped in `state`. - (void)recordBadgeTappedInState:(MobileMessagesBadgeState)state; @end
diff --git a/ios/chrome/browser/infobars/infobar_utils.h b/ios/chrome/browser/infobars/infobar_utils.h index af4824f..cfee4312 100644 --- a/ios/chrome/browser/infobars/infobar_utils.h +++ b/ios/chrome/browser/infobars/infobar_utils.h
@@ -13,12 +13,12 @@ class InfoBar; } -// Returns a confirm infobar that owns |delegate|. +// Returns a confirm infobar that owns `delegate`. std::unique_ptr<infobars::InfoBar> CreateConfirmInfoBar( std::unique_ptr<ConfirmInfoBarDelegate> delegate); // Returns a confirm infobar with high priority presentation that owns -// |delegate|. +// `delegate`. // TODO (crbug.com/961343):Reassess this method once there's more clarity on how // to handle queueing and if priorities are actually needed. std::unique_ptr<infobars::InfoBar> CreateHighPriorityConfirmInfoBar(
diff --git a/ios/chrome/browser/infobars/test/fake_infobar_delegate.h b/ios/chrome/browser/infobars/test/fake_infobar_delegate.h index 052fdfd..e4d33b4 100644 --- a/ios/chrome/browser/infobars/test/fake_infobar_delegate.h +++ b/ios/chrome/browser/infobars/test/fake_infobar_delegate.h
@@ -18,7 +18,7 @@ FakeInfobarDelegate(infobars::InfoBarDelegate::InfoBarIdentifier identifier); ~FakeInfobarDelegate() override; - // Returns |identifier_|, set during construction. + // Returns `identifier_`, set during construction. InfoBarIdentifier GetIdentifier() const override; // Returns the message string to be displayed for the Infobar.
diff --git a/ios/chrome/browser/infobars/test/fake_infobar_ios.h b/ios/chrome/browser/infobars/test/fake_infobar_ios.h index 803937e..82b75b3 100644 --- a/ios/chrome/browser/infobars/test/fake_infobar_ios.h +++ b/ios/chrome/browser/infobars/test/fake_infobar_ios.h
@@ -17,11 +17,11 @@ // Fake version of InfoBarIOS set up with fake delegates to use in tests. class FakeInfobarIOS : public InfoBarIOS { public: - // Creates a FakeInfobarIOS with |type| that has a delegate that uses - // |message_text| as its message. + // Creates a FakeInfobarIOS with `type` that has a delegate that uses + // `message_text` as its message. FakeInfobarIOS(InfobarType type = InfobarType::kInfobarTypeConfirm, std::u16string message_text = u"FakeInfobar"); - // Creates a FakeInfobarIOS with |fake_delegate|. Uses + // Creates a FakeInfobarIOS with `fake_delegate`. Uses // InfobarType::kInfobarTypeConfirm as a default type value.} FakeInfobarIOS(std::unique_ptr<FakeInfobarDelegate> fake_delegate); ~FakeInfobarIOS() override;
diff --git a/ios/chrome/browser/sync/sync_service_factory_unittest.cc b/ios/chrome/browser/sync/sync_service_factory_unittest.cc index f9b5111c..e1c45ac5 100644 --- a/ios/chrome/browser/sync/sync_service_factory_unittest.cc +++ b/ios/chrome/browser/sync/sync_service_factory_unittest.cc
@@ -53,7 +53,7 @@ protected: // Returns the collection of default datatypes. syncer::ModelTypeSet DefaultDatatypes() { - static_assert(40 == syncer::GetNumModelTypes(), + static_assert(41 == syncer::GetNumModelTypes(), "When adding a new type, you probably want to add it here as " "well (assuming it is already enabled)."); @@ -67,6 +67,7 @@ datatypes.Put(syncer::AUTOFILL_WALLET_METADATA); datatypes.Put(syncer::AUTOFILL_WALLET_OFFER); datatypes.Put(syncer::BOOKMARKS); + // TODO(crbug.com/1348294): Add CONTACT_INFO once it has a controller. datatypes.Put(syncer::DEVICE_INFO); if (base::FeatureList::IsEnabled(syncer::kSyncEnableHistoryDataType)) { datatypes.Put(syncer::HISTORY);
diff --git a/ios/chrome/browser/ui/settings/clear_browsing_data/BUILD.gn b/ios/chrome/browser/ui/settings/clear_browsing_data/BUILD.gn index 3898f0e..22ed395 100644 --- a/ios/chrome/browser/ui/settings/clear_browsing_data/BUILD.gn +++ b/ios/chrome/browser/ui/settings/clear_browsing_data/BUILD.gn
@@ -32,6 +32,7 @@ "//components/prefs/ios", "//components/search_engines", "//components/signin/public/identity_manager", + "//components/signin/public/identity_manager/objc", "//components/strings", "//ios/chrome/app/strings", "//ios/chrome/browser",
diff --git a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager.h b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager.h index f61c312..f2586cd 100644 --- a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager.h +++ b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager.h
@@ -91,6 +91,9 @@ // Fills `model` with appropriate sections and items. - (void)loadModel:(ListModel*)model; +// Update the footer depending on whether the user signed in or out. +- (void)updateModel:(ListModel*)model withTableView:(UITableView*)tableView; + // Restarts browsing data counters, which in turn updates UI, with those data // types specified by `mask`. - (void)restartCounters:(BrowsingDataRemoveMask)mask;
diff --git a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager.mm b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager.mm index 4e316ac..8427756 100644 --- a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager.mm +++ b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager.mm
@@ -246,6 +246,27 @@ [self addSyncProfileItemsToModel:model]; } +- (void)updateModel:(ListModel*)model withTableView:(UITableView*)tableView { + if (!base::FeatureList::IsEnabled(switches::kEnableCbdSignOut)) { + // Footer update are only needed in the Enabled Cbd Signout experiment. + return; + } + const BOOL hasSectionSavedSiteData = + [model hasSectionForSectionIdentifier:SectionIdentifierSavedSiteData]; + if (hasSectionSavedSiteData && [self loggedIn]) { + // Nothing to do. We have data iff we are logged-in + return; + } + if (hasSectionSavedSiteData) { + // User signed-out, no need for footer anymore. + [model removeSectionWithIdentifier:SectionIdentifierSavedSiteData]; + } else if (!hasSectionSavedSiteData) { + // User signed-in, we need to add footer + [self addSavedSiteDataSectionWithModel:model]; + } + [tableView reloadData]; +} + - (void)prepare { _prefObserverBridge->ObserveChangesForPreference( browsing_data::prefs::kDeleteTimePeriod, &_prefChangeRegistrar); @@ -391,11 +412,7 @@ // Add footers about user's account data. - (void)addSyncProfileItemsToModel:(ListModel*)model { // Google Account footer. - signin::IdentityManager* identityManager = - IdentityManagerFactory::GetForBrowserState(self.browserState); - - const BOOL loggedIn = - identityManager->HasPrimaryAccount(signin::ConsentLevel::kSignin); + const BOOL loggedIn = [self loggedIn]; const TemplateURLService* templateURLService = ios::TemplateURLServiceFactory::GetForBrowserState(_browserState); const TemplateURL* defaultSearchEngine = @@ -418,25 +435,11 @@ forSectionWithIdentifier:SectionIdentifierGoogleAccount]; } - syncer::SyncService* syncService = - SyncServiceFactory::GetForBrowserState(self.browserState); - if (!base::FeatureList::IsEnabled(switches::kEnableCbdSignOut)) { - [model addSectionWithIdentifier:SectionIdentifierSavedSiteData]; - if (syncService && syncService->IsSyncFeatureActive()) { - [model setFooter:[self footerClearSyncAndSavedSiteDataItem] - forSectionWithIdentifier:SectionIdentifierSavedSiteData]; - } else { - [model setFooter:[self footerSavedSiteDataItem] - forSectionWithIdentifier:SectionIdentifierSavedSiteData]; - } - } else if (loggedIn) { - [model addSectionWithIdentifier:SectionIdentifierSavedSiteData]; - [model setFooter:[self signOutFooterItem] - forSectionWithIdentifier:SectionIdentifierSavedSiteData]; - } + syncer::SyncService* syncService = [self syncService]; + [self addSavedSiteDataSectionWithModel:model]; // If not syncing, no need to continue with profile syncing. - if (!identityManager->HasPrimaryAccount(signin::ConsentLevel::kSync)) { + if (![self identityManager]->HasPrimaryAccount(signin::ConsentLevel::kSync)) { return; } @@ -679,11 +682,45 @@ #pragma mark - Private Methods +// An identity manager +- (signin::IdentityManager*)identityManager { + return IdentityManagerFactory::GetForBrowserState(self.browserState); +} + +// Whether user is currently logged-in. +- (BOOL)loggedIn { + return + [self identityManager]->HasPrimaryAccount(signin::ConsentLevel::kSignin); +} + +// A sync service +- (syncer::SyncService*)syncService { + return SyncServiceFactory::GetForBrowserState(self.browserState); +} + +// Add at the end of the list model the elements related to signing-out. +- (void)addSavedSiteDataSectionWithModel:(ListModel*)model { + syncer::SyncService* syncService = [self syncService]; + if (!base::FeatureList::IsEnabled(switches::kEnableCbdSignOut)) { + [model addSectionWithIdentifier:SectionIdentifierSavedSiteData]; + if (syncService && syncService->IsSyncFeatureActive()) { + [model setFooter:[self footerClearSyncAndSavedSiteDataItem] + forSectionWithIdentifier:SectionIdentifierSavedSiteData]; + } else { + [model setFooter:[self footerSavedSiteDataItem] + forSectionWithIdentifier:SectionIdentifierSavedSiteData]; + } + } else if ([self loggedIn]) { + [model addSectionWithIdentifier:SectionIdentifierSavedSiteData]; + [model setFooter:[self signOutFooterItem] + forSectionWithIdentifier:SectionIdentifierSavedSiteData]; + } +} + // Signs the user out of Chrome if the sign-in state is `ConsentLevel::kSignin`. - (void)signOutIfNotSyncing { DCHECK(self.browserState); - signin::IdentityManager* identityManager = - IdentityManagerFactory::GetForBrowserState(self.browserState); + signin::IdentityManager* identityManager = [self identityManager]; DCHECK(identityManager); if (!identityManager->HasPrimaryAccount(signin::ConsentLevel::kSync)) { AuthenticationService* authenticationService = @@ -753,9 +790,7 @@ "History.ClearBrowsingData.HistoryNoticeShownInFooterWhenUpdated", _shouldShowNoticeAboutOtherFormsOfBrowsingHistory); - signin::IdentityManager* identityManager = - IdentityManagerFactory::GetForBrowserState(_browserState); - if (!identityManager->HasPrimaryAccount(signin::ConsentLevel::kSync)) { + if (![self identityManager]->HasPrimaryAccount(signin::ConsentLevel::kSync)) { return; } @@ -763,6 +798,12 @@ forSectionWithIdentifier:SectionIdentifierGoogleAccount]; } +#pragma mark - IdentityManagerObserverBridgeDelegate + +- (void)onPrimaryAccountChanged: + (const signin::PrimaryAccountChangeEvent&)event { +} + #pragma mark - PrefObserverDelegate - (void)onPreferenceChanged:(const std::string&)preferenceName {
diff --git a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager_unittest.mm b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager_unittest.mm index 5ec9ea0..2e0f61d7 100644 --- a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager_unittest.mm +++ b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager_unittest.mm
@@ -4,47 +4,48 @@ #import "ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager.h" -#include "base/bind.h" -#include "base/mac/foundation_util.h" -#include "base/strings/utf_string_conversions.h" -#include "components/browsing_data/core/pref_names.h" -#include "components/pref_registry/pref_registry_syncable.h" -#include "components/search_engines/template_url_data_util.h" -#include "components/search_engines/template_url_prepopulate_data.h" -#include "components/search_engines/template_url_service.h" -#include "components/sync/driver/test_sync_service.h" -#include "components/sync_preferences/pref_service_mock_factory.h" -#include "components/sync_preferences/pref_service_syncable.h" -#include "ios/chrome/browser/application_context.h" -#include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" -#include "ios/chrome/browser/browsing_data/browsing_data_features.h" -#include "ios/chrome/browser/browsing_data/cache_counter.h" -#include "ios/chrome/browser/browsing_data/fake_browsing_data_remover.h" +#import "base/bind.h" +#import "base/mac/foundation_util.h" +#import "base/strings/utf_string_conversions.h" +#import "components/browsing_data/core/pref_names.h" +#import "components/pref_registry/pref_registry_syncable.h" +#import "components/search_engines/template_url_data_util.h" +#import "components/search_engines/template_url_prepopulate_data.h" +#import "components/search_engines/template_url_service.h" +#import "components/sync/driver/sync_service.h" +#import "components/sync/driver/test_sync_service.h" +#import "components/sync_preferences/pref_service_mock_factory.h" +#import "components/sync_preferences/pref_service_syncable.h" +#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/browser_state/test_chrome_browser_state.h" +#import "ios/chrome/browser/browsing_data/browsing_data_features.h" +#import "ios/chrome/browser/browsing_data/cache_counter.h" +#import "ios/chrome/browser/browsing_data/fake_browsing_data_remover.h" #import "ios/chrome/browser/net/crurl.h" -#include "ios/chrome/browser/pref_names.h" -#include "ios/chrome/browser/prefs/browser_prefs.h" -#include "ios/chrome/browser/search_engines/template_url_service_factory.h" -#include "ios/chrome/browser/signin/authentication_service.h" -#include "ios/chrome/browser/signin/authentication_service_delegate_fake.h" -#include "ios/chrome/browser/signin/authentication_service_factory.h" +#import "ios/chrome/browser/pref_names.h" +#import "ios/chrome/browser/prefs/browser_prefs.h" +#import "ios/chrome/browser/search_engines/template_url_service_factory.h" +#import "ios/chrome/browser/signin/authentication_service.h" +#import "ios/chrome/browser/signin/authentication_service_delegate_fake.h" +#import "ios/chrome/browser/signin/authentication_service_factory.h" #import "ios/chrome/browser/signin/chrome_account_manager_service.h" #import "ios/chrome/browser/signin/chrome_account_manager_service_factory.h" -#include "ios/chrome/browser/sync/sync_service_factory.h" -#include "ios/chrome/browser/sync/sync_setup_service_factory.h" -#include "ios/chrome/browser/sync/sync_setup_service_mock.h" +#import "ios/chrome/browser/sync/sync_service_factory.h" +#import "ios/chrome/browser/sync/sync_setup_service_factory.h" +#import "ios/chrome/browser/sync/sync_setup_service_mock.h" #import "ios/chrome/browser/ui/settings/clear_browsing_data/fake_browsing_data_counter_wrapper_producer.h" #import "ios/chrome/browser/ui/table_view/cells/table_view_detail_icon_item.h" #import "ios/chrome/browser/ui/table_view/cells/table_view_link_header_footer_item.h" #import "ios/chrome/browser/ui/table_view/table_view_model.h" -#include "ios/chrome/browser/ui/ui_feature_flags.h" -#include "ios/chrome/grit/ios_strings.h" -#include "ios/chrome/test/ios_chrome_scoped_testing_local_state.h" -#include "ios/public/provider/chrome/browser/signin/fake_chrome_identity_service.h" -#include "ios/web/public/test/web_task_environment.h" -#include "testing/gtest/include/gtest/gtest.h" +#import "ios/chrome/browser/ui/ui_feature_flags.h" +#import "ios/chrome/grit/ios_strings.h" +#import "ios/chrome/test/ios_chrome_scoped_testing_local_state.h" +#import "ios/public/provider/chrome/browser/signin/fake_chrome_identity_service.h" +#import "ios/web/public/test/web_task_environment.h" +#import "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" -#include "testing/platform_test.h" -#include "ui/base/l10n/l10n_util_mac.h" +#import "testing/platform_test.h" +#import "ui/base/l10n/l10n_util_mac.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support."
diff --git a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.mm b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.mm index ac3bcbe..afcd9a2 100644 --- a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.mm
@@ -12,12 +12,14 @@ #include "components/prefs/pref_service.h" #import "components/signin/public/base/signin_metrics.h" #import "components/signin/public/base/signin_switches.h" +#import "components/signin/public/identity_manager/objc/identity_manager_observer_bridge.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browsing_data/browsing_data_features.h" #include "ios/chrome/browser/browsing_data/browsing_data_remove_mask.h" #include "ios/chrome/browser/chrome_url_constants.h" #import "ios/chrome/browser/main/browser.h" #import "ios/chrome/browser/net/crurl.h" +#import "ios/chrome/browser/signin/identity_manager_factory.h" #import "ios/chrome/browser/ui/alert_coordinator/action_sheet_coordinator.h" #import "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h" #import "ios/chrome/browser/ui/authentication/signout_action_sheet_coordinator.h" @@ -48,6 +50,7 @@ @interface ClearBrowsingDataTableViewController () < ClearBrowsingDataConsumer, + IdentityManagerObserverBridgeDelegate, SignoutActionSheetCoordinatorDelegate, TableViewLinkHeaderFooterItemDelegate, UIGestureRecognizerDelegate> @@ -86,6 +89,8 @@ @implementation ClearBrowsingDataTableViewController { // Modal alert for sign out. SignoutActionSheetCoordinator* _signoutCoordinator; + std::unique_ptr<signin::IdentityManagerObserverBridge> + _identityManagerObserverBridge; } @synthesize dispatcher = _dispatcher; @synthesize delegate = _delegate; @@ -101,6 +106,9 @@ _dataManager = [[ClearBrowsingDataManager alloc] initWithBrowserState:browser->GetBrowserState()]; _dataManager.consumer = self; + _identityManagerObserverBridge.reset( + new signin::IdentityManagerObserverBridge( + IdentityManagerFactory::GetForBrowserState(_browserState), self)); } return self; } @@ -128,6 +136,15 @@ return _clearBrowsingDataBarButton; } +#pragma mark - IdentityManagerObserverBridgeDelegate + +// Update footer to take into account whether the user is signed-in or not. +- (void)onPrimaryAccountChanged: + (const signin::PrimaryAccountChangeEvent&)event { + [self.dataManager updateModel:self.tableViewModel + withTableView:self.tableView]; +} + #pragma mark - UIViewController - (void)viewDidLoad { @@ -201,6 +218,7 @@ self.navigationController.interactivePopGestureRecognizer.delegate = nil; self.overlayCoordinator = nil; } + _identityManagerObserverBridge.reset(); [self.dataManager disconnect]; }
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 index 5cb0d2d..386990e 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -a1832948c434df7643b8f3caaf829493d1fe81aa \ No newline at end of file +3114e8446d2ad74ddbc14117f4470948b6793d97 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 index ea4561f..1d1f28f 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -99c930a5ee8dfc56e89efd0b0776eb29793f84c6 \ No newline at end of file +46c2a19d470a6221ad8f57c4612a0ba352b447b4 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 index fd1e05c..f6fc865 100644 --- a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -9054ea5e1c1500c4f0f879e9e7147d29072e756d \ No newline at end of file +510e3f4bf08c6b12e3b5d7faccf90159b2c7b923 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 index 6f12ef4..8a5f5fd 100644 --- a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -d6e8cf338456e072ccec5e10d9521e1777a05340 \ No newline at end of file +eaf2355708265bb2de9b4fac723a2ca01d578c41 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 index 81cd7c1..3c82f82 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -48a2adb6b0a14beea9438d8802c81cac7cb91469 \ No newline at end of file +9e0505db1e769778606c6e104f45b8e8a4270a3c \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 index 560adfff..61383e1 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -a8e3560697dfd633936a826f5eec00a51316058f \ No newline at end of file +2b06e7ba8ab2e303d576060dba1b77e2001922c5 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 index 508ead5..bd91493 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -d07f2fb9a23a9ecc0580da8ceae636c6a145123c \ No newline at end of file +11c5f1ebb0eac5b2b9acd13f8928742026a5d0b5 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 index 0526687..c351f11e 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -0b3ede7d285f41f817bf447e0399aa2128f17c90 \ No newline at end of file +e439aefd24a3246b24f9bf323603b38b9a0dcc46 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 index 024b477..2cbaa85 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -5a6747a1ce7a59f9d226ac8376f852ab79f5cacb \ No newline at end of file +243f00d27022ff942897c9af22887e7a8b0a37e5 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 index 1e57fa65..ba74418 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -7882fa9961376c358dd89e26bb649881bdf4fd09 \ No newline at end of file +6d17f9f938c4932c98707bc6748013d689ff0c33 \ No newline at end of file
diff --git a/ios/web/webui/mojo_facade.mm b/ios/web/webui/mojo_facade.mm index 33e7357..08d80349 100644 --- a/ios/web/webui/mojo_facade.mm +++ b/ios/web/webui/mojo_facade.mm
@@ -24,7 +24,6 @@ #include "ios/web/public/thread/web_thread.h" #import "ios/web/public/web_state.h" #include "mojo/public/cpp/bindings/generic_pending_receiver.h" -#include "mojo/public/cpp/system/core.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support."
diff --git a/ipc/ipc_channel_mojo.h b/ipc/ipc_channel_mojo.h index 4f8bb22..187b132 100644 --- a/ipc/ipc_channel_mojo.h +++ b/ipc/ipc_channel_mojo.h
@@ -26,7 +26,6 @@ #include "ipc/ipc_channel_factory.h" #include "ipc/ipc_message_pipe_reader.h" #include "ipc/ipc_mojo_bootstrap.h" -#include "mojo/public/cpp/system/core.h" namespace IPC {
diff --git a/ipc/ipc_message_pipe_reader.h b/ipc/ipc_message_pipe_reader.h index ed9696d..d219eab 100644 --- a/ipc/ipc_message_pipe_reader.h +++ b/ipc/ipc_message_pipe_reader.h
@@ -25,7 +25,6 @@ #include "mojo/public/cpp/bindings/pending_associated_receiver.h" #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" #include "mojo/public/cpp/bindings/shared_remote.h" -#include "mojo/public/cpp/system/core.h" #include "mojo/public/cpp/system/message_pipe.h" namespace IPC {
diff --git a/ipc/ipc_perftest_util.h b/ipc/ipc_perftest_util.h index 0d93632..a89bd032 100644 --- a/ipc/ipc_perftest_util.h +++ b/ipc/ipc_perftest_util.h
@@ -26,7 +26,7 @@ #include "ipc/ipc_sender.h" #include "ipc/ipc_test.mojom.h" #include "mojo/public/cpp/bindings/receiver.h" -#include "mojo/public/cpp/system/core.h" +#include "mojo/public/cpp/system/message_pipe.h" #if BUILDFLAG(IS_WIN) #include <windows.h>
diff --git a/media/video/gpu_memory_buffer_video_frame_pool.cc b/media/video/gpu_memory_buffer_video_frame_pool.cc index ef464da..bb9c9c9 100644 --- a/media/video/gpu_memory_buffer_video_frame_pool.cc +++ b/media/video/gpu_memory_buffer_video_frame_pool.cc
@@ -1212,7 +1212,7 @@ } gpu::MailboxHolder mailbox_holders[VideoFrame::kMaxPlanes]; - bool is_webgpu_compatible = true; + bool is_webgpu_compatible = false; // Set up the planes creating the mailboxes needed to refer to the textures. for (size_t plane = 0; plane < NumSharedImages(output_format_); plane++) { size_t gpu_memory_buffer_plane = @@ -1223,15 +1223,19 @@ frame_resources->plane_resources[gpu_memory_buffer_plane] .gpu_memory_buffer.get(); +#if BUILDFLAG(IS_MAC) + // Shared image uses iosurface as native resource which is compatible to + // WebGPU always. + is_webgpu_compatible = (gpu_memory_buffer != nullptr); +#endif + #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) - is_webgpu_compatible &= (gpu_memory_buffer != nullptr); + is_webgpu_compatible = (gpu_memory_buffer != nullptr); if (is_webgpu_compatible) { is_webgpu_compatible &= gpu_memory_buffer->CloneHandle() .native_pixmap_handle.supports_zero_copy_webgpu_import; } -#else - is_webgpu_compatible = false; #endif const gfx::BufferFormat buffer_format = @@ -1243,7 +1247,7 @@ gpu::SHARED_IMAGE_USAGE_GLES2 | gpu::SHARED_IMAGE_USAGE_RASTER | gpu::SHARED_IMAGE_USAGE_DISPLAY | gpu::SHARED_IMAGE_USAGE_SCANOUT; -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) // TODO(crbug.com/1241537): Always add the flag once the // OzoneImageBacking is by default turned on. if (base::CommandLine::ForCurrentProcess()->HasSwitch(
diff --git a/mojo/public/cpp/bindings/connector.h b/mojo/public/cpp/bindings/connector.h index d4cc158..f3e2a4cd 100644 --- a/mojo/public/cpp/bindings/connector.h +++ b/mojo/public/cpp/bindings/connector.h
@@ -20,8 +20,8 @@ #include "mojo/public/cpp/bindings/connection_group.h" #include "mojo/public/cpp/bindings/message.h" #include "mojo/public/cpp/bindings/message_header_validator.h" -#include "mojo/public/cpp/system/core.h" #include "mojo/public/cpp/system/handle_signal_tracker.h" +#include "mojo/public/cpp/system/message_pipe.h" #include "mojo/public/cpp/system/simple_watcher.h" #include "third_party/abseil-cpp/absl/types/optional.h"
diff --git a/mojo/public/cpp/bindings/lib/binding_state.h b/mojo/public/cpp/bindings/lib/binding_state.h index 1b33aa7..d45e8535 100644 --- a/mojo/public/cpp/bindings/lib/binding_state.h +++ b/mojo/public/cpp/bindings/lib/binding_state.h
@@ -27,7 +27,6 @@ #include "mojo/public/cpp/bindings/pending_flush.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" -#include "mojo/public/cpp/system/core.h" namespace mojo {
diff --git a/mojo/public/cpp/bindings/lib/bindings_internal.h b/mojo/public/cpp/bindings/lib/bindings_internal.h index bf78b003..98a2502 100644 --- a/mojo/public/cpp/bindings/lib/bindings_internal.h +++ b/mojo/public/cpp/bindings/lib/bindings_internal.h
@@ -15,7 +15,7 @@ #include "mojo/public/cpp/bindings/interface_id.h" #include "mojo/public/cpp/bindings/lib/template_util.h" #include "mojo/public/cpp/platform/platform_handle.h" -#include "mojo/public/cpp/system/core.h" +#include "mojo/public/cpp/system/handle.h" namespace mojo {
diff --git a/mojo/public/cpp/bindings/lib/handle_serialization.h b/mojo/public/cpp/bindings/lib/handle_serialization.h index 4a3c3c6..508df40 100644 --- a/mojo/public/cpp/bindings/lib/handle_serialization.h +++ b/mojo/public/cpp/bindings/lib/handle_serialization.h
@@ -11,6 +11,7 @@ #include "mojo/public/cpp/bindings/message.h" #include "mojo/public/cpp/platform/platform_handle.h" #include "mojo/public/cpp/system/handle.h" +#include "mojo/public/cpp/system/message_pipe.h" #include "mojo/public/cpp/system/platform_handle.h" // This header defines helpers used by generated bindings to stash various types
diff --git a/mojo/public/cpp/bindings/lib/interface_serialization.h b/mojo/public/cpp/bindings/lib/interface_serialization.h index 3cae724..f1ed949 100644 --- a/mojo/public/cpp/bindings/lib/interface_serialization.h +++ b/mojo/public/cpp/bindings/lib/interface_serialization.h
@@ -7,7 +7,6 @@ #include <type_traits> -#include "mojo/public/cpp/bindings/associated_group_controller.h" #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" #include "mojo/public/cpp/bindings/interface_data_view.h" #include "mojo/public/cpp/bindings/lib/bindings_internal.h"
diff --git a/mojo/public/cpp/bindings/sync_handle_registry.h b/mojo/public/cpp/bindings/sync_handle_registry.h index 6dce7c8..b11f234 100644 --- a/mojo/public/cpp/bindings/sync_handle_registry.h +++ b/mojo/public/cpp/bindings/sync_handle_registry.h
@@ -16,7 +16,6 @@ #include "base/sequence_checker.h" #include "base/synchronization/waitable_event.h" #include "base/types/pass_key.h" -#include "mojo/public/cpp/system/core.h" #include "mojo/public/cpp/system/wait_set.h" namespace mojo {
diff --git a/mojo/public/cpp/bindings/sync_handle_watcher.h b/mojo/public/cpp/bindings/sync_handle_watcher.h index 8826c3d5..aa14a79 100644 --- a/mojo/public/cpp/bindings/sync_handle_watcher.h +++ b/mojo/public/cpp/bindings/sync_handle_watcher.h
@@ -9,7 +9,6 @@ #include "base/memory/ref_counted.h" #include "base/sequence_checker.h" #include "mojo/public/cpp/bindings/sync_handle_registry.h" -#include "mojo/public/cpp/system/core.h" namespace mojo {
diff --git a/mojo/public/cpp/bindings/tests/validation_context_unittest.cc b/mojo/public/cpp/bindings/tests/validation_context_unittest.cc index 9ce9d60e..2e309a6 100644 --- a/mojo/public/cpp/bindings/tests/validation_context_unittest.cc +++ b/mojo/public/cpp/bindings/tests/validation_context_unittest.cc
@@ -9,7 +9,6 @@ #include "mojo/public/cpp/bindings/lib/serialization_util.h" #include "mojo/public/cpp/bindings/lib/validation_context.h" -#include "mojo/public/cpp/system/core.h" #include "testing/gtest/include/gtest/gtest.h" namespace mojo {
diff --git a/mojo/public/cpp/bindings/tests/validation_unittest.cc b/mojo/public/cpp/bindings/tests/validation_unittest.cc index 253acc7..dd65196 100644 --- a/mojo/public/cpp/bindings/tests/validation_unittest.cc +++ b/mojo/public/cpp/bindings/tests/validation_unittest.cc
@@ -25,7 +25,6 @@ #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/bindings/tests/validation_test_input_parser.h" -#include "mojo/public/cpp/system/core.h" #include "mojo/public/cpp/system/message.h" #include "mojo/public/cpp/test_support/test_support.h" #include "mojo/public/interfaces/bindings/tests/validation_test_associated_interfaces.mojom.h"
diff --git a/mojo/public/cpp/system/BUILD.gn b/mojo/public/cpp/system/BUILD.gn index d374b42..30c7745 100644 --- a/mojo/public/cpp/system/BUILD.gn +++ b/mojo/public/cpp/system/BUILD.gn
@@ -8,7 +8,6 @@ sources = [ "buffer.cc", "buffer.h", - "core.h", "data_pipe.h", "data_pipe_drainer.cc", "data_pipe_drainer.h",
diff --git a/mojo/public/cpp/system/core.h b/mojo/public/cpp/system/core.h deleted file mode 100644 index f1d18d97..0000000 --- a/mojo/public/cpp/system/core.h +++ /dev/null
@@ -1,14 +0,0 @@ -// Copyright 2014 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 MOJO_PUBLIC_CPP_SYSTEM_CORE_H_ -#define MOJO_PUBLIC_CPP_SYSTEM_CORE_H_ - -#include "mojo/public/cpp/system/buffer.h" -#include "mojo/public/cpp/system/data_pipe.h" -#include "mojo/public/cpp/system/functions.h" -#include "mojo/public/cpp/system/handle.h" -#include "mojo/public/cpp/system/message_pipe.h" - -#endif // MOJO_PUBLIC_CPP_SYSTEM_CORE_H_
diff --git a/mojo/public/cpp/system/data_pipe_drainer.h b/mojo/public/cpp/system/data_pipe_drainer.h index 5ff7052..df4ccbe6 100644 --- a/mojo/public/cpp/system/data_pipe_drainer.h +++ b/mojo/public/cpp/system/data_pipe_drainer.h
@@ -9,7 +9,7 @@ #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" -#include "mojo/public/cpp/system/core.h" +#include "mojo/public/cpp/system/data_pipe.h" #include "mojo/public/cpp/system/simple_watcher.h" #include "mojo/public/cpp/system/system_export.h"
diff --git a/mojo/public/cpp/system/tests/core_unittest.cc b/mojo/public/cpp/system/tests/core_unittest.cc index d40b186..e1dde31b 100644 --- a/mojo/public/cpp/system/tests/core_unittest.cc +++ b/mojo/public/cpp/system/tests/core_unittest.cc
@@ -6,13 +6,15 @@ // TODO(vtl): Maybe rename "CoreCppTest" -> "CoreTest" if/when this gets // compiled into a different binary from the C API tests. -#include "mojo/public/cpp/system/core.h" - #include <stddef.h> #include <stdint.h> #include <map> #include <utility> +#include "mojo/public/cpp/system/buffer.h" +#include "mojo/public/cpp/system/data_pipe.h" +#include "mojo/public/cpp/system/functions.h" +#include "mojo/public/cpp/system/message_pipe.h" #include "mojo/public/cpp/system/wait.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/mojo/public/cpp/test_support/lib/test_utils.cc b/mojo/public/cpp/test_support/lib/test_utils.cc index 71c74b8..b627909 100644 --- a/mojo/public/cpp/test_support/lib/test_utils.cc +++ b/mojo/public/cpp/test_support/lib/test_utils.cc
@@ -11,8 +11,8 @@ #include "base/bind.h" #include "base/callback_helpers.h" -#include "mojo/public/cpp/system/core.h" #include "mojo/public/cpp/system/functions.h" +#include "mojo/public/cpp/system/message_pipe.h" #include "mojo/public/cpp/system/wait.h" #include "mojo/public/cpp/test_support/test_support.h"
diff --git a/mojo/public/cpp/test_support/test_utils.h b/mojo/public/cpp/test_support/test_utils.h index 327cdf9..0b3a815 100644 --- a/mojo/public/cpp/test_support/test_utils.h +++ b/mojo/public/cpp/test_support/test_utils.h
@@ -11,9 +11,11 @@ #include "base/run_loop.h" #include "mojo/public/cpp/bindings/message.h" #include "mojo/public/cpp/bindings/struct_ptr.h" -#include "mojo/public/cpp/system/core.h" namespace mojo { + +class MessagePipeHandle; + namespace test { // This overload is used for mojom structures with struct traits. The C++
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module-shared.h.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module-shared.h.tmpl index 29aca23..cc848ec 100644 --- a/mojo/public/tools/bindings/generators/cpp_templates/module-shared.h.tmpl +++ b/mojo/public/tools/bindings/generators/cpp_templates/module-shared.h.tmpl
@@ -62,6 +62,7 @@ {#- Avoid transitive includes of interface headers if possible. #} {% if not disallow_interfaces and uses_interfaces -%} #include "mojo/public/cpp/bindings/lib/interface_serialization.h" +#include "mojo/public/cpp/system/data_pipe.h" {%- endif %} {% if not disallow_native_types and uses_native_types %}
diff --git a/mojo/public/tools/fuzzers/mojolpm.h b/mojo/public/tools/fuzzers/mojolpm.h index 7f336eb..a72aecc 100644 --- a/mojo/public/tools/fuzzers/mojolpm.h +++ b/mojo/public/tools/fuzzers/mojolpm.h
@@ -17,7 +17,7 @@ #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/platform/platform_handle.h" -#include "mojo/public/cpp/system/core.h" +#include "mojo/public/cpp/system/buffer.h" #include "mojo/public/cpp/system/data_pipe.h" #include "mojo/public/tools/fuzzers/mojolpm.pb.h"
diff --git a/rlz/chromeos/lib/rlz_value_store_chromeos.cc b/rlz/chromeos/lib/rlz_value_store_chromeos.cc index ab3300b7..6a5fc34 100644 --- a/rlz/chromeos/lib/rlz_value_store_chromeos.cc +++ b/rlz/chromeos/lib/rlz_value_store_chromeos.cc
@@ -126,10 +126,8 @@ void SetRlzPingSent(int retry_count) { // GetSystemBus() could return null in tests. base::SequencedTaskRunner* const origin_task_runner = - chromeos::DBusThreadManager::Get()->GetSystemBus() - ? chromeos::DBusThreadManager::Get() - ->GetSystemBus() - ->GetOriginTaskRunner() + ash::DBusThreadManager::Get()->GetSystemBus() + ? ash::DBusThreadManager::Get()->GetSystemBus()->GetOriginTaskRunner() : nullptr; if (origin_task_runner && !origin_task_runner->RunsTasksInCurrentSequence()) { origin_task_runner->PostTask(FROM_HERE,
diff --git a/rlz/lib/rlz_lib_test.cc b/rlz/lib/rlz_lib_test.cc index c309bb3..66ea64b 100644 --- a/rlz/lib/rlz_lib_test.cc +++ b/rlz/lib/rlz_lib_test.cc
@@ -1112,7 +1112,7 @@ }; TEST_F(RlzLibTest, SetRlzPingSent) { - chromeos::DBusThreadManager::Initialize(); + ash::DBusThreadManager::Initialize(); auto debug_daemon_client = std::make_unique<ScopedTestDebugDaemonClient>(); const char* kPingResponse = "stateful-events: CAF\r\n" @@ -1133,7 +1133,7 @@ EXPECT_EQ(debug_daemon_client->num_set_rlz_ping_sent(), 1 + rlz_lib::RlzValueStoreChromeOS::kMaxRetryCount); debug_daemon_client.reset(); - chromeos::DBusThreadManager::Shutdown(); + ash::DBusThreadManager::Shutdown(); } TEST_F(RlzLibTest, NoRecordCAFEvent) {
diff --git a/services/device/media_transfer_protocol/mtp_device_manager.cc b/services/device/media_transfer_protocol/mtp_device_manager.cc index d7eae096..e871247 100644 --- a/services/device/media_transfer_protocol/mtp_device_manager.cc +++ b/services/device/media_transfer_protocol/mtp_device_manager.cc
@@ -22,7 +22,7 @@ } // namespace MtpDeviceManager::MtpDeviceManager() - : bus_(chromeos::DBusThreadManager::Get()->GetSystemBus()) { + : bus_(ash::DBusThreadManager::Get()->GetSystemBus()) { // Listen for future mtpd service owner changes, in case it is not // available right now. There is no guarantee that mtpd is running already. dbus::Bus::ServiceOwnerChangeCallback mtpd_owner_changed_callback =
diff --git a/services/network/network_context_unittest.cc b/services/network/network_context_unittest.cc index 8ad38ad..99cf666f 100644 --- a/services/network/network_context_unittest.cc +++ b/services/network/network_context_unittest.cc
@@ -1559,6 +1559,79 @@ EXPECT_EQ(net::ERR_NAME_NOT_RESOLVED, callback2.GetResult(result)); } } + +TEST_F(NetworkContextTest, P2PHostResolutionWithFamily) { + net::NetworkIsolationKey network_isolation_key = + net::NetworkIsolationKey::CreateTransient(); + auto context_builder = CreateTestURLRequestContextBuilder(); + std::unique_ptr<net::MockHostResolver> resolver = + std::make_unique<net::MockHostResolver>(); + auto& host_resolver = *resolver.get(); + context_builder->set_host_resolver(std::move(resolver)); + auto url_request_context = context_builder->Build(); + + network_context_remote_.reset(); + std::unique_ptr<NetworkContext> network_context = + std::make_unique<NetworkContext>( + network_service_.get(), + network_context_remote_.BindNewPipeAndPassReceiver(), + url_request_context.get(), + std::vector<std::string>() /* cors_exempt_header_list */); + + MockP2PTrustedSocketManagerClient client; + mojo::Receiver<network::mojom::P2PTrustedSocketManagerClient> receiver( + &client); + mojo::Remote<mojom::P2PTrustedSocketManager> trusted_socket_manager; + mojo::Remote<mojom::P2PSocketManager> socket_manager; + network_context_remote_->CreateP2PSocketManager( + network_isolation_key, receiver.BindNewPipeAndPassRemote(), + trusted_socket_manager.BindNewPipeAndPassReceiver(), + socket_manager.BindNewPipeAndPassReceiver()); + + const char kIPv4Hostname[] = "ipv4.test."; + net::MockHostResolverBase::RuleResolver::RuleKey ipv4_key; + ipv4_key.hostname_pattern = kIPv4Hostname; + ipv4_key.query_type = net::DnsQueryType::A; + net::IPAddress ipv4_address; + ASSERT_TRUE(ipv4_address.AssignFromIPLiteral("1.2.3.4")); + host_resolver.rules()->AddRule(ipv4_key, ipv4_address.ToString()); + + const char kIPv6Hostname[] = "ipv6.test."; + net::MockHostResolverBase::RuleResolver::RuleKey ipv6_key; + ipv6_key.hostname_pattern = kIPv6Hostname; + ipv6_key.query_type = net::DnsQueryType::AAAA; + net::IPAddress ipv6_address; + ASSERT_TRUE(ipv6_address.AssignFromIPLiteral("::1234:5678")); + host_resolver.rules()->AddRule(ipv6_key, ipv6_address.ToString()); + + { + base::RunLoop run_loop; + std::vector<net::IPAddress> results; + // Expect IPv4 address when family passed as AF_INET. + socket_manager->GetHostAddressWithFamily( + kIPv4Hostname, AF_INET, false /* enable_mdns */, + base::BindLambdaForTesting( + [&](const std::vector<net::IPAddress>& addresses) { + EXPECT_EQ(std::vector<net::IPAddress>{ipv4_address}, addresses); + run_loop.Quit(); + })); + run_loop.Run(); + } + + { + base::RunLoop run_loop; + std::vector<net::IPAddress> results; + // Expect IPv6 address when family passed as AF_INET6. + socket_manager->GetHostAddressWithFamily( + kIPv6Hostname, AF_INET6, false /* enable_mdns */, + base::BindLambdaForTesting( + [&](const std::vector<net::IPAddress>& addresses) { + EXPECT_EQ(std::vector<net::IPAddress>{ipv6_address}, addresses); + run_loop.Quit(); + })); + run_loop.Run(); + } +} #endif // BUILDFLAG(IS_P2P_ENABLED) // Test that valid referrers are allowed, while invalid ones result in errors.
diff --git a/services/network/p2p/socket_manager.cc b/services/network/p2p/socket_manager.cc index 27a3637..7c360f1 100644 --- a/services/network/p2p/socket_manager.cc +++ b/services/network/p2p/socket_manager.cc
@@ -12,11 +12,13 @@ #include "base/memory/raw_ptr.h" #include "base/task/thread_pool.h" #include "base/threading/thread_task_runner_handle.h" +#include "net/base/address_family.h" #include "net/base/address_list.h" #include "net/base/net_errors.h" #include "net/base/network_interfaces.h" #include "net/base/network_isolation_key.h" #include "net/base/sys_addrinfo.h" +#include "net/dns/dns_util.h" #include "net/dns/host_resolver.h" #include "net/log/net_log_source.h" #include "net/log/net_log_with_source.h" @@ -28,6 +30,7 @@ #include "services/network/p2p/socket.h" #include "services/network/proxy_resolving_client_socket_factory.h" #include "services/network/public/cpp/p2p_param_traits.h" +#include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/webrtc/media/base/rtp_utils.h" #include "third_party/webrtc/media/base/turn_utils.h" @@ -71,6 +74,10 @@ return EndsWith(host_name, kLocalTld, base::CompareCase::INSENSITIVE_ASCII); } +net::DnsQueryType FamilyToDnsQueryType(int family) { + return net::AddressFamilyToDnsQueryType(net::ToAddressFamily(family)); +} + } // namespace class P2PSocketManager::DnsRequest { @@ -81,6 +88,7 @@ : resolver_(host_resolver), enable_mdns_(enable_mdns) {} void Resolve(const std::string& host_name, + absl::optional<int> family, const net::NetworkIsolationKey& network_isolation_key, DoneCallback done_callback) { DCHECK(!done_callback.is_null()); @@ -110,6 +118,9 @@ parameters.source = net::HostResolverSource::MULTICAST_DNS; #endif // ENABLE_MDNS } + if (family.has_value()) { + parameters.dns_query_type = FamilyToDnsQueryType(family.value()); + } request_ = resolver_->CreateRequest(host, network_isolation_key, net::NetLogWithSource(), parameters); @@ -301,12 +312,30 @@ const std::string& host_name, bool enable_mdns, mojom::P2PSocketManager::GetHostAddressCallback callback) { + DoGetHostAddress(host_name, /*address_family=*/absl::nullopt, enable_mdns, + std::move(callback)); +} + +void P2PSocketManager::GetHostAddressWithFamily( + const std::string& host_name, + int address_family, + bool enable_mdns, + mojom::P2PSocketManager::GetHostAddressCallback callback) { + DoGetHostAddress(host_name, absl::make_optional(address_family), enable_mdns, + std::move(callback)); +} + +void P2PSocketManager::DoGetHostAddress( + const std::string& host_name, + absl::optional<int> address_family, + bool enable_mdns, + mojom::P2PSocketManager::GetHostAddressCallback callback) { auto request = std::make_unique<DnsRequest>( url_request_context_->host_resolver(), enable_mdns); DnsRequest* request_ptr = request.get(); dns_requests_.insert(std::move(request)); request_ptr->Resolve( - host_name, network_isolation_key_, + host_name, address_family, network_isolation_key_, base::BindOnce(&P2PSocketManager::OnAddressResolved, base::Unretained(this), request_ptr, std::move(callback))); }
diff --git a/services/network/p2p/socket_manager.h b/services/network/p2p/socket_manager.h index 105178cf..8a305668 100644 --- a/services/network/p2p/socket_manager.h +++ b/services/network/p2p/socket_manager.h
@@ -32,6 +32,7 @@ #include "services/network/public/cpp/p2p_socket_type.h" #include "services/network/public/mojom/p2p.mojom.h" #include "services/network/public/mojom/p2p_trusted.mojom.h" +#include "third_party/abseil-cpp/absl/types/optional.h" namespace net { class URLRequestContext; @@ -103,6 +104,11 @@ const std::string& host_name, bool enable_mdns, mojom::P2PSocketManager::GetHostAddressCallback callback) override; + void GetHostAddressWithFamily( + const std::string& host_name, + int address_family, + bool enable_mdns, + mojom::P2PSocketManager::GetHostAddressCallback callback) override; void CreateSocket(P2PSocketType type, const net::IPEndPoint& local_address, const P2PPortRange& port_range, @@ -121,6 +127,12 @@ // retrieves the default local address. static net::IPAddress GetDefaultLocalAddress(int family); + void DoGetHostAddress( + const std::string& host_name, + absl::optional<int> address_family, + bool enable_mdns, + mojom::P2PSocketManager::GetHostAddressCallback callback); + void OnAddressResolved( DnsRequest* request, mojom::P2PSocketManager::GetHostAddressCallback callback,
diff --git a/services/network/public/mojom/p2p.mojom b/services/network/public/mojom/p2p.mojom index 324e5a9..7514652 100644 --- a/services/network/public/mojom/p2p.mojom +++ b/services/network/public/mojom/p2p.mojom
@@ -39,9 +39,15 @@ StartNetworkNotifications( pending_remote<P2PNetworkNotificationClient> client); + // Performs DNS hostname resolution. GetHostAddress(string host_name, bool enable_mdns) => (array<IPAddress> addresses); + // Performs DNS hostname resolution for a specific IP address family. + GetHostAddressWithFamily(string host_name, + int32 address_family, + bool enable_mdns) => (array<IPAddress> addresses); + CreateSocket(P2PSocketType type, IPEndPoint local_address, P2PPortRange port_range,
diff --git a/services/service_manager/public/cpp/service_executable/BUILD.gn b/services/service_manager/public/cpp/service_executable/BUILD.gn index e07aaf61..4c1c496 100644 --- a/services/service_manager/public/cpp/service_executable/BUILD.gn +++ b/services/service_manager/public/cpp/service_executable/BUILD.gn
@@ -52,13 +52,11 @@ sources = [ "main.cc" ] public_deps = [ "//services/service_manager/public/mojom" ] - testonly = true deps = [ ":support", "//base", "//base:base_static", "//base:i18n", - "//base/test:test_support", ] }
diff --git a/services/service_manager/public/cpp/service_executable/main.cc b/services/service_manager/public/cpp/service_executable/main.cc index 3b2d494..ef4a5e3 100644 --- a/services/service_manager/public/cpp/service_executable/main.cc +++ b/services/service_manager/public/cpp/service_executable/main.cc
@@ -11,12 +11,12 @@ #include "base/files/file_path.h" #include "base/i18n/icu_util.h" #include "base/logging.h" +#include "base/metrics/field_trial.h" #include "base/process/launch.h" #include "base/strings/string_split.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/task/thread_pool/thread_pool_instance.h" -#include "base/test/scoped_feature_list.h" #include "build/build_config.h" #include "services/service_manager/public/cpp/service_executable/service_executable_environment.h" #include "services/service_manager/public/cpp/service_executable/service_main.h" @@ -91,8 +91,15 @@ #endif base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - base::test::ScopedFeatureList feature_list; - feature_list.InitFromCommandLine( + std::unique_ptr<base::FieldTrialList> field_trial_list = + std::make_unique<base::FieldTrialList>(nullptr); + // Create field trials according to --force-fieldtrials param. + base::FieldTrialList::CreateTrialsFromCommandLine(*command_line, -1); + // Enable and disable features according to --enable-features and + // --disable-features. + std::unique_ptr<base::FeatureList> feature_list = + std::make_unique<base::FeatureList>(); + feature_list->InitializeFromCommandLine( command_line->GetSwitchValueASCII(switches::kEnableFeatures), command_line->GetSwitchValueASCII(switches::kDisableFeatures));
diff --git a/services/service_manager/service_process_launcher.cc b/services/service_manager/service_process_launcher.cc index d26daacc..e720394b 100644 --- a/services/service_manager/service_process_launcher.cc +++ b/services/service_manager/service_process_launcher.cc
@@ -14,6 +14,7 @@ #include "base/location.h" #include "base/logging.h" #include "base/memory/ptr_util.h" +#include "base/metrics/field_trial.h" #include "base/path_service.h" #include "base/process/kill.h" #include "base/process/launch.h" @@ -28,7 +29,6 @@ #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "mojo/public/cpp/platform/platform_channel.h" -#include "mojo/public/cpp/system/core.h" #include "mojo/public/cpp/system/invitation.h" #include "sandbox/policy/mojom/sandbox.mojom.h" #include "sandbox/policy/sandbox_type.h" @@ -127,6 +127,15 @@ disabled_features); } + // Use --force-field-trials to make the child process to create field trials. + std::string field_trial_states; + base::FieldTrialList::AllStatesToString(&field_trial_states, false); + if (!field_trial_states.empty()) { + DCHECK(!child_command_line->HasSwitch(::switches::kForceFieldTrials)); + child_command_line->AppendSwitchASCII(::switches::kForceFieldTrials, + field_trial_states); + } + child_command_line->AppendSwitchASCII(switches::kServiceName, target.name()); #ifndef NDEBUG child_command_line->AppendSwitchASCII("g",
diff --git a/services/tracing/public/cpp/perfetto/perfetto_tracing_backend.cc b/services/tracing/public/cpp/perfetto/perfetto_tracing_backend.cc index 53c4127..a9c20d12 100644 --- a/services/tracing/public/cpp/perfetto/perfetto_tracing_backend.cc +++ b/services/tracing/public/cpp/perfetto/perfetto_tracing_backend.cc
@@ -354,7 +354,7 @@ ~ConsumerEndpoint() override { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - consumer_->OnDisconnect(); + consumer_.ExtractAsDangling()->OnDisconnect(); // May delete |consumer_|. } // perfetto::ConsumerEndpoint implementation. @@ -632,7 +632,7 @@ } SEQUENCE_CHECKER(sequence_checker_); - const raw_ptr<perfetto::Consumer, DanglingUntriaged> consumer_; + raw_ptr<perfetto::Consumer> consumer_; mojo::Remote<tracing::mojom::ConsumerHost> consumer_host_; mojo::Remote<tracing::mojom::TracingSessionHost> tracing_session_host_; mojo::Receiver<tracing::mojom::TracingSessionClient> tracing_session_client_{
diff --git a/third_party/blink/PRESUBMIT.py b/third_party/blink/PRESUBMIT.py index 5c98c2df..7de25ab6 100644 --- a/third_party/blink/PRESUBMIT.py +++ b/third_party/blink/PRESUBMIT.py
@@ -45,6 +45,7 @@ r'third_party[\\/]blink[\\/]common[\\/]', r'third_party[\\/]blink[\\/]public[\\/]common[\\/]', r'third_party[\\/]blink[\\/]renderer[\\/]platform[\\/]loader[\\/]fetch[\\/]url_loader[\\/]', + r'third_party[\\/]blink[\\/]renderer[\\/]core[\\/]frame[\\/]web_view_impl.*\.(cc|h)$', r'third_party[\\/]blink[\\/]renderer[\\/]core[\\/]frame[\\/]web.*frame.*\.(cc|h)$', ])
diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc index ab96da2..99568ba 100644 --- a/third_party/blink/common/features.cc +++ b/third_party/blink/common/features.cc
@@ -83,6 +83,10 @@ const base::Feature kBackForwardCacheDedicatedWorker{ "BackForwardCacheDedicatedWorker", base::FEATURE_ENABLED_BY_DEFAULT}; +const base::Feature kBackForwardCacheSendNotRestoredReasons{ + "BackForwardCacheSendNotRestoredReasons", + base::FEATURE_DISABLED_BY_DEFAULT}; + // Accumulates the fetch requests for resources while parsing chunks of HTML so // they can be evaluated, prioritized and processed as a group rather than as // they are discovered.
diff --git a/third_party/blink/public/BUILD.gn b/third_party/blink/public/BUILD.gn index d7f0821..dca977f 100644 --- a/third_party/blink/public/BUILD.gn +++ b/third_party/blink/public/BUILD.gn
@@ -3,7 +3,6 @@ # found in the LICENSE file. import("//build/buildflag_header.gni") -import("//build/config/dcheck_always_on.gni") import("//build/config/devtools.gni") import("//mojo/public/tools/bindings/mojom.gni") import("//third_party/blink/public/public_features.gni") @@ -306,6 +305,7 @@ "web/web_crypto_normalize.h", "web/web_css_origin.h", "web/web_custom_element.h", + "web/web_disallow_transition_scope.h", "web/web_document.h", "web/web_document_loader.h", "web/web_dom_activity_logger.h", @@ -402,10 +402,6 @@ "web/web_window_features.h", ] - if (is_debug || dcheck_always_on) { - sources += [ "web/web_disallow_transition_scope.h" ] - } - if (is_mac) { sources += [ "platform/mac/web_sandbox_support.h",
diff --git a/third_party/blink/public/common/features.h b/third_party/blink/public/common/features.h index 84095bf2..9a3b09c 100644 --- a/third_party/blink/public/common/features.h +++ b/third_party/blink/public/common/features.h
@@ -40,6 +40,8 @@ BLINK_COMMON_EXPORT extern const base::Feature kBackForwardCacheDedicatedWorker; BLINK_COMMON_EXPORT extern const base::Feature kBatchFetchRequests; BLINK_COMMON_EXPORT extern const base::Feature + kBackForwardCacheSendNotRestoredReasons; +BLINK_COMMON_EXPORT extern const base::Feature kBlockingDownloadsInAdFrameWithoutUserActivation; BLINK_COMMON_EXPORT extern const base::Feature kCSSContainerQueries; BLINK_COMMON_EXPORT extern const base::Feature kConversionMeasurement;
diff --git a/third_party/blink/public/mojom/BUILD.gn b/third_party/blink/public/mojom/BUILD.gn index e440af9..076e485 100644 --- a/third_party/blink/public/mojom/BUILD.gn +++ b/third_party/blink/public/mojom/BUILD.gn
@@ -28,6 +28,7 @@ "array_buffer/array_buffer_contents.mojom", "associated_interfaces/associated_interfaces.mojom", "autoplay/autoplay.mojom", + "back_forward_cache_not_restored_reasons.mojom", "background_fetch/background_fetch.mojom", "background_sync/background_sync.mojom", "badging/badging.mojom",
diff --git a/third_party/blink/public/mojom/back_forward_cache_not_restored_reasons.mojom b/third_party/blink/public/mojom/back_forward_cache_not_restored_reasons.mojom new file mode 100644 index 0000000..881ce5f6 --- /dev/null +++ b/third_party/blink/public/mojom/back_forward_cache_not_restored_reasons.mojom
@@ -0,0 +1,33 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module blink.mojom; + +// This is a recursive struct which has HTML attributes and information +// about whether this document blocked back/forward cache. +struct SameOriginBfcacheNotRestoredDetails { + // URL when the frame navigated away. This could be cut down if the reported value was longer than a limit. + string url; + // HTML src attribute of the frame. This could be cut down if the reported value was longer than a limit. + string src; + // HTML id attribute of the frame. + string id; + // HTML name attribute of the frame. + string name; + // List of reasons that blocked back/forward cache if any. + array<string> reasons; + // List of children frames' information. + array<BackForwardCacheNotRestoredReasons> children; +}; + +// Struct for NotRestoredReasons API to report from browser to renderer. +struct BackForwardCacheNotRestoredReasons { + // Indicates whether or not this document blocked back/forward cache. If this + // document is cross-origin from the main document, this boolean indicates if + // this frame's subtree blocked back/forward cache. + bool blocked; + // This will be absl::nullopt when this document is cross-origin from the main + // document. + SameOriginBfcacheNotRestoredDetails? same_origin_details; +};
diff --git a/third_party/blink/public/web/web_disallow_transition_scope.h b/third_party/blink/public/web/web_disallow_transition_scope.h index 5af0a8b..3b240b6 100644 --- a/third_party/blink/public/web/web_disallow_transition_scope.h +++ b/third_party/blink/public/web/web_disallow_transition_scope.h
@@ -5,6 +5,10 @@ #ifndef THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_DISALLOW_TRANSITION_SCOPE_H_ #define THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_DISALLOW_TRANSITION_SCOPE_H_ +#include "base/dcheck_is_on.h" + +#if DCHECK_IS_ON() + #include "third_party/blink/public/platform/web_common.h" #include "third_party/blink/public/web/web_document.h" @@ -18,7 +22,7 @@ // when updating properties in the accessible object hierarchy. public: BLINK_EXPORT explicit WebDisallowTransitionScope(WebDocument* web_document); - BLINK_EXPORT virtual ~WebDisallowTransitionScope(); + BLINK_EXPORT ~WebDisallowTransitionScope(); private: DocumentLifecycle& Lifecycle(WebDocument*) const; @@ -28,4 +32,6 @@ } // namespace blink +#endif // DCHECK_IS_ON() + #endif // THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_DISALLOW_TRANSITION_SCOPE_H_
diff --git a/third_party/blink/public/web/web_local_frame.h b/third_party/blink/public/web/web_local_frame.h index efc88bf0..e9a2fa8 100644 --- a/third_party/blink/public/web/web_local_frame.h +++ b/third_party/blink/public/web/web_local_frame.h
@@ -24,6 +24,7 @@ #include "third_party/blink/public/common/frame/user_activation_update_source.h" #include "third_party/blink/public/common/permissions_policy/permissions_policy_features.h" #include "third_party/blink/public/common/tokens/tokens.h" +#include "third_party/blink/public/mojom/back_forward_cache_not_restored_reasons.mojom-forward.h" #include "third_party/blink/public/mojom/blob/blob_url_store.mojom-shared.h" #include "third_party/blink/public/mojom/commit_result/commit_result.mojom-shared.h" #include "third_party/blink/public/mojom/context_menu/context_menu.mojom-shared.h" @@ -217,6 +218,12 @@ // loaded document changes (e.g. frame navigated to a different document). virtual ui::AXTreeID GetAXTreeID() const = 0; + // Sets BackForwardCache NotRestoredReasons for the current frame. + virtual void SetNotRestoredReasons( + const mojom::BackForwardCacheNotRestoredReasonsPtr&) = 0; + // Returns if the current frame's NotRestoredReasons has any blocking reasons. + virtual bool HasBlockingReasons() = 0; + // Hierarchy ---------------------------------------------------------- // Returns true if the current frame is a provisional frame.
diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn index 5bea05b0..c3e2c20 100644 --- a/third_party/blink/renderer/core/BUILD.gn +++ b/third_party/blink/renderer/core/BUILD.gn
@@ -1351,10 +1351,6 @@ sources += rebase_path(blink_core_tests_workers, "", "workers") sources += rebase_path(blink_core_tests_xml, "", "xml") - if (is_debug || dcheck_always_on) { - sources += [ "exported/web_disallow_transition_scope_test.cc" ] - } - configs += [ ":blink_core_pch", "//third_party/blink/renderer:config",
diff --git a/third_party/blink/renderer/core/editing/commands/insert_paragraph_separator_command.cc b/third_party/blink/renderer/core/editing/commands/insert_paragraph_separator_command.cc index 8d0bf4ea..80d5e83 100644 --- a/third_party/blink/renderer/core/editing/commands/insert_paragraph_separator_command.cc +++ b/third_party/blink/renderer/core/editing/commands/insert_paragraph_separator_command.cc
@@ -39,6 +39,7 @@ #include "third_party/blink/renderer/core/editing/visible_units.h" #include "third_party/blink/renderer/core/html/html_br_element.h" #include "third_party/blink/renderer/core/html/html_element.h" +#include "third_party/blink/renderer/core/html/html_object_element.h" #include "third_party/blink/renderer/core/html/html_quote_element.h" #include "third_party/blink/renderer/core/html_names.h" #include "third_party/blink/renderer/core/layout/layout_object.h" @@ -166,13 +167,20 @@ // Make clones of ancestors in between the start node and the start block. Element* parent = block_to_insert; for (wtf_size_t i = ancestors.size(); i != 0; --i) { - Element& child = ancestors[i - 1]->CloneWithoutChildren(); + Element& ancestor = *ancestors[i - 1]; + Element& child = ancestor.CloneWithoutChildren(); // It should always be okay to remove id from the cloned elements, since the // originals are not deleted. child.removeAttribute(html_names::kIdAttr); AppendNode(&child, parent, editing_state); if (editing_state->IsAborted()) return nullptr; + if (auto* html_object = DynamicTo<HTMLObjectElement>(ancestor)) { + if (html_object->UseFallbackContent()) { + To<HTMLObjectElement>(child).RenderFallbackContent( + HTMLObjectElement::ErrorEventPolicy::kDoNotDispatch); + } + } parent = &child; }
diff --git a/third_party/blink/renderer/core/editing/commands/insert_paragraph_separator_command_test.cc b/third_party/blink/renderer/core/editing/commands/insert_paragraph_separator_command_test.cc index 95f55f17..6d0ce13a 100644 --- a/third_party/blink/renderer/core/editing/commands/insert_paragraph_separator_command_test.cc +++ b/third_party/blink/renderer/core/editing/commands/insert_paragraph_separator_command_test.cc
@@ -88,4 +88,22 @@ Selection().GetSelectionInDOMTree())); } +// http://crbug.com/1345989 +TEST_F(InsertParagraphSeparatorCommandTest, CrashWithObject) { + GetDocument().setDesignMode("on"); + Selection().SetSelection( + SetSelectionTextToBody("<object><b>|ABC</b></object>"), + SetSelectionOptions()); + base::RunLoop().RunUntilIdle(); // prepare <object> fallback content + + auto* command = + MakeGarbageCollected<InsertParagraphSeparatorCommand>(GetDocument()); + + EXPECT_TRUE(command->Apply()); + EXPECT_EQ( + "<div><object><b><br></b></object></div>" + "<object><b>|ABC</b></object>", + GetSelectionTextFromBody()); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/editing/spellcheck/cold_mode_spell_check_requester.h b/third_party/blink/renderer/core/editing/spellcheck/cold_mode_spell_check_requester.h index 61bb3e7c..72585a5 100644 --- a/third_party/blink/renderer/core/editing/spellcheck/cold_mode_spell_check_requester.h +++ b/third_party/blink/renderer/core/editing/spellcheck/cold_mode_spell_check_requester.h
@@ -44,6 +44,10 @@ bool FullyChecked() const; + void RemoveFromFullyChecked(const Element& element) { + fully_checked_root_editables_.erase(&element); + } + void Trace(Visitor*) const; private:
diff --git a/third_party/blink/renderer/core/editing/spellcheck/idle_spell_check_controller.cc b/third_party/blink/renderer/core/editing/spellcheck/idle_spell_check_controller.cc index 8f3e11ad..a02e7230 100644 --- a/third_party/blink/renderer/core/editing/spellcheck/idle_spell_check_controller.cc +++ b/third_party/blink/renderer/core/editing/spellcheck/idle_spell_check_controller.cc
@@ -266,4 +266,9 @@ cold_mode_requester_->SetNeedsMoreInvocationForTesting(); } +void IdleSpellCheckController::SetSpellCheckingDisabled( + const Element& element) { + cold_mode_requester_->RemoveFromFullyChecked(element); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/editing/spellcheck/idle_spell_check_controller.h b/third_party/blink/renderer/core/editing/spellcheck/idle_spell_check_controller.h index d35247d..ff09de3 100644 --- a/third_party/blink/renderer/core/editing/spellcheck/idle_spell_check_controller.h +++ b/third_party/blink/renderer/core/editing/spellcheck/idle_spell_check_controller.h
@@ -15,6 +15,7 @@ class ColdModeSpellCheckRequester; class Document; +class Element; class LocalDOMWindow; class SpellCheckRequester; @@ -53,6 +54,9 @@ // document is detached or spellchecking is globally disabled. void Deactivate(); + // Called when spellchecking is disabled on the specific element. + void SetSpellCheckingDisabled(const Element&); + // Exposed for testing only. SpellCheckRequester& GetSpellCheckRequester() const; void ForceInvocationForTesting();
diff --git a/third_party/blink/renderer/core/editing/spellcheck/spell_checker.cc b/third_party/blink/renderer/core/editing/spellcheck/spell_checker.cc index 39b81ee6..85f81638d 100644 --- a/third_party/blink/renderer/core/editing/spellcheck/spell_checker.cc +++ b/third_party/blink/renderer/core/editing/spellcheck/spell_checker.cc
@@ -505,10 +505,12 @@ void SpellChecker::RespondToChangedEnablement(const HTMLElement& element, bool enabled) { - if (enabled) + if (enabled) { idle_spell_check_controller_->SetNeedsInvocation(); - else + } else { RemoveSpellingAndGrammarMarkers(element); + idle_spell_check_controller_->SetSpellCheckingDisabled(element); + } } void SpellChecker::RemoveSpellingMarkers() {
diff --git a/third_party/blink/renderer/core/exported/BUILD.gn b/third_party/blink/renderer/core/exported/BUILD.gn index 5ab81e7..ac03574 100644 --- a/third_party/blink/renderer/core/exported/BUILD.gn +++ b/third_party/blink/renderer/core/exported/BUILD.gn
@@ -1,7 +1,6 @@ # Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/dcheck_always_on.gni") import("//third_party/blink/renderer/core/core.gni") import("//third_party/blink/renderer/core/exported/build.gni") @@ -22,10 +21,6 @@ blink_core_sources("exported") { sources = blink_core_sources_exported - if (is_debug || dcheck_always_on) { - sources += [ "web_disallow_transition_scope.cc" ] - } - deps = [ "//build:chromeos_buildflags", "//third_party/blink/renderer/core:core_generated",
diff --git a/third_party/blink/renderer/core/exported/build.gni b/third_party/blink/renderer/core/exported/build.gni index dbce0cb0..55b7ec3 100644 --- a/third_party/blink/renderer/core/exported/build.gni +++ b/third_party/blink/renderer/core/exported/build.gni
@@ -11,6 +11,7 @@ "web_custom_element.cc", "web_dev_tools_agent_impl.cc", "web_dev_tools_agent_impl.h", + "web_disallow_transition_scope.cc", "web_document.cc", "web_dom_activity_logger.cc", "web_dom_event.cc", @@ -72,6 +73,7 @@ ] blink_core_tests_exported = [ + "web_disallow_transition_scope_test.cc", "web_document_subresource_filter_test.cc", "web_document_test.cc", "web_drag_data_test.cc",
diff --git a/third_party/blink/renderer/core/exported/web_disallow_transition_scope.cc b/third_party/blink/renderer/core/exported/web_disallow_transition_scope.cc index e94290cb..a7cb5e388 100644 --- a/third_party/blink/renderer/core/exported/web_disallow_transition_scope.cc +++ b/third_party/blink/renderer/core/exported/web_disallow_transition_scope.cc
@@ -4,6 +4,8 @@ #include "third_party/blink/public/web/web_disallow_transition_scope.h" +#if DCHECK_IS_ON() + #include "third_party/blink/public/web/web_document.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/document_lifecycle.h" @@ -27,3 +29,5 @@ } } // namespace blink + +#endif // DCHECK_IS_ON()
diff --git a/third_party/blink/renderer/core/exported/web_disallow_transition_scope_test.cc b/third_party/blink/renderer/core/exported/web_disallow_transition_scope_test.cc index 5bf102b..53d62e3 100644 --- a/third_party/blink/renderer/core/exported/web_disallow_transition_scope_test.cc +++ b/third_party/blink/renderer/core/exported/web_disallow_transition_scope_test.cc
@@ -4,6 +4,8 @@ #include "third_party/blink/public/web/web_disallow_transition_scope.h" +#if DCHECK_IS_ON() + #include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/core/frame/frame_test_helpers.h" @@ -60,3 +62,5 @@ #endif } // namespace blink + +#endif // DCHECK_IS_ON()
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc index 231f76d..bcc5e31 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
@@ -74,6 +74,7 @@ #include "third_party/blink/public/web/web_input_element.h" #include "third_party/blink/public/web/web_local_frame_client.h" #include "third_party/blink/public/web/web_meaningful_layout.h" +#include "third_party/blink/public/web/web_navigation_type.h" #include "third_party/blink/public/web/web_node.h" #include "third_party/blink/public/web/web_plugin.h" #include "third_party/blink/public/web/web_range.h" @@ -2502,7 +2503,7 @@ } } - DispatchPageshow(page_restore_params->navigation_start); + DispatchPersistedPageshow(page_restore_params->navigation_start); Scheduler()->SetPageBackForwardCached(new_state->is_in_back_forward_cache); if (MainFrame()->IsWebLocalFrame()) { @@ -2583,7 +2584,16 @@ } } -void WebViewImpl::DispatchPageshow(base::TimeTicks navigation_start) { +void WebViewImpl::DispatchPersistedPageshow(base::TimeTicks navigation_start) { + // Reset NotRestoredReasons for successful back/forward cache restore here, + // so that we set a new value for NotRestoredReasons every time main-frame + // history navigation is completed. For history navigation that is not + // restored from back/forward cache, we set a new value in + // |CommitNavigationWithParams()|. + if (MainFrame()->IsWebLocalFrame()) { + MainFrame()->ToWebLocalFrame()->SetNotRestoredReasons(nullptr); + } + for (Frame* frame = GetPage()->MainFrame(); frame; frame = frame->Tree().TraverseNext()) { auto* local_frame = DynamicTo<LocalFrame>(frame);
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.h b/third_party/blink/renderer/core/exported/web_view_impl.h index 08cc814..49da24d 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.h +++ b/third_party/blink/renderer/core/exported/web_view_impl.h
@@ -301,7 +301,7 @@ mojom::blink::RemoteMainFrameInterfacesPtr remote_main_frame_interfaces) override; - void DispatchPageshow(base::TimeTicks navigation_start); + void DispatchPersistedPageshow(base::TimeTicks navigation_start); void DispatchPagehide(mojom::blink::PagehideDispatch pagehide_dispatch); void HookBackForwardCacheEviction(bool hook);
diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc index f68a6be8..6821b872 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
@@ -2076,7 +2076,9 @@ MakeGarbageCollected<FindInPage>(*this, interface_registry)), interface_registry_(interface_registry), input_method_controller_(*this), - spell_check_panel_host_client_(nullptr) { + spell_check_panel_host_client_(nullptr), + not_restored_reasons_( + mojom::BackForwardCacheNotRestoredReasonsPtr(nullptr)) { CHECK(client_); g_frame_count++; client_->BindToFrame(this); @@ -2981,6 +2983,34 @@ *GetFrame(), std::move(session_storage_area)); } +void WebLocalFrameImpl::SetNotRestoredReasons( + const mojom::BackForwardCacheNotRestoredReasonsPtr& not_restored_reasons) { + not_restored_reasons_ = + not_restored_reasons.is_null() + ? mojom::BackForwardCacheNotRestoredReasonsPtr(nullptr) + : not_restored_reasons->Clone(); +} + +bool WebLocalFrameImpl::HasBlockingReasons() { + if (!not_restored_reasons_) + return false; + return HasBlockingReasonsHelper(not_restored_reasons_); +} + +bool WebLocalFrameImpl::HasBlockingReasonsHelper( + const mojom::BackForwardCacheNotRestoredReasonsPtr& not_restored) { + if (not_restored->blocked) + return true; + if (not_restored->same_origin_details) { + for (const auto& child : not_restored->same_origin_details->children) { + if (HasBlockingReasonsHelper(child)) + return true; + } + return false; + } + return not_restored->blocked; +} + void WebLocalFrameImpl::AddHitTestOnTouchStartCallback( base::RepeatingCallback<void(const blink::WebHitTestResult&)> callback) { TouchStartEventListener* touch_start_event_listener =
diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.h b/third_party/blink/renderer/core/frame/web_local_frame_impl.h index 66053fa..68811749f 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.h +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.h
@@ -44,6 +44,7 @@ #include "services/network/public/mojom/web_sandbox_flags.mojom-blink.h" #include "third_party/blink/public/common/context_menu_data/context_menu_data.h" #include "third_party/blink/public/common/tokens/tokens.h" +#include "third_party/blink/public/mojom/back_forward_cache_not_restored_reasons.mojom.h" #include "third_party/blink/public/mojom/blob/blob_url_store.mojom-blink-forward.h" #include "third_party/blink/public/mojom/context_menu/context_menu.mojom-blink.h" #include "third_party/blink/public/mojom/devtools/devtools_agent.mojom-blink-forward.h" @@ -373,6 +374,11 @@ CrossVariantMojoRemote<mojom::blink::BlobURLTokenInterfaceBase> blob_url_token) override; + void SetNotRestoredReasons( + const mojom::BackForwardCacheNotRestoredReasonsPtr&) override; + // Returns if the current frame's NotRestoredReasons has any blocking reasons. + bool HasBlockingReasons() override; + void InitializeCoreFrame( Page&, FrameOwner*, @@ -532,6 +538,10 @@ // Sets the local core frame and registers destruction observers. void SetCoreFrame(LocalFrame*); + // Helper function for |HasBlockingReasons()|. + bool HasBlockingReasonsHelper( + const mojom::BackForwardCacheNotRestoredReasonsPtr&); + // Inherited from WebFrame, but intentionally hidden: it never makes sense // to call these on a WebLocalFrameImpl. bool IsWebLocalFrame() const override; @@ -623,6 +633,8 @@ WebSpellCheckPanelHostClient* spell_check_panel_host_client_; + mojom::BackForwardCacheNotRestoredReasonsPtr not_restored_reasons_; + // Oilpan: WebLocalFrameImpl must remain alive until close() is called. // Accomplish that by keeping a self-referential Persistent<>. It is // cleared upon close().
diff --git a/third_party/blink/renderer/core/layout/ng/ng_frame_set_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/ng_frame_set_layout_algorithm.cc index 989d48a..c64424c 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_frame_set_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_frame_set_layout_algorithm.cc
@@ -184,6 +184,75 @@ } } + // If we still have some left over space we need to divide it over the already + // existing columns/rows + if (remaining_length) { + // Our first priority is to spread if over the percentage columns. The + // remaining space is spread evenly, for example: if we have a space of + // 100px, the columns definition of 25%,25% used to result in two columns of + // 25px. After this the columns will each be 50px in width. + if (!percent_indices.IsEmpty() && total_percent) { + LayoutUnit remaining_percent = remaining_length; + for (auto i : percent_indices) { + LayoutUnit change_percent = AdjustSizeToRemainingSize( + sizes[i], remaining_percent, total_percent); + sizes[i] += change_percent; + remaining_length -= change_percent; + } + } else if (total_fixed) { + // Our last priority is to spread the remaining space over the fixed + // columns. For example if we have 100px of space and two column of each + // 40px, both columns will become exactly 50px. + LayoutUnit remaining_fixed = remaining_length; + for (auto i : fixed_indices) { + LayoutUnit change_fixed = + AdjustSizeToRemainingSize(sizes[i], remaining_fixed, total_fixed); + sizes[i] += change_fixed; + remaining_length -= change_fixed; + } + } + } + + // If we still have some left over space we probably ended up with a remainder + // of a division. We cannot spread it evenly anymore. If we have any + // percentage columns/rows simply spread the remainder equally over all + // available percentage columns, regardless of their size. + if (remaining_length && !percent_indices.IsEmpty()) { + LayoutUnit remaining_percent = remaining_length; + for (auto i : percent_indices) { + int change_percent = (remaining_percent / percent_indices.size()).ToInt(); + sizes[i] += change_percent; + remaining_length -= change_percent; + } + } else if (remaining_length && !fixed_indices.IsEmpty()) { + // If we don't have any percentage columns/rows we only have fixed columns. + // Spread the remainder equally over all fixed columns/rows. + LayoutUnit remaining_fixed = remaining_length; + for (auto i : fixed_indices) { + int change_fixed = (remaining_fixed / fixed_indices.size()).ToInt(); + sizes[i] += change_fixed; + remaining_length -= change_fixed; + } + } + + // Still some left over. Add it to the last column, because it is impossible + // spread it evenly or equally. + if (remaining_length) + sizes[count - 1] += remaining_length; + + // Now we have the final layout, distribute the delta over it. + bool worked = true; + for (wtf_size_t i = 0; i < count; ++i) { + if (sizes[i] && sizes[i] + deltas[i] <= 0) + worked = false; + sizes[i] += deltas[i]; + } + // If the deltas broke something, undo them. + if (!worked) { + for (wtf_size_t i = 0; i < count; ++i) + sizes[i] -= deltas[i]; + } + return sizes; }
diff --git a/third_party/blink/renderer/core/mojo/mojo.h b/third_party/blink/renderer/core/mojo/mojo.h index b35233d9..b966ff6 100644 --- a/third_party/blink/renderer/core/mojo/mojo.h +++ b/third_party/blink/renderer/core/mojo/mojo.h
@@ -5,7 +5,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_MOJO_MOJO_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_MOJO_MOJO_H_ -#include "mojo/public/cpp/system/core.h" +#include "mojo/public/c/system/types.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
diff --git a/third_party/blink/renderer/core/mojo/mojo_handle.h b/third_party/blink/renderer/core/mojo/mojo_handle.h index beab5b2c..b58ad25d 100644 --- a/third_party/blink/renderer/core/mojo/mojo_handle.h +++ b/third_party/blink/renderer/core/mojo/mojo_handle.h
@@ -5,7 +5,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_MOJO_MOJO_HANDLE_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_MOJO_MOJO_HANDLE_H_ -#include "mojo/public/cpp/system/core.h" +#include "mojo/public/cpp/system/handle.h" #include "third_party/blink/renderer/bindings/core/v8/v8_typedefs.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
diff --git a/third_party/blink/renderer/platform/blob/blob_data.h b/third_party/blink/renderer/platform/blob/blob_data.h index 8ef6a22..fdf80604 100644 --- a/third_party/blink/renderer/platform/blob/blob_data.h +++ b/third_party/blink/renderer/platform/blob/blob_data.h
@@ -45,6 +45,7 @@ #include "base/thread_annotations.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/struct_ptr.h" +#include "mojo/public/cpp/system/data_pipe.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/public/mojom/blob/data_element.mojom-blink-forward.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h"
diff --git a/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc b/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc index e7234d0..73c9cf27 100644 --- a/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc +++ b/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc
@@ -6,6 +6,7 @@ #include <algorithm> #include <memory> +#include <numeric> #include <vector> #include "base/callback_helpers.h" @@ -452,6 +453,23 @@ } } +std::unique_ptr<std::pair<base::UnsafeSharedMemoryRegion, + base::WritableSharedMemoryMapping>> +CreateInputBuffer(const gfx::Size& input_coded_size) { + base::UnsafeSharedMemoryRegion shm = + base::UnsafeSharedMemoryRegion::Create(media::VideoFrame::AllocationSize( + media::PIXEL_FORMAT_I420, input_coded_size)); + if (!shm.IsValid()) { + return nullptr; + } + base::WritableSharedMemoryMapping mapping = shm.Map(); + if (!mapping.IsValid()) { + return nullptr; + } + return std::make_unique<std::pair<base::UnsafeSharedMemoryRegion, + base::WritableSharedMemoryMapping>>( + std::move(shm), std::move(mapping)); +} } // namespace namespace features { @@ -994,27 +1012,12 @@ // |input_buffers_| is only needed in non import mode. if (!use_native_input_) { - for (unsigned int i = 0; i < input_count + kInputBufferExtraCount; ++i) { - base::UnsafeSharedMemoryRegion shm = - base::UnsafeSharedMemoryRegion::Create( - media::VideoFrame::AllocationSize(media::PIXEL_FORMAT_I420, - input_coded_size)); - if (!shm.IsValid()) { - LogAndNotifyError(FROM_HERE, "failed to create input buffer ", - media::VideoEncodeAccelerator::kPlatformFailureError); - return; - } - base::WritableSharedMemoryMapping mapping = shm.Map(); - if (!mapping.IsValid()) { - LogAndNotifyError(FROM_HERE, "failed to create input buffer ", - media::VideoEncodeAccelerator::kPlatformFailureError); - return; - } - input_buffers_.push_back( - std::make_unique<std::pair<base::UnsafeSharedMemoryRegion, - base::WritableSharedMemoryMapping>>( - std::move(shm), std::move(mapping))); - input_buffers_free_.push_back(i); + const wtf_size_t num_input_buffers = input_count + kInputBufferExtraCount; + input_buffers_free_.resize(num_input_buffers); + input_buffers_.resize(num_input_buffers); + for (wtf_size_t i = 0; i < num_input_buffers; i++) { + input_buffers_free_[i] = i; + input_buffers_[i] = nullptr; } } @@ -1396,21 +1399,29 @@ return; } } else { - std::pair<base::UnsafeSharedMemoryRegion, - base::WritableSharedMemoryMapping>* input_buffer = - input_buffers_[index].get(); + if (!input_buffers_[index]) { + input_buffers_[index] = CreateInputBuffer(input_frame_coded_size_); + if (!input_buffers_[index]) { + LogAndNotifyError( + FROM_HERE, "Failed to create input buffer", + media::VideoEncodeAccelerator::kPlatformFailureError); + return; + } + } + + const auto& [shm_region, shm_mapping] = *input_buffers_[index]; frame = media::VideoFrame::WrapExternalData( media::PIXEL_FORMAT_I420, input_frame_coded_size_, gfx::Rect(input_visible_size_), input_visible_size_, - input_buffer->second.GetMemoryAsSpan<uint8_t>().data(), - input_buffer->second.size(), timestamp); + shm_mapping.GetMemoryAsSpan<uint8_t>().data(), shm_mapping.size(), + timestamp); if (!frame.get()) { LogAndNotifyError(FROM_HERE, "failed to create frame", media::VideoEncodeAccelerator::kPlatformFailureError); async_encode_event_.SetAndReset(WEBRTC_VIDEO_CODEC_ERROR); return; } - frame->BackWithSharedMemory(&input_buffer->first); + frame->BackWithSharedMemory(&shm_region); // Do a strided copy and scale (if necessary) the input frame to match // the input requirements for the encoder.
diff --git a/third_party/blink/web_tests/SlowTests b/third_party/blink/web_tests/SlowTests index f489040..40bfb50 100644 --- a/third_party/blink/web_tests/SlowTests +++ b/third_party/blink/web_tests/SlowTests
@@ -824,3 +824,5 @@ crbug.com/1228246 http/tests/inspector-protocol/fetch/disable-with-response-in-flight.js [ Slow ] crbug.com/1306770 http/tests/inspector-protocol/network/interception-download.js [ Slow ] crbug.com/1344358 inspector-protocol/page/frameNavigatedContext.js [ Slow ] + +crbug.com/1353929 editing/spelling/cold_mode_spellcheck_reenable.html [ Slow ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 5f63da37..fa3c6e4a 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -3724,7 +3724,7 @@ crbug.com/626703 external/wpt/screen-orientation/onchange-event-subframe.html [ Timeout ] # Synthetic modules report the wrong location in errors -crbug.com/994315 virtual/json-modules/external/wpt/html/semantics/scripting-1/the-script-element/json-module/parse-error.html [ Skip ] +crbug.com/994315 virtual/import-assertions/external/wpt/html/semantics/scripting-1/the-script-element/json-module/parse-error.html [ Skip ] # These tests pass on the blink_rel bots but fail on the other builders crbug.com/1051773 external/wpt/css/CSS2/floats/float-nowrap-3-ref.html [ Crash ]
diff --git a/third_party/blink/web_tests/VirtualTestSuites b/third_party/blink/web_tests/VirtualTestSuites index e78213b..12c9dce3 100644 --- a/third_party/blink/web_tests/VirtualTestSuites +++ b/third_party/blink/web_tests/VirtualTestSuites
@@ -603,12 +603,6 @@ "args": ["--disable-blink-features=PaymentRequestTotalOptional"] }, { - "prefix": "json-modules", - "platforms": ["Linux", "Mac", "Win"], - "bases": ["external/wpt/html/semantics/scripting-1/the-script-element/json-module"], - "args": ["--enable-features=JSONModules", "--js-flags=--harmony-import-assertions"] - }, - { "prefix": "css-trigonometric-functions-disabled", "platforms": ["Linux", "Mac", "Win"], "bases": [ @@ -623,7 +617,8 @@ "platforms": ["Linux", "Mac", "Win"], "bases": [ "external/wpt/html/semantics/scripting-1/the-script-element/import-assertions", - "external/wpt/html/semantics/scripting-1/the-script-element/css-module"], + "external/wpt/html/semantics/scripting-1/the-script-element/css-module", + "external/wpt/html/semantics/scripting-1/the-script-element/json-module"], "args": ["--js-flags=--harmony-import-assertions"] }, {
diff --git a/third_party/blink/web_tests/editing/spelling/cold_mode_spellcheck_reenable.html b/third_party/blink/web_tests/editing/spelling/cold_mode_spellcheck_reenable.html new file mode 100644 index 0000000..a2ab836 --- /dev/null +++ b/third_party/blink/web_tests/editing/spelling/cold_mode_spellcheck_reenable.html
@@ -0,0 +1,78 @@ +<!doctype html> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<script src="../assert_selection.js"></script> +<script src="spellcheck_test.js"></script> +<script> +const n = 100; +const markup = '<div>zz zz zz zz.</div>'.repeat(n); +const checkedMarkup = '<div>#zz# #zz# #zz# #zz#.</div>'.repeat(n); + +const step1 = () => spellcheck_test( + `<div contenteditable id="target">${markup}</div>`, + document => document.getElementById('target').focus(), + `<div contenteditable id="target">${checkedMarkup}</div>`, + { + title: '1. Initial full checking for contenteditable', + needsFullCheck: true, + callback: step2, + } +); + +const step2 = sample => spellcheck_test( + sample, + document => document.getElementById('target').setAttribute('spellcheck', 'false'), + `<div contenteditable id="target" spellcheck="false">${markup}</div>`, + { + title: '1. Clear markers after disabling spellcheck', + callback: step3, + } +); + +const step3 = sample => spellcheck_test( + sample, + document => document.getElementById('target').setAttribute('spellcheck', 'true'), + `<div contenteditable id="target" spellcheck="true">${checkedMarkup}</div>`, + { + title: '1. Content is re-checked in full after re-enabling spellcheck', + needsFullCheck: true, + } +); + +const text = 'zz zz zz zz.\n'.repeat(n - 1) + 'zz zz zz zz.'; +const checkedText = '#zz# #zz# #zz# #zz#.\n'.repeat(n - 1) + '#zz# #zz# #zz# #zz#.'; + +const step4 = () => spellcheck_test( + `<textarea id="target">${text}</textarea>`, + document => document.getElementById('target').focus(), + `<textarea id="target">${checkedText}</textarea>`, + { + title: '2. Initial full checking for textarea', + needsFullCheck: true, + callback: step5, + } +); + +const step5 = sample => spellcheck_test( + sample, + document => document.getElementById('target').setAttribute('spellcheck', 'false'), + `<textarea id="target" spellcheck="false">${text}</textarea>`, + { + title: '2. Clear markers after disabling spellcheck', + callback: step6, + } +); + +const step6 = sample => spellcheck_test( + sample, + document => document.getElementById('target').setAttribute('spellcheck', 'true'), + `<textarea id="target" spellcheck="true">${checkedText}</textarea>`, + { + title: '2. Content is re-checked in full after re-enabling spellcheck', + needsFullCheck: true, + } +); + +step1(); +step4(); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/mediacapture-streams/MediaStreamTrack-iframe-transfer.https.html b/third_party/blink/web_tests/external/wpt/mediacapture-streams/MediaStreamTrack-iframe-transfer.https.html index 28ff506b..1dfc872 100644 --- a/third_party/blink/web_tests/external/wpt/mediacapture-streams/MediaStreamTrack-iframe-transfer.https.html +++ b/third_party/blink/web_tests/external/wpt/mediacapture-streams/MediaStreamTrack-iframe-transfer.https.html
@@ -5,8 +5,9 @@ <script> promise_test(async () => { const iframe = document.createElement("iframe"); - const stream = await navigator.mediaDevices.getUserMedia({video: true}); + const stream = await navigator.mediaDevices.getDisplayMedia({video: true}); const track = stream.getVideoTracks()[0]; + const cloned_track = track.clone(); const result = new Promise((resolve, reject) => { window.onmessage = (e) => { if (e.data.result === 'Failure') { @@ -17,7 +18,10 @@ }; }); iframe.addEventListener("load", () => { + assert_not_equals(track.readyState, "ended"); iframe.contentWindow.postMessage(track); + assert_equals(track.readyState, "ended"); + assert_equals(cloned_track.readyState, "live"); }); iframe.src = "support/iframe-MediaStreamTrack-transfer.html"; document.body.appendChild(iframe);
diff --git a/third_party/blink/web_tests/platform/generic/virtual/json-modules/external/wpt/html/semantics/scripting-1/the-script-element/json-module/parse-error.tentative-expected.txt b/third_party/blink/web_tests/platform/generic/virtual/json-modules/external/wpt/html/semantics/scripting-1/the-script-element/json-module/parse-error.tentative-expected.txt deleted file mode 100644 index 2fcf3eb..0000000 --- a/third_party/blink/web_tests/platform/generic/virtual/json-modules/external/wpt/html/semantics/scripting-1/the-script-element/json-module/parse-error.tentative-expected.txt +++ /dev/null
@@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL JSON modules: parse error assert_equals: expected "http://web-platform.test:8001/html/semantics/scripting-1/the-script-element/json-module/parse-error.json" but got "http://web-platform.test:8001/html/semantics/scripting-1/the-script-element/json-module/parse-error.tentative.html" -Harness: the test ran to completion. -
diff --git a/third_party/freetype/README.chromium b/third_party/freetype/README.chromium index 88bdd48..f1964b48 100644 --- a/third_party/freetype/README.chromium +++ b/third_party/freetype/README.chromium
@@ -1,7 +1,7 @@ Name: FreeType URL: http://www.freetype.org/ -Version: VER-2-12-1-76-g7cd3f19f2 -Revision: 7cd3f19f21cc9d600e3b765ef2058474d20233e2 +Version: VER-2-12-1-78-g395da3d72 +Revision: 395da3d72ac5186fdf68fb450bba1d57515fce1e CPEPrefix: cpe:/a:freetype:freetype:2.11.1 License: Custom license "inspired by the BSD, Artistic, and IJG (Independent JPEG Group) licenses"
diff --git a/third_party/webrtc_overrides/rtc_base/event.h b/third_party/webrtc_overrides/rtc_base/event.h index b26746a..80bd71f 100644 --- a/third_party/webrtc_overrides/rtc_base/event.h +++ b/third_party/webrtc_overrides/rtc_base/event.h
@@ -33,19 +33,7 @@ // Wait for the event to become signaled, for the specified duration. To wait // indefinitely, pass kForever. bool Wait(webrtc::TimeDelta give_up_after); - // TODO(bugs.webrtc.org/13756): Remove after millisec-based Wait is removed. - bool Wait(int give_up_after_ms) { - // SocketServer users can get here with SocketServer::kForever which is -1. - // Mirror the definition here to avoid dependence. - constexpr int kForeverMs = -1; - return Wait(give_up_after_ms == kForeverMs - ? kForever - : webrtc::TimeDelta::Millis(give_up_after_ms)); - } - // TODO(bugs.webrtc.org/13756): De-template this after millisec-based Wait is - // removed. - template <class T, class U> - bool Wait(T give_up_after, U /*warn_after*/) { + bool Wait(webrtc::TimeDelta give_up_after, webrtc::TimeDelta /*warn_after*/) { return Wait(give_up_after); }
diff --git a/tools/cr/OWNERS b/tools/cr/OWNERS index a0c4170..15a182a6 100644 --- a/tools/cr/OWNERS +++ b/tools/cr/OWNERS
@@ -1,2 +1 @@ -petrcermak@chromium.org skyostil@chromium.org
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index e4b6895..98f3c3f 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -93914,6 +93914,7 @@ <int value="50" label="Workspace Desk"/> <int value="51" label="History"/> <int value="52" label="Printers Authorization Servers"/> + <int value="53" label="Contact info"/> </enum> <enum name="SyncModelTypeStoreInitResult">
diff --git a/tools/metrics/histograms/metadata/histogram_suffixes_list.xml b/tools/metrics/histograms/metadata/histogram_suffixes_list.xml index 7bc729f..92aea6d 100644 --- a/tools/metrics/histograms/metadata/histogram_suffixes_list.xml +++ b/tools/metrics/histograms/metadata/histogram_suffixes_list.xml
@@ -6547,6 +6547,10 @@ <histogram_suffixes name="PageLoadMetricsClientsMedia" separator="." ordering="prefix"> + <obsolete> + Removed in favor of Clients.MediaPageLoad2, which includes samples from + prerendered pages. + </obsolete> <suffix name="Clients.MediaPageLoad" label="PageLoadMetrics for page loads that involved playing a media element."/> @@ -6557,6 +6561,18 @@ <affected-histogram name="PageLoad.Experimental.Bytes.Total2"/> </histogram_suffixes> +<histogram_suffixes name="PageLoadMetricsClientsMedia2" separator="." + ordering="prefix"> + <suffix name="Clients.MediaPageLoad2" + label="PageLoadMetrics for page loads that involved playing a media + element. Includes samples from prerendered pages"/> + <affected-histogram name="PageLoad.Experimental.Bytes.Cache"/> + <affected-histogram name="PageLoad.Experimental.Bytes.Cache2"/> + <affected-histogram name="PageLoad.Experimental.Bytes.Network"/> + <affected-histogram name="PageLoad.Experimental.Bytes.Total"/> + <affected-histogram name="PageLoad.Experimental.Bytes.Total2"/> +</histogram_suffixes> + <histogram_suffixes name="PageLoadMetricsClientsMultiTabLoading" separator="." ordering="prefix"> <suffix name="Clients.MultiTabLoading"
diff --git a/tools/metrics/histograms/metadata/sync/histograms.xml b/tools/metrics/histograms/metadata/sync/histograms.xml index e11b267..5b66be0 100644 --- a/tools/metrics/histograms/metadata/sync/histograms.xml +++ b/tools/metrics/histograms/metadata/sync/histograms.xml
@@ -32,6 +32,7 @@ <variant name=".AUTOFILL_PROFILE" summary="AUTOFILL_PROFILE"/> <variant name=".AUTOFILL_WALLET" summary="AUTOFILL_WALLET"/> <variant name=".BOOKMARK" summary="BOOKMARK"/> + <variant name=".CONTACT_INFO" summary="CONTACT_INFO"/> <variant name=".DEVICE_INFO" summary="DEVICE_INFO"/> <variant name=".DICTIONARY" summary="DICTIONARY"/> <variant name=".EXTENSION" summary="EXTENSION"/> @@ -593,7 +594,7 @@ </histogram> <histogram name="Sync.ModelTypeCommitMessageHasDepletedQuota" - enum="SyncModelTypes" expires_after="2022-09-28"> + enum="SyncModelTypes" expires_after="2022-12-04"> <owner>rushans@google.com</owner> <owner>treib@chromium.org</owner> <component>Services>Sync</component>
diff --git a/ui/display/mac/test/virtual_display_mac_util.mm b/ui/display/mac/test/virtual_display_mac_util.mm index 6636b1d..19e84b1 100644 --- a/ui/display/mac/test/virtual_display_mac_util.mm +++ b/ui/display/mac/test/virtual_display_mac_util.mm
@@ -9,9 +9,9 @@ #include <map> -#include "base/auto_reset.h" #include "base/check.h" #include "base/check_op.h" +#include "base/mac/scoped_cftyperef.h" #include "base/mac/scoped_nsobject.h" #include "ui/display/display.h" #include "ui/display/screen.h" @@ -251,6 +251,100 @@ return is_running_headless; } +// Observer for display metrics change notifications. +class DisplayMetricsChangeObserver : public display::DisplayObserver { + public: + DisplayMetricsChangeObserver(int64_t display_id, + const gfx::Size& size, + uint32_t expected_changed_metrics) + : display_id_(display_id), + size_(size), + expected_changed_metrics_(expected_changed_metrics) { + display::Screen::GetScreen()->AddObserver(this); + } + ~DisplayMetricsChangeObserver() override { + display::Screen::GetScreen()->RemoveObserver(this); + }; + + DisplayMetricsChangeObserver(const DisplayMetricsChangeObserver&) = delete; + DisplayMetricsChangeObserver& operator=(const DisplayMetricsChangeObserver&) = + delete; + + // Runs a loop until the display metrics change is seen (unless one has + // already been observed, in which case it returns immediately). + void Wait() { + if (observed_change_) + return; + + run_loop_.Run(); + } + + private: + // display::DisplayObserver: + void OnDisplayMetricsChanged(const display::Display& display, + uint32_t changed_metrics) override { + if (!(display.id() == display_id_ && display.size() == size_ && + (changed_metrics & expected_changed_metrics_))) { + return; + } + + observed_change_ = true; + if (run_loop_.running()) + run_loop_.Quit(); + } + void OnDisplayAdded(const display::Display& new_display) override{}; + void OnDisplayRemoved(const display::Display& old_display) override{}; + + const int64_t display_id_; + const gfx::Size size_; + const uint32_t expected_changed_metrics_; + + bool observed_change_ = false; + base::RunLoop run_loop_; +}; + +void EnsureDisplayWithResolution(CGDirectDisplayID display_id, + const gfx::Size& size) { + base::ScopedCFTypeRef<CGDisplayModeRef> current_display_mode( + CGDisplayCopyDisplayMode(display_id)); + if (gfx::Size(CGDisplayModeGetWidth(current_display_mode), + CGDisplayModeGetHeight(current_display_mode)) == size) { + return; + } + + base::ScopedCFTypeRef<CFArrayRef> display_modes( + CGDisplayCopyAllDisplayModes(display_id, nullptr)); + DCHECK(display_modes); + + CGDisplayModeRef prefered_display_mode = nullptr; + for (CFIndex i = 0; i < CFArrayGetCount(display_modes); ++i) { + CGDisplayModeRef display_mode = + (CGDisplayModeRef)CFArrayGetValueAtIndex(display_modes, i); + if (gfx::Size(CGDisplayModeGetWidth(display_mode), + CGDisplayModeGetHeight(display_mode)) == size) { + prefered_display_mode = display_mode; + break; + } + } + DCHECK(prefered_display_mode); + + uint32_t expected_changed_metrics = + display::DisplayObserver::DISPLAY_METRIC_BOUNDS | + display::DisplayObserver::DISPLAY_METRIC_WORK_AREA | + display::DisplayObserver::DISPLAY_METRIC_DEVICE_SCALE_FACTOR; + DisplayMetricsChangeObserver display_metrics_change_observer( + display_id, size, expected_changed_metrics); + + // This operation is always synchronous. The function doesn’t return until the + // mode switch is complete. + CGError result = + CGDisplaySetDisplayMode(display_id, prefered_display_mode, nullptr); + DCHECK_EQ(result, kCGErrorSuccess); + + // Wait for `display::Screen` and `display::Display` structures to be updated. + display_metrics_change_observer.Wait(); +} + } // namespace namespace display::test { @@ -292,13 +386,6 @@ int64_t VirtualDisplayMacUtil::AddDisplay(int64_t display_id, const DisplayParams& display_params) { if (@available(macos 10.14, *)) { - // When there are no virtual displays at all, the first virtual display - // added will use the default resolution provided by the system. Adding and - // removing a temporary virtual display will fix the resolution of the first - // display that was previously added. - // TODO(crbug.com/1126278): Resolve this defect in a more hermetic manner. - bool need_display_resolution_workaround = g_display_map.empty(); - DCHECK(display_params.IsValid()); NSString* display_name = @@ -319,6 +406,9 @@ WaitForDisplay(id, /*added=*/true); + EnsureDisplayWithResolution( + id, gfx::Size(display_params.width, display_params.height)); + // TODO(crbug.com/1126278): Please remove this log or replace it with // [D]CHECK() ASAP when the TEST is stable. LOG(INFO) << "VirtualDisplayMacUtil::" << __func__ @@ -328,11 +418,6 @@ DCHECK(!g_display_map[id]); g_display_map[id] = display; - if (need_display_resolution_workaround) { - int64_t tmp_id = AddDisplay(0, k1920x1080); - RemoveDisplay(tmp_id); - } - return id; } return display::kInvalidDisplayId;
diff --git a/ui/display/mac/test/virtual_display_mac_util_interactive_uitest.mm b/ui/display/mac/test/virtual_display_mac_util_interactive_uitest.mm index 42cc7e5..ebeba99a 100644 --- a/ui/display/mac/test/virtual_display_mac_util_interactive_uitest.mm +++ b/ui/display/mac/test/virtual_display_mac_util_interactive_uitest.mm
@@ -7,6 +7,7 @@ #include "ui/display/mac/test/virtual_display_mac_util.h" #include "ui/display/screen.h" #include "ui/display/types/display_constants.h" +#include "ui/gfx/geometry/size.h" class VirtualDisplayMacUtilInteractiveUitest : public testing::Test { protected: @@ -81,3 +82,14 @@ virtual_display_mac_util.reset(); EXPECT_EQ(display::Screen::GetScreen()->GetNumDisplays(), display_count); } + +TEST_F(VirtualDisplayMacUtilInteractiveUitest, EnsureDisplayWithResolution) { + display::test::VirtualDisplayMacUtil virtual_display_mac_util; + + int64_t id = virtual_display_mac_util.AddDisplay( + 1, display::test::VirtualDisplayMacUtil::k1920x1080); + + display::Display d; + display::Screen::GetScreen()->GetDisplayWithDisplayId(id, &d); + EXPECT_EQ(d.size(), gfx::Size(1920, 1080)); +}
diff --git a/ui/file_manager/file_manager/background/js/BUILD.gn b/ui/file_manager/file_manager/background/js/BUILD.gn index 9459ea88..a5487d3 100644 --- a/ui/file_manager/file_manager/background/js/BUILD.gn +++ b/ui/file_manager/file_manager/background/js/BUILD.gn
@@ -112,10 +112,9 @@ deps = [ ":app_windows", "//ui/file_manager/file_manager/common/js:api", - "//ui/file_manager/file_manager/common/js:app_util", "//ui/file_manager/file_manager/common/js:async_util", "//ui/file_manager/file_manager/common/js:files_app_state", - "//ui/webui/resources/js:assert.m", + "//ui/file_manager/file_manager/common/js:xfm", ] }
diff --git a/ui/file_manager/file_manager/background/js/app_window_wrapper.js b/ui/file_manager/file_manager/background/js/app_window_wrapper.js index f8501dd..f953477 100644 --- a/ui/file_manager/file_manager/background/js/app_window_wrapper.js +++ b/ui/file_manager/file_manager/background/js/app_window_wrapper.js
@@ -4,10 +4,7 @@ import './app_windows.js'; -import {assertInstanceof} from 'chrome://resources/js/assert.m.js'; - import {openWindow} from '../../common/js/api.js'; -import {appUtil} from '../../common/js/app_util.js'; import {AsyncUtil} from '../../common/js/async_util.js'; import {FilesAppState} from '../../common/js/files_app_state.js'; import {xfm} from '../../common/js/xfm.js'; @@ -306,12 +303,6 @@ this.window_ = null; this.openingOrOpened_ = false; - // Updates preferences. - if (contentWindow.saveOnExit) { - contentWindow.saveOnExit.forEach(entry => { - appUtil.AppCache.update(entry.key, entry.value); - }); - } xfm.storage.local.remove(this.id_); // Forget the persisted state. // Remove the window from the set. @@ -354,83 +345,3 @@ * @const */ AppWindowWrapper.SHIFT_DISTANCE = 40; - -/** - * Wrapper for a singleton app window. - * - * In addition to the AppWindowWrapper requirements the app scripts should - * have |reload| method that re-initializes the app based on a changed - * |window.appState|. - */ -export class SingletonAppWindowWrapper extends AppWindowWrapper { - /** - * @param {string} url App window content url. - * @param {Object|function()} options Options object or a function to return - * it. - */ - constructor(url, options) { - super(url, url, options); - } - - /** - * Open the window. - * - * Activates an existing window or creates a new one. - * - * @param {!FilesAppState} appState App state. - * @param {boolean} reopen True if the launching is triggered automatically. - * False otherwise. - * @return {Promise} Resolved when the window is launched. - */ - async launch(appState, reopen) { - // If the window is not opened yet, just call the parent method. - if (!this.openingOrOpened_) { - return super.launch(appState, reopen); - } - - // The lock is used to wait until the window is opened and set in - // this.window_. - const unlock = await this.getLaunchLock(); - - try { - // If the window is already opened, reload the window. - this.window_.contentWindow.appState = appState; - this.window_.contentWindow.appReopen = reopen; - if (!this.window_.contentWindow.reload) { - // Currently the queue is not made to wait for window loading after - // creating window. Therefore contentWindow might not have the reload() - // function ready yet. This happens when launching the same app twice - // quickly. See crbug.com/789226. - console.warn('Window reload requested before loaded. Skiping.'); - } else { - this.window_.contentWindow.reload(); - } - } finally { - unlock(); - } - } - - /** - * Reopen a window if its state is saved in the local xfm.storage. - * @param {function()=} opt_callback Completion callback. - */ - async reopen(opt_callback) { - const items = await xfm.storage.local.getAsync(this.id_); - const value = /** @type {string} */ (items[this.id_]); - if (!value) { - opt_callback && opt_callback(); - return; // No app state persisted. - } - - let appState; - try { - appState = assertInstanceof(JSON.parse(value), Object); - } catch (e) { - console.error('Corrupt launch data for ' + this.id_, value); - opt_callback && opt_callback(); - return; - } - await this.launch(appState, true); - opt_callback && opt_callback(); - } -}
diff --git a/ui/file_manager/file_manager/background/js/file_operation_handler.js b/ui/file_manager/file_manager/background/js/file_operation_handler.js index 5b9812c..bacb4b3 100644 --- a/ui/file_manager/file_manager/background/js/file_operation_handler.js +++ b/ui/file_manager/file_manager/background/js/file_operation_handler.js
@@ -69,7 +69,7 @@ * @param {!chrome.fileManagerPrivate.ProgressStatus} event * @private */ - async onIOTaskProgressStatus_(event) { + onIOTaskProgressStatus_(event) { if (event.type === chrome.fileManagerPrivate.IOTaskType.TRASH) { if (event.state === chrome.fileManagerPrivate.IOTaskState.SUCCESS) { this.showRestoreTrashToast_(event); @@ -545,8 +545,7 @@ case chrome.fileManagerPrivate.IOTaskType.RESTORE: return str('RESTORE_FROM_TRASH_ERROR'); default: - console.warn( - `Unexpected operation type: ${event.status.operationType}`); + console.warn(`Unexpected operation type: ${event.type}`); return strf('FILE_ERROR_GENERIC'); } }
diff --git a/ui/file_manager/file_manager/background/js/volume_manager_impl.js b/ui/file_manager/file_manager/background/js/volume_manager_impl.js index 8f8ab6f7..a835542 100644 --- a/ui/file_manager/file_manager/background/js/volume_manager_impl.js +++ b/ui/file_manager/file_manager/background/js/volume_manager_impl.js
@@ -105,10 +105,10 @@ * Adds new volume info from the given volumeMetadata. If the corresponding * volume info has already been added, the volumeMetadata is ignored. * @param {!VolumeInfo} volumeInfo - * @return {!Promise<!VolumeInfo>} + * @return {!VolumeInfo} * @private */ - async addVolumeInfo_(volumeInfo) { + addVolumeInfo_(volumeInfo) { const volumeType = volumeInfo.volumeType; // We don't show Downloads and Drive on volume list if they have @@ -193,7 +193,7 @@ volumeInfo = await volumeManagerUtil.createVolumeInfo(volumeMetadata); // Add addVolumeInfo_() changes the VolumeInfoList which propagates // to the foreground. - await this.addVolumeInfo_(volumeInfo); + this.addVolumeInfo_(volumeInfo); console.debug(`Initialized volume #${idx} ${volumeId}'`); } catch (error) { console.warn(`Error initiliazing #${idx} ${volumeId}: ${error}`); @@ -267,7 +267,7 @@ this.finishRequest_(requestKey, status); throw (error); } - await this.addVolumeInfo_(volumeInfo); + this.addVolumeInfo_(volumeInfo); this.finishRequest_(requestKey, status, volumeInfo); return; }
diff --git a/ui/file_manager/file_manager/common/js/app_util.js b/ui/file_manager/file_manager/common/js/app_util.js index d8a5a7a..eb528e6 100644 --- a/ui/file_manager/file_manager/common/js/app_util.js +++ b/ui/file_manager/file_manager/common/js/app_util.js
@@ -39,129 +39,4 @@ appUtil.saveAppState(); }; - -/** - * AppCache is a persistent timestamped key-value storage backed by - * HTML5 local storage. - * - * It is not designed for frequent access. In order to avoid costly - * localStorage iteration all data is kept in a single localStorage item. - * There is no in-memory caching, so concurrent access is _almost_ safe. - * - * TODO(kaznacheev) Reimplement this based on Indexed DB. - */ -appUtil.AppCache = () => {}; - -/** - * Local storage key. - */ -appUtil.AppCache.KEY = 'AppCache'; - -/** - * Max number of items. - */ -appUtil.AppCache.CAPACITY = 100; - -/** - * Default lifetime. - */ -appUtil.AppCache.LIFETIME = 30 * 24 * 60 * 60 * 1000; // 30 days. - -/** - * @param {string} key Key. - * @param {function(number)} callback Callback accepting a value. - */ -appUtil.AppCache.getValue = (key, callback) => { - appUtil.AppCache.read_(map => { - const entry = map[key]; - callback(entry && entry.value); - }); -}; - -/** - * Updates the cache. - * - * @param {string} key Key. - * @param {?(string|number)} value Value. Remove the key if value is null. - * @param {number=} opt_lifetime Maximum time to keep an item (in milliseconds). - */ -appUtil.AppCache.update = (key, value, opt_lifetime) => { - appUtil.AppCache.read_(map => { - if (value != null) { - map[key] = { - value: value, - expire: Date.now() + (opt_lifetime || appUtil.AppCache.LIFETIME), - }; - } else if (key in map) { - delete map[key]; - } else { - return; // Nothing to do. - } - appUtil.AppCache.cleanup_(map); - appUtil.AppCache.write_(map); - }); -}; - -/** - * @param {function(Object)} callback Callback accepting a map of timestamped - * key-value pairs. - * @private - */ -appUtil.AppCache.read_ = async (callback) => { - const values = await xfm.storage.local.getAsync(appUtil.AppCache.KEY); - - const json = /** @type {string} */ (values[appUtil.AppCache.KEY]); - if (json) { - try { - callback(/** @type {Object} */ (JSON.parse(json))); - } catch (e) { - // The local storage item somehow got messed up, start fresh. - } - } - callback({}); -}; - -/** - * @param {Object} map A map of timestamped key-value pairs. - * @private - */ -appUtil.AppCache.write_ = map => { - const items = {}; - items[appUtil.AppCache.KEY] = JSON.stringify(map); - xfm.storage.local.setAsync(items); -}; - -/** - * Remove over-capacity and obsolete items. - * - * @param {Object} map A map of timestamped key-value pairs. - * @private - */ -appUtil.AppCache.cleanup_ = map => { - // Sort keys by ascending timestamps. - const keys = []; - for (const key in map) { - if (map.hasOwnProperty(key)) { - keys.push(key); - } - } - keys.sort((a, b) => { - return map[a].expire - map[b].expire; - }); - - const cutoff = Date.now(); - - let obsolete = 0; - while (obsolete < keys.length && map[keys[obsolete]].expire < cutoff) { - obsolete++; - } - - const overCapacity = Math.max(0, keys.length - appUtil.AppCache.CAPACITY); - - const itemsToDelete = Math.max(obsolete, overCapacity); - for (let i = 0; i != itemsToDelete; i++) { - delete map[keys[i]]; - } -}; - export {appUtil};
diff --git a/ui/file_manager/file_manager/common/js/error_counter.js b/ui/file_manager/file_manager/common/js/error_counter.js index b2c080e..cab2776 100644 --- a/ui/file_manager/file_manager/common/js/error_counter.js +++ b/ui/file_manager/file_manager/common/js/error_counter.js
@@ -4,8 +4,6 @@ import {GlitchType, reportGlitch} from './glitch.js'; -(function() { - /** * This variable is checked in several integration and unit tests, to make sure * that new code changes don't cause unhandled exceptions. @@ -72,33 +70,3 @@ return orig.apply(this, [condition].concat(args.join('\n'))); }; })(); - -/** - * Wraps the function to use it as a callback, adding: - * - Stack trace of wrapping time, which better reveals the call site. - * - Bind this object - * - * @param {Object=} thisObject Object to be used as this. - * @param {...*} bindArgs Arguments to be bound with the wrapped function. - * @return {function(...)} Wrapped function. - */ -Function.prototype.wrap = function(thisObject, ...bindArgs) { - const func = this; - const bindStack = (new Error('Stack trace before async call')).stack; - if (thisObject === undefined) { - thisObject = null; - } - return function wrappedCallback(...args) { - try { - const finalArgs = bindArgs.concat(args); - return func.apply(thisObject, finalArgs); - } catch (e) { - // Log current exception and the stack for the binding time. - console.error( - e.stack || e, - 'Exception happened in callback which was bound at:', bindStack); - throw e; - } - }; -}; -})();
diff --git a/ui/file_manager/file_manager/common/js/util.js b/ui/file_manager/file_manager/common/js/util.js index f7fb9b0d..064a340d 100644 --- a/ui/file_manager/file_manager/common/js/util.js +++ b/ui/file_manager/file_manager/common/js/util.js
@@ -116,23 +116,6 @@ }; /** - * @param {string} str String to unescape. - * @return {string} Unescaped string. - */ -util.htmlUnescape = str => { - return str.replace(/&(lt|gt|amp);/g, entity => { - switch (entity) { - case '<': - return '<'; - case '>': - return '>'; - case '&': - return '&'; - } - }); -}; - -/** * Remove a file or a directory. * @param {Entry} entry The entry to remove. * @param {function()} onSuccess The success callback. @@ -229,29 +212,6 @@ }; /** - * @typedef {?{ - * scaleX: number, - * scaleY: number, - * rotate90: number - * }} - */ -util.Transform; - -/** - * @param {Element} element Element to transform. - * @param {util.Transform} transform Transform object, - * contains scaleX, scaleY and rotate90 properties. - */ -util.applyTransform = (element, transform) => { - // The order of rotate and scale matters. - element.style.transform = transform ? - 'rotate(' + transform.rotate90 * 90 + 'deg)' + - 'scaleX(' + transform.scaleX + ') ' + - 'scaleY(' + transform.scaleY + ') ' : - ''; -}; - -/** * Extracts path from filesystem: URL. * @param {?string=} url Filesystem URL. * @return {?string} The path if it can be parsed, null if it cannot.
diff --git a/ui/file_manager/file_manager/foreground/js/constants.js b/ui/file_manager/file_manager/foreground/js/constants.js index ffa6eb08..736c631 100644 --- a/ui/file_manager/file_manager/foreground/js/constants.js +++ b/ui/file_manager/file_manager/foreground/js/constants.js
@@ -85,31 +85,6 @@ ]; /** - * Path for files_quick_view.html file. Allow override for testing. - * @type {string} - */ -constants.FILES_QUICK_VIEW_HTML = 'foreground/elements/files_quick_view.html'; - -/** - * Path for drive_welcome.css file. Allow override for testing. - * @type {string} - */ -constants.DRIVE_WELCOME_CSS = 'foreground/css/drive_welcome.css'; - -/** - * Path for photos_welcome.css file. - * @type {string} - */ -constants.PHOTOS_WELCOME_CSS = 'foreground/css/photos_welcome.css'; - -/** - * Path for holding_space_welcome.css file. Allow override for testing. - * @type {string} - */ -constants.HOLDING_SPACE_WELCOME_CSS = - 'foreground/css/holding_space_welcome.css'; - -/** * Name of the default crostini VM. * @const */
diff --git a/ui/file_manager/file_manager/foreground/js/file_manager.js b/ui/file_manager/file_manager/foreground/js/file_manager.js index f6d4c76..951458a00 100644 --- a/ui/file_manager/file_manager/foreground/js/file_manager.js +++ b/ui/file_manager/file_manager/foreground/js/file_manager.js
@@ -405,14 +405,6 @@ this.initBackgroundPagePromise_ = null; /** - * Flags async retrieved once at startup and can be used to switch behaviour - * on sync functions. - * @dict - * @private - */ - this.commandLineFlags_ = {}; - - /** * Whether Drive is enabled. Retrieved from user preferences. * @private {?boolean} */ @@ -967,7 +959,7 @@ this.launchParams_ = new LaunchParam(params); } else { - // Used by the select dialog only. + // Used by the select dialog and SWA. let json = {}; if (location.search) { const query = location.search.substr(1);
diff --git a/ui/file_manager/file_manager/foreground/js/metadata/metadata_dispatcher.js b/ui/file_manager/file_manager/foreground/js/metadata/metadata_dispatcher.js index c10d9fb..f5adf47 100644 --- a/ui/file_manager/file_manager/foreground/js/metadata/metadata_dispatcher.js +++ b/ui/file_manager/file_manager/foreground/js/metadata/metadata_dispatcher.js
@@ -10,11 +10,6 @@ import {MetadataParser} from './metadata_parser.js'; import {MpegParser} from './mpeg_parser.js'; -// All of these scripts could be imported with a single call to importScripts, -// but then load and compile time errors would all be reported from the same -// line. Note: update component_extension_resources.grd when adding new parsers. - - /** * Dispatches metadata requests to the correct parser. * @implements {MetadataParserLogger}
diff --git a/ui/file_manager/file_manager/foreground/js/metadata/metadata_dispatcher_mock_deps.js b/ui/file_manager/file_manager/foreground/js/metadata/metadata_dispatcher_mock_deps.js deleted file mode 100644 index ebea153..0000000 --- a/ui/file_manager/file_manager/foreground/js/metadata/metadata_dispatcher_mock_deps.js +++ /dev/null
@@ -1,7 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// importScripts is used in metadata_dispatcher.js which is designed to work -// inside SharedWorker. -function importScripts(arg1) {}
diff --git a/ui/file_manager/integration_tests/file_manager/background.js b/ui/file_manager/integration_tests/file_manager/background.js index ac3f7d4..fe70a923 100644 --- a/ui/file_manager/integration_tests/file_manager/background.js +++ b/ui/file_manager/integration_tests/file_manager/background.js
@@ -502,6 +502,37 @@ } /** + * Registers a GuestOS, mounts the volume, and populates it with tbe specified + * entries. + * @param {string} appId Files app windowId. + * @param {!Array<!TestEntryInfo>} initialEntries List of initial entries to + * load in the volume. + */ +export async function mountGuestOs(appId, initialEntries) { + const id = await sendTestMessage({ + name: 'registerMountableGuest', + displayName: 'Bluejohn', + canMount: true, + vmType: 'bruschetta', + }); + const placeholder = '#directory-tree [root-type-icon="bruschetta"]'; + const real = '#directory-tree [volume-type-icon="bruschetta"]'; + + // Wait for the GuestOS fake root then click it. + remoteCall.waitAndClickElement(appId, placeholder); + + // Wait for the volume to get mounted. + await remoteCall.waitForElement(appId, real); + + // Add entries to GuestOS volume + await addEntries(['guest_os_0'], initialEntries); + + // Ensure real root and files are shown. + const files = TestEntryInfo.getExpectedRows(initialEntries); + await remoteCall.waitForFiles(appId, files); +} + +/** * Returns true if the SinglePartitionFormat flag is on. * @param {string} appId Files app windowId. */
diff --git a/ui/file_manager/integration_tests/file_manager/guest_os.js b/ui/file_manager/integration_tests/file_manager/guest_os.js index b802804..567bfe2 100644 --- a/ui/file_manager/integration_tests/file_manager/guest_os.js +++ b/ui/file_manager/integration_tests/file_manager/guest_os.js
@@ -94,7 +94,7 @@ /** * Tests that clicking on a Guest OS entry in the sidebar mounts the - * corresponding volume, and that the UI is update appropriately (volume in + * corresponding volume, and that the UI is updated appropriately (volume in * sidebar and not fake, contents show up once done loading, etc). */ testcase.mountGuestSuccess = async () => {
diff --git a/ui/file_manager/integration_tests/file_manager/quick_view.js b/ui/file_manager/integration_tests/file_manager/quick_view.js index e213123..54116c6 100644 --- a/ui/file_manager/integration_tests/file_manager/quick_view.js +++ b/ui/file_manager/integration_tests/file_manager/quick_view.js
@@ -9,7 +9,7 @@ import {addEntries, ENTRIES, EntryType, getCaller, getHistogramCount, pending, repeatUntil, RootPath, sendTestMessage, TestEntryInfo, wait} from '../test_util.js'; import {testcase} from '../testcase.js'; -import {mountCrostini, navigateWithDirectoryTree, openNewWindow, remoteCall, setupAndWaitUntilReady} from './background.js'; +import {mountCrostini, mountGuestOs, navigateWithDirectoryTree, openNewWindow, remoteCall, setupAndWaitUntilReady} from './background.js'; import {BASIC_ANDROID_ENTRY_SET, BASIC_FAKE_ENTRY_SET, BASIC_LOCAL_ENTRY_SET, BASIC_ZIP_ENTRY_SET, MODIFIED_ENTRY_SET} from './test_data.js'; /** @@ -662,6 +662,19 @@ }; /** + * Tests opening Quick View on a GuestOS file. + */ +testcase.openQuickViewGuestOs = async () => { + // Open Files app on Downloads containing ENTRIES.photos. + const appId = + await setupAndWaitUntilReady(RootPath.DOWNLOADS, [ENTRIES.photos], []); + + // Open a GuestOS file in Quick View. + await mountGuestOs(appId, BASIC_LOCAL_ENTRY_SET); + await openQuickView(appId, ENTRIES.hello.nameText); +}; + +/** * Tests opening Quick View on an Android file. */ testcase.openQuickViewAndroid = async () => {
diff --git a/ui/webui/resources/cr_components/app_management/app_management_mojom_traits_unittests.cc b/ui/webui/resources/cr_components/app_management/app_management_mojom_traits_unittests.cc index 33d0f80..f7b5e691 100644 --- a/ui/webui/resources/cr_components/app_management/app_management_mojom_traits_unittests.cc +++ b/ui/webui/resources/cr_components/app_management/app_management_mojom_traits_unittests.cc
@@ -138,7 +138,8 @@ apps::InstallReason::kUnknown, apps::InstallReason::kSystem, apps::InstallReason::kPolicy, apps::InstallReason::kOem, apps::InstallReason::kDefault, apps::InstallReason::kSync, - apps::InstallReason::kUser, apps::InstallReason::kSubApp}; + apps::InstallReason::kUser, apps::InstallReason::kSubApp, + apps::InstallReason::kKiosk}; for (auto install_reason_in : kTestInstallReason) { apps::InstallReason install_reason_out;