diff --git a/DEPS b/DEPS index 40d297c..c9c5d39 100644 --- a/DEPS +++ b/DEPS
@@ -231,19 +231,19 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '0f124cd7cd601c61bac74a11ff665e99b702f03d', + 'skia_revision': 'aaa81ab61e43f858f73c6b3585039a1a2477e18d', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': 'ecce279edeac902a97c734f36d60931168f949e8', + 'v8_revision': '285437eda0607296f0df749d4697bc4a95888840', # 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': '5b699b4b726164db25679196e452de24b2a0eb59', + 'angle_revision': '8f8ca06dfb903fcc8517c69142c46c05e618f40d', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. - 'swiftshader_revision': 'a4b405bee4b4eaff7bc787845c60ee2e23045068', + 'swiftshader_revision': 'd625b6424dbaf90fbd451ce0b47d9fdf4316f84d', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. @@ -306,7 +306,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling devtools-frontend # and whatever else without interference from each other. - 'devtools_frontend_revision': '6da128c3ae6b6dd0d4602059c23f8c4003823f5b', + 'devtools_frontend_revision': '8ad19a591b50d9aa214c206c34c5ee033dc4e184', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libprotobuf-mutator # and whatever else without interference from each other. @@ -1037,7 +1037,7 @@ }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'f5b6ddf39bff8cafa793cce3bb78d9d2e5287861', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'd2fe58c115bb6e5822d6ab3426f73a1e749c3019', 'src/third_party/devtools-frontend/src': Var('chromium_git') + '/devtools/devtools-frontend' + '@' + Var('devtools_frontend_revision'), @@ -1501,7 +1501,7 @@ 'packages': [ { 'package': 'fuchsia/third_party/aemu/linux-amd64', - 'version': '6Vr4alb5803W2n5PbA5ZLwCcJznKdmFX1pDoy_5hfOAC' + 'version': 'YOWVVCdylIMM9vKukczQH2-4DIo-Lnq3AEyUf9mro0QC' }, ], 'condition': 'host_os == "linux" and checkout_fuchsia', @@ -1702,7 +1702,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@a78a49a0bbff8ce261e3721dd64114784707983c', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@4a3ff9cc5f2b904b94454e30b343fa56b6e39150', 'condition': 'checkout_src_internal', }, @@ -1721,7 +1721,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/help_app/app', - 'version': 'qOOwSFA26ck4vnbkaSGVzKnT0J3jg7Tz0RCSffNVJNEC', + 'version': 'UwyXl1fbj-DOn9uVw6gpQr8soG5WhbLZwDkkck3KaR0C', }, ], 'condition': 'checkout_chromeos and checkout_src_internal',
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index 6360187..e10ebb0d 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -2987,6 +2987,7 @@ "//device/bluetooth", "//services/device/public/cpp:test_support", "//services/device/public/mojom", + "//services/network:test_support", "//skia", "//testing/gtest", "//ui/accessibility",
diff --git a/ash/ambient/ambient_controller.cc b/ash/ambient/ambient_controller.cc index dcf21131f..9c28778 100644 --- a/ash/ambient/ambient_controller.cc +++ b/ash/ambient/ambient_controller.cc
@@ -566,7 +566,9 @@ OnLockScreenBackgroundTimeoutPrefChanged(); OnPhotoRefreshIntervalPrefChanged(); - ambient_photo_controller_ = std::make_unique<AmbientPhotoController>(); + DCHECK(AmbientClient::Get()); + ambient_photo_controller_ = std::make_unique<AmbientPhotoController>( + *AmbientClient::Get(), access_token_controller_); ambient_ui_model_observer_.Observe(&ambient_ui_model_);
diff --git a/ash/ambient/ambient_controller_unittest.cc b/ash/ambient/ambient_controller_unittest.cc index 2649132e..510e457f 100644 --- a/ash/ambient/ambient_controller_unittest.cc +++ b/ash/ambient/ambient_controller_unittest.cc
@@ -41,7 +41,7 @@ class AmbientControllerTest : public AmbientAshTestBase { public: - AmbientControllerTest() : AmbientAshTestBase() {} + AmbientControllerTest() = default; ~AmbientControllerTest() override = default; // AmbientAshTestBase:
diff --git a/ash/ambient/ambient_photo_cache.cc b/ash/ambient/ambient_photo_cache.cc index 3373a22a..1e95349 100644 --- a/ash/ambient/ambient_photo_cache.cc +++ b/ash/ambient/ambient_photo_cache.cc
@@ -7,7 +7,9 @@ #include <fstream> #include <iostream> +#include "ash/ambient/ambient_access_token_controller.h" #include "ash/ambient/ambient_constants.h" +#include "ash/constants/ash_features.h" #include "ash/public/cpp/ambient/ambient_client.h" #include "ash/public/cpp/ambient/proto/photo_cache_entry.pb.h" #include "base/bind.h" @@ -52,12 +54,20 @@ } std::unique_ptr<network::SimpleURLLoader> CreateSimpleURLLoader( - const std::string& url) { + const std::string& url, + const std::string& token) { auto resource_request = std::make_unique<network::ResourceRequest>(); resource_request->url = GURL(url); resource_request->method = "GET"; resource_request->credentials_mode = network::mojom::CredentialsMode::kOmit; + if (ash::features::IsAmbientModeNewUrlEnabled()) { + if (token.empty()) + DVLOG(2) << "Failed to fetch access token"; + else + resource_request->headers.SetHeader("Authorization", "Bearer " + token); + } + return network::SimpleURLLoader::Create(std::move(resource_request), NO_TRAFFIC_ANNOTATION_YET); } @@ -122,35 +132,58 @@ class AmbientPhotoCacheImpl : public AmbientPhotoCache { public: - explicit AmbientPhotoCacheImpl(base::FilePath path) + AmbientPhotoCacheImpl(base::FilePath path, + AmbientClient& ambient_client, + AmbientAccessTokenController& access_token_controller) : root_directory_(path), task_runner_(base::ThreadPool::CreateSequencedTaskRunner( {base::MayBlock(), base::TaskPriority::BEST_EFFORT, - base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN})) {} + base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN})), + ambient_client_(ambient_client), + access_token_controller_(access_token_controller) {} + ~AmbientPhotoCacheImpl() override = default; // AmbientPhotoCache: void DownloadPhoto( const std::string& url, base::OnceCallback<void(std::string&&)> callback) override { - std::unique_ptr<network::SimpleURLLoader> simple_loader = - CreateSimpleURLLoader(url); - scoped_refptr<network::SharedURLLoaderFactory> loader_factory = - AmbientClient::Get()->GetURLLoaderFactory(); - auto* loader_ptr = simple_loader.get(); - - loader_ptr->DownloadToString( - loader_factory.get(), - base::BindOnce(&AmbientPhotoCacheImpl::OnUrlDownloaded, - weak_factory_.GetWeakPtr(), std::move(callback), - std::move(simple_loader), loader_factory), - kMaxImageSizeInBytes); + if (ash::features::IsAmbientModeNewUrlEnabled()) { + access_token_controller_.RequestAccessToken( + base::BindOnce(&AmbientPhotoCacheImpl::DownloadPhotoInternal, + weak_factory_.GetWeakPtr(), url, std::move(callback))); + } else { + DownloadPhotoInternal(url, std::move(callback), /*gaia_id=*/std::string(), + /*access_token=*/std::string()); + } } void DownloadPhotoToFile(const std::string& url, int cache_index, base::OnceCallback<void(bool)> callback) override { auto file_path = GetCachePath(cache_index, root_directory_); + base::OnceClosure download_callback; + if (ash::features::IsAmbientModeNewUrlEnabled()) { + download_callback = base::BindOnce( + [](base::WeakPtr<AmbientPhotoCacheImpl> weak_ptr, + base::OnceCallback<void(const std::string&, const std::string&)> + callback) { + if (!weak_ptr) + return; + weak_ptr->access_token_controller_.RequestAccessToken( + std::move(callback)); + }, + weak_factory_.GetWeakPtr(), + base::BindOnce(&AmbientPhotoCacheImpl::DownloadPhotoToFileInternal, + weak_factory_.GetWeakPtr(), url, std::move(callback), + file_path)); + } else { + download_callback = base::BindOnce( + &AmbientPhotoCacheImpl::DownloadPhotoToFileInternal, + weak_factory_.GetWeakPtr(), url, std::move(callback), file_path, + /*gaia_id=*/std::string(), /*access_token=*/std::string()); + } + task_runner_->PostTaskAndReply( FROM_HERE, base::BindOnce( @@ -159,9 +192,7 @@ LOG(ERROR) << "Cannot create ambient mode directory"; }, root_directory_), - base::BindOnce(&AmbientPhotoCacheImpl::DownloadPhotoToFileInternal, - weak_factory_.GetWeakPtr(), url, std::move(callback), - file_path)); + std::move(download_callback)); } void DecodePhoto( @@ -224,13 +255,34 @@ } private: + void DownloadPhotoInternal(const std::string& url, + base::OnceCallback<void(std::string&&)> callback, + const std::string& gaia_id, + const std::string& access_token) { + std::unique_ptr<network::SimpleURLLoader> simple_loader = + CreateSimpleURLLoader(url, access_token); + scoped_refptr<network::SharedURLLoaderFactory> loader_factory = + ambient_client_.GetURLLoaderFactory(); + auto* loader_ptr = simple_loader.get(); + auto* loader_factory_ptr = loader_factory.get(); + + loader_ptr->DownloadToString( + loader_factory_ptr, + base::BindOnce(&AmbientPhotoCacheImpl::OnUrlDownloaded, + weak_factory_.GetWeakPtr(), std::move(callback), + std::move(simple_loader), std::move(loader_factory)), + kMaxImageSizeInBytes); + } + void DownloadPhotoToFileInternal(const std::string& url, base::OnceCallback<void(bool)> callback, - const base::FilePath& file_path) { + const base::FilePath& file_path, + const std::string& gaia_id, + const std::string& access_token) { std::unique_ptr<network::SimpleURLLoader> simple_loader = - CreateSimpleURLLoader(url); + CreateSimpleURLLoader(url, access_token); scoped_refptr<network::SharedURLLoaderFactory> loader_factory = - AmbientClient::Get()->GetURLLoaderFactory(); + ambient_client_.GetURLLoaderFactory(); auto* loader_ptr = simple_loader.get(); auto* loader_factory_ptr = loader_factory.get(); @@ -322,6 +374,8 @@ const base::FilePath root_directory_; scoped_refptr<base::SequencedTaskRunner> task_runner_; + AmbientClient& ambient_client_; + AmbientAccessTokenController& access_token_controller_; base::WeakPtrFactory<AmbientPhotoCacheImpl> weak_factory_{this}; }; @@ -331,8 +385,11 @@ // static std::unique_ptr<AmbientPhotoCache> AmbientPhotoCache::Create( - base::FilePath root_path) { - return std::make_unique<AmbientPhotoCacheImpl>(root_path); + base::FilePath root_path, + AmbientClient& ambient_client, + AmbientAccessTokenController& access_token_controller) { + return std::make_unique<AmbientPhotoCacheImpl>(root_path, ambient_client, + access_token_controller); } } // namespace ash
diff --git a/ash/ambient/ambient_photo_cache.h b/ash/ambient/ambient_photo_cache.h index 45aead0..289d49f 100644 --- a/ash/ambient/ambient_photo_cache.h +++ b/ash/ambient/ambient_photo_cache.h
@@ -19,6 +19,9 @@ namespace ash { +class AmbientClient; +class AmbientAccessTokenController; + // Interface for downloading and decoding photos for Ambient mode. Mocked for // testing to isolate from network and file system. // Each cache entry is written to disk as three files in the |root_path|, with @@ -30,7 +33,13 @@ AmbientPhotoCache& operator=(const AmbientPhotoCache&) = delete; virtual ~AmbientPhotoCache() = default; - static std::unique_ptr<AmbientPhotoCache> Create(base::FilePath root_path); + // `root_path` is where the cached photos stored on disk. + // `ambient_client` and `access_token_controller` are used to obtain url + // loader factory and access tokens to fetch the online images. + static std::unique_ptr<AmbientPhotoCache> Create( + base::FilePath root_path, + AmbientClient& ambient_client, + AmbientAccessTokenController& access_token_controller); virtual void DownloadPhoto( const std::string& url,
diff --git a/ash/ambient/ambient_photo_cache_unittest.cc b/ash/ambient/ambient_photo_cache_unittest.cc index c063e0b..5c7709b 100644 --- a/ash/ambient/ambient_photo_cache_unittest.cc +++ b/ash/ambient/ambient_photo_cache_unittest.cc
@@ -7,14 +7,21 @@ #include <fstream> #include <iostream> +#include "ash/ambient/ambient_access_token_controller.h" #include "ash/ambient/ambient_constants.h" +#include "ash/ambient/test/ambient_ash_test_helper.h" +#include "ash/ambient/test/test_ambient_client.h" +#include "ash/constants/ash_features.h" #include "ash/public/cpp/ambient/proto/photo_cache_entry.pb.h" #include "base/bind.h" #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/path_service.h" #include "base/run_loop.h" +#include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" +#include "services/network/test/test_url_loader_factory.h" #include "testing/gtest/include/gtest/gtest.h" namespace ash { @@ -32,20 +39,43 @@ class AmbientPhotoCacheTest : public testing::Test { public: + AmbientPhotoCacheTest() = default; + void SetUp() override { + ambient_ash_test_helper_ = std::make_unique<AmbientAshTestHelper>(); + access_token_controller_ = std::make_unique<AmbientAccessTokenController>(); + auto test_path = GetTestPath(); base::DeletePathRecursively(test_path); - photo_cache_ = AmbientPhotoCache::Create(test_path); + photo_cache_ = AmbientPhotoCache::Create( + test_path, ambient_ash_test_helper_->ambient_client(), + *access_token_controller_); } void TearDown() override { base::DeletePathRecursively(GetTestPath()); } AmbientPhotoCache* photo_cache() { return photo_cache_.get(); } - protected: - base::test::TaskEnvironment task_environment_; + network::TestURLLoaderFactory& test_url_loader_factory() { + return ambient_ash_test_helper_->ambient_client().test_url_loader_factory(); + } + + bool IsAccessTokenRequestPending() { + return ambient_ash_test_helper_->ambient_client() + .IsAccessTokenRequestPending(); + } + + void IssueAccessToken(const std::string& token) { + ambient_ash_test_helper_->ambient_client().IssueAccessToken( + token, /*with_error=*/false); + } + + void RunUntilIdle() { task_environment_.RunUntilIdle(); } private: + base::test::TaskEnvironment task_environment_; + std::unique_ptr<AmbientAshTestHelper> ambient_ash_test_helper_; + std::unique_ptr<AmbientAccessTokenController> access_token_controller_; std::unique_ptr<AmbientPhotoCache> photo_cache_; }; @@ -111,4 +141,69 @@ } } +TEST_F(AmbientPhotoCacheTest, DisableNewUrlDisablesTokenFetch) { + std::string fake_url = "https://faketesturl/"; + + // not token request if new url feature is not enabled. + base::test::ScopedFeatureList feature; + feature.InitAndDisableFeature(features::kAmbientModeNewUrl); + + EXPECT_FALSE(IsAccessTokenRequestPending()); + photo_cache()->DownloadPhoto(fake_url, base::BindOnce([](std::string&&) {})); + + RunUntilIdle(); + EXPECT_FALSE(IsAccessTokenRequestPending()); + + photo_cache()->DownloadPhotoToFile(fake_url, /*cache_index=*/1, + base::BindOnce([](bool) {})); + + RunUntilIdle(); + EXPECT_FALSE(IsAccessTokenRequestPending()); +} + +TEST_F(AmbientPhotoCacheTest, EnableNewUrlAttachesTokenToDownloadRequest) { + std::string fake_url = "https://faketesturl/"; + std::string fake_token = "fake_access_token"; + base::test::ScopedFeatureList feature; + feature.InitAndEnableFeature(features::kAmbientModeNewUrl); + + photo_cache()->DownloadPhoto(fake_url, base::BindOnce([](std::string&&) {})); + RunUntilIdle(); + EXPECT_TRUE(IsAccessTokenRequestPending()); + IssueAccessToken(fake_token); + EXPECT_FALSE(IsAccessTokenRequestPending()); + + auto* pending_requests = test_url_loader_factory().pending_requests(); + EXPECT_EQ(pending_requests->size(), std::size_t{1}); + EXPECT_EQ(pending_requests->at(0).request.url, fake_url); + std::string header; + pending_requests->at(0).request.headers.GetHeader("Authorization", &header); + + EXPECT_EQ(header, "Bearer " + fake_token); +} + +TEST_F(AmbientPhotoCacheTest, + EnableNewUrlAttachesTokenToDownloadToFileRequest) { + std::string fake_url = "https://faketesturl/"; + std::string fake_token = "fake_access_token"; + base::test::ScopedFeatureList feature; + feature.InitAndEnableFeature(features::kAmbientModeNewUrl); + + photo_cache()->DownloadPhotoToFile(fake_url, /*cache_index=*/1, + base::BindOnce([](bool) {})); + + RunUntilIdle(); + EXPECT_TRUE(IsAccessTokenRequestPending()); + IssueAccessToken(fake_token); + EXPECT_FALSE(IsAccessTokenRequestPending()); + + auto* pending_requests = test_url_loader_factory().pending_requests(); + EXPECT_EQ(pending_requests->size(), std::size_t{1}); + EXPECT_EQ(pending_requests->at(0).request.url, fake_url); + std::string header; + pending_requests->at(0).request.headers.GetHeader("Authorization", &header); + + EXPECT_EQ(header, "Bearer " + fake_token); +} + } // namespace ash
diff --git a/ash/ambient/ambient_photo_controller.cc b/ash/ambient/ambient_photo_controller.cc index 38d9b90d..ae2db0e 100644 --- a/ash/ambient/ambient_photo_controller.cc +++ b/ash/ambient/ambient_photo_controller.cc
@@ -38,6 +38,7 @@ #include "base/task_runner_util.h" #include "base/threading/sequenced_task_runner_handle.h" #include "net/traffic_annotation/network_traffic_annotation.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/gfx/image/image_skia.h" #include "url/gurl.h" @@ -102,13 +103,21 @@ } // namespace -AmbientPhotoController::AmbientPhotoController() +AmbientPhotoController::AmbientPhotoController( + AmbientClient& ambient_client, + AmbientAccessTokenController& access_token_controller) : fetch_topic_retry_backoff_(&kFetchTopicRetryBackoffPolicy), resume_fetch_image_backoff_(&kResumeFetchImageBackoffPolicy), - photo_cache_(AmbientPhotoCache::Create(GetCacheRootPath().Append( - FILE_PATH_LITERAL(kAmbientModeCacheDirectoryName)))), - backup_photo_cache_(AmbientPhotoCache::Create(GetCacheRootPath().Append( - FILE_PATH_LITERAL(kAmbientModeBackupCacheDirectoryName)))), + photo_cache_(AmbientPhotoCache::Create( + GetCacheRootPath().Append( + FILE_PATH_LITERAL(kAmbientModeCacheDirectoryName)), + ambient_client, + access_token_controller)), + backup_photo_cache_(AmbientPhotoCache::Create( + GetCacheRootPath().Append( + FILE_PATH_LITERAL(kAmbientModeBackupCacheDirectoryName)), + ambient_client, + access_token_controller)), task_runner_( base::ThreadPool::CreateSequencedTaskRunner(GetTaskTraits())) { ambient_backend_model_observation_.Observe(&ambient_backend_model_);
diff --git a/ash/ambient/ambient_photo_controller.h b/ash/ambient/ambient_photo_controller.h index 9099286..78e0c888 100644 --- a/ash/ambient/ambient_photo_controller.h +++ b/ash/ambient/ambient_photo_controller.h
@@ -33,6 +33,9 @@ namespace ash { +class AmbientClient; +class AmbientAccessTokenController; + // Class to handle photos in ambient mode. class ASH_EXPORT AmbientPhotoController : public AmbientBackendModelObserver { public: @@ -48,7 +51,8 @@ using PhotoDownloadCallback = base::OnceCallback<void(const gfx::ImageSkia&)>; - AmbientPhotoController(); + AmbientPhotoController(AmbientClient& ambient_client, + AmbientAccessTokenController& access_token_controller); AmbientPhotoController(const AmbientPhotoController&) = delete; AmbientPhotoController& operator=(const AmbientPhotoController&) = delete;
diff --git a/ash/ambient/test/ambient_ash_test_helper.cc b/ash/ambient/test/ambient_ash_test_helper.cc index a4503b7..56a7eba6 100644 --- a/ash/ambient/test/ambient_ash_test_helper.cc +++ b/ash/ambient/test/ambient_ash_test_helper.cc
@@ -8,19 +8,17 @@ namespace ash { -AmbientAshTestHelper::AmbientAshTestHelper() { - ambient_client_ = std::make_unique<TestAmbientClient>(&wake_lock_provider_); -} +AmbientAshTestHelper::AmbientAshTestHelper() = default; AmbientAshTestHelper::~AmbientAshTestHelper() = default; void AmbientAshTestHelper::IssueAccessToken(const std::string& token, bool with_error) { - ambient_client_->IssueAccessToken(token, with_error); + ambient_client_.IssueAccessToken(token, with_error); } bool AmbientAshTestHelper::IsAccessTokenRequestPending() const { - return ambient_client_->IsAccessTokenRequestPending(); + return ambient_client_.IsAccessTokenRequestPending(); } } // namespace ash
diff --git a/ash/ambient/test/ambient_ash_test_helper.h b/ash/ambient/test/ambient_ash_test_helper.h index 651fcda..4615449 100644 --- a/ash/ambient/test/ambient_ash_test_helper.h +++ b/ash/ambient/test/ambient_ash_test_helper.h
@@ -7,12 +7,11 @@ #include <memory> +#include "ash/ambient/test/test_ambient_client.h" #include "services/device/public/cpp/test/test_wake_lock_provider.h" namespace ash { -class TestAmbientClient; - // The helper class to test the Ambient Mode in Ash. class AmbientAshTestHelper { public: @@ -29,9 +28,11 @@ return &wake_lock_provider_; } + TestAmbientClient& ambient_client() { return ambient_client_; } + private: device::TestWakeLockProvider wake_lock_provider_; - std::unique_ptr<TestAmbientClient> ambient_client_; + TestAmbientClient ambient_client_{&wake_lock_provider_}; }; } // namespace ash
diff --git a/ash/ambient/test/test_ambient_client.cc b/ash/ambient/test/test_ambient_client.cc index 1dded4f..69bcc5c 100644 --- a/ash/ambient/test/test_ambient_client.cc +++ b/ash/ambient/test/test_ambient_client.cc
@@ -10,6 +10,7 @@ #include "ash/shell.h" #include "base/time/time.h" #include "services/network/public/cpp/shared_url_loader_factory.h" +#include "services/network/test/test_url_loader_factory.h" namespace ash { @@ -20,11 +21,57 @@ constexpr base::TimeDelta kDefaultTokenExpirationDelay = base::TimeDelta::FromSeconds(60); +// A simple SharedURLLoaderFactory implementation for tests. +class FakeSharedURLLoaderFactory : public network::SharedURLLoaderFactory { + public: + FakeSharedURLLoaderFactory() = default; + FakeSharedURLLoaderFactory(const FakeSharedURLLoaderFactory&) = delete; + FakeSharedURLLoaderFactory& operator=(const FakeSharedURLLoaderFactory&) = + delete; + + // network::mojom::URLLoaderFactory implementation: + void Clone(mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver) + override { + test_url_loader_factory_.Clone(std::move(receiver)); + } + + void CreateLoaderAndStart( + mojo::PendingReceiver<network::mojom::URLLoader> loader, + int32_t request_id, + uint32_t options, + const network::ResourceRequest& request, + mojo::PendingRemote<network::mojom::URLLoaderClient> client, + const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) + override { + test_url_loader_factory_.CreateLoaderAndStart( + std::move(loader), request_id, options, request, std::move(client), + traffic_annotation); + } + + // network::SharedURLLoaderFactory implementation: + std::unique_ptr<network::PendingSharedURLLoaderFactory> Clone() override { + NOTREACHED(); + return nullptr; + } + + network::TestURLLoaderFactory& test_url_loader_factory() { + return test_url_loader_factory_; + } + + private: + friend class base::RefCounted<FakeSharedURLLoaderFactory>; + + ~FakeSharedURLLoaderFactory() override = default; + + network::TestURLLoaderFactory test_url_loader_factory_; +}; + } // namespace TestAmbientClient::TestAmbientClient( device::TestWakeLockProvider* wake_lock_provider) - : wake_lock_provider_(wake_lock_provider) {} + : url_loader_factory_(new FakeSharedURLLoaderFactory()), + wake_lock_provider_(wake_lock_provider) {} TestAmbientClient::~TestAmbientClient() = default; @@ -39,8 +86,7 @@ scoped_refptr<network::SharedURLLoaderFactory> TestAmbientClient::GetURLLoaderFactory() { - // TODO: return fake URL loader facotry. - return nullptr; + return url_loader_factory_; } void TestAmbientClient::RequestWakeLockProvider( @@ -73,4 +119,9 @@ return !!pending_callback_; } +network::TestURLLoaderFactory& TestAmbientClient::test_url_loader_factory() { + return static_cast<FakeSharedURLLoaderFactory*>(url_loader_factory_.get()) + ->test_url_loader_factory(); +} + } // namespace ash
diff --git a/ash/ambient/test/test_ambient_client.h b/ash/ambient/test/test_ambient_client.h index f1e19e97..38783eb 100644 --- a/ash/ambient/test/test_ambient_client.h +++ b/ash/ambient/test/test_ambient_client.h
@@ -12,6 +12,10 @@ #include "base/callback.h" #include "services/device/public/cpp/test/test_wake_lock_provider.h" +namespace network { +class TestURLLoaderFactory; +} // namespace network + namespace ash { // An implementation for test support. @@ -35,9 +39,11 @@ bool IsAccessTokenRequestPending() const; + network::TestURLLoaderFactory& test_url_loader_factory(); + private: GetAccessTokenCallback pending_callback_; - + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_; device::TestWakeLockProvider* const wake_lock_provider_; };
diff --git a/ash/app_list/BUILD.gn b/ash/app_list/BUILD.gn index dc39d109..85bfb38 100644 --- a/ash/app_list/BUILD.gn +++ b/ash/app_list/BUILD.gn
@@ -57,6 +57,7 @@ "views/apps_container_view.h", "views/apps_grid_view.cc", "views/apps_grid_view.h", + "views/apps_grid_view_focus_delegate.h", "views/apps_grid_view_folder_delegate.h", "views/assistant/app_list_bubble_assistant_page.cc", "views/assistant/app_list_bubble_assistant_page.h",
diff --git a/ash/app_list/app_list_util.cc b/ash/app_list/app_list_util.cc index 84d4668..145c9d2 100644 --- a/ash/app_list/app_list_util.cc +++ b/ash/app_list/app_list_util.cc
@@ -8,13 +8,17 @@ #include "ash/app_list/model/app_list_item.h" #include "ash/constants/ash_constants.h" #include "ash/public/cpp/app_list/app_list_color_provider.h" +#include "ui/events/event.h" #include "ui/gfx/canvas.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/vector2d.h" +#include "ui/gfx/image/image_skia.h" #include "ui/gfx/image/image_skia_operations.h" #include "ui/gfx/skia_util.h" +#include "ui/views/accessibility/view_accessibility.h" #include "ui/views/controls/textfield/textfield.h" #include "ui/views/focus/focus_manager.h" +#include "ui/views/view.h" namespace ash { @@ -144,4 +148,11 @@ canvas->DrawLine(top_point, bottom_point, flags); } +void SetViewIgnoredForAccessibility(views::View* view, bool ignored) { + auto& view_accessibility = view->GetViewAccessibility(); + view_accessibility.OverrideIsLeaf(ignored); + view_accessibility.OverrideIsIgnored(ignored); + view_accessibility.NotifyAccessibilityEvent(ax::mojom::Event::kTreeChanged); +} + } // namespace ash
diff --git a/ash/app_list/app_list_util.h b/ash/app_list/app_list_util.h index f10a76b1..0dcf3fe 100644 --- a/ash/app_list/app_list_util.h +++ b/ash/app_list/app_list_util.h
@@ -6,17 +6,24 @@ #define ASH_APP_LIST_APP_LIST_UTIL_H_ #include "ash/ash_export.h" -#include "ui/events/event.h" -#include "ui/gfx/image/image_skia.h" - -namespace views { -class Textfield; -} // namespace views +#include "third_party/skia/include/core/SkColor.h" +#include "ui/events/keycodes/keyboard_codes.h" namespace gfx { class Canvas; +class ImageSkia; +class Point; } // namespace gfx +namespace ui { +class KeyEvent; +} // namespace ui + +namespace views { +class Textfield; +class View; +} // namespace views + namespace ash { class AppListItem; @@ -66,6 +73,10 @@ const gfx::Point content_origin, const int height); +// Sets a view as an ignored leaf node, so that it and its child views will be +// ignored by ChromeVox. +ASH_EXPORT void SetViewIgnoredForAccessibility(views::View* view, bool ignored); + } // namespace ash #endif // ASH_APP_LIST_APP_LIST_UTIL_H_
diff --git a/ash/app_list/app_list_view_delegate.h b/ash/app_list/app_list_view_delegate.h index 210ad1ff..4214530 100644 --- a/ash/app_list/app_list_view_delegate.h +++ b/ash/app_list/app_list_view_delegate.h
@@ -15,7 +15,6 @@ #include "ash/public/cpp/app_list/app_list_types.h" #include "ash/public/cpp/ash_public_export.h" #include "base/callback_forward.h" -#include "mojo/public/cpp/bindings/pending_receiver.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/base/ui_base_types.h" #include "ui/events/event_constants.h"
diff --git a/ash/app_list/test/app_list_test_helper.cc b/ash/app_list/test/app_list_test_helper.cc index ed12faf..b53c37e7 100644 --- a/ash/app_list/test/app_list_test_helper.cc +++ b/ash/app_list/test/app_list_test_helper.cc
@@ -21,7 +21,6 @@ #include "base/guid.h" #include "base/run_loop.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/views/view_utils.h" namespace ash { @@ -184,13 +183,4 @@ ->assistant_page_; } -std::vector<AppListItemView*> GetAppListItemViews(views::View* parent) { - std::vector<AppListItemView*> app_list_item_views; - for (auto* child : parent->children()) { - if (views::IsViewClass<AppListItemView>(child)) - app_list_item_views.push_back(static_cast<AppListItemView*>(child)); - } - return app_list_item_views; -} - } // namespace ash
diff --git a/ash/app_list/test/app_list_test_helper.h b/ash/app_list/test/app_list_test_helper.h index df3caf4..28680e5 100644 --- a/ash/app_list/test/app_list_test_helper.h +++ b/ash/app_list/test/app_list_test_helper.h
@@ -6,15 +6,10 @@ #define ASH_APP_LIST_TEST_APP_LIST_TEST_HELPER_H_ #include <memory> -#include <vector> #include "ash/app_list/app_list_metrics.h" #include "ash/app_list/test_app_list_client.h" -namespace views { -class View; -} // namespace views - namespace ash { class AppListBubbleAppsPage; @@ -23,7 +18,6 @@ class AppListBubbleView; class AppListControllerImpl; class AppListFolderView; -class AppListItemView; class AppListView; class ContinueSectionView; class PagedAppsGridView; @@ -116,9 +110,6 @@ std::unique_ptr<TestAppListClient> app_list_client_; }; -// Returns all children of `parent` that are of type AppListItemView. -std::vector<AppListItemView*> GetAppListItemViews(views::View* parent); - } // namespace ash #endif // ASH_APP_LIST_TEST_APP_LIST_TEST_HELPER_H_
diff --git a/ash/app_list/views/app_list_bubble_apps_page.cc b/ash/app_list/views/app_list_bubble_apps_page.cc index 3da5dc6..74cfb27 100644 --- a/ash/app_list/views/app_list_bubble_apps_page.cc +++ b/ash/app_list/views/app_list_bubble_apps_page.cc
@@ -28,7 +28,6 @@ #include "ui/views/controls/textfield/textfield.h" #include "ui/views/focus/focus_manager.h" #include "ui/views/layout/box_layout.h" -#include "ui/views/view_utils.h" using views::BoxLayout; @@ -107,7 +106,8 @@ scrollable_apps_grid_view_ = scroll_contents->AddChildView(std::make_unique<ScrollableAppsGridView>( a11y_announcer, view_delegate, - /*folder_delegate=*/nullptr, scroll_view_, folder_controller)); + /*folder_delegate=*/nullptr, scroll_view_, folder_controller, + /*focus_delegate=*/this)); scrollable_apps_grid_view_->SetDragAndDropHostOfCurrentAppList( drag_and_drop_host); scrollable_apps_grid_view_->SetMaxColumns(5); @@ -130,9 +130,8 @@ } void AppListBubbleAppsPage::MoveFocusUpFromRecents() { - DCHECK(!recent_apps_->children().empty()); - views::View* first_recent = recent_apps_->children()[0]; - DCHECK(views::IsViewClass<AppListItemView>(first_recent)); + DCHECK_GT(recent_apps_->GetItemViewCount(), 0); + AppListItemView* first_recent = recent_apps_->GetItemViewAt(0); // Find the view one step in reverse from the first recent app. views::View* previous_view = GetFocusManager()->GetNextFocusableView( first_recent, GetWidget(), /*reverse=*/true, /*dont_loop=*/false); @@ -154,6 +153,22 @@ item->RequestFocus(); } +bool AppListBubbleAppsPage::MoveFocusUpFromAppsGrid(int column) { + DVLOG(1) << __FUNCTION__; + const int recent_app_count = recent_apps_->GetItemViewCount(); + // If there aren't any recent apps, don't change focus here. Fall back to the + // app grid's default behavior. + if (!recent_apps_->GetVisible() || recent_app_count <= 0) + return false; + // Attempt to focus the item at `column`, or the last item if there aren't + // enough items. + int index = std::min(column, recent_app_count - 1); + AppListItemView* item = recent_apps_->GetItemViewAt(index); + DCHECK(item); + item->RequestFocus(); + return true; +} + BEGIN_METADATA(AppListBubbleAppsPage, views::View) END_METADATA
diff --git a/ash/app_list/views/app_list_bubble_apps_page.h b/ash/app_list/views/app_list_bubble_apps_page.h index 2560e5f..b7727f6 100644 --- a/ash/app_list/views/app_list_bubble_apps_page.h +++ b/ash/app_list/views/app_list_bubble_apps_page.h
@@ -5,6 +5,7 @@ #ifndef ASH_APP_LIST_VIEWS_APP_LIST_BUBBLE_APPS_PAGE_H_ #define ASH_APP_LIST_VIEWS_APP_LIST_BUBBLE_APPS_PAGE_H_ +#include "ash/app_list/views/apps_grid_view_focus_delegate.h" #include "ash/app_list/views/recent_apps_view.h" #include "ash/ash_export.h" #include "ui/base/metadata/metadata_header_macros.h" @@ -26,7 +27,8 @@ // - Grid of all apps // Does not include the search box, which is owned by a parent view. class ASH_EXPORT AppListBubbleAppsPage : public views::View, - public RecentAppsView::Delegate { + public RecentAppsView::Delegate, + public AppsGridViewFocusDelegate { public: METADATA_HEADER(AppListBubbleAppsPage); @@ -46,6 +48,9 @@ void MoveFocusUpFromRecents() override; void MoveFocusDownFromRecents(int column) override; + // AppsGridViewFocusDelegate: + bool MoveFocusUpFromAppsGrid(int column) override; + views::ScrollView* scroll_view() { return scroll_view_; } ScrollableAppsGridView* scrollable_apps_grid_view() { return scrollable_apps_grid_view_;
diff --git a/ash/app_list/views/app_list_bubble_view.cc b/ash/app_list/views/app_list_bubble_view.cc index 977ff84..6c57747 100644 --- a/ash/app_list/views/app_list_bubble_view.cc +++ b/ash/app_list/views/app_list_bubble_view.cc
@@ -8,6 +8,7 @@ #include <memory> #include <utility> +#include "ash/app_list/app_list_util.h" #include "ash/app_list/model/app_list_folder_item.h" #include "ash/app_list/views/app_list_a11y_announcer.h" #include "ash/app_list/views/app_list_bubble_apps_page.h" @@ -355,6 +356,8 @@ void AppListBubbleView::DisableFocusForShowingActiveFolder(bool disabled) { search_box_view_->SetEnabled(!disabled); + SetViewIgnoredForAccessibility(search_box_view_, disabled); + apps_page_->DisableFocusForShowingActiveFolder(disabled); }
diff --git a/ash/app_list/views/app_list_bubble_view_unittest.cc b/ash/app_list/views/app_list_bubble_view_unittest.cc index 46add7b..be64f7d 100644 --- a/ash/app_list/views/app_list_bubble_view_unittest.cc +++ b/ash/app_list/views/app_list_bubble_view_unittest.cc
@@ -39,6 +39,7 @@ #include "ui/events/keycodes/keyboard_codes_posix.h" #include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/rect.h" +#include "ui/views/accessibility/view_accessibility.h" #include "ui/views/controls/image_view.h" #include "ui/views/controls/textfield/textfield.h" #include "ui/views/view_utils.h" @@ -126,6 +127,10 @@ app_list_test_model_->PopulateApps(num_items); } + void AddFolderWithApps(int count) { + app_list_test_model_->CreateAndPopulateFolderWithApps(count); + } + void LeftClickOn(views::View* view) { GetEventGenerator()->MoveMouseTo(view->GetBoundsInScreen().CenterPoint()); GetEventGenerator()->ClickLeftButton(); @@ -356,7 +361,7 @@ } TEST_F(AppListBubbleViewTest, BackActionsCloseFolder) { - app_list_test_model_->CreateAndPopulateFolderWithApps(3); + AddFolderWithApps(3); ShowAppList(); AppListItemView* folder_item = @@ -384,7 +389,7 @@ } TEST_F(AppListBubbleViewTest, BackActionWithSelectedItemSelectsFolder) { - app_list_test_model_->CreateAndPopulateFolderWithApps(3); + AddFolderWithApps(3); ShowAppList(); AppListItemView* folder_item = @@ -470,13 +475,12 @@ AddAppItems(5); ShowAppList(); - std::vector<AppListItemView*> recent_apps = - GetAppListItemViews(GetRecentAppsView()); for (int column = 0; column < 5; column++) { // Pressing down arrow from an item in recent apps selects the app in the // same column in the apps grid. - recent_apps[column]->RequestFocus(); - ASSERT_TRUE(recent_apps[column]->HasFocus()); + AppListItemView* recent_app = GetRecentAppsView()->GetItemViewAt(column); + recent_app->RequestFocus(); + ASSERT_TRUE(recent_app->HasFocus()); PressAndReleaseKey(ui::VKEY_DOWN); @@ -487,8 +491,8 @@ TEST_F(AppListBubbleViewTest, DownArrowFromRecentsSelectsLastColumnInAppsGrid) { AddRecentApps(5); - app_list_test_model_->CreateAndPopulateFolderWithApps(2); - app_list_test_model_->CreateAndPopulateFolderWithApps(3); + AddFolderWithApps(2); + AddFolderWithApps(3); ShowAppList(); // There are only 2 folders, and hence 2 columns, in the top level apps grid. @@ -496,10 +500,9 @@ ASSERT_EQ(2, apps_grid_view->view_model()->view_size()); // Focus the 5th recent app. - std::vector<AppListItemView*> recent_apps = - GetAppListItemViews(GetRecentAppsView()); - ASSERT_EQ(5u, recent_apps.size()); - recent_apps[4]->RequestFocus(); + auto* recent_apps_view = GetRecentAppsView(); + ASSERT_EQ(5, recent_apps_view->GetItemViewCount()); + recent_apps_view->GetItemViewAt(4)->RequestFocus(); PressAndReleaseKey(ui::VKEY_DOWN); @@ -517,14 +520,12 @@ ContinueTaskView* last_continue_task = GetAppListTestHelper()->GetContinueSectionView()->GetTaskViewAtForTesting( 3); - std::vector<AppListItemView*> recent_apps = - GetAppListItemViews(GetRecentAppsView()); - ASSERT_EQ(5u, recent_apps.size()); + auto* recent_apps_view = GetRecentAppsView(); // Pressing 'up' from any column in recent apps moves to the last continue // task. for (int column = 0; column < 5; ++column) { - recent_apps[column]->RequestFocus(); + recent_apps_view->GetItemViewAt(column)->RequestFocus(); PressAndReleaseKey(ui::VKEY_UP); @@ -534,6 +535,56 @@ } } +TEST_F(AppListBubbleViewTest, UpArrowFromAppsGridSelectsSameColumnInRecents) { + AddRecentApps(5); + AddAppItems(5); + ShowAppList(); + + for (int column = 0; column < 5; column++) { + // Pressing up arrow from an item in the apps grid selects the app in the + // same column in the recents list. + AppListItemView* app = GetAppsGridView()->GetItemViewAt(column); + app->RequestFocus(); + ASSERT_TRUE(app->HasFocus()); + + PressAndReleaseKey(ui::VKEY_UP); + + EXPECT_TRUE(GetRecentAppsView()->GetItemViewAt(column)->HasFocus()) + << "Focus mismatch for column " << column; + } +} + +TEST_F(AppListBubbleViewTest, UpArrowFromAppsGridSelectsLastColumnInRecents) { + // Add 4 columns of recents, but 5 columns of apps. + AddRecentApps(4); + AddAppItems(5); + ShowAppList(); + + // Select the app in the last column of the apps grid. + GetAppsGridView()->GetItemViewAt(4)->RequestFocus(); + + PressAndReleaseKey(ui::VKEY_UP); + + // The last app in recents is selected. + EXPECT_TRUE(GetRecentAppsView()->GetItemViewAt(3)->HasFocus()); +} + +TEST_F(AppListBubbleViewTest, + UpArrowFromAppsGridWithNoRecentsSelectsContinueTasks) { + AddContinueSuggestionResult(4); + // Don't add recents. + AddAppItems(5); + ShowAppList(); + GetAppsGridView()->GetItemViewAt(0)->RequestFocus(); + + PressAndReleaseKey(ui::VKEY_UP); + + auto* continue_section = GetAppListTestHelper()->GetContinueSectionView(); + auto* focus_manager = GetAppsPage()->GetFocusManager(); + EXPECT_TRUE(continue_section->Contains(focus_manager->GetFocusedView())) + << GetFocusedViewName(); +} + TEST_F(AppListBubbleViewTest, DownArrowMovesFocusToContinueTasks) { // Add an app, and some "Continue" suggestions. AddAppItems(1); @@ -561,7 +612,7 @@ } TEST_F(AppListBubbleViewTest, ClickOnFolderOpensFolder) { - app_list_test_model_->CreateAndPopulateFolderWithApps(3); + AddFolderWithApps(3); ShowAppList(); AppListItemView* folder_item = GetAppsGridView()->GetItemViewAt(0); @@ -574,7 +625,7 @@ TEST_F(AppListBubbleViewTest, LargeFolderViewFitsInsideMainBubble) { // Create more apps than fit in the default sized folder. - app_list_test_model_->CreateAndPopulateFolderWithApps(30); + AddFolderWithApps(30); ShowAppList(); AppListItemView* folder_item = @@ -595,7 +646,7 @@ } TEST_F(AppListBubbleViewTest, ClickOutsideFolderClosesFolder) { - app_list_test_model_->CreateAndPopulateFolderWithApps(3); + AddFolderWithApps(3); ShowAppList(); AppListItemView* folder_item = @@ -614,7 +665,7 @@ } TEST_F(AppListBubbleViewTest, ReparentDragOutOfFolderClosesFolder) { - app_list_test_model_->CreateAndPopulateFolderWithApps(3); + AddFolderWithApps(3); ShowAppList(); AppListItemView* folder_item = @@ -646,7 +697,7 @@ } TEST_F(AppListBubbleViewTest, DragItemInsideFolderDoesNotSelectItem) { - app_list_test_model_->CreateAndPopulateFolderWithApps(3); + AddFolderWithApps(3); ShowAppList(); AppListItemView* folder_item = @@ -669,7 +720,7 @@ } TEST_F(AppListBubbleViewTest, OpenFolderWithMouseDoesNotFocusItem) { - app_list_test_model_->CreateAndPopulateFolderWithApps(3); + AddFolderWithApps(3); ShowAppList(); AppListItemView* folder_item = GetAppsGridView()->GetItemViewAt(0); @@ -682,7 +733,7 @@ } TEST_F(AppListBubbleViewTest, PressingTabMovesFocusInsideFolder) { - app_list_test_model_->CreateAndPopulateFolderWithApps(3); + AddFolderWithApps(3); ShowAppList(); AppListItemView* folder_item = GetAppsGridView()->GetItemViewAt(0); @@ -705,8 +756,44 @@ } } +TEST_F(AppListBubbleViewTest, OpeningFolderRemovesOtherViewsFromAccessibility) { + AddContinueSuggestionResult(4); + AddRecentApps(5); + AddFolderWithApps(5); + ShowAppList(); + + // Open the folder. + AppListItemView* folder_item = GetAppsGridView()->GetItemViewAt(0); + LeftClickOn(folder_item); + + auto* search_box = GetSearchBoxView(); + EXPECT_TRUE(search_box->GetViewAccessibility().IsIgnored()); + EXPECT_TRUE(search_box->GetViewAccessibility().IsLeaf()); + auto* continue_section = GetAppListTestHelper()->GetContinueSectionView(); + EXPECT_TRUE(continue_section->GetViewAccessibility().IsIgnored()); + EXPECT_TRUE(continue_section->GetViewAccessibility().IsLeaf()); + auto* recent_apps = GetRecentAppsView(); + EXPECT_TRUE(recent_apps->GetViewAccessibility().IsIgnored()); + EXPECT_TRUE(recent_apps->GetViewAccessibility().IsLeaf()); + auto* apps_grid = GetAppsGridView(); + EXPECT_TRUE(apps_grid->GetViewAccessibility().IsIgnored()); + EXPECT_TRUE(apps_grid->GetViewAccessibility().IsLeaf()); + + // Close the folder. + PressAndReleaseKey(ui::VKEY_ESCAPE); + + EXPECT_FALSE(search_box->GetViewAccessibility().IsIgnored()); + EXPECT_FALSE(search_box->GetViewAccessibility().IsLeaf()); + EXPECT_FALSE(continue_section->GetViewAccessibility().IsIgnored()); + EXPECT_FALSE(continue_section->GetViewAccessibility().IsLeaf()); + EXPECT_FALSE(recent_apps->GetViewAccessibility().IsIgnored()); + EXPECT_FALSE(recent_apps->GetViewAccessibility().IsLeaf()); + EXPECT_FALSE(apps_grid->GetViewAccessibility().IsIgnored()); + EXPECT_FALSE(apps_grid->GetViewAccessibility().IsLeaf()); +} + TEST_F(AppListBubbleViewTest, OpenFolderWithKeyboardFocusesFirstItem) { - app_list_test_model_->CreateAndPopulateFolderWithApps(3); + AddFolderWithApps(3); ShowAppList(); AppListItemView* folder_item = GetAppsGridView()->GetItemViewAt(0); @@ -723,7 +810,7 @@ } TEST_F(AppListBubbleViewTest, CloseFolderWithNoSelectedItemFocusesSearchBox) { - app_list_test_model_->CreateAndPopulateFolderWithApps(3); + AddFolderWithApps(3); ShowAppList(); AppListItemView* folder_item = GetAppsGridView()->GetItemViewAt(0); @@ -732,11 +819,8 @@ auto* folder_view = GetAppListTestHelper()->GetBubbleFolderView(); ASSERT_FALSE(folder_view->items_grid_view()->has_selected_view()); - // TODO(jamescook): Switch to using keyboard to close folder. - gfx::Point outside_view = - folder_view->GetBoundsInScreen().bottom_right() + gfx::Vector2d(10, 10); - GetEventGenerator()->MoveMouseTo(outside_view); - GetEventGenerator()->ClickLeftButton(); + // Close the folder. + PressAndReleaseKey(ui::VKEY_ESCAPE); SearchBoxView* search_box_view = GetSearchBoxView(); EXPECT_TRUE(search_box_view->search_box()->HasFocus()) @@ -745,7 +829,7 @@ } TEST_F(AppListBubbleViewTest, CloseFolderWithSelectedItemFocusesFolderItem) { - app_list_test_model_->CreateAndPopulateFolderWithApps(3); + AddFolderWithApps(3); ShowAppList(); AppListItemView* folder_item = GetAppsGridView()->GetItemViewAt(0); @@ -755,11 +839,8 @@ folder_view->items_grid_view()->GetItemViewAt(0)->RequestFocus(); ASSERT_TRUE(folder_view->items_grid_view()->has_selected_view()); - // TODO(jamescook): Switch to using keyboard to close folder. - gfx::Point outside_view = - folder_view->GetBoundsInScreen().bottom_right() + gfx::Vector2d(10, 10); - GetEventGenerator()->MoveMouseTo(outside_view); - GetEventGenerator()->ClickLeftButton(); + // Close the folder. + PressAndReleaseKey(ui::VKEY_ESCAPE); // Folder item is selected and focused. auto* root_apps_grid_view = GetAppsGridView();
diff --git a/ash/app_list/views/app_list_folder_view.cc b/ash/app_list/views/app_list_folder_view.cc index fedb8779..0ac5ea7 100644 --- a/ash/app_list/views/app_list_folder_view.cc +++ b/ash/app_list/views/app_list_folder_view.cc
@@ -619,7 +619,7 @@ items_grid_view_ = scroll_contents->AddChildView(std::make_unique<ScrollableAppsGridView>( a11y_announcer_, view_delegate_, this, scroll_view_, - /*folder_controller=*/nullptr)); + /*folder_controller=*/nullptr, /*focus_delegate=*/nullptr)); items_grid_view_->SetMaxColumns(kMaxFolderColumns); items_grid_view_->SetFixedTilePadding(kTileSpacingInFolder / 2, kTileSpacingInFolder / 2);
diff --git a/ash/app_list/views/app_list_view_unittest.cc b/ash/app_list/views/app_list_view_unittest.cc index 59acedc..b81ea5a 100644 --- a/ash/app_list/views/app_list_view_unittest.cc +++ b/ash/app_list/views/app_list_view_unittest.cc
@@ -66,6 +66,8 @@ #include "ui/display/display.h" #include "ui/display/screen.h" #include "ui/events/event_utils.h" +#include "ui/events/keycodes/keyboard_codes.h" +#include "ui/views/accessibility/view_accessibility.h" #include "ui/views/controls/textfield/textfield.h" #include "ui/views/test/views_test_base.h" #include "ui/views/view_model.h" @@ -1086,6 +1088,34 @@ ui::VKEY_LEFT, false); } +TEST_F(AppListViewFocusTest, OpeningFolderRemovesOtherViewsFromAccessibility) { + Show(); + + // Transition to FULLSCREEN_ALL_APPS state and open the folder. + SetAppListState(ash::AppListViewState::kFullscreenAllApps); + folder_item_view()->RequestFocus(); + SimulateKeyPress(ui::VKEY_RETURN, false); + auto* apps_container_view = contents_view()->apps_container_view(); + ASSERT_TRUE(apps_container_view->IsInFolderView()); + + // Note: For fullscreen app list, the search box is part of the focus cycle + // when a folder is open. + auto* suggestion_chip_container = + apps_container_view->suggestion_chip_container_view_for_test(); + EXPECT_TRUE(suggestion_chip_container->GetViewAccessibility().IsIgnored()); + EXPECT_TRUE(suggestion_chip_container->GetViewAccessibility().IsLeaf()); + EXPECT_TRUE(apps_grid_view()->GetViewAccessibility().IsIgnored()); + EXPECT_TRUE(apps_grid_view()->GetViewAccessibility().IsLeaf()); + + // Close the folder. + SimulateKeyPress(ui::VKEY_ESCAPE, false); + + EXPECT_FALSE(suggestion_chip_container->GetViewAccessibility().IsIgnored()); + EXPECT_FALSE(suggestion_chip_container->GetViewAccessibility().IsLeaf()); + EXPECT_FALSE(apps_grid_view()->GetViewAccessibility().IsIgnored()); + EXPECT_FALSE(apps_grid_view()->GetViewAccessibility().IsLeaf()); +} + // Tests the vertical focus traversal by in PEEKING state. TEST_P(AppListViewFocusTest, VerticalFocusTraversalInPeekingState) { Show();
diff --git a/ash/app_list/views/apps_container_view.cc b/ash/app_list/views/apps_container_view.cc index 7b2241c3..4e2bb5c1 100644 --- a/ash/app_list/views/apps_container_view.cc +++ b/ash/app_list/views/apps_container_view.cc
@@ -9,6 +9,7 @@ #include <utility> #include <vector> +#include "ash/app_list/app_list_util.h" #include "ash/app_list/views/app_list_a11y_announcer.h" #include "ash/app_list/views/app_list_folder_view.h" #include "ash/app_list/views/app_list_item_view.h" @@ -973,9 +974,7 @@ // Ignore the page switcher in accessibility tree so that buttons inside it // will not be accessed by ChromeVox. - page_switcher_->GetViewAccessibility().OverrideIsIgnored(disabled); - page_switcher_->GetViewAccessibility().NotifyAccessibilityEvent( - ax::mojom::Event::kTreeChanged); + SetViewIgnoredForAccessibility(page_switcher_, disabled); } int AppsContainerView::GetExpectedSuggestionChipY(float progress) {
diff --git a/ash/app_list/views/apps_grid_view.cc b/ash/app_list/views/apps_grid_view.cc index af5c69e4..8e83025b 100644 --- a/ash/app_list/views/apps_grid_view.cc +++ b/ash/app_list/views/apps_grid_view.cc
@@ -25,6 +25,7 @@ #include "ash/app_list/views/app_list_main_view.h" #include "ash/app_list/views/app_list_view.h" #include "ash/app_list/views/apps_container_view.h" +#include "ash/app_list/views/apps_grid_view_focus_delegate.h" #include "ash/app_list/views/contents_view.h" #include "ash/app_list/views/ghost_image_view.h" #include "ash/app_list/views/pulsing_block_view.h" @@ -275,12 +276,14 @@ AppListA11yAnnouncer* a11y_announcer, AppListViewDelegate* app_list_view_delegate, AppsGridViewFolderDelegate* folder_delegate, - AppListFolderController* folder_controller) + AppListFolderController* folder_controller, + AppsGridViewFocusDelegate* focus_delegate) : folder_delegate_(folder_delegate), folder_controller_(folder_controller), contents_view_(contents_view), a11y_announcer_(a11y_announcer), - app_list_view_delegate_(app_list_view_delegate) { + app_list_view_delegate_(app_list_view_delegate), + focus_delegate_(focus_delegate) { DCHECK(a11y_announcer_); DCHECK(app_list_view_delegate_); // Top-level grids must have a folder controller. @@ -396,9 +399,7 @@ // Ignore the grid view in accessibility tree so that items inside it will not // be accessed by ChromeVox. - GetViewAccessibility().OverrideIsIgnored(disabled); - GetViewAccessibility().NotifyAccessibilityEvent( - ax::mojom::Event::kTreeChanged); + SetViewIgnoredForAccessibility(this, disabled); } void AppsGridView::SetModel(AppListModel* model) { @@ -1504,6 +1505,12 @@ if (target_page < 0) { // Move focus up outside the apps grid if target page is negative. + if (focus_delegate_ && + focus_delegate_->MoveFocusUpFromAppsGrid(target_col)) { + // The delegate handled the focus move. + return true; + } + // Move focus backwards from the first item in the grid. views::View* v = GetFocusManager()->GetNextFocusableView( view_model_.view_at(0), /*starting_widget=*/nullptr, /*reverse=*/true, /*dont_loop=*/false);
diff --git a/ash/app_list/views/apps_grid_view.h b/ash/app_list/views/apps_grid_view.h index dcf323ef..6722614e 100644 --- a/ash/app_list/views/apps_grid_view.h +++ b/ash/app_list/views/apps_grid_view.h
@@ -51,6 +51,7 @@ class AppListItemView; class AppListModel; class AppListViewDelegate; +class AppsGridViewFocusDelegate; class AppsGridViewFolderDelegate; class ContentsView; class PulsingBlockView; @@ -99,7 +100,8 @@ AppListA11yAnnouncer* a11y_announcer, AppListViewDelegate* app_list_view_delegate, AppsGridViewFolderDelegate* folder_delegate, - AppListFolderController* folder_controller); + AppListFolderController* folder_controller, + AppsGridViewFocusDelegate* focus_delegate); AppsGridView(const AppsGridView&) = delete; AppsGridView& operator=(const AppsGridView&) = delete; ~AppsGridView() override; @@ -788,6 +790,9 @@ AppListA11yAnnouncer* const a11y_announcer_; AppListViewDelegate* const app_list_view_delegate_; + // May be nullptr if this apps grid doesn't have custom focus handling. + AppsGridViewFocusDelegate* const focus_delegate_; + // Keeps the individual AppListItemView. Owned by views hierarchy. views::View* items_container_ = nullptr;
diff --git a/ash/app_list/views/apps_grid_view_focus_delegate.h b/ash/app_list/views/apps_grid_view_focus_delegate.h new file mode 100644 index 0000000..6e0a547 --- /dev/null +++ b/ash/app_list/views/apps_grid_view_focus_delegate.h
@@ -0,0 +1,27 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_APP_LIST_VIEWS_APPS_GRID_VIEW_FOCUS_DELEGATE_H_ +#define ASH_APP_LIST_VIEWS_APPS_GRID_VIEW_FOCUS_DELEGATE_H_ + +#include "ash/ash_export.h" + +namespace ash { + +// A delegate which allows an AppsGridView to request custom focus changes. +class ASH_EXPORT AppsGridViewFocusDelegate { + public: + // Requests that focus move up and out (usually to the recent apps list). + // `column` is the column of the item that was focused in the grid. + // The delegate should choose an appropriate item to focus. Returns true if + // the delegate handled the move. + virtual bool MoveFocusUpFromAppsGrid(int column) = 0; + + protected: + virtual ~AppsGridViewFocusDelegate() = default; +}; + +} // namespace ash + +#endif // ASH_APP_LIST_VIEWS_APPS_GRID_VIEW_FOCUS_DELEGATE_H_
diff --git a/ash/app_list/views/continue_section_view.cc b/ash/app_list/views/continue_section_view.cc index 0c8e1aaf..16351ddf 100644 --- a/ash/app_list/views/continue_section_view.cc +++ b/ash/app_list/views/continue_section_view.cc
@@ -9,6 +9,7 @@ #include <string> #include <vector> +#include "ash/app_list/app_list_util.h" #include "ash/app_list/app_list_view_delegate.h" #include "ash/app_list/model/search/search_model.h" #include "ash/app_list/views/continue_task_view.h" @@ -84,6 +85,11 @@ void ContinueSectionView::DisableFocusForShowingActiveFolder(bool disabled) { suggestions_container_->DisableFocusForShowingActiveFolder(disabled); + + // Prevent items from being accessed by ChromeVox. + // TODO(crbug.com/1254015): This does not ignore the "Continue" label itself. + // Explicitly ignoring that view doesn't work either. + SetViewIgnoredForAccessibility(this, disabled); } ContinueTaskView* ContinueSectionView::GetTaskViewAtForTesting(
diff --git a/ash/app_list/views/paged_apps_grid_view.cc b/ash/app_list/views/paged_apps_grid_view.cc index df53c42..2719152b 100644 --- a/ash/app_list/views/paged_apps_grid_view.cc +++ b/ash/app_list/views/paged_apps_grid_view.cc
@@ -189,7 +189,8 @@ a11y_announcer, contents_view->GetAppListMainView()->view_delegate(), folder_delegate, - folder_controller), + folder_controller, + /*focus_delegate=*/nullptr), contents_view_(contents_view), container_delegate_(container_delegate), page_flip_delay_(kPageFlipDelay),
diff --git a/ash/app_list/views/recent_apps_view.cc b/ash/app_list/views/recent_apps_view.cc index b265784..44af7add 100644 --- a/ash/app_list/views/recent_apps_view.cc +++ b/ash/app_list/views/recent_apps_view.cc
@@ -9,6 +9,7 @@ #include <string> #include <vector> +#include "ash/app_list/app_list_util.h" #include "ash/app_list/app_list_view_delegate.h" #include "ash/app_list/model/app_list_item.h" #include "ash/app_list/model/app_list_model.h" @@ -176,6 +177,7 @@ views::kFlexBehaviorKey, views::FlexSpecification(views::MinimumFlexSizeRule::kPreferred, views::MaximumFlexSizeRule::kPreferred)); + item_views_.push_back(item_view); // Add a empty-space view used to evenly distribute app list item views // within the available space. @@ -195,9 +197,22 @@ RecentAppsView::~RecentAppsView() = default; +int RecentAppsView::GetItemViewCount() const { + return item_views_.size(); +} + +AppListItemView* RecentAppsView::GetItemViewAt(int index) const { + if (static_cast<int>(item_views_.size()) <= index) + return nullptr; + return item_views_[index]; +} + void RecentAppsView::DisableFocusForShowingActiveFolder(bool disabled) { for (views::View* child : children()) child->SetEnabled(!disabled); + + // Prevent items from being accessed by ChromeVox. + SetViewIgnoredForAccessibility(this, disabled); } bool RecentAppsView::OnKeyPressed(const ui::KeyEvent& event) {
diff --git a/ash/app_list/views/recent_apps_view.h b/ash/app_list/views/recent_apps_view.h index f0bef0df..0d49eb10 100644 --- a/ash/app_list/views/recent_apps_view.h +++ b/ash/app_list/views/recent_apps_view.h
@@ -42,6 +42,12 @@ RecentAppsView& operator=(const RecentAppsView&) = delete; ~RecentAppsView() override; + // Returns the number of AppListItemView children. + int GetItemViewCount() const; + + // Returns an AppListItemView child. `index` must be valid. + AppListItemView* GetItemViewAt(int index) const; + // See AppsGridView::DisableFocusForShowingActiveFolder(). void DisableFocusForShowingActiveFolder(bool disabled); @@ -64,6 +70,10 @@ // The grid delegate for each AppListItemView. class GridDelegateImpl; std::unique_ptr<GridDelegateImpl> grid_delegate_; + + // The recent app items. Stored here because this view has child views for + // spacing that are not AppListItemViews. + std::vector<AppListItemView*> item_views_; }; } // namespace ash
diff --git a/ash/app_list/views/recent_apps_view_unittest.cc b/ash/app_list/views/recent_apps_view_unittest.cc index 8fa1ddb..f285b66 100644 --- a/ash/app_list/views/recent_apps_view_unittest.cc +++ b/ash/app_list/views/recent_apps_view_unittest.cc
@@ -96,6 +96,14 @@ } } + std::vector<AppListItemView*> GetAppListItemViews() { + std::vector<AppListItemView*> views; + RecentAppsView* recent_apps = GetRecentAppsView(); + for (int i = 0; i < recent_apps->GetItemViewCount(); i++) + views.push_back(recent_apps->GetItemViewAt(i)); + return views; + } + base::test::ScopedFeatureList scoped_feature_list_; }; @@ -111,16 +119,14 @@ ShowAppList(); - RecentAppsView* view = GetRecentAppsView(); - EXPECT_EQ(GetAppListItemViews(view).size(), 4u); + EXPECT_EQ(GetAppListItemViews().size(), 4u); } TEST_F(RecentAppsViewTest, ItemsEvenlySpacedInTheViewWith5Items) { AddAppResults(5); ShowAppList(); - RecentAppsView* view = GetRecentAppsView(); - std::vector<AppListItemView*> items = GetAppListItemViews(view); + std::vector<AppListItemView*> items = GetAppListItemViews(); ASSERT_EQ(5u, items.size()); for (int i = 4; i > 1; --i) { @@ -138,7 +144,7 @@ ShowAppList(); RecentAppsView* view = GetRecentAppsView(); - std::vector<AppListItemView*> items = GetAppListItemViews(view); + std::vector<AppListItemView*> items = GetAppListItemViews(); ASSERT_EQ(5u, items.size()); EXPECT_EQ(view->GetContentsBounds().left_center(), @@ -151,8 +157,7 @@ AddAppResults(4); ShowAppList(); - RecentAppsView* view = GetRecentAppsView(); - std::vector<AppListItemView*> items = GetAppListItemViews(view); + std::vector<AppListItemView*> items = GetAppListItemViews(); ASSERT_EQ(4u, items.size()); for (int i = 3; i > 1; --i) { @@ -170,7 +175,7 @@ ShowAppList(); RecentAppsView* view = GetRecentAppsView(); - std::vector<AppListItemView*> items = GetAppListItemViews(view); + std::vector<AppListItemView*> items = GetAppListItemViews(); ASSERT_EQ(4u, items.size()); EXPECT_EQ(view->GetContentsBounds().left_center(), @@ -183,8 +188,7 @@ AddAppResults(3); ShowAppList(); - RecentAppsView* view = GetRecentAppsView(); - std::vector<AppListItemView*> items = GetAppListItemViews(view); + std::vector<AppListItemView*> items = GetAppListItemViews(); ASSERT_EQ(3u, items.size()); for (int i = 2; i > 1; --i) { @@ -202,7 +206,7 @@ ShowAppList(); RecentAppsView* view = GetRecentAppsView(); - std::vector<AppListItemView*> items = GetAppListItemViews(view); + std::vector<AppListItemView*> items = GetAppListItemViews(); ASSERT_EQ(3u, items.size()); EXPECT_EQ(view->GetContentsBounds().left_center(), @@ -218,8 +222,7 @@ ShowAppList(); - RecentAppsView* view = GetRecentAppsView(); - EXPECT_EQ(GetAppListItemViews(view).size(), 0u); + EXPECT_EQ(GetAppListItemViews().size(), 0u); } TEST_F(RecentAppsViewTest, DoesNotCreateIconForMismatchedId) { @@ -239,8 +242,7 @@ ShowAppList(); // Click on the first icon. - std::vector<AppListItemView*> items = - GetAppListItemViews(GetRecentAppsView()); + std::vector<AppListItemView*> items = GetAppListItemViews(); ASSERT_FALSE(items.empty()); views::View* icon = items[0]; GetEventGenerator()->MoveMouseTo(icon->GetBoundsInScreen().CenterPoint()); @@ -257,8 +259,7 @@ ShowAppList(); // Right click on the first icon. - std::vector<AppListItemView*> items = - GetAppListItemViews(GetRecentAppsView()); + std::vector<AppListItemView*> items = GetAppListItemViews(); ASSERT_FALSE(items.empty()); GetEventGenerator()->MoveMouseTo(items[0]->GetBoundsInScreen().CenterPoint()); GetEventGenerator()->ClickRightButton(); @@ -282,8 +283,7 @@ AddSearchResult("id2", AppListSearchResultType::kInstalledApp); ShowAppList(); - std::vector<AppListItemView*> items = - GetAppListItemViews(GetRecentAppsView()); + std::vector<AppListItemView*> items = GetAppListItemViews(); ASSERT_EQ(2u, items.size()); AppListItemView* item1 = items[0]; AppListItemView* item2 = items[1];
diff --git a/ash/app_list/views/scrollable_apps_grid_view.cc b/ash/app_list/views/scrollable_apps_grid_view.cc index be11493b..ff4d99cb 100644 --- a/ash/app_list/views/scrollable_apps_grid_view.cc +++ b/ash/app_list/views/scrollable_apps_grid_view.cc
@@ -46,12 +46,14 @@ AppListViewDelegate* view_delegate, AppsGridViewFolderDelegate* folder_delegate, views::ScrollView* parent_scroll_view, - AppListFolderController* folder_controller) + AppListFolderController* folder_controller, + AppsGridViewFocusDelegate* focus_delegate) : AppsGridView(/*contents_view=*/nullptr, a11y_announcer, view_delegate, folder_delegate, - folder_controller), + folder_controller, + focus_delegate), scroll_view_(parent_scroll_view) { DCHECK(scroll_view_); view_structure_.Init(PagedViewStructure::Mode::kSinglePage);
diff --git a/ash/app_list/views/scrollable_apps_grid_view.h b/ash/app_list/views/scrollable_apps_grid_view.h index 7d3cb00..551b1154 100644 --- a/ash/app_list/views/scrollable_apps_grid_view.h +++ b/ash/app_list/views/scrollable_apps_grid_view.h
@@ -19,6 +19,7 @@ namespace ash { class AppListViewDelegate; +class AppsGridViewFocusDelegate; // An apps grid that shows all the apps in a long scrolling list. Used for // the clamshell mode bubble launcher. Implemented as a single "page" of apps. @@ -33,7 +34,8 @@ AppListViewDelegate* view_delegate, AppsGridViewFolderDelegate* folder_delegate, views::ScrollView* scroll_view, - AppListFolderController* folder_controller); + AppListFolderController* folder_controller, + AppsGridViewFocusDelegate* focus_delegate); ScrollableAppsGridView(const ScrollableAppsGridView&) = delete; ScrollableAppsGridView& operator=(const ScrollableAppsGridView&) = delete; ~ScrollableAppsGridView() override;
diff --git a/ash/app_list/views/suggestion_chip_container_view.cc b/ash/app_list/views/suggestion_chip_container_view.cc index 1f2f818..4bc482a 100644 --- a/ash/app_list/views/suggestion_chip_container_view.cc +++ b/ash/app_list/views/suggestion_chip_container_view.cc
@@ -278,9 +278,7 @@ // Ignore the container view in accessibility tree so that suggestion chips // will not be accessed by ChromeVox. - GetViewAccessibility().OverrideIsIgnored(disabled); - GetViewAccessibility().NotifyAccessibilityEvent( - ax::mojom::Event::kTreeChanged); + SetViewIgnoredForAccessibility(this, disabled); } void SuggestionChipContainerView::OnTabletModeChanged(bool started) {
diff --git a/ash/display/privacy_screen_controller.cc b/ash/display/privacy_screen_controller.cc index 87e2208..47e85410 100644 --- a/ash/display/privacy_screen_controller.cc +++ b/ash/display/privacy_screen_controller.cc
@@ -71,7 +71,8 @@ if (IsManaged()) { const bool currently_enabled = GetEnabled(); for (Observer& observer : observers_) - observer.OnPrivacyScreenSettingChanged(currently_enabled); + observer.OnPrivacyScreenSettingChanged(currently_enabled, + /*notify_ui=*/true); return; } @@ -142,11 +143,8 @@ Shell::Get()->display_configurator()->SetPrivacyScreen(display_id, is_enabled); - if (!notify_observers) - return; - for (Observer& observer : observers_) - observer.OnPrivacyScreenSettingChanged(is_enabled); + observer.OnPrivacyScreenSettingChanged(is_enabled, notify_observers); } void PrivacyScreenController::InitFromUserPrefs() {
diff --git a/ash/display/privacy_screen_controller.h b/ash/display/privacy_screen_controller.h index 3380fe0..719799b 100644 --- a/ash/display/privacy_screen_controller.h +++ b/ash/display/privacy_screen_controller.h
@@ -28,7 +28,7 @@ class Observer : public base::CheckedObserver { public: // Called when the privacy screen setting is changed. - virtual void OnPrivacyScreenSettingChanged(bool enabled) {} + virtual void OnPrivacyScreenSettingChanged(bool enabled, bool notify_ui) {} protected: ~Observer() override = default;
diff --git a/ash/display/privacy_screen_controller_unittest.cc b/ash/display/privacy_screen_controller_unittest.cc index 4b71c3b..2bef7a3 100644 --- a/ash/display/privacy_screen_controller_unittest.cc +++ b/ash/display/privacy_screen_controller_unittest.cc
@@ -30,7 +30,10 @@ MockObserver() {} ~MockObserver() override = default; - MOCK_METHOD(void, OnPrivacyScreenSettingChanged, (bool enabled), (override)); + MOCK_METHOD(void, + OnPrivacyScreenSettingChanged, + (bool enabled, bool notify_ui), + (override)); }; class PrivacyScreenControllerTest : public NoSessionAshTestBase { @@ -148,16 +151,20 @@ ASSERT_TRUE(controller()->IsSupported()); // Enable for user 1, and switch to user 2. User 2 should have it disabled. + EXPECT_CALL(*observer(), OnPrivacyScreenSettingChanged(true, true)); controller()->SetEnabled(true, PrivacyScreenController::kToggleUISurfaceCount); - // Switching accounts shouldn't trigger observers. - ::testing::Mock::VerifyAndClear(observer()); - EXPECT_CALL(*observer(), OnPrivacyScreenSettingChanged).Times(0); EXPECT_TRUE(controller()->GetEnabled()); + + // Switching accounts should trigger observers but should not notify ui. + ::testing::Mock::VerifyAndClear(observer()); + EXPECT_CALL(*observer(), OnPrivacyScreenSettingChanged(false, false)); SwitchActiveUser(kUser2Email); EXPECT_FALSE(controller()->GetEnabled()); // Switch back to user 1, expect it to be enabled. + ::testing::Mock::VerifyAndClear(observer()); + EXPECT_CALL(*observer(), OnPrivacyScreenSettingChanged(true, false)); SwitchActiveUser(kUser1Email); EXPECT_TRUE(controller()->GetEnabled()); } @@ -176,34 +183,40 @@ EXPECT_FALSE(controller()->GetEnabled()); // Enforce privacy screen and check notification. - EXPECT_CALL(*observer(), OnPrivacyScreenSettingChanged(true)); + EXPECT_CALL(*observer(), OnPrivacyScreenSettingChanged(true, true)); controller()->SetEnforced(true); EXPECT_TRUE(controller()->GetEnabled()); // Additionally enable it via pref, no change. ::testing::Mock::VerifyAndClear(observer()); + EXPECT_CALL(*observer(), OnPrivacyScreenSettingChanged(true, true)); controller()->SetEnabled(true, PrivacyScreenController::kToggleUISurfaceCount); EXPECT_TRUE(controller()->GetEnabled()); // Shouldn't be turned off when pref is disabled, because already enforced. + ::testing::Mock::VerifyAndClear(observer()); + EXPECT_CALL(*observer(), OnPrivacyScreenSettingChanged(true, true)); controller()->SetEnabled(false, PrivacyScreenController::kToggleUISurfaceCount); EXPECT_TRUE(controller()->GetEnabled()); // Remove enforcement, turned off as pref was not changed. - EXPECT_CALL(*observer(), OnPrivacyScreenSettingChanged(false)); + ::testing::Mock::VerifyAndClear(observer()); + EXPECT_CALL(*observer(), OnPrivacyScreenSettingChanged(false, true)); controller()->SetEnforced(false); EXPECT_FALSE(controller()->GetEnabled()); // Add pref back. - EXPECT_CALL(*observer(), OnPrivacyScreenSettingChanged(true)); + ::testing::Mock::VerifyAndClear(observer()); + EXPECT_CALL(*observer(), OnPrivacyScreenSettingChanged(true, true)); controller()->SetEnabled(true, PrivacyScreenController::kToggleUISurfaceCount); EXPECT_TRUE(controller()->GetEnabled()); // Disable via pref, privacy screen is turned off with a notification. - EXPECT_CALL(*observer(), OnPrivacyScreenSettingChanged(false)); + ::testing::Mock::VerifyAndClear(observer()); + EXPECT_CALL(*observer(), OnPrivacyScreenSettingChanged(false, true)); controller()->SetEnabled(false, PrivacyScreenController::kToggleUISurfaceCount); EXPECT_FALSE(controller()->GetEnabled()); @@ -220,12 +233,13 @@ EXPECT_EQ(1u, display_manager()->GetNumDisplays()); ASSERT_TRUE(controller()->IsSupported()); - EXPECT_CALL(*observer(), OnPrivacyScreenSettingChanged(true)); + EXPECT_CALL(*observer(), OnPrivacyScreenSettingChanged(true, true)); EXPECT_FALSE(controller()->GetEnabled()); user1_pref_service()->SetBoolean(prefs::kDisplayPrivacyScreenEnabled, true); EXPECT_TRUE(controller()->GetEnabled()); - EXPECT_CALL(*observer(), OnPrivacyScreenSettingChanged(false)); + ::testing::Mock::VerifyAndClear(observer()); + EXPECT_CALL(*observer(), OnPrivacyScreenSettingChanged(false, true)); user1_pref_service()->SetBoolean(prefs::kDisplayPrivacyScreenEnabled, false); EXPECT_FALSE(controller()->GetEnabled()); } @@ -239,6 +253,7 @@ EXPECT_EQ(1u, display_manager()->GetNumDisplays()); ASSERT_TRUE(controller()->IsSupported()); + EXPECT_CALL(*observer(), OnPrivacyScreenSettingChanged(true, true)); controller()->SetEnabled(true, PrivacyScreenController::kToggleUISurfaceCount); EXPECT_TRUE(controller()->GetEnabled());
diff --git a/ash/projector/ui/projector_bar_view.cc b/ash/projector/ui/projector_bar_view.cc index 0cd4022c..537fa5d 100644 --- a/ash/projector/ui/projector_bar_view.cc +++ b/ash/projector/ui/projector_bar_view.cc
@@ -207,7 +207,7 @@ laser_pointer_button_ = AddChildView(std::make_unique<ProjectorImageButton>( base::BindRepeating(&ProjectorBarView::OnLaserPointerPressed, base::Unretained(this)), - kPaletteTrayIconLaserPointerIcon, + kPaletteModeLaserPointerIcon, l10n_util::GetStringUTF16(IDS_LASER_POINTER_BUTTON))); // Add marker button.
diff --git a/ash/public/cpp/app_list/app_list_features.cc b/ash/public/cpp/app_list/app_list_features.cc index 148d251a..0229f37 100644 --- a/ash/public/cpp/app_list/app_list_features.cc +++ b/ash/public/cpp/app_list/app_list_features.cc
@@ -46,8 +46,6 @@ "EnableAggregatedMlSearchRanking", base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kNewDragSpecInLauncher{"NewDragSpecInLauncher", base::FEATURE_ENABLED_BY_DEFAULT}; -const base::Feature kEnableOmniboxRichEntities{ - "EnableOmniboxRichEntities", base::FEATURE_ENABLED_BY_DEFAULT}; const base::Feature kEnableLauncherSearchNormalization{ "EnableLauncherSearchNormalization", base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kCategoricalSearch{"CategoricalSearch", @@ -111,10 +109,6 @@ return base::FeatureList::IsEnabled(kNewDragSpecInLauncher); } -bool IsOmniboxRichEntitiesEnabled() { - return base::FeatureList::IsEnabled(kEnableOmniboxRichEntities); -} - bool IsLauncherSearchNormalizationEnabled() { return base::FeatureList::IsEnabled(kEnableLauncherSearchNormalization); }
diff --git a/ash/public/cpp/app_list/app_list_features.h b/ash/public/cpp/app_list/app_list_features.h index 3f72399..b963841a 100644 --- a/ash/public/cpp/app_list/app_list_features.h +++ b/ash/public/cpp/app_list/app_list_features.h
@@ -70,9 +70,6 @@ // apps grid pages are scaled down and shown a background card. ASH_PUBLIC_EXPORT extern const base::Feature kNewDragSpecInLauncher; -// Enables rich entity formatting for Omnibox results in the launcher. -ASH_PUBLIC_EXPORT extern const base::Feature kEnableOmniboxRichEntities; - // Enables normalization of search results in the launcher. ASH_PUBLIC_EXPORT extern const base::Feature kEnableLauncherSearchNormalization; @@ -97,7 +94,6 @@ bool ASH_PUBLIC_EXPORT IsLauncherSettingsSearchEnabled(); bool ASH_PUBLIC_EXPORT IsAggregatedMlSearchRankingEnabled(); bool ASH_PUBLIC_EXPORT IsNewDragSpecInLauncherEnabled(); -bool ASH_PUBLIC_EXPORT IsOmniboxRichEntitiesEnabled(); bool ASH_PUBLIC_EXPORT IsLauncherSearchNormalizationEnabled(); bool ASH_PUBLIC_EXPORT IsCategoricalSearchEnabled(); bool ASH_PUBLIC_EXPORT IsLauncherQueryHighlightingEnabled();
diff --git a/ash/resources/vector_icons/BUILD.gn b/ash/resources/vector_icons/BUILD.gn index b14e3cb3..8648476 100644 --- a/ash/resources/vector_icons/BUILD.gn +++ b/ash/resources/vector_icons/BUILD.gn
@@ -159,15 +159,10 @@ "overview_window_close.icon", "palette_action_create_note.icon", "palette_mode_laser_pointer.icon", - "palette_mode_laser_pointer_light_mode.icon", "palette_mode_magnify.icon", "palette_mode_metalayer.icon", "palette_tray_icon_default.icon", "palette_tray_icon_default_newui.icon", - "palette_tray_icon_laser_pointer.icon", - "palette_tray_icon_laser_pointer_light_mode.icon", - "palette_tray_icon_magnify.icon", - "palette_tray_icon_metalayer.icon", "palette_tray_icon_projector.icon", "pause.icon", "persistent_desks_bar_chevron_down.icon",
diff --git a/ash/resources/vector_icons/palette_mode_laser_pointer.icon b/ash/resources/vector_icons/palette_mode_laser_pointer.icon index 2e46bdc92..c140fdac 100644 --- a/ash/resources/vector_icons/palette_mode_laser_pointer.icon +++ b/ash/resources/vector_icons/palette_mode_laser_pointer.icon
@@ -1,80 +1,30 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2021 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -CANVAS_DIMENSIONS, 40, -PATH_COLOR_ARGB, 0x4D, 0xFF, 0xFF, 0xFF, -MOVE_TO, 30.06f, 15, -R_H_LINE_TO, -9.59f, -R_LINE_TO, 9.6f, -9.27f, -R_CUBIC_TO, 0.6f, -0.48f, 1, -1.24f, 1, -2.11f, -CUBIC_TO, 31.07f, 2.17f, 29.96f, 1, 28.6f, 1, -R_CUBIC_TO, -0.51f, 0, -0.98f, 0.16f, -1.37f, 0.44f, -LINE_TO, 8.09f, 15.03f, -R_CUBIC_TO, -0.23f, 0.13f, -0.44f, 0.28f, -0.64f, 0.46f, -R_LINE_TO, -0.07f, 0.05f, -CUBIC_TO, 6.54f, 16.31f, 6, 17.43f, 6, 18.69f, -R_CUBIC_TO, 0, 2.31f, 1.76f, 4.18f, 3.93f, 4.31f, -R_H_LINE_TO, 6.22f, -R_LINE_TO, -7.54f, 4.83f, -R_CUBIC_TO, 0.84f, -0.54f, 1.81f, -0.86f, 2.86f, -0.86f, -R_CUBIC_TO, 3.07f, 0, 5.55f, 2.64f, 5.55f, 5.9f, -R_CUBIC_TO, 0, 1.61f, -0.61f, 3.07f, -1.6f, 4.13f, -R_LINE_TO, 16.68f, -14.75f, -R_CUBIC_TO, 0.32f, -0.21f, 0.61f, -0.46f, 0.86f, -0.76f, -R_CUBIC_TO, 0.65f, -0.81f, 1.03f, -1.75f, 1.03f, -2.79f, -R_CUBIC_TO, 0, -2.31f, -1.76f, -3.67f, -3.94f, -3.69f, -CLOSE, -NEW_PATH, -MOVE_TO, 18, 32.57f, -R_CUBIC_TO, 0, -3.31f, -2.69f, -6, -6, -6, -R_CUBIC_TO, -1.13f, 0, -2.18f, 0.33f, -3.09f, 0.88f, -R_LINE_TO, -0.36f, 0.23f, -R_CUBIC_TO, -0.03f, 0.02f, -0.05f, 0.05f, -0.08f, 0.07f, -CUBIC_TO, 6.98f, 28.83f, 6, 30.58f, 6, 32.56f, -R_CUBIC_TO, 0, 3.31f, 2.69f, 6, 6, 6, -R_CUBIC_TO, 1.24f, 0, 2.39f, -0.38f, 3.34f, -1.03f, -R_LINE_TO, 0, 0, -R_LINE_TO, 0.02f, -0.01f, -R_CUBIC_TO, 0.33f, -0.22f, 0.63f, -0.48f, 0.91f, -0.76f, -CUBIC_TO, 17.34f, 35.69f, 18, 34.21f, 18, 32.57f, -CLOSE - CANVAS_DIMENSIONS, 20, -PATH_COLOR_ARGB, 0x4D, 0xFF, 0xFF, 0xFF, -MOVE_TO, 14.96f, 8.04f, -R_H_LINE_TO, -4.56f, -R_LINE_TO, 4.56f, -4.8f, -R_CUBIC_TO, 0.3f, -0.23f, 0.5f, -0.59f, 0.5f, -0.99f, -R_CUBIC_TO, 0, -0.68f, -0.55f, -1.24f, -1.22f, -1.24f, -R_CUBIC_TO, -0.25f, 0, -0.48f, 0.08f, -0.68f, 0.21f, -R_CUBIC_TO, 0, 0, -9.48f, 6.42f, -9.48f, 6.42f, -R_LINE_TO, -0.36f, 0.24f, -R_CUBIC_TO, -0.41f, 0.37f, -0.7f, 0.16f, -0.7f, 1.41f, -R_CUBIC_TO, 0, 0.56f, 0.92f, 1.69f, 2, 1.69f, -H_LINE_TO, 9.03f, -R_LINE_TO, -1.18f, 0.69f, -R_CUBIC_TO, -1.17f, 0.68f, -3.52f, 2.04f, -3.52f, 2.04f, -R_CUBIC_TO, 0.42f, -0.25f, 0.9f, -0.41f, 1.42f, -0.41f, -R_CUBIC_TO, 1.52f, 0, 2.75f, 1.25f, 2.75f, 2.79f, -R_CUBIC_TO, 0, 0.76f, -0.3f, 1.45f, -0.79f, 1.96f, -R_LINE_TO, 8.26f, -6.98f, -R_CUBIC_TO, 0.16f, -0.1f, 0.3f, -0.22f, 0.43f, -0.36f, -R_CUBIC_TO, 0.25f, -0.29f, 0.47f, -0.54f, 0.56f, -0.86f, -R_CUBIC_TO, 0.03f, -0.1f, 0.04f, -0.2f, 0.04f, -0.32f, -R_CUBIC_TO, 0, -1.31f, -0.96f, -1.48f, -2.04f, -1.48f, +MOVE_TO, 14.31f, 7.52f, +H_LINE_TO, 10.2f, +LINE_TO, 14.31f, 3.5f, +CUBIC_TO, 14.57f, 3.29f, 14.74f, 2.96f, 14.74f, 2.58f, +CUBIC_TO, 14.74f, 1.96f, 14.27f, 1.45f, 13.69f, 1.45f, +CUBIC_TO, 13.47f, 1.45f, 13.27f, 1.52f, 13.1f, 1.64f, +CUBIC_TO, 13.1f, 1.64f, 4.9f, 7.53f, 4.9f, 7.53f, +CUBIC_TO, 4.8f, 7.59f, 4.71f, 7.65f, 4.62f, 7.73f, +LINE_TO, 4.59f, 7.75f, +CUBIC_TO, 4.23f, 8.09f, 4, 8.57f, 4, 9.12f, +CUBIC_TO, 4, 10.12f, 4.75f, 10.94f, 5.69f, 11, +H_LINE_TO, 8.35f, +LINE_TO, 7.42f, 11.67f, +CUBIC_TO, 8.94f, 12.14f, 10.08f, 13.49f, 10.23f, 15.13f, +CUBIC_TO, 12.5f, 13.09f, 15.49f, 10.41f, 15.56f, 10.33f, +CUBIC_TO, 15.84f, 9.98f, 16, 9.57f, 16, 9.12f, +CUBIC_TO, 16, 8.12f, 15.24f, 7.53f, 14.31f, 7.52f, CLOSE, NEW_PATH, -MOVE_TO, 9, 16, -R_CUBIC_TO, 0, -1.66f, -1.34f, -3, -3, -3, -R_CUBIC_TO, -0.57f, 0, -1.09f, 0.17f, -1.54f, 0.44f, -R_LINE_TO, -0.18f, 0.11f, -R_CUBIC_TO, -0.01f, 0.01f, -0.03f, 0.02f, -0.04f, 0.03f, -CUBIC_TO, 3.49f, 14.13f, 3, 15.01f, 3, 16, -R_CUBIC_TO, 0, 1.66f, 1.34f, 3, 3, 3, -R_CUBIC_TO, 0.62f, 0, 1.19f, -0.19f, 1.67f, -0.51f, -R_H_LINE_TO, 0, -R_LINE_TO, 0.01f, -0.01f, -R_CUBIC_TO, 0.16f, -0.11f, 0.32f, -0.24f, 0.45f, -0.38f, -CUBIC_TO, 8.67f, 17.56f, 9, 16.82f, 9, 16, -CLOSE +MOVE_TO, 6.25f, 18.32f, +CUBIC_TO, 7.81f, 18.32f, 9.07f, 17.06f, 9.07f, 15.5f, +CUBIC_TO, 9.07f, 13.94f, 7.81f, 12.68f, 6.25f, 12.68f, +CUBIC_TO, 4.69f, 12.68f, 3.43f, 13.94f, 3.43f, 15.5f, +CUBIC_TO, 3.43f, 17.06f, 4.69f, 18.32f, 6.25f, 18.32f, +CLOSE \ No newline at end of file
diff --git a/ash/resources/vector_icons/palette_mode_laser_pointer_light_mode.icon b/ash/resources/vector_icons/palette_mode_laser_pointer_light_mode.icon deleted file mode 100644 index 1c7955bb..0000000 --- a/ash/resources/vector_icons/palette_mode_laser_pointer_light_mode.icon +++ /dev/null
@@ -1,80 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -CANVAS_DIMENSIONS, 40, -PATH_COLOR_ARGB, 0x4D, 0x00, 0x00, 0x00, -MOVE_TO, 30.06f, 15, -R_H_LINE_TO, -9.59f, -R_LINE_TO, 9.6f, -9.27f, -R_CUBIC_TO, 0.6f, -0.48f, 1, -1.24f, 1, -2.11f, -CUBIC_TO, 31.07f, 2.17f, 29.96f, 1, 28.6f, 1, -R_CUBIC_TO, -0.51f, 0, -0.98f, 0.16f, -1.37f, 0.44f, -LINE_TO, 8.09f, 15.03f, -R_CUBIC_TO, -0.23f, 0.13f, -0.44f, 0.28f, -0.64f, 0.46f, -R_LINE_TO, -0.07f, 0.05f, -CUBIC_TO, 6.54f, 16.31f, 6, 17.43f, 6, 18.69f, -R_CUBIC_TO, 0, 2.31f, 1.76f, 4.18f, 3.93f, 4.31f, -R_H_LINE_TO, 6.22f, -R_LINE_TO, -7.54f, 4.83f, -R_CUBIC_TO, 0.84f, -0.54f, 1.81f, -0.86f, 2.86f, -0.86f, -R_CUBIC_TO, 3.07f, 0, 5.55f, 2.64f, 5.55f, 5.9f, -R_CUBIC_TO, 0, 1.61f, -0.61f, 3.07f, -1.6f, 4.13f, -R_LINE_TO, 16.68f, -14.75f, -R_CUBIC_TO, 0.32f, -0.21f, 0.61f, -0.46f, 0.86f, -0.76f, -R_CUBIC_TO, 0.65f, -0.81f, 1.03f, -1.75f, 1.03f, -2.79f, -R_CUBIC_TO, 0, -2.31f, -1.76f, -3.67f, -3.94f, -3.69f, -CLOSE, -NEW_PATH, -MOVE_TO, 18, 32.57f, -R_CUBIC_TO, 0, -3.31f, -2.69f, -6, -6, -6, -R_CUBIC_TO, -1.13f, 0, -2.18f, 0.33f, -3.09f, 0.88f, -R_LINE_TO, -0.36f, 0.23f, -R_CUBIC_TO, -0.03f, 0.02f, -0.05f, 0.05f, -0.08f, 0.07f, -CUBIC_TO, 6.98f, 28.83f, 6, 30.58f, 6, 32.56f, -R_CUBIC_TO, 0, 3.31f, 2.69f, 6, 6, 6, -R_CUBIC_TO, 1.24f, 0, 2.39f, -0.38f, 3.34f, -1.03f, -R_LINE_TO, 0, 0, -R_LINE_TO, 0.02f, -0.01f, -R_CUBIC_TO, 0.33f, -0.22f, 0.63f, -0.48f, 0.91f, -0.76f, -CUBIC_TO, 17.34f, 35.69f, 18, 34.21f, 18, 32.57f, -CLOSE - -CANVAS_DIMENSIONS, 20, -PATH_COLOR_ARGB, 0x4D, 0x00, 0x00, 0x00, -MOVE_TO, 14.96f, 8.04f, -R_H_LINE_TO, -4.56f, -R_LINE_TO, 4.56f, -4.8f, -R_CUBIC_TO, 0.3f, -0.23f, 0.5f, -0.59f, 0.5f, -0.99f, -R_CUBIC_TO, 0, -0.68f, -0.55f, -1.24f, -1.22f, -1.24f, -R_CUBIC_TO, -0.25f, 0, -0.48f, 0.08f, -0.68f, 0.21f, -R_CUBIC_TO, 0, 0, -9.48f, 6.42f, -9.48f, 6.42f, -R_LINE_TO, -0.36f, 0.24f, -R_CUBIC_TO, -0.41f, 0.37f, -0.7f, 0.16f, -0.7f, 1.41f, -R_CUBIC_TO, 0, 0.56f, 0.92f, 1.69f, 2, 1.69f, -H_LINE_TO, 9.03f, -R_LINE_TO, -1.18f, 0.69f, -R_CUBIC_TO, -1.17f, 0.68f, -3.52f, 2.04f, -3.52f, 2.04f, -R_CUBIC_TO, 0.42f, -0.25f, 0.9f, -0.41f, 1.42f, -0.41f, -R_CUBIC_TO, 1.52f, 0, 2.75f, 1.25f, 2.75f, 2.79f, -R_CUBIC_TO, 0, 0.76f, -0.3f, 1.45f, -0.79f, 1.96f, -R_LINE_TO, 8.26f, -6.98f, -R_CUBIC_TO, 0.16f, -0.1f, 0.3f, -0.22f, 0.43f, -0.36f, -R_CUBIC_TO, 0.25f, -0.29f, 0.47f, -0.54f, 0.56f, -0.86f, -R_CUBIC_TO, 0.03f, -0.1f, 0.04f, -0.2f, 0.04f, -0.32f, -R_CUBIC_TO, 0, -1.31f, -0.96f, -1.48f, -2.04f, -1.48f, -CLOSE, -NEW_PATH, -MOVE_TO, 9, 16, -R_CUBIC_TO, 0, -1.66f, -1.34f, -3, -3, -3, -R_CUBIC_TO, -0.57f, 0, -1.09f, 0.17f, -1.54f, 0.44f, -R_LINE_TO, -0.18f, 0.11f, -R_CUBIC_TO, -0.01f, 0.01f, -0.03f, 0.02f, -0.04f, 0.03f, -CUBIC_TO, 3.49f, 14.13f, 3, 15.01f, 3, 16, -R_CUBIC_TO, 0, 1.66f, 1.34f, 3, 3, 3, -R_CUBIC_TO, 0.62f, 0, 1.19f, -0.19f, 1.67f, -0.51f, -R_H_LINE_TO, 0, -R_LINE_TO, 0.01f, -0.01f, -R_CUBIC_TO, 0.16f, -0.11f, 0.32f, -0.24f, 0.45f, -0.38f, -CUBIC_TO, 8.67f, 17.56f, 9, 16.82f, 9, 16, -CLOSE
diff --git a/ash/resources/vector_icons/palette_tray_icon_laser_pointer.icon b/ash/resources/vector_icons/palette_tray_icon_laser_pointer.icon deleted file mode 100644 index 8dc901f..0000000 --- a/ash/resources/vector_icons/palette_tray_icon_laser_pointer.icon +++ /dev/null
@@ -1,79 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -CANVAS_DIMENSIONS, 32, -NEW_PATH, -PATH_COLOR_ARGB, 0x4D, 0xFF, 0xFF, 0xFF, -MOVE_TO, 24.05f, 12, -H_LINE_TO, 16.38f, -R_LINE_TO, 7.68f, -7.42f, -R_CUBIC_TO, 0.48f, -0.38f, 0.8f, -0.99f, 0.8f, -1.68f, -CUBIC_TO, 24.86f, 1.74f, 23.97f, 0.8f, 22.88f, 0.8f, -R_CUBIC_TO, -0.4f, 0, -0.78f, 0.13f, -1.1f, 0.35f, -LINE_TO, 6.47f, 12.02f, -R_CUBIC_TO, -0.18f, 0.1f, -0.36f, 0.23f, -0.51f, 0.37f, -R_LINE_TO, -0.06f, 0.04f, -R_CUBIC_TO, -0.67f, 0.62f, -1.1f, 1.52f, -1.1f, 2.53f, -R_CUBIC_TO, 0, 1.85f, 1.41f, 3.34f, 3.15f, 3.44f, -R_H_LINE_TO, 4.98f, -R_LINE_TO, -6.03f, 3.87f, -R_CUBIC_TO, 0.67f, -0.43f, 1.45f, -0.69f, 2.29f, -0.69f, -R_CUBIC_TO, 2.46f, 0, 4.44f, 2.11f, 4.44f, 4.72f, -R_CUBIC_TO, 0, 1.29f, -0.49f, 2.45f, -1.28f, 3.31f, -R_LINE_TO, 13.35f, -11.8f, -R_CUBIC_TO, 0.26f, -0.17f, 0.49f, -0.37f, 0.69f, -0.61f, -R_CUBIC_TO, 0.52f, -0.64f, 0.82f, -1.4f, 0.82f, -2.23f, -R_CUBIC_TO, 0, -1.84f, -1.41f, -2.94f, -3.15f, -2.96f, -CLOSE, -NEW_PATH, -MOVE_TO, 14.4f, 26.05f, -R_CUBIC_TO, 0, -2.65f, -2.15f, -4.8f, -4.8f, -4.8f, -R_CUBIC_TO, -0.91f, 0, -1.75f, 0.27f, -2.47f, 0.71f, -R_LINE_TO, -0.29f, 0.18f, -R_CUBIC_TO, -0.02f, 0.02f, -0.04f, 0.04f, -0.07f, 0.05f, -R_CUBIC_TO, -1.19f, 0.88f, -1.97f, 2.27f, -1.97f, 3.86f, -R_CUBIC_TO, 0, 2.65f, 2.15f, 4.8f, 4.8f, 4.8f, -R_CUBIC_TO, 0.99f, 0, 1.91f, -0.3f, 2.67f, -0.82f, -R_LINE_TO, 0.02f, -0.01f, -R_CUBIC_TO, 0.26f, -0.18f, 0.51f, -0.38f, 0.73f, -0.61f, -R_CUBIC_TO, 0.85f, -0.87f, 1.38f, -2.05f, 1.38f, -3.36f, -CLOSE - -CANVAS_DIMENSIONS, 16, -NEW_PATH, -PATH_COLOR_ARGB, 0x4D, 0xFF, 0xFF, 0xFF, -MOVE_TO, 12.03f, 6, -H_LINE_TO, 8.19f, -R_LINE_TO, 3.84f, -3.71f, -R_CUBIC_TO, 0.24f, -0.19f, 0.4f, -0.5f, 0.4f, -0.84f, -CUBIC_TO, 12.43f, 0.87f, 11.99f, 0.4f, 11.44f, 0.4f, -R_CUBIC_TO, -0.2f, 0, -0.39f, 0.07f, -0.55f, 0.18f, -LINE_TO, 3.24f, 6.01f, -R_CUBIC_TO, -0.09f, 0.05f, -0.18f, 0.11f, -0.26f, 0.18f, -R_LINE_TO, -0.03f, 0.02f, -R_CUBIC_TO, -0.33f, 0.31f, -0.55f, 0.76f, -0.55f, 1.26f, -R_CUBIC_TO, 0, 0.92f, 0.7f, 1.67f, 1.57f, 1.72f, -R_H_LINE_TO, 2.49f, -R_LINE_TO, -3.02f, 1.93f, -R_CUBIC_TO, 0.34f, -0.21f, 0.72f, -0.35f, 1.14f, -0.35f, -R_CUBIC_TO, 1.23f, 0, 2.22f, 1.06f, 2.22f, 2.36f, -R_CUBIC_TO, 0, 0.64f, -0.24f, 1.23f, -0.64f, 1.65f, -R_LINE_TO, 6.68f, -5.9f, -R_CUBIC_TO, 0.13f, -0.08f, 0.24f, -0.18f, 0.34f, -0.3f, -R_CUBIC_TO, 0.26f, -0.32f, 0.41f, -0.7f, 0.41f, -1.12f, -R_CUBIC_TO, 0, -0.92f, -0.71f, -1.47f, -1.57f, -1.48f, -CLOSE, -NEW_PATH, -MOVE_TO, 7.2f, 13.03f, -R_CUBIC_TO, 0, -1.33f, -1.07f, -2.4f, -2.4f, -2.4f, -R_CUBIC_TO, -0.45f, 0, -0.87f, 0.13f, -1.24f, 0.35f, -R_LINE_TO, -0.15f, 0.09f, -R_CUBIC_TO, -0.01f, 0.01f, -0.02f, 0.02f, -0.03f, 0.03f, -R_CUBIC_TO, -0.59f, 0.44f, -0.98f, 1.14f, -0.98f, 1.93f, -R_CUBIC_TO, 0, 1.33f, 1.08f, 2.4f, 2.4f, 2.4f, -R_CUBIC_TO, 0.5f, 0, 0.96f, -0.15f, 1.34f, -0.41f, -R_LINE_TO, 0.01f, 0, -R_CUBIC_TO, 0.13f, -0.09f, 0.25f, -0.19f, 0.36f, -0.3f, -R_CUBIC_TO, 0.43f, -0.43f, 0.69f, -1.02f, 0.69f, -1.68f, -CLOSE
diff --git a/ash/resources/vector_icons/palette_tray_icon_laser_pointer_light_mode.icon b/ash/resources/vector_icons/palette_tray_icon_laser_pointer_light_mode.icon deleted file mode 100644 index 98f9959..0000000 --- a/ash/resources/vector_icons/palette_tray_icon_laser_pointer_light_mode.icon +++ /dev/null
@@ -1,79 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -CANVAS_DIMENSIONS, 32, -NEW_PATH, -PATH_COLOR_ARGB, 0x4D, 0x00, 0x00, 0x00, -MOVE_TO, 24.05f, 12, -H_LINE_TO, 16.38f, -R_LINE_TO, 7.68f, -7.42f, -R_CUBIC_TO, 0.48f, -0.38f, 0.8f, -0.99f, 0.8f, -1.68f, -CUBIC_TO, 24.86f, 1.74f, 23.97f, 0.8f, 22.88f, 0.8f, -R_CUBIC_TO, -0.4f, 0, -0.78f, 0.13f, -1.1f, 0.35f, -LINE_TO, 6.47f, 12.02f, -R_CUBIC_TO, -0.18f, 0.1f, -0.36f, 0.23f, -0.51f, 0.37f, -R_LINE_TO, -0.06f, 0.04f, -R_CUBIC_TO, -0.67f, 0.62f, -1.1f, 1.52f, -1.1f, 2.53f, -R_CUBIC_TO, 0, 1.85f, 1.41f, 3.34f, 3.15f, 3.44f, -R_H_LINE_TO, 4.98f, -R_LINE_TO, -6.03f, 3.87f, -R_CUBIC_TO, 0.67f, -0.43f, 1.45f, -0.69f, 2.29f, -0.69f, -R_CUBIC_TO, 2.46f, 0, 4.44f, 2.11f, 4.44f, 4.72f, -R_CUBIC_TO, 0, 1.29f, -0.49f, 2.45f, -1.28f, 3.31f, -R_LINE_TO, 13.35f, -11.8f, -R_CUBIC_TO, 0.26f, -0.17f, 0.49f, -0.37f, 0.69f, -0.61f, -R_CUBIC_TO, 0.52f, -0.64f, 0.82f, -1.4f, 0.82f, -2.23f, -R_CUBIC_TO, 0, -1.84f, -1.41f, -2.94f, -3.15f, -2.96f, -CLOSE, -NEW_PATH, -MOVE_TO, 14.4f, 26.05f, -R_CUBIC_TO, 0, -2.65f, -2.15f, -4.8f, -4.8f, -4.8f, -R_CUBIC_TO, -0.91f, 0, -1.75f, 0.27f, -2.47f, 0.71f, -R_LINE_TO, -0.29f, 0.18f, -R_CUBIC_TO, -0.02f, 0.02f, -0.04f, 0.04f, -0.07f, 0.05f, -R_CUBIC_TO, -1.19f, 0.88f, -1.97f, 2.27f, -1.97f, 3.86f, -R_CUBIC_TO, 0, 2.65f, 2.15f, 4.8f, 4.8f, 4.8f, -R_CUBIC_TO, 0.99f, 0, 1.91f, -0.3f, 2.67f, -0.82f, -R_LINE_TO, 0.02f, -0.01f, -R_CUBIC_TO, 0.26f, -0.18f, 0.51f, -0.38f, 0.73f, -0.61f, -R_CUBIC_TO, 0.85f, -0.87f, 1.38f, -2.05f, 1.38f, -3.36f, -CLOSE - -CANVAS_DIMENSIONS, 16, -NEW_PATH, -PATH_COLOR_ARGB, 0x4D, 0x00, 0x00, 0x00, -MOVE_TO, 12.03f, 6, -H_LINE_TO, 8.19f, -R_LINE_TO, 3.84f, -3.71f, -R_CUBIC_TO, 0.24f, -0.19f, 0.4f, -0.5f, 0.4f, -0.84f, -CUBIC_TO, 12.43f, 0.87f, 11.99f, 0.4f, 11.44f, 0.4f, -R_CUBIC_TO, -0.2f, 0, -0.39f, 0.07f, -0.55f, 0.18f, -LINE_TO, 3.24f, 6.01f, -R_CUBIC_TO, -0.09f, 0.05f, -0.18f, 0.11f, -0.26f, 0.18f, -R_LINE_TO, -0.03f, 0.02f, -R_CUBIC_TO, -0.33f, 0.31f, -0.55f, 0.76f, -0.55f, 1.26f, -R_CUBIC_TO, 0, 0.92f, 0.7f, 1.67f, 1.57f, 1.72f, -R_H_LINE_TO, 2.49f, -R_LINE_TO, -3.02f, 1.93f, -R_CUBIC_TO, 0.34f, -0.21f, 0.72f, -0.35f, 1.14f, -0.35f, -R_CUBIC_TO, 1.23f, 0, 2.22f, 1.06f, 2.22f, 2.36f, -R_CUBIC_TO, 0, 0.64f, -0.24f, 1.23f, -0.64f, 1.65f, -R_LINE_TO, 6.68f, -5.9f, -R_CUBIC_TO, 0.13f, -0.08f, 0.24f, -0.18f, 0.34f, -0.3f, -R_CUBIC_TO, 0.26f, -0.32f, 0.41f, -0.7f, 0.41f, -1.12f, -R_CUBIC_TO, 0, -0.92f, -0.71f, -1.47f, -1.57f, -1.48f, -CLOSE, -NEW_PATH, -MOVE_TO, 7.2f, 13.03f, -R_CUBIC_TO, 0, -1.33f, -1.07f, -2.4f, -2.4f, -2.4f, -R_CUBIC_TO, -0.45f, 0, -0.87f, 0.13f, -1.24f, 0.35f, -R_LINE_TO, -0.15f, 0.09f, -R_CUBIC_TO, -0.01f, 0.01f, -0.02f, 0.02f, -0.03f, 0.03f, -R_CUBIC_TO, -0.59f, 0.44f, -0.98f, 1.14f, -0.98f, 1.93f, -R_CUBIC_TO, 0, 1.33f, 1.08f, 2.4f, 2.4f, 2.4f, -R_CUBIC_TO, 0.5f, 0, 0.96f, -0.15f, 1.34f, -0.41f, -R_LINE_TO, 0.01f, 0, -R_CUBIC_TO, 0.13f, -0.09f, 0.25f, -0.19f, 0.36f, -0.3f, -R_CUBIC_TO, 0.43f, -0.43f, 0.69f, -1.02f, 0.69f, -1.68f, -CLOSE
diff --git a/ash/resources/vector_icons/palette_tray_icon_magnify.icon b/ash/resources/vector_icons/palette_tray_icon_magnify.icon deleted file mode 100644 index dea365b7..0000000 --- a/ash/resources/vector_icons/palette_tray_icon_magnify.icon +++ /dev/null
@@ -1,67 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -CANVAS_DIMENSIONS, 32, -MOVE_TO, 12.8f, 16, -R_H_LINE_TO, -4, -R_V_LINE_TO, -3.2f, -R_H_LINE_TO, 4, -R_V_LINE_TO, -4, -H_LINE_TO, 16, -R_V_LINE_TO, 4, -R_H_LINE_TO, 4, -V_LINE_TO, 16, -R_H_LINE_TO, -4, -R_V_LINE_TO, 4, -R_H_LINE_TO, -3.2f, -R_V_LINE_TO, -4, -CLOSE, -R_MOVE_TO, 13.31f, 12.64f, -R_LINE_TO, 2.64f, -2.88f, -R_LINE_TO, -5.26f, -4.82f, -R_CUBIC_TO, 1.33f, -1.84f, 2.11f, -4.1f, 2.11f, -6.54f, -R_CUBIC_TO, 0, -6.17f, -5.03f, -11.2f, -11.2f, -11.2f, -CUBIC_TO, 8.22f, 3.2f, 3.2f, 8.23f, 3.2f, 14.4f, -R_CUBIC_TO, 0, 6.18f, 5.02f, 11.2f, 11.2f, 11.2f, -R_CUBIC_TO, 2.33f, 0, 4.49f, -0.71f, 6.28f, -1.93f, -R_LINE_TO, 5.42f, 4.97f, -CLOSE, -MOVE_TO, 14.4f, 6.4f, -R_CUBIC_TO, -4.41f, 0, -8, 3.59f, -8, 8, -R_CUBIC_TO, 0, 4.41f, 3.59f, 8, 8, 8, -R_CUBIC_TO, 4.41f, 0, 8, -3.59f, 8, -8, -R_CUBIC_TO, 0, -4.41f, -3.59f, -8, -8, -8, -CLOSE - -CANVAS_DIMENSIONS, 16, -MOVE_TO, 6.4f, 8, -R_H_LINE_TO, -2, -V_LINE_TO, 6.4f, -R_H_LINE_TO, 2, -R_V_LINE_TO, -2, -H_LINE_TO, 8, -R_V_LINE_TO, 2, -R_H_LINE_TO, 2, -V_LINE_TO, 8, -H_LINE_TO, 8, -R_V_LINE_TO, 2, -H_LINE_TO, 6.4f, -V_LINE_TO, 8, -CLOSE, -R_MOVE_TO, 6.65f, 6.32f, -R_LINE_TO, 1.32f, -1.44f, -R_LINE_TO, -2.63f, -2.41f, -R_CUBIC_TO, 0.67f, -0.92f, 1.06f, -2.05f, 1.06f, -3.27f, -R_CUBIC_TO, 0, -3.09f, -2.51f, -5.6f, -5.6f, -5.6f, -R_CUBIC_TO, -3.09f, 0, -5.6f, 2.51f, -5.6f, 5.6f, -R_CUBIC_TO, 0, 3.09f, 2.51f, 5.6f, 5.6f, 5.6f, -R_CUBIC_TO, 1.16f, 0, 2.25f, -0.36f, 3.14f, -0.97f, -R_LINE_TO, 2.71f, 2.49f, -CLOSE, -MOVE_TO, 7.2f, 3.2f, -R_CUBIC_TO, -2.21f, 0, -4, 1.79f, -4, 4, -R_CUBIC_TO, 0, 2.21f, 1.79f, 4, 4, 4, -R_CUBIC_TO, 2.2f, 0, 4, -1.79f, 4, -4, -R_CUBIC_TO, 0, -2.21f, -1.8f, -4, -4, -4, -CLOSE
diff --git a/ash/resources/vector_icons/palette_tray_icon_metalayer.icon b/ash/resources/vector_icons/palette_tray_icon_metalayer.icon deleted file mode 100644 index 88c6a17..0000000 --- a/ash/resources/vector_icons/palette_tray_icon_metalayer.icon +++ /dev/null
@@ -1,49 +0,0 @@ -// 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. - -CANVAS_DIMENSIONS, 32, -MOVE_TO, 26.86f, 12.64f, -CUBIC_TO, 27.8f, 12.64f, 28.57f, 11.88f, 28.57f, 10.93f, -CUBIC_TO, 28.57f, 9.99f, 27.8f, 9.23f, 26.86f, 9.23f, -CUBIC_TO, 25.92f, 9.23f, 25.16f, 9.99f, 25.16f, 10.93f, -CUBIC_TO, 25.16f, 11.88f, 25.92f, 12.64f, 26.86f, 12.64f, -MOVE_TO, 21.74f, 18.33f, -CUBIC_TO, 23.63f, 18.33f, 25.16f, 16.8f, 25.16f, 14.92f, -CUBIC_TO, 25.16f, 13.03f, 23.63f, 11.5f, 21.74f, 11.5f, -CUBIC_TO, 19.86f, 11.5f, 18.33f, 13.03f, 18.33f, 14.92f, -CUBIC_TO, 18.33f, 16.8f, 19.86f, 18.33f, 21.74f, 18.33f, -MOVE_TO, 21.74f, 27.43f, -CUBIC_TO, 23.94f, 27.43f, 25.72f, 25.65f, 25.72f, 23.45f, -CUBIC_TO, 25.72f, 21.25f, 23.94f, 19.47f, 21.74f, 19.47f, -CUBIC_TO, 19.54f, 19.47f, 17.76f, 21.25f, 17.76f, 23.45f, -CUBIC_TO, 17.76f, 25.65f, 19.54f, 27.43f, 21.74f, 27.43f, -MOVE_TO, 17.19f, 11.5f, -CUBIC_TO, 17.19f, 7.73f, 14.13f, 4.68f, 10.36f, 4.68f, -CUBIC_TO, 6.59f, 4.68f, 3.54f, 7.73f, 3.54f, 11.5f, -CUBIC_TO, 3.54f, 15.27f, 6.59f, 18.33f, 10.36f, 18.33f, -CUBIC_TO, 14.13f, 18.33f, 17.19f, 15.27f, 17.19f, 11.5f, -CLOSE - -CANVAS_DIMENSIONS, 16, -MOVE_TO, 13.43f, 6.32f, -CUBIC_TO, 13.9f, 6.32f, 14.28f, 5.94f, 14.28f, 5.47f, -CUBIC_TO, 14.28f, 5, 13.9f, 4.61f, 13.43f, 4.61f, -CUBIC_TO, 12.96f, 4.61f, 12.58f, 5, 12.58f, 5.47f, -CUBIC_TO, 12.58f, 5.94f, 12.96f, 6.32f, 13.43f, 6.32f, -MOVE_TO, 10.87f, 9.16f, -CUBIC_TO, 11.81f, 9.16f, 12.58f, 8.4f, 12.58f, 7.46f, -CUBIC_TO, 12.58f, 6.52f, 11.81f, 5.75f, 10.87f, 5.75f, -CUBIC_TO, 9.93f, 5.75f, 9.16f, 6.52f, 9.16f, 7.46f, -CUBIC_TO, 9.16f, 8.4f, 9.93f, 9.16f, 10.87f, 9.16f, -MOVE_TO, 10.87f, 13.72f, -CUBIC_TO, 11.97f, 13.72f, 12.86f, 12.82f, 12.86f, 11.72f, -CUBIC_TO, 12.86f, 10.62f, 11.97f, 9.73f, 10.87f, 9.73f, -CUBIC_TO, 9.77f, 9.73f, 8.88f, 10.62f, 8.88f, 11.72f, -CUBIC_TO, 8.88f, 12.82f, 9.77f, 13.72f, 10.87f, 13.72f, -MOVE_TO, 8.6f, 5.75f, -CUBIC_TO, 8.6f, 3.87f, 7.07f, 2.34f, 5.18f, 2.34f, -CUBIC_TO, 3.3f, 2.34f, 1.77f, 3.87f, 1.77f, 5.75f, -CUBIC_TO, 1.77f, 7.64f, 3.3f, 9.16f, 5.18f, 9.16f, -CUBIC_TO, 7.07f, 9.16f, 8.6f, 7.64f, 8.6f, 5.75f, -CLOSE
diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h index a57d220..393c400 100644 --- a/ash/shell_delegate.h +++ b/ash/shell_delegate.h
@@ -13,6 +13,7 @@ #include "base/callback.h" #include "base/files/file_path.h" #include "chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom-forward.h" +#include "chromeos/ui/base/window_pin_type.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "services/device/public/mojom/bluetooth_system.mojom-forward.h" #include "services/device/public/mojom/fingerprint.mojom-forward.h" @@ -120,6 +121,11 @@ // Returns if window browser sessions are restoring. virtual bool IsSessionRestoreInProgress() const = 0; + // Pin or unpin a window. This is used for Quiz modes and called from another + // client (e.g. Lacros) through Exo. + virtual void SetPinnedFromExo(aura::Window* window, + chromeos::WindowPinType type) = 0; + // Ui Dev Tools control. virtual bool IsUiDevToolsStarted() const; virtual void StartUiDevTools() {}
diff --git a/ash/style/ash_color_provider.cc b/ash/style/ash_color_provider.cc index 178ddb8..cd0add8 100644 --- a/ash/style/ash_color_provider.cc +++ b/ash/style/ash_color_provider.cc
@@ -361,7 +361,6 @@ case ContentLayerType::kIconColorSecondaryBackground: return use_dark_color ? gfx::kGoogleGrey100 : gfx::kGoogleGrey800; case ContentLayerType::kButtonLabelColor: - case ContentLayerType::kButtonIconColor: case ContentLayerType::kAppStateIndicatorColor: case ContentLayerType::kScrollBarColor: case ContentLayerType::kSliderColorInactive: @@ -401,6 +400,8 @@ case ContentLayerType::kHighlightColorHover: return use_dark_color ? SkColorSetA(SK_ColorWHITE, 0x0D) : SkColorSetA(SK_ColorBLACK, 0x14); + case ContentLayerType::kButtonIconColor: + return use_dark_color ? gfx::kGoogleGrey200 : gfx::kGoogleGrey900; default: return ResolveColor(type, use_dark_color); }
diff --git a/ash/system/bluetooth/bluetooth_feature_pod_controller.cc b/ash/system/bluetooth/bluetooth_feature_pod_controller.cc index 9708814..a9321866 100644 --- a/ash/system/bluetooth/bluetooth_feature_pod_controller.cc +++ b/ash/system/bluetooth/bluetooth_feature_pod_controller.cc
@@ -112,20 +112,21 @@ return l10n_util::GetStringUTF16( IDS_ASH_STATUS_TRAY_BLUETOOTH_ENABLED_SHORT); - if (DoesFirstConnectedDeviceHaveBatteryInfo()) - return l10n_util::GetStringFUTF16( - IDS_ASH_STATUS_TRAY_BLUETOOTH_DEVICE_BATTERY_PERCENTAGE_LABEL, - base::NumberToString16( - first_connected_device_.value() - .battery_info->default_properties->battery_percentage)); + if (connected_device_count_ == 1) { + if (DoesFirstConnectedDeviceHaveBatteryInfo()) { + return l10n_util::GetStringFUTF16( + IDS_ASH_STATUS_TRAY_BLUETOOTH_DEVICE_BATTERY_PERCENTAGE_LABEL, + base::NumberToString16( + first_connected_device_.value() + .battery_info->default_properties->battery_percentage)); + } + return l10n_util::GetStringUTF16( + IDS_ASH_STATUS_TRAY_BLUETOOTH_DEVICE_CONNECTED_LABEL); + } - if (connected_device_count_ > 1) - return l10n_util::GetStringFUTF16( - IDS_ASH_STATUS_TRAY_BLUETOOTH_MULTIPLE_DEVICES_CONNECTED_LABEL, - base::FormatNumber(connected_device_count_)); - - return l10n_util::GetStringUTF16( - IDS_ASH_STATUS_TRAY_BLUETOOTH_DEVICE_CONNECTED_LABEL); + return l10n_util::GetStringFUTF16( + IDS_ASH_STATUS_TRAY_BLUETOOTH_MULTIPLE_DEVICES_CONNECTED_LABEL, + base::FormatNumber(connected_device_count_)); } std::u16string BluetoothFeaturePodController::ComputeTooltip() const { @@ -133,22 +134,23 @@ return l10n_util::GetStringUTF16( IDS_ASH_STATUS_TRAY_BLUETOOTH_ENABLED_TOOLTIP); - if (DoesFirstConnectedDeviceHaveBatteryInfo()) + if (connected_device_count_ == 1) { + if (DoesFirstConnectedDeviceHaveBatteryInfo()) { + return l10n_util::GetStringFUTF16( + IDS_ASH_STATUS_TRAY_BLUETOOTH_DEVICE_CONNECTED_WITH_BATTERY_TOOLTIP, + first_connected_device_.value().device_name, + base::NumberToString16( + first_connected_device_.value() + .battery_info->default_properties->battery_percentage)); + } return l10n_util::GetStringFUTF16( - IDS_ASH_STATUS_TRAY_BLUETOOTH_DEVICE_CONNECTED_WITH_BATTERY_TOOLTIP, - first_connected_device_.value().device_name, - base::NumberToString16( - first_connected_device_.value() - .battery_info->default_properties->battery_percentage)); - - if (connected_device_count_ > 1) - return l10n_util::GetStringFUTF16( - IDS_ASH_STATUS_TRAY_BLUETOOTH_MULTIPLE_DEVICES_CONNECTED_TOOLTIP, - base::FormatNumber(connected_device_count_)); + IDS_ASH_STATUS_TRAY_BLUETOOTH_DEVICE_CONNECTED_TOOLTIP, + first_connected_device_.value().device_name); + } return l10n_util::GetStringFUTF16( - IDS_ASH_STATUS_TRAY_BLUETOOTH_DEVICE_CONNECTED_TOOLTIP, - first_connected_device_.value().device_name); + IDS_ASH_STATUS_TRAY_BLUETOOTH_MULTIPLE_DEVICES_CONNECTED_TOOLTIP, + base::FormatNumber(connected_device_count_)); } void BluetoothFeaturePodController::UpdateButtonStateIfExists() {
diff --git a/ash/system/bluetooth/bluetooth_feature_pod_controller_unittest.cc b/ash/system/bluetooth/bluetooth_feature_pod_controller_unittest.cc index 22e15aa..58502cec 100644 --- a/ash/system/bluetooth/bluetooth_feature_pod_controller_unittest.cc +++ b/ash/system/bluetooth/bluetooth_feature_pod_controller_unittest.cc
@@ -31,6 +31,7 @@ using chromeos::bluetooth_config::mojom::BluetoothDeviceProperties; using chromeos::bluetooth_config::mojom::BluetoothSystemState; using chromeos::bluetooth_config::mojom::DeviceBatteryInfo; +using chromeos::bluetooth_config::mojom::DeviceBatteryInfoPtr; using chromeos::bluetooth_config::mojom::DeviceConnectionState; using chromeos::bluetooth_config::mojom::PairedBluetoothDeviceProperties; using chromeos::bluetooth_config::mojom::PairedBluetoothDevicePropertiesPtr; @@ -73,6 +74,13 @@ AshTestBase::TearDown(); } + DeviceBatteryInfoPtr CreateDefaultBatteryInfo() { + DeviceBatteryInfoPtr battery_info = DeviceBatteryInfo::New(); + battery_info->default_properties = BatteryProperties::New(); + battery_info->default_properties->battery_percentage = kBatteryPercentage; + return battery_info; + } + void ExpectBluetoothDetailedViewFocused() { EXPECT_TRUE(tray_view_->detailed_view()); const FeaturePodIconButton::Views& children = @@ -268,11 +276,7 @@ EXPECT_EQ(base::ASCIIToUTF16(kDeviceNickname), label_button->GetLabelText()); // Change the device battery information and reset the paired device list. - paired_device->device_properties->battery_info = DeviceBatteryInfo::New(); - paired_device->device_properties->battery_info->default_properties = - BatteryProperties::New(); - paired_device->device_properties->battery_info->default_properties - ->battery_percentage = kBatteryPercentage; + paired_device->device_properties->battery_info = CreateDefaultBatteryInfo(); SetConnectedDevice(paired_device); EXPECT_EQ(l10n_util::GetStringFUTF16( @@ -285,12 +289,13 @@ HasCorrectMetadataWithMultipleDevice) { SetSystemState(BluetoothSystemState::kEnabled); - // Create a device with zero configuration, mark it as connected, and reset - // the list of paired devices with multiple duplicates of it. + // Create a device with basic battery information, mark it as connected, and + // reset the list of paired devices with multiple duplicates of it. auto paired_device = PairedBluetoothDeviceProperties::New(); paired_device->device_properties = BluetoothDeviceProperties::New(); paired_device->device_properties->connection_state = DeviceConnectionState::kConnected; + paired_device->device_properties->battery_info = CreateDefaultBatteryInfo(); std::vector<PairedBluetoothDevicePropertiesPtr> paired_devices; for (int i = 0; i < kMultipleDeviceCount; ++i) {
diff --git a/ash/system/palette/common_palette_tool.h b/ash/system/palette/common_palette_tool.h index 27d6502..c27ecc3 100644 --- a/ash/system/palette/common_palette_tool.h +++ b/ash/system/palette/common_palette_tool.h
@@ -38,7 +38,10 @@ void OnViewClicked(views::View* sender) override; // Returns the icon used in the palette tray on the left-most edge of the - // tool. + // tool. The icon will be the same as that used in the status area i.e. + // PaletteTool::GetActiveTrayIcon(). + // TODO(michelefan): Consider using the same function to return + // icon for palette menu and palette tray at the status area. virtual const gfx::VectorIcon& GetPaletteIcon() const = 0; // Creates a default view implementation to be returned by CreateView.
diff --git a/ash/system/palette/palette_tool.h b/ash/system/palette/palette_tool.h index c48d963..7153f73 100644 --- a/ash/system/palette/palette_tool.h +++ b/ash/system/palette/palette_tool.h
@@ -97,7 +97,11 @@ virtual void OnViewDestroyed() = 0; // Returns an icon to use in the tray if this tool is active. Only one tool - // (per-group) should ever have an active icon at any given time. + // (per-group) should ever have an active icon at any given time. The icon + // will be the same as that used in the palette tray on the left-most edge of + // the tool i.e. CommonPaletteTool::GetPaletteIcon(). + // TODO(michelefan): Consider using the same function to return + // icon for palette menu and palette tray at the status area. virtual const gfx::VectorIcon& GetActiveTrayIcon() const; void SetExternalDisplayForTest() { external_display_for_test_ = true; }
diff --git a/ash/system/palette/tools/laser_pointer_mode.cc b/ash/system/palette/tools/laser_pointer_mode.cc index 7e3e1de..2839412d 100644 --- a/ash/system/palette/tools/laser_pointer_mode.cc +++ b/ash/system/palette/tools/laser_pointer_mode.cc
@@ -8,7 +8,6 @@ #include "ash/resources/vector_icons/vector_icons.h" #include "ash/shell.h" #include "ash/strings/grit/ash_strings.h" -#include "ash/style/ash_color_provider.h" #include "ash/system/palette/palette_ids.h" #include "ui/base/l10n/l10n_util.h" @@ -51,17 +50,11 @@ } const gfx::VectorIcon& LaserPointerMode::GetActiveTrayIcon() const { - if (AshColorProvider::Get()->IsDarkModeEnabled()) - return kPaletteTrayIconLaserPointerIcon; - - return kPaletteTrayIconLaserPointerLightModeIcon; + return kPaletteModeLaserPointerIcon; } const gfx::VectorIcon& LaserPointerMode::GetPaletteIcon() const { - if (AshColorProvider::Get()->IsDarkModeEnabled()) - return kPaletteModeLaserPointerIcon; - - return kPaletteModeLaserPointerLightModeIcon; + return kPaletteModeLaserPointerIcon; } views::View* LaserPointerMode::CreateView() {
diff --git a/ash/system/palette/tools/magnifier_mode.cc b/ash/system/palette/tools/magnifier_mode.cc index a942fc8..012b3f5 100644 --- a/ash/system/palette/tools/magnifier_mode.cc +++ b/ash/system/palette/tools/magnifier_mode.cc
@@ -27,7 +27,7 @@ } const gfx::VectorIcon& MagnifierMode::GetActiveTrayIcon() const { - return kPaletteTrayIconMagnifyIcon; + return kPaletteModeMagnifyIcon; } void MagnifierMode::OnEnable() {
diff --git a/ash/system/palette/tools/metalayer_mode.cc b/ash/system/palette/tools/metalayer_mode.cc index f5fb22a..cdef824 100644 --- a/ash/system/palette/tools/metalayer_mode.cc +++ b/ash/system/palette/tools/metalayer_mode.cc
@@ -84,7 +84,7 @@ } const gfx::VectorIcon& MetalayerMode::GetActiveTrayIcon() const { - return kPaletteTrayIconMetalayerIcon; + return kPaletteModeMetalayerIcon; } const gfx::VectorIcon& MetalayerMode::GetPaletteIcon() const {
diff --git a/ash/system/privacy_screen/privacy_screen_feature_pod_controller.cc b/ash/system/privacy_screen/privacy_screen_feature_pod_controller.cc index c9e41588..8dc5293 100644 --- a/ash/system/privacy_screen/privacy_screen_feature_pod_controller.cc +++ b/ash/system/privacy_screen/privacy_screen_feature_pod_controller.cc
@@ -91,8 +91,10 @@ } void PrivacyScreenFeaturePodController::OnPrivacyScreenSettingChanged( - bool enabled) { - UpdateButton(); + bool enabled, + bool notify_ui) { + if (notify_ui) + UpdateButton(); } } // namespace ash
diff --git a/ash/system/privacy_screen/privacy_screen_feature_pod_controller.h b/ash/system/privacy_screen/privacy_screen_feature_pod_controller.h index f5a1f1a..57201e0 100644 --- a/ash/system/privacy_screen/privacy_screen_feature_pod_controller.h +++ b/ash/system/privacy_screen/privacy_screen_feature_pod_controller.h
@@ -35,7 +35,7 @@ void UpdateButton(); // PrivacyScreenController::Observer: - void OnPrivacyScreenSettingChanged(bool enabled) override; + void OnPrivacyScreenSettingChanged(bool enabled, bool notify_ui) override; // Unowned. FeaturePodButton* button_ = nullptr;
diff --git a/ash/system/privacy_screen/privacy_screen_toast_controller.cc b/ash/system/privacy_screen/privacy_screen_toast_controller.cc index e0bad95fe..8857ea32 100644 --- a/ash/system/privacy_screen/privacy_screen_toast_controller.cc +++ b/ash/system/privacy_screen/privacy_screen_toast_controller.cc
@@ -112,7 +112,12 @@ return toast_view_->GetAccessibleName(); } -void PrivacyScreenToastController::OnPrivacyScreenSettingChanged(bool enabled) { +void PrivacyScreenToastController::OnPrivacyScreenSettingChanged( + bool enabled, + bool notify_ui) { + if (!notify_ui) + return; + if (tray_->IsBubbleShown()) return;
diff --git a/ash/system/privacy_screen/privacy_screen_toast_controller.h b/ash/system/privacy_screen/privacy_screen_toast_controller.h index 18fa4c6..a973008 100644 --- a/ash/system/privacy_screen/privacy_screen_toast_controller.h +++ b/ash/system/privacy_screen/privacy_screen_toast_controller.h
@@ -54,7 +54,7 @@ std::u16string GetAccessibleNameForBubble() override; // PrivacyScreenController::Observer: - void OnPrivacyScreenSettingChanged(bool enabled) override; + void OnPrivacyScreenSettingChanged(bool enabled, bool notify_ui) override; UnifiedSystemTray* const tray_; TrayBubbleView* bubble_view_ = nullptr;
diff --git a/ash/test_shell_delegate.h b/ash/test_shell_delegate.h index a8cf6eb..2de7d52a 100644 --- a/ash/test_shell_delegate.h +++ b/ash/test_shell_delegate.h
@@ -61,6 +61,8 @@ void OpenFeedbackPageForPersistentDesksBar() override {} std::unique_ptr<app_restore::AppLaunchInfo> GetAppLaunchDataForDeskTemplate( aura::Window* window) const override; + void SetPinnedFromExo(aura::Window* window, + chromeos::WindowPinType type) override {} private: // True if the current top window can go back.
diff --git a/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java b/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java index 5408816..6126560 100644 --- a/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java +++ b/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java
@@ -72,7 +72,7 @@ // Compile time switch for sharing RELRO between the browser and the app zygote. // TODO(crbug.com/1154224): remove when the issue is closed. - private static final boolean ALLOW_CHROMIUM_LINKER_IN_ZYGOTE = false; + private static final boolean ALLOW_CHROMIUM_LINKER_IN_ZYGOTE = true; // Default sampling interval for reached code profiler in microseconds. private static final int DEFAULT_REACHED_CODE_SAMPLING_INTERVAL_US = 10000;
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 6b893dd..51266299 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn
@@ -487,8 +487,7 @@ #} } - # TODO(crbug.com/1253924): Enable on apple/lld for arm64 too once it works. - if (use_icf && (!is_apple || (use_lld && current_cpu != "arm64"))) { + if (use_icf && !is_apple) { ldflags += [ "-Wl,--icf=all" ] }
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index 66a3a2c..c29faa9 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -6.20210928.0.1 +6.20210928.1.1
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index 66a3a2c..ea0307d 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -6.20210928.0.1 +6.20210928.2.1
diff --git a/chrome/android/chrome_java_resources.gni b/chrome/android/chrome_java_resources.gni index 0222e90..64934c2 100644 --- a/chrome/android/chrome_java_resources.gni +++ b/chrome/android/chrome_java_resources.gni
@@ -503,7 +503,6 @@ "java/res/drawable/ic_open_in_browser.xml", "java/res/drawable/ic_person_add_40dp.xml", "java/res/drawable/ic_reading_list_folder_24dp.xml", - "java/res/drawable/ic_remove_box_rounded_corner.xml", "java/res/drawable/ic_select_window.xml", "java/res/drawable/ic_signout_40dp.xml", "java/res/drawable/ic_site_timer.xml", @@ -550,7 +549,6 @@ "java/res/drawable/visa_card.xml", "java/res/layout-sw360dp/preference_spinner_single_line.xml", "java/res/layout-sw600dp/find_toolbar.xml", - "java/res/layout/accessibility_page_zoom_preference.xml", "java/res/layout/accessibility_tab_switcher.xml", "java/res/layout/accessibility_tab_switcher_list_item.xml", "java/res/layout/account_chooser_dialog_item.xml",
diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni index 535e48b0..9eb1d29 100644 --- a/chrome/android/chrome_java_sources.gni +++ b/chrome/android/chrome_java_sources.gni
@@ -57,7 +57,6 @@ "java/src/org/chromium/chrome/browser/about_settings/HyperlinkPreference.java", "java/src/org/chromium/chrome/browser/about_settings/LegalInformationSettings.java", "java/src/org/chromium/chrome/browser/accessibility/FontSizePrefs.java", - "java/src/org/chromium/chrome/browser/accessibility/settings/AccessibilityPageZoomPreference.java", "java/src/org/chromium/chrome/browser/accessibility/settings/AccessibilitySettings.java", "java/src/org/chromium/chrome/browser/accessibility/settings/TextScalePreference.java", "java/src/org/chromium/chrome/browser/accessibility_tab_switcher/AccessibilityTabModelAdapter.java",
diff --git a/chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceTest.java b/chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceTest.java index 839ba089..6b26977 100644 --- a/chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceTest.java +++ b/chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceTest.java
@@ -65,6 +65,7 @@ import org.junit.Test; import org.junit.runner.RunWith; +import org.chromium.base.TimeUtils; import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.test.params.ParameterAnnotations; import org.chromium.base.test.params.ParameterAnnotations.UseRunnerDelegate; @@ -92,6 +93,8 @@ import org.chromium.chrome.browser.native_page.ContextMenuManager; import org.chromium.chrome.browser.ntp.NewTabPageLaunchOrigin; import org.chromium.chrome.browser.ntp.NewTabPageUtils; +import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; +import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.browser.suggestions.SiteSuggestion; import org.chromium.chrome.browser.suggestions.tile.SuggestionsTileView; import org.chromium.chrome.browser.tab.Tab; @@ -156,6 +159,7 @@ "force-fieldtrial-params=Study.Group:start_surface_variation"; private static final long MAX_TIMEOUT_MS = 40000L; + private static final long MILLISECONDS_PER_MINUTE = TimeUtils.SECONDS_PER_MINUTE * 1000; @Rule public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @@ -2019,6 +2023,130 @@ TabUiTestHelper.verifyTabModelTabCount(cta, 1, 0); } + @Test + @MediumTest + @Feature({"StartSurface"}) + // clang-format off + @CommandLineFlags.Add({BASE_PARAMS + "/single/behavioural_targeting/mv_tiles" + + "/user_clicks_threshold/1/num_days_user_click_below_threshold/2"}) + public void testStartWithBehaviouralTargeting() throws Exception { + // clang-format on + Assume.assumeTrue(mImmediateReturn); + ChromeTabbedActivity cta = mActivityTestRule.getActivity(); + StartSurfaceTestUtils.waitForTabModel(cta); + TabUiTestHelper.verifyTabModelTabCount(cta, 1, 0); + Assert.assertFalse(cta.getLayoutManager().overviewVisible()); + + SharedPreferencesManager manager = SharedPreferencesManager.getInstance(); + // Verifies that the START_NEXT_SHOW_ON_STARTUP_DECISION_MS has been set. + long nextDecisionTime = + manager.readLong(ChromePreferenceKeys.START_NEXT_SHOW_ON_STARTUP_DECISION_MS, + ReturnToChromeExperimentsUtil.INVALID_DECISION_TIMESTAMP); + verifyNextDecisionTimeStampInDays( + manager, StartSurfaceConfiguration.NUM_DAYS_USER_CLICK_BELOW_THRESHOLD.getValue()); + Assert.assertFalse(manager.readBoolean(ChromePreferenceKeys.START_SHOW_ON_STARTUP, false)); + Assert.assertEquals(0, manager.readInt(ChromePreferenceKeys.TAP_MV_TILES_COUNT, 0)); + + StartSurfaceConfiguration.USER_CLICK_THRESHOLD.setForTesting(1); + int clicksHigherThreshold = StartSurfaceConfiguration.USER_CLICK_THRESHOLD.getValue(); + Assert.assertEquals(1, clicksHigherThreshold); + ReturnToChromeExperimentsUtil.onMVTileOpened(); + // Verifies that userBehaviourSupported() returns the same result before the next decision + // time arrives. + Assert.assertFalse(ReturnToChromeExperimentsUtil.userBehaviourSupported()); + Assert.assertEquals(nextDecisionTime, + manager.readLong(ChromePreferenceKeys.START_NEXT_SHOW_ON_STARTUP_DECISION_MS, + ReturnToChromeExperimentsUtil.INVALID_DECISION_TIMESTAMP)); + Assert.assertFalse(manager.readBoolean(ChromePreferenceKeys.START_SHOW_ON_STARTUP, false)); + Assert.assertEquals(1, manager.readInt(ChromePreferenceKeys.TAP_MV_TILES_COUNT, 0)); + + // Verifies if the next decision time past and the clicks of MV tiles is higher than the + // threshold, userBehaviourSupported() returns true. Besides, the next decision time is set + // to NUM_DAYS_KEEP_SHOW_START_AT_STARTUP day's later, and MV tiles count is reset. + manager.writeLong(ChromePreferenceKeys.START_NEXT_SHOW_ON_STARTUP_DECISION_MS, + System.currentTimeMillis() - 1); + Assert.assertTrue(ReturnToChromeExperimentsUtil.userBehaviourSupported()); + Assert.assertTrue(manager.readBoolean(ChromePreferenceKeys.START_SHOW_ON_STARTUP, false)); + verifyNextDecisionTimeStampInDays( + manager, StartSurfaceConfiguration.NUM_DAYS_KEEP_SHOW_START_AT_STARTUP.getValue()); + Assert.assertEquals(0, manager.readInt(ChromePreferenceKeys.TAP_MV_TILES_COUNT, 0)); + + // Verifies if the next decision time past and the clicks of MV tiles is lower than the + // threshold, userBehaviourSupported() returns false. Besides, the next decision time is + // set to NUM_DAYS_USER_CLICK_BELOW_THRESHOLD day's later. + manager.writeLong(ChromePreferenceKeys.START_NEXT_SHOW_ON_STARTUP_DECISION_MS, + System.currentTimeMillis() - 1); + Assert.assertEquals(0, manager.readInt(ChromePreferenceKeys.TAP_MV_TILES_COUNT, 0)); + Assert.assertFalse(ReturnToChromeExperimentsUtil.userBehaviourSupported()); + Assert.assertFalse(manager.readBoolean(ChromePreferenceKeys.START_SHOW_ON_STARTUP, false)); + verifyNextDecisionTimeStampInDays( + manager, StartSurfaceConfiguration.NUM_DAYS_USER_CLICK_BELOW_THRESHOLD.getValue()); + + StartSurfaceConfiguration.BEHAVIOURAL_TARGETING.setForTesting("feeds"); + verifyBehaviourTypeRecordedAndChecked(manager); + + StartSurfaceConfiguration.BEHAVIOURAL_TARGETING.setForTesting("open_new_tab"); + verifyBehaviourTypeRecordedAndChecked(manager); + + StartSurfaceConfiguration.BEHAVIOURAL_TARGETING.setForTesting("open_history"); + verifyBehaviourTypeRecordedAndChecked(manager); + + StartSurfaceConfiguration.BEHAVIOURAL_TARGETING.setForTesting("open_recent_tabs"); + verifyBehaviourTypeRecordedAndChecked(manager); + + // Verifies if the key doesn't match the value of + // StartSurfaceConfiguration.BEHAVIOURAL_TARGETING, e.g., the value isn't set, onUIClicked() + // doesn't record or increase the count. + StartSurfaceConfiguration.BEHAVIOURAL_TARGETING.setForTesting(""); + String type = "feeds"; + String key = ReturnToChromeExperimentsUtil.getBehaviourTypeKeyForTesting(type); + ReturnToChromeExperimentsUtil.onUIClicked(key); + Assert.assertEquals(0, manager.readInt(key, 0)); + } + + /** + * Check that the next decision time is within |numOfDays| from now. + * @param numOfDays Number of days to check. + */ + private void verifyNextDecisionTimeStampInDays( + SharedPreferencesManager manager, int numOfDays) { + long approximateTime = System.currentTimeMillis() + + numOfDays * ReturnToChromeExperimentsUtil.MILLISECONDS_PER_DAY; + long nextDecisionTime = + manager.readLong(ChromePreferenceKeys.START_NEXT_SHOW_ON_STARTUP_DECISION_MS, + ReturnToChromeExperimentsUtil.INVALID_DECISION_TIMESTAMP); + + Assert.assertThat("new decision time lower bound", + approximateTime - MILLISECONDS_PER_MINUTE, + Matchers.lessThanOrEqualTo(nextDecisionTime)); + + Assert.assertThat("new decision time upper bound", + approximateTime + MILLISECONDS_PER_MINUTE, + Matchers.greaterThanOrEqualTo(nextDecisionTime)); + } + + private void verifyBehaviourTypeRecordedAndChecked(SharedPreferencesManager manager) { + String key = ReturnToChromeExperimentsUtil.getBehaviourTypeKeyForTesting( + StartSurfaceConfiguration.BEHAVIOURAL_TARGETING.getValue()); + Assert.assertEquals(0, manager.readInt(key, 0)); + + // Increase the count of the key. + ReturnToChromeExperimentsUtil.onUIClicked(key); + Assert.assertEquals(1, manager.readInt(key, 0)); + Assert.assertFalse(manager.readBoolean(ChromePreferenceKeys.START_SHOW_ON_STARTUP, false)); + + // Verifies that userBehaviourSupported() return true due to the count of this key is higher + // or equal to the threshold. + manager.writeLong(ChromePreferenceKeys.START_NEXT_SHOW_ON_STARTUP_DECISION_MS, + System.currentTimeMillis() - 1); + Assert.assertTrue(ReturnToChromeExperimentsUtil.userBehaviourSupported()); + Assert.assertEquals(0, manager.readInt(key, 0)); + Assert.assertTrue(manager.readBoolean(ChromePreferenceKeys.START_SHOW_ON_STARTUP, false)); + + // Resets the decision. + manager.writeBoolean(ChromePreferenceKeys.START_SHOW_ON_STARTUP, false); + } + private void backActionDeleteBlankTabForOmniboxFocusedOnNewTabSingleSurface( Runnable backAction) { if (!mImmediateReturn) {
diff --git a/chrome/android/features/start_surface/public/java/src/org/chromium/chrome/features/start_surface/StartSurfaceConfiguration.java b/chrome/android/features/start_surface/public/java/src/org/chromium/chrome/features/start_surface/StartSurfaceConfiguration.java index e0d7cb6..80ca52a0 100644 --- a/chrome/android/features/start_surface/public/java/src/org/chromium/chrome/features/start_surface/StartSurfaceConfiguration.java +++ b/chrome/android/features/start_surface/public/java/src/org/chromium/chrome/features/start_surface/StartSurfaceConfiguration.java
@@ -110,6 +110,28 @@ new BooleanCachedFieldTrialParameter(ChromeFeatureList.START_SURFACE_ANDROID, CHECK_SYNC_BEFORE_SHOW_START_AT_STARTUP_PARAM, false); + private static final String BEHAVIOURAL_TARGETING_PARAM = "behavioural_targeting"; + public static final StringCachedFieldTrialParameter BEHAVIOURAL_TARGETING = + new StringCachedFieldTrialParameter( + ChromeFeatureList.START_SURFACE_ANDROID, BEHAVIOURAL_TARGETING_PARAM, ""); + + private static final String USER_CLICK_THRESHOLD_PARAM = "user_clicks_threshold"; + public static final IntCachedFieldTrialParameter USER_CLICK_THRESHOLD = + new IntCachedFieldTrialParameter(ChromeFeatureList.START_SURFACE_ANDROID, + USER_CLICK_THRESHOLD_PARAM, Integer.MAX_VALUE); + + private static final String NUM_DAYS_KEEP_SHOW_START_AT_STARTUP_PARAM = + "num_days_keep_show_start_at_startup"; + public static final IntCachedFieldTrialParameter NUM_DAYS_KEEP_SHOW_START_AT_STARTUP = + new IntCachedFieldTrialParameter(ChromeFeatureList.START_SURFACE_ANDROID, + NUM_DAYS_KEEP_SHOW_START_AT_STARTUP_PARAM, 7); + + private static final String NUM_DAYS_USER_CLICK_BELOW_THRESHOLD_PARAM = + "num_days_user_click_below_threshold"; + public static final IntCachedFieldTrialParameter NUM_DAYS_USER_CLICK_BELOW_THRESHOLD = + new IntCachedFieldTrialParameter(ChromeFeatureList.START_SURFACE_ANDROID, + NUM_DAYS_USER_CLICK_BELOW_THRESHOLD_PARAM, 7); + private static final String SIGN_IN_PROMO_SHOW_SINCE_LAST_BACKGROUND_LIMIT_MS_PARAM = "sign_in_promo_show_since_last_background_limit_ms"; public static final IntCachedFieldTrialParameter
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/NewTabTileMediator.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/NewTabTileMediator.java index 5f77f74..0faa39b 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/NewTabTileMediator.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/NewTabTileMediator.java
@@ -13,6 +13,7 @@ import org.chromium.chrome.browser.tabmodel.TabModel; import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserver; +import org.chromium.chrome.browser.tasks.ReturnToChromeExperimentsUtil; import org.chromium.ui.modelutil.PropertyModel; /** @@ -36,6 +37,9 @@ model.set(NewTabTileViewProperties.ON_CLICK_LISTENER, view -> { tabCreatorManager.getTabCreator(tabModelSelector.isIncognitoSelected()).launchNTP(); RecordUserAction.record("MobileNewTabOpened.NewTabTile"); + if (!tabModelSelector.isIncognitoSelected()) { + ReturnToChromeExperimentsUtil.onNewTabOpened(); + } }); mTabModelSelectorObserver = new TabModelSelectorObserver() {
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediator.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediator.java index 10ed2997..a2d67bbf 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediator.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediator.java
@@ -34,6 +34,7 @@ import org.chromium.chrome.browser.tabmodel.TabModelObserver; import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserver; +import org.chromium.chrome.browser.tasks.ReturnToChromeExperimentsUtil; import org.chromium.chrome.browser.tasks.tab_groups.TabGroupModelFilter; import org.chromium.chrome.browser.ui.messages.snackbar.Snackbar; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; @@ -519,6 +520,9 @@ .createNewTab(new LoadUrlParams(UrlConstants.NTP_URL), TabLaunchType.FROM_TAB_GROUP_UI, parentTabToAttach); RecordUserAction.record("MobileNewTabOpened." + mComponentName); + if (!currentTab.isIncognito()) { + ReturnToChromeExperimentsUtil.onNewTabOpened(); + } }; }
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupUiMediator.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupUiMediator.java index c21024a..3f33145 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupUiMediator.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupUiMediator.java
@@ -40,6 +40,7 @@ import org.chromium.chrome.browser.tasks.ConditionalTabStripUtils; import org.chromium.chrome.browser.tasks.ConditionalTabStripUtils.FeatureStatus; import org.chromium.chrome.browser.tasks.ConditionalTabStripUtils.ReasonToShow; +import org.chromium.chrome.browser.tasks.ReturnToChromeExperimentsUtil; import org.chromium.chrome.browser.tasks.tab_groups.EmptyTabGroupModelFilterObserver; import org.chromium.chrome.browser.tasks.tab_groups.TabGroupModelFilter; import org.chromium.chrome.browser.toolbar.bottom.BottomControlsCoordinator; @@ -439,6 +440,9 @@ .createNewTab(new LoadUrlParams(UrlConstants.NTP_URL), TabLaunchType.FROM_TAB_GROUP_UI, parentTabToAttach); RecordUserAction.record("MobileNewTabOpened." + TabGroupUiCoordinator.COMPONENT_NAME); + if (!currentTab.isIncognito()) { + ReturnToChromeExperimentsUtil.onNewTabOpened(); + } }; mModel.set(TabGroupUiProperties.RIGHT_BUTTON_ON_CLICK_LISTENER, rightButtonOnClickListener);
diff --git a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedPlaceholderLayout.java b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedPlaceholderLayout.java index 61182e8..a6097c7 100644 --- a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedPlaceholderLayout.java +++ b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedPlaceholderLayout.java
@@ -16,6 +16,8 @@ import android.widget.ImageView; import android.widget.LinearLayout; +import androidx.appcompat.widget.AppCompatImageView; + import org.chromium.chrome.R; import org.chromium.components.browser_ui.widget.displaystyle.UiConfig; import org.chromium.components.browser_ui.widget.displaystyle.ViewResizer; @@ -108,7 +110,7 @@ private ImageView getImagePlaceholder(boolean isSmallCard) { LinearLayout.LayoutParams imagePlaceholderLp = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); - ImageView imagePlaceholder = new ImageView(mContext); + ImageView imagePlaceholder = new AppCompatImageView(mContext); imagePlaceholder.setImageDrawable( isSmallCard ? getSmallImageDrawable() : getLargeImageDrawable()); imagePlaceholder.setLayoutParams(imagePlaceholderLp); @@ -149,7 +151,7 @@ ? getSmallTextDrawable(top, width, height, contentHeight) : getLargeTextDrawable(top, left, width, height, contentHeight + 2 * top); - ImageView textPlaceholder = new ImageView(mContext); + ImageView textPlaceholder = new AppCompatImageView(mContext); textPlaceholder.setImageDrawable(layerDrawable); textPlaceholder.setLayoutParams(textPlaceholderLp); textPlaceholder.setScaleType(ImageView.ScaleType.FIT_XY);
diff --git a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/v2/FeedStream.java b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/v2/FeedStream.java index fd67359..71aa9f7 100644 --- a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/v2/FeedStream.java +++ b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/v2/FeedStream.java
@@ -53,6 +53,7 @@ import org.chromium.chrome.browser.suggestions.SuggestionsConfig; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tasks.ReturnToChromeExperimentsUtil; import org.chromium.chrome.browser.ui.messages.snackbar.Snackbar; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; import org.chromium.chrome.browser.xsurface.FeedActionsHandler; @@ -227,6 +228,7 @@ NavigationRecorder.record(tab, visitData -> FeedServiceBridge.reportOpenVisitComplete(visitData.duration)); } + ReturnToChromeExperimentsUtil.onFeedCardOpened(); } }
diff --git a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/v2/NativeViewListRenderer.java b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/v2/NativeViewListRenderer.java index 9d6980bd..5ebd17a 100644 --- a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/v2/NativeViewListRenderer.java +++ b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/v2/NativeViewListRenderer.java
@@ -11,6 +11,7 @@ import android.view.ViewGroup.MarginLayoutParams; import android.widget.TextView; +import androidx.appcompat.widget.AppCompatTextView; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -119,7 +120,7 @@ } private View createCannotRenderViewItem() { - TextView viewItem = new TextView(mContext); + TextView viewItem = new AppCompatTextView(mContext); String message = "Unable to render external view"; viewItem.setText(message);
diff --git a/chrome/android/java/res/drawable/ic_remove_box_rounded_corner.xml b/chrome/android/java/res/drawable/ic_remove_box_rounded_corner.xml deleted file mode 100644 index 3231b78..0000000 --- a/chrome/android/java/res/drawable/ic_remove_box_rounded_corner.xml +++ /dev/null
@@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright 2021 The Chromium Authors. All rights reserved. - Use of this source code is governed by a BSD-style license that can be - found in the LICENSE file. --> - -<vector - xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:pathData="M 16.63 12.926 L 7.37 12.926 L 7.37 11.074 L 16.63 11.074 Z" - android:fillColor="?attr/default_icon_color" - android:strokeWidth="1"/> - <path - android:pathData="M 16.444 2 L 7.556 2 C 4.487 2 2 4.487 2 7.556 L 2 16.444 C 2 19.513 4.487 22 7.556 22 L 16.444 22 C 19.513 22 22 19.513 22 16.444 L 22 7.556 C 22 4.487 19.513 2 16.444 2 Z M 4.222 7.556 C 4.222 5.715 5.715 4.222 7.556 4.222 L 16.444 4.222 C 18.285 4.222 19.778 5.715 19.778 7.556 L 19.778 16.444 C 19.778 18.285 18.285 19.778 16.444 19.778 L 7.556 19.778 C 5.715 19.778 4.222 18.285 4.222 16.444 L 4.222 7.556 Z" - android:fillColor="?attr/default_icon_color" - android:strokeWidth="1"/> -</vector>
diff --git a/chrome/android/java/res/layout/accessibility_page_zoom_preference.xml b/chrome/android/java/res/layout/accessibility_page_zoom_preference.xml deleted file mode 100644 index 4548d53..0000000 --- a/chrome/android/java/res/layout/accessibility_page_zoom_preference.xml +++ /dev/null
@@ -1,73 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright 2021 The Chromium Authors. All rights reserved. - Use of this source code is governed by a BSD-style license that can be - found in the LICENSE file. --> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" > - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="center_vertical" - android:orientation="horizontal" > - - <TextView - style="@style/PreferenceTitle" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/accessibility_page_zoom_title" /> - - <org.chromium.ui.widget.ChromeImageButton - android:id="@+id/accessibility_page_zoom_decrease_zoom_button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:src="@drawable/ic_remove_box_rounded_corner" - android:background="?attr/selectableItemBackground" - android:minWidth="@dimen/accessibility_page_zoom_minimum_button_size" - android:minHeight="@dimen/accessibility_page_zoom_minimum_button_size" - android:layout_marginHorizontal="@dimen/accessibility_page_zoom_control_spacing" - android:contentDescription="@string/accessibility_page_zoom_decrease_zoom_button_text" - android:tint="@color/default_icon_color_tint_list" - android:layout_weight="1" /> - - <TextView - android:id="@+id/accessibility_page_zoom_current_zoom_level_text" - style="@style/PreferenceTitle" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAlignment="center" - android:layout_weight="1" /> - - <org.chromium.ui.widget.ChromeImageButton - android:id="@+id/accessibility_page_zoom_increase_zoom_button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:src="@drawable/ic_add_box_rounded_corner" - android:background="?attr/selectableItemBackground" - android:minWidth="@dimen/accessibility_page_zoom_minimum_button_size" - android:minHeight="@dimen/accessibility_page_zoom_minimum_button_size" - android:layout_marginHorizontal="@dimen/accessibility_page_zoom_control_spacing" - android:contentDescription="@string/accessibility_page_zoom_increase_zoom_button_text" - android:tint="@color/default_icon_color_tint_list" - android:layout_weight="1" /> - - <org.chromium.ui.widget.ButtonCompat - android:id="@+id/accessibility_page_zoom_reset_zoom_button" - style="@style/TextButton" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/reset" - android:layout_weight="1" /> - - </LinearLayout> - - <TextView - style="@style/PreferenceSummary" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/accessibility_page_zoom_summary" /> - -</LinearLayout>
diff --git a/chrome/android/java/res/values/dimens.xml b/chrome/android/java/res/values/dimens.xml index 298a6cd..f43190e 100644 --- a/chrome/android/java/res/values/dimens.xml +++ b/chrome/android/java/res/values/dimens.xml
@@ -415,10 +415,6 @@ <!-- IPH shared highlighting builder padding top --> <dimen name="iph_shared_highlighting_padding_top">120dp</dimen> - <!-- Accessibility Page Zoom Settings dimensions --> - <dimen name="accessibility_page_zoom_minimum_button_size">44dp</dimen> - <dimen name="accessibility_page_zoom_control_spacing">10dp</dimen> - <dimen name="sharing_hub_tile_width">69sp</dimen> <dimen name="sharing_hub_tile_margin">8sp</dimen> </resources>
diff --git a/chrome/android/java/res/xml/accessibility_preferences.xml b/chrome/android/java/res/xml/accessibility_preferences.xml index 12b5cd37..8d634d2 100644 --- a/chrome/android/java/res/xml/accessibility_preferences.xml +++ b/chrome/android/java/res/xml/accessibility_preferences.xml
@@ -34,9 +34,4 @@ android:key="image_descriptions" android:title="@string/image_descriptions_settings_title" /> - <org.chromium.chrome.browser.accessibility.settings.AccessibilityPageZoomPreference - android:key="accessibility_page_zoom" - android:layout="@layout/custom_preference" - android:widgetLayout="@layout/accessibility_page_zoom_preference" /> - </PreferenceScreen>
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java index 9ddfc68..80f0519 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
@@ -774,6 +774,7 @@ RecordUserAction.record("MobileTopToolbarNewTabButton"); RecordUserAction.record("MobileNewTabOpened"); + ReturnToChromeExperimentsUtil.onNewTabOpened(); }; OnClickListener bookmarkClickHandler = v -> addOrEditBookmark(getActivityTab()); @@ -1969,6 +1970,7 @@ getTabModelSelector().getModel(false).commitAllTabClosures(); RecordUserAction.record("MobileMenuNewTab"); RecordUserAction.record("MobileNewTabOpened"); + ReturnToChromeExperimentsUtil.onNewTabOpened(); reportNewTabShortcutUsed(false); if (fromMenu) RecordUserAction.record("MobileMenuNewTab.AppMenu"); @@ -1982,6 +1984,7 @@ // are dropped when an incognito tab is open. RecordUserAction.record("MobileMenuNewIncognitoTab"); RecordUserAction.record("MobileNewTabOpened"); + ReturnToChromeExperimentsUtil.onNewTabOpened(); reportNewTabShortcutUsed(true); if (fromMenu) RecordUserAction.record("MobileMenuNewIncognitoTab.AppMenu"); getTabCreator(true).launchNTP(); @@ -2031,6 +2034,7 @@ NewTabPageUma.recordAction(NewTabPageUma.ACTION_OPENED_RECENT_TABS_MANAGER); } RecordUserAction.record("MobileMenuRecentTabs"); + ReturnToChromeExperimentsUtil.onRecentTabsOpened(); } else if (id == R.id.close_tab) { getCurrentTabModel().closeTab(currentTab, true, false, true); RecordUserAction.record("MobileTabClosed");
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/accessibility/settings/AccessibilitySettings.java b/chrome/android/java/src/org/chromium/chrome/browser/accessibility/settings/AccessibilitySettings.java index d2db113..309e100 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/accessibility/settings/AccessibilitySettings.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/accessibility/settings/AccessibilitySettings.java
@@ -23,7 +23,6 @@ import org.chromium.components.browser_ui.settings.ChromeBaseCheckBoxPreference; import org.chromium.components.browser_ui.settings.SettingsUtils; import org.chromium.components.user_prefs.UserPrefs; -import org.chromium.content_public.browser.ContentFeatureList; /** * Fragment to keep track of all the accessibility related preferences. @@ -35,7 +34,6 @@ static final String PREF_READER_FOR_ACCESSIBILITY = "reader_for_accessibility"; static final String PREF_CAPTIONS = "captions"; static final String PREF_IMAGE_DESCRIPTIONS = "image_descriptions"; - static final String PREF_ACCESSIBILITY_PAGE_ZOOM = "accessibility_page_zoom"; private TextScalePreference mTextScalePref; private ChromeBaseCheckBoxPreference mForceEnableZoomPref; @@ -108,10 +106,6 @@ Preference imageDescriptionsPreference = findPreference(PREF_IMAGE_DESCRIPTIONS); imageDescriptionsPreference.setVisible( ImageDescriptionsController.getInstance().shouldShowImageDescriptionsMenuItem()); - - Preference accessibilityPageZoomPreference = findPreference(PREF_ACCESSIBILITY_PAGE_ZOOM); - accessibilityPageZoomPreference.setVisible(ContentFeatureList.isEnabled( - ContentFeatureList.ACCESSIBILITY_PAGE_ZOOM_UPDATED_UI)); } @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/app/ChromeActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/app/ChromeActivity.java index c6a07ac8..eb5f68a 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/app/ChromeActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/app/ChromeActivity.java
@@ -174,6 +174,7 @@ import org.chromium.chrome.browser.tabmodel.TabModelSelectorSupplier; import org.chromium.chrome.browser.tabmodel.TabModelSelectorTabObserver; import org.chromium.chrome.browser.tabmodel.TabModelUtils; +import org.chromium.chrome.browser.tasks.ReturnToChromeExperimentsUtil; import org.chromium.chrome.browser.toolbar.ControlContainer; import org.chromium.chrome.browser.toolbar.ToolbarManager; import org.chromium.chrome.browser.translate.TranslateAssistContent; @@ -2392,6 +2393,7 @@ NewTabPageUma.recordAction(NewTabPageUma.ACTION_OPENED_HISTORY_MANAGER); } RecordUserAction.record("MobileMenuHistory"); + ReturnToChromeExperimentsUtil.onHistoryOpened(); HistoryManagerUtils.showHistoryManager( this, currentTab, getTabModelSelector().isIncognitoSelected()); RecordHistogram.recordEnumeratedHistogram("Android.OpenHistoryFromMenu.PerProfileType",
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/app/flags/ChromeCachedFlags.java b/chrome/android/java/src/org/chromium/chrome/browser/app/flags/ChromeCachedFlags.java index c9b0bf9..3edacae9 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/app/flags/ChromeCachedFlags.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/app/flags/ChromeCachedFlags.java
@@ -117,6 +117,7 @@ new ArrayList<CachedFieldTrialParameter>() { { add(ChimeFeatures.ALWAYS_REGISTER); + add(StartSurfaceConfiguration.BEHAVIOURAL_TARGETING); add(ConditionalTabStripUtils.CONDITIONAL_TAB_STRIP_INFOBAR_LIMIT); add(ConditionalTabStripUtils.CONDITIONAL_TAB_STRIP_INFOBAR_PERIOD); add(ConditionalTabStripUtils.CONDITIONAL_TAB_STRIP_SESSION_TIME_MS); @@ -127,6 +128,8 @@ add(StartSurfaceConfiguration.FINALE_ANIMATION_ENABLED); add(StartSurfaceConfiguration.HOME_BUTTON_ON_GRID_TAB_SWITCHER); add(StartSurfaceConfiguration.NEW_SURFACE_FROM_HOME_BUTTON); + add(StartSurfaceConfiguration.NUM_DAYS_KEEP_SHOW_START_AT_STARTUP); + add(StartSurfaceConfiguration.NUM_DAYS_USER_CLICK_BELOW_THRESHOLD); add(StartSurfaceConfiguration.OMNIBOX_FOCUSED_ON_NEW_TAB); add(StartSurfaceConfiguration.SHOW_NTP_TILES_ON_OMNIBOX); add(StartSurfaceConfiguration.SHOW_TABS_IN_MRU_ORDER); @@ -140,6 +143,7 @@ add(StartSurfaceConfiguration.START_SURFACE_VARIATION); add(StartSurfaceConfiguration.SUPPORT_ACCESSIBILITY); add(StartSurfaceConfiguration.TAB_COUNT_BUTTON_ON_START_SURFACE); + add(StartSurfaceConfiguration.USER_CLICK_THRESHOLD); add(StartSurfaceConfiguration.WARM_UP_RENDERER); add(StartupPaintPreviewHelper.ACCESSIBILITY_SUPPORT_PARAM); add(CommerceSubscriptionsServiceConfig.STALE_TAB_LOWER_BOUND_SECONDS);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/tile/TileGroupDelegateImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/tile/TileGroupDelegateImpl.java index 362334e..cabcb845 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/tile/TileGroupDelegateImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/tile/TileGroupDelegateImpl.java
@@ -16,6 +16,7 @@ import org.chromium.chrome.browser.suggestions.SuggestionsMetrics; import org.chromium.chrome.browser.suggestions.SuggestionsNavigationDelegate; import org.chromium.chrome.browser.suggestions.mostvisited.MostVisitedSites; +import org.chromium.chrome.browser.tasks.ReturnToChromeExperimentsUtil; import org.chromium.chrome.browser.ui.messages.snackbar.Snackbar; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager.SnackbarController; @@ -144,6 +145,7 @@ private void recordOpenedTile(Tile tile) { NewTabPageUma.recordAction(NewTabPageUma.ACTION_OPENED_MOST_VISITED_TILE); RecordUserAction.record("MobileNTPMostVisited"); + ReturnToChromeExperimentsUtil.onMVTileOpened(); mMostVisitedSites.recordOpenedMostVisitedItem(tile); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tasks/ReturnToChromeExperimentsUtil.java b/chrome/android/java/src/org/chromium/chrome/browser/tasks/ReturnToChromeExperimentsUtil.java index 8ef52b5..3854ad0 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tasks/ReturnToChromeExperimentsUtil.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tasks/ReturnToChromeExperimentsUtil.java
@@ -17,6 +17,7 @@ import org.chromium.base.IntentUtils; import org.chromium.base.Log; import org.chromium.base.StrictModeContext; +import org.chromium.base.TimeUtils; import org.chromium.base.TraceEvent; import org.chromium.base.library_loader.LibraryLoader; import org.chromium.base.metrics.RecordHistogram; @@ -61,6 +62,10 @@ public final class ReturnToChromeExperimentsUtil { private static final String TAG = "TabSwitcherOnReturn"; + @VisibleForTesting + public static final long INVALID_DECISION_TIMESTAMP = -1L; + public static final long MILLISECONDS_PER_DAY = TimeUtils.SECONDS_PER_DAY * 1000; + /** An inner class to monitor the state of a newly create Tab. */ private static class TabStateObserver implements UrlFocusChangeListener { private final Tab mNewTab; @@ -492,15 +497,20 @@ // If the overview page won't be shown on startup, stops here. if (!tabSwitcherOnReturn) return false; - // We only check the sync status when flag CHECK_SYNC_BEFORE_SHOW_START_AT_STARTUP and the - // Start surface are both enabled. - if (StartSurfaceConfiguration.CHECK_SYNC_BEFORE_SHOW_START_AT_STARTUP.getValue() - && ReturnToChromeExperimentsUtil.isStartSurfaceHomepageEnabled()) { - return ReturnToChromeExperimentsUtil.isPrimaryAccountSync(); + if (ReturnToChromeExperimentsUtil.isStartSurfaceHomepageEnabled()) { + if (StartSurfaceConfiguration.CHECK_SYNC_BEFORE_SHOW_START_AT_STARTUP.getValue()) { + // We only check the sync status when flag CHECK_SYNC_BEFORE_SHOW_START_AT_STARTUP + // and the Start surface are both enabled. + return ReturnToChromeExperimentsUtil.isPrimaryAccountSync(); + } else if (!TextUtils.isEmpty( + StartSurfaceConfiguration.BEHAVIOURAL_TARGETING.getValue())) { + return ReturnToChromeExperimentsUtil.userBehaviourSupported(); + } } // If Start surface is disable and should show the Grid tab switcher at startup, or flag - // CHECK_SYNC_BEFORE_SHOW_START_AT_STARTUP isn't enabled, return true here. + // CHECK_SYNC_BEFORE_SHOW_START_AT_STARTUP and behavioural targeting flag aren't enabled, + // return true here. return true; } @@ -526,6 +536,142 @@ ChromePreferenceKeys.PRIMARY_ACCOUNT_SYNC, isPrimaryAccountSync); } + /** + * Returns whether to show the Start surface at startup based on whether user has done the + * targeted behaviour. + */ + public static boolean userBehaviourSupported() { + SharedPreferencesManager manager = SharedPreferencesManager.getInstance(); + long nextDecisionTimestamp = + manager.readLong(ChromePreferenceKeys.START_NEXT_SHOW_ON_STARTUP_DECISION_MS, + INVALID_DECISION_TIMESTAMP); + boolean noPreviousHistory = nextDecisionTimestamp == INVALID_DECISION_TIMESTAMP; + // If this is the first time we make a decision, don't show the Start surface at startup. + if (noPreviousHistory) { + resetTargetBehaviourAndNextDecisionTime(false, null); + return false; + } + + // Returns the current decision before the next decision timestamp. + if (System.currentTimeMillis() < nextDecisionTimestamp) { + return SharedPreferencesManager.getInstance().readBoolean( + ChromePreferenceKeys.START_SHOW_ON_STARTUP, false); + } + + // Shows the start surface st startup for a period of time If the user has clicked the UI; + // otherwise, hides it. + String key = getBehaviourType(StartSurfaceConfiguration.BEHAVIOURAL_TARGETING.getValue()); + int clicks = manager.readInt(key, 0); + boolean showStartOnStartup = + clicks >= StartSurfaceConfiguration.USER_CLICK_THRESHOLD.getValue(); + resetTargetBehaviourAndNextDecisionTime(showStartOnStartup, key); + return showStartOnStartup; + } + + /** + * Returns the ChromePreferenceKeys of the type to record in the SharedPreference. + * @param behaviourType: the type of targeted behaviour. + */ + private static @Nullable String getBehaviourType(String behaviourType) { + switch (behaviourType) { + case "mv_tiles": + return ChromePreferenceKeys.TAP_MV_TILES_COUNT; + case "feeds": + return ChromePreferenceKeys.TAP_FEED_CARDS_COUNT; + case "open_new_tab": + return ChromePreferenceKeys.OPEN_NEW_TAB_PAGE_COUNT; + case "open_history": + return ChromePreferenceKeys.OPEN_HISTORY_COUNT; + case "open_recent_tabs": + return ChromePreferenceKeys.OPEN_RECENT_TABS_COUNT; + default: + return null; + } + } + + private static void resetTargetBehaviourAndNextDecisionTime( + boolean showStartOnStartup, @Nullable String behaviourTypeKey) { + long nextDecisionTime = System.currentTimeMillis(); + + if (showStartOnStartup) { + nextDecisionTime += MILLISECONDS_PER_DAY + * StartSurfaceConfiguration.NUM_DAYS_KEEP_SHOW_START_AT_STARTUP.getValue(); + } else { + nextDecisionTime += MILLISECONDS_PER_DAY + * StartSurfaceConfiguration.NUM_DAYS_USER_CLICK_BELOW_THRESHOLD.getValue(); + } + SharedPreferencesManager.getInstance().writeBoolean( + ChromePreferenceKeys.START_SHOW_ON_STARTUP, showStartOnStartup); + SharedPreferencesManager.getInstance().writeLong( + ChromePreferenceKeys.START_NEXT_SHOW_ON_STARTUP_DECISION_MS, nextDecisionTime); + + if (behaviourTypeKey != null) { + SharedPreferencesManager.getInstance().removeKey(behaviourTypeKey); + } + } + + /** + * Called when a targeted behaviour happens. It may increase the count if the corresponding + * behaviour targeting type is set. + */ + @VisibleForTesting + public static void onUIClicked(String chromePreferenceKey) { + String type = StartSurfaceConfiguration.BEHAVIOURAL_TARGETING.getValue(); + if (TextUtils.isEmpty(type) + || !TextUtils.equals(getBehaviourType(type), chromePreferenceKey)) { + return; + } + + int currentCount = SharedPreferencesManager.getInstance().readInt(chromePreferenceKey, 0); + SharedPreferencesManager.getInstance().writeInt(chromePreferenceKey, currentCount + 1); + } + + /** + * Called when the "New Tab" from menu or "+" button is clicked. The count is only recorded when + * the behavioural targeting is enabled on the Start surface. + */ + public static void onNewTabOpened() { + onUIClicked(ChromePreferenceKeys.OPEN_NEW_TAB_PAGE_COUNT); + } + + /** + * Called when the "History" menu is clicked. The count is only recorded when the behavioural + * targeting is enabled on the Start surface. + */ + public static void onHistoryOpened() { + onUIClicked(ChromePreferenceKeys.OPEN_HISTORY_COUNT); + } + + /** + * Called when the "Recent tabs" menu is clicked. The count is only recorded when the + * behavioural targeting is enabled on the Start surface. + */ + public static void onRecentTabsOpened() { + onUIClicked(ChromePreferenceKeys.OPEN_RECENT_TABS_COUNT); + } + + /** + * Called when a Feed card is opened in 1) a foreground tab; 2) a background tab and 3) an + * incognito tab. The count is only recorded when the behavioural targeting is enabledf on the + * Start surface. + */ + public static void onFeedCardOpened() { + onUIClicked(ChromePreferenceKeys.TAP_FEED_CARDS_COUNT); + } + + /** + * Called when a MV tile is opened. The count is only recorded when the behavioural targeting is + * enabled on the Start surface. + */ + public static void onMVTileOpened() { + onUIClicked(ChromePreferenceKeys.TAP_MV_TILES_COUNT); + } + + @VisibleForTesting + public static String getBehaviourTypeKeyForTesting(String key) { + return getBehaviourType(key); + } + @VisibleForTesting public static void setSyncForTesting(boolean isSyncing) { SharedPreferencesManager manager = SharedPreferencesManager.getInstance();
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/feed/v2/FeedStreamTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/feed/v2/FeedStreamTest.java index 85403d9..502cf5d3 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/feed/v2/FeedStreamTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/feed/v2/FeedStreamTest.java
@@ -26,8 +26,8 @@ import android.util.ArrayMap; import android.util.TypedValue; import android.widget.FrameLayout; -import android.widget.TextView; +import androidx.appcompat.widget.AppCompatTextView; import androidx.recyclerview.widget.RecyclerView; import androidx.test.filters.SmallTest; @@ -619,7 +619,7 @@ (FeedStream.FeedSurfaceActionsHandler) mContentManager.getContextValues(0).get( SurfaceActionsHandler.KEY); - handler.showBottomSheet(new TextView(mActivity), null); + handler.showBottomSheet(new AppCompatTextView(mActivity), null); verify(mBottomSheetController).requestShowContent(any(), anyBoolean()); } @@ -631,7 +631,7 @@ (FeedStream.FeedSurfaceActionsHandler) mContentManager.getContextValues(0).get( SurfaceActionsHandler.KEY); - handler.showBottomSheet(new TextView(mActivity), null); + handler.showBottomSheet(new AppCompatTextView(mActivity), null); mFeedStream.dismissBottomSheet(); verify(mBottomSheetController).hideContent(any(), anyBoolean()); } @@ -830,7 +830,7 @@ List<NtpListContentManager.FeedContent> contentList = new ArrayList<>(); for (int i = 0; i < number; i++) { contentList.add(new NtpListContentManager.NativeViewContent( - HEADER_PREFIX + i, new TextView(mActivity))); + HEADER_PREFIX + i, new AppCompatTextView(mActivity))); } mContentManager.addContents(0, contentList); }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/feed/v2/NativeViewListRendererTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/feed/v2/NativeViewListRendererTest.java index 6786bfb7..2ad570c 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/feed/v2/NativeViewListRendererTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/feed/v2/NativeViewListRendererTest.java
@@ -18,6 +18,7 @@ import android.widget.FrameLayout; import android.widget.TextView; +import androidx.appcompat.widget.AppCompatTextView; import androidx.recyclerview.widget.RecyclerView; import androidx.test.filters.SmallTest; @@ -170,7 +171,7 @@ } private NtpListContentManager.FeedContent createContent(String text) { - TextView v = new TextView(mContext); + TextView v = new AppCompatTextView(mContext); v.setText(text); return new NtpListContentManager.NativeViewContent(v.toString(), v); }
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 6fb1c7ca..6e3489d 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -5975,23 +5975,26 @@ <ph name="BREAK"><br></ph> Learn about the data Google Drive collects and why <ph name="BEGIN_LINK"><a href="https://support.google.com/drive/answer/2450387" target="_blank"></ph>here<ph name="END_LINK"></a></ph>. </message> - <message name="IDS_NTP_MODULES_PHOTOS_TITLE" desc="Title shown in the header of the photos module and various other UIs."> - Google Photos + <message name="IDS_NTP_MODULES_PHOTOS_TITLE" desc="Title shown in the header of the photos module."> + From your Google Photos </message> - <message name="IDS_NTP_MODULES_PHOTOS_MEMORIES_HIDE_TODAY" desc="Label used to hide Google Photos Memories from the new tab page for today."> - Hide memories for today + <message name="IDS_NTP_MODULES_PHOTOS_MEMORIES_TITLE" desc="Title shown for Google Photos Memories in the list of available cards for the new tab page."> + Google Photos memories + </message> + <message name="IDS_NTP_MODULES_PHOTOS_MEMORIES_HIDE_TODAY" desc="Part of label (combined with IDS_NTP_MODULES_DISMISS_BUTTON_TEXT) used to hide Google Photos Memories from the new tab page for today."> + your memories for today </message> <message name="IDS_NTP_MODULES_PHOTOS_MEMORIES_HIDDEN_TODAY" desc="Confirmation text shown when Google Photos Memories were hidden from the new tab page for today."> Memories hidden for today </message> - <message name="IDS_NTP_MODULES_PHOTOS_MEMORIES_DISABLE" desc="Label used to disable Google Photos Memories from the new tab page."> - Never show memories + <message name="IDS_NTP_MODULES_PHOTOS_MEMORIES_DISABLE" desc="Part of label (combined with IDS_NTP_MODULES_DISABLE_BUTTON_TEXT) used to disable Google Photos Memories from the new tab page."> + memories </message> - <message name="IDS_NTP_MODULES_PHOTOS_MEMORIES_DISABLED" desc="Confirmation text shown when the Google Photos Memories module is disabled from the new tab page."> - All memories hidden + <message name="IDS_NTP_MODULES_PHOTOS_MEMORIES_DISABLED" desc="Part of confirmation text (combined with IDS_NTP_MODULES_DISABLE_TOAST_MESSAGE) shown when the Google Photos Memories module is disabled from the new tab page."> + memories from Google Photos </message> <message name="IDS_NTP_MODULES_PHOTOS_INFO" desc="Text shown in the body of the info dialog of the Photos module."> - Your Memories from Google Photos are shown here. They are visible only when you’re signed in. + Your memories from Google Photos are shown here. They are visible only to you, whenever you’re signed in. <ph name="BREAK"><br></ph> <ph name="BREAK"><br></ph> Manage what you see in your memories at <ph name="BEGIN_LINK"><a href="https://photos.google.com/settings" target="_blank"></ph>photos.google.com/settings<ph name="END_LINK"></a></ph>. @@ -6003,7 +6006,7 @@ See your memories here </message> <message name="IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_TEXT" desc="Text for the opt-in UI for Google Photos in the new tab page."> - You’ll see your memories from Google Photos here. They’ll only show when you’re signed in. + Start exploring your memories from Google Photos, whenever you’re signed in. </message> <message name="IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_BUTTON_OPT_IN" desc="Label of the button to opt-in of Google Photos in the new tab page."> See memories
diff --git a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_INFO.png.sha1 b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_INFO.png.sha1 index 232b463..8d3375a0 100644 --- a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_INFO.png.sha1 +++ b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_INFO.png.sha1
@@ -1 +1 @@ -761ed6895997d7447ed9d8b4d82c8bfac9d85241 \ No newline at end of file +d1361415167ebd8d14176f29c3437a0658a89c93 \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_DISABLE.png.sha1 b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_DISABLE.png.sha1 index 13eb59fa..408b82c 100644 --- a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_DISABLE.png.sha1 +++ b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_DISABLE.png.sha1
@@ -1 +1 @@ -9533441bac054532772d42e0fe29168272f13ecc \ No newline at end of file +30da01f537dd8b5ac7b65551fe023b845f4f9e27 \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_DISABLED.png.sha1 b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_DISABLED.png.sha1 index 32cae66..2627f38 100644 --- a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_DISABLED.png.sha1 +++ b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_DISABLED.png.sha1
@@ -1 +1 @@ -d2edb67587ca46b7dfd5cfdbae81e0aa36eb7b18 \ No newline at end of file +b933824f356bf36ee245631fbdaf338a76fb72e8 \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_HIDE_TODAY.png.sha1 b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_HIDE_TODAY.png.sha1 index 13eb59fa..408b82c 100644 --- a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_HIDE_TODAY.png.sha1 +++ b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_HIDE_TODAY.png.sha1
@@ -1 +1 @@ -9533441bac054532772d42e0fe29168272f13ecc \ No newline at end of file +30da01f537dd8b5ac7b65551fe023b845f4f9e27 \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_TITLE.png.sha1 b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_TITLE.png.sha1 new file mode 100644 index 0000000..007f68b --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_TITLE.png.sha1
@@ -0,0 +1 @@ +ec2eb2ffd22446cbdea8fc435bfac30276bb7fb9 \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_TEXT.png.sha1 b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_TEXT.png.sha1 index 34dbedb..a32e63b 100644 --- a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_TEXT.png.sha1 +++ b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_MEMORIES_WELCOME_TEXT.png.sha1
@@ -1 +1 @@ -96415d2481956732ec758c1d1adb7554eb885a4f \ No newline at end of file +8fb3d822ddb252a44caf10ea1056e6abd3239fa9 \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_TITLE.png.sha1 b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_TITLE.png.sha1 index c4c8948..65ffe5b 100644 --- a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_TITLE.png.sha1 +++ b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_PHOTOS_TITLE.png.sha1
@@ -1 +1 @@ -75580300f38744f4acebf073d3fcebc4bd5825c4 \ No newline at end of file +f59d65add723034c143abd34c12cd2a204f83e93 \ No newline at end of file
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp index f546683..f0981c0 100644 --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp
@@ -2533,7 +2533,7 @@ <message name="IDS_SETTINGS_SITE_SETTINGS_APP_PROTOCOL_HANDLERS" desc="Label for the app protocol handlers (e.g. mailto) in site settings."> Apps </message> - <message name="IDS_SETTINGS_SITE_SETTINGS_APP_APPROVED_PROTOCOL_HANDLERS_DESCRIPTION" desc="Description of the approved protocol handlers list registered with the OS, where the user has previously permitted the app to handle the protocol."> + <message name="IDS_SETTINGS_SITE_SETTINGS_APP_ALLOWED_PROTOCOL_HANDLERS_DESCRIPTION" desc="Description of the allowed protocol handlers list registered with the OS, where the user has previously permitted the app to handle the protocol."> Apps listed below can handle protocol links as well. Other apps will ask for permission. </message> <message name="IDS_SETTINGS_SITE_SETTINGS_APP_DISALLOWED_PROTOCOL_HANDLERS_DESCRIPTION" desc="Description of the disallowed protocol handlers list. The user has previously diallowed the launch of these apps.">
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 47dbf45..134e3b9 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -5845,6 +5845,10 @@ ] } + if (is_chromeos_lacros) { + deps += [ "//chromeos/ui/base" ] + } + if (is_posix && !is_mac) { # TODO(crbug.com/1226159): Complete crash reporting integration on Fuchsia. sources += [
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 1f15621..cb101e2 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -2564,13 +2564,6 @@ base::size(kSubresourceRedirectLoginRobotsBasedCompression), nullptr}}; #if BUILDFLAG(IS_CHROMEOS_ASH) -const FeatureEntry::FeatureVariation - kOmniboxRichEntitiesInLauncherVariations[] = { - {"with linked Suggest experiment", {}, 0, "t4461027"}, -}; -#endif // BUILDFLAG(IS_CHROMEOS_ASH) - -#if BUILDFLAG(IS_CHROMEOS_ASH) const FeatureEntry::FeatureParam kCategoricalSearch_Unranked[] = { {"ranking", "none"}}; @@ -4659,7 +4652,7 @@ "OmniboxBundledExperimentV1")}, {"memories", flag_descriptions::kMemoriesName, - flag_descriptions::kMemoriesDescription, kOsAll, + flag_descriptions::kMemoriesDescription, kOsDesktop, FEATURE_WITH_PARAMS_VALUE_TYPE(history_clusters::kMemories, kMemoriesVariations, "Memories")}, @@ -5862,12 +5855,6 @@ FEATURE_VALUE_TYPE(features::kSearchHistoryLink)}, #if defined(OS_ANDROID) - {"safe-browsing-client-side-detection-android", - flag_descriptions::kSafeBrowsingClientSideDetectionAndroidName, - flag_descriptions::kSafeBrowsingClientSideDetectionAndroidDescription, - kOsAndroid, - FEATURE_VALUE_TYPE(safe_browsing::kClientSideDetectionForAndroid)}, - {"safe-browsing-enhanced-protection-promo-android", flag_descriptions::kEnhancedProtectionPromoAndroidName, flag_descriptions::kEnhancedProtectionPromoAndroidDescription, kOsAndroid, @@ -6873,16 +6860,6 @@ FEATURE_VALUE_TYPE(printing::features::kEnableOopPrintDrivers)}, #endif -#if BUILDFLAG(IS_CHROMEOS_ASH) - {"omnibox-rich-entities-in-launcher", - flag_descriptions::kOmniboxRichEntitiesInLauncherName, - flag_descriptions::kOmniboxRichEntitiesInLauncherDescription, kOsCrOS, - FEATURE_WITH_PARAMS_VALUE_TYPE( - app_list_features::kEnableOmniboxRichEntities, - kOmniboxRichEntitiesInLauncherVariations, - "OmniboxRichEntitiesInLauncher")}, -#endif - {"enable-browsing-data-lifetime-manager", flag_descriptions::kEnableBrowsingDataLifetimeManagerName, flag_descriptions::kEnableBrowsingDataLifetimeManagerDescription, kOsAll, @@ -7570,12 +7547,6 @@ FEATURE_VALUE_TYPE(share::kShareMenu)}, #endif - {"enable-safe-browsing-per-profile-network-contexts", - flag_descriptions::kSafeBrowsingPerProfileNetworkContextsName, - flag_descriptions::kSafeBrowsingPerProfileNetworkContextsDescription, - kOsDesktop, - FEATURE_VALUE_TYPE(safe_browsing::kSafeBrowsingSeparateNetworkContexts)}, - #if BUILDFLAG(IS_CHROMEOS_LACROS) {"multi-profile-account-consistency", flag_descriptions::kMultiProfileAccountConsistencyName,
diff --git a/chrome/browser/android/bookmarks/bookmark_bridge.cc b/chrome/browser/android/bookmarks/bookmark_bridge.cc index 7d48fa2..ec9625c1 100644 --- a/chrome/browser/android/bookmarks/bookmark_bridge.cc +++ b/chrome/browser/android/bookmarks/bookmark_bridge.cc
@@ -601,7 +601,7 @@ jint type) { const BookmarkNode* node = GetNodeByID(id, type); std::unique_ptr<power_bookmarks::PowerBookmarkMeta> meta = - power_bookmarks::GetNodePowerBookmarkMeta(node); + power_bookmarks::GetNodePowerBookmarkMeta(bookmark_model_, node); std::string proto_bytes; if (meta)
diff --git a/chrome/browser/apps/app_service/app_platform_metrics.cc b/chrome/browser/apps/app_service/app_platform_metrics.cc index a29eef5..aa26b43 100644 --- a/chrome/browser/apps/app_service/app_platform_metrics.cc +++ b/chrome/browser/apps/app_service/app_platform_metrics.cc
@@ -158,7 +158,7 @@ // The app type may be kSystemWeb (system web apps in Ash when // Lacros web apps are enabled), or kWeb (all other cases). type_name = - (update.InstallSource() == apps::mojom::InstallSource::kSystem) + (update.InstallSource() == apps::mojom::InstallReason::kSystem) ? apps::AppTypeName::kSystemWeb : apps::AppTypeName::kWeb; window_mode = update.WindowMode(); @@ -184,21 +184,21 @@ return apps::AppTypeName::kWeb; } -std::string GetInstallSource(apps::mojom::InstallSource install_source) { - switch (install_source) { - case apps::mojom::InstallSource::kUnknown: +std::string GetInstallSource(apps::mojom::InstallReason install_reason) { + switch (install_reason) { + case apps::mojom::InstallReason::kUnknown: return kInstallSourceUnknownHistogram; - case apps::mojom::InstallSource::kSystem: + case apps::mojom::InstallReason::kSystem: return kInstallSourceSystemHistogram; - case apps::mojom::InstallSource::kPolicy: + case apps::mojom::InstallReason::kPolicy: return kInstallSourcePolicyHistogram; - case apps::mojom::InstallSource::kOem: + case apps::mojom::InstallReason::kOem: return kInstallSourceOemHistogram; - case apps::mojom::InstallSource::kDefault: + case apps::mojom::InstallReason::kDefault: return kInstallSourcePreloadHistogram; - case apps::mojom::InstallSource::kSync: + case apps::mojom::InstallReason::kSync: return kInstallSourceSyncHistogram; - case apps::mojom::InstallSource::kUser: + case apps::mojom::InstallReason::kUser: return kInstallSourceUserHistogram; } } @@ -644,10 +644,10 @@ std::string AppPlatformMetrics::GetAppsCountPerInstallSourceHistogramNameForTest( AppTypeName app_type_name, - apps::mojom::InstallSource install_source) { + apps::mojom::InstallReason install_reason) { return kAppsCountPerInstallSourceHistogramPrefix + GetAppTypeHistogramName(app_type_name) + "." + - GetInstallSource(install_source); + GetInstallSource(install_reason); } // static @@ -1049,7 +1049,7 @@ void AppPlatformMetrics::RecordAppsCount(apps::mojom::AppType app_type) { std::map<AppTypeName, int> app_count; - std::map<AppTypeName, std::map<apps::mojom::InstallSource, int>> + std::map<AppTypeName, std::map<apps::mojom::InstallReason, int>> app_count_per_install_source; app_registry_cache_.ForEachApp( [app_type, this, &app_count, @@ -1244,11 +1244,11 @@ case apps::mojom::AppType::kWeb: case apps::mojom::AppType::kSystemWeb: { std::string publisher_id; - apps::mojom::InstallSource install_source; - app_registry_cache_.ForOneApp(app_id, [&publisher_id, &install_source]( + apps::mojom::InstallReason install_reason; + app_registry_cache_.ForOneApp(app_id, [&publisher_id, &install_reason]( const apps::AppUpdate& update) { publisher_id = update.PublisherId(); - install_source = update.InstallSource(); + install_reason = update.InstallSource(); }); if (publisher_id.empty()) { return ukm::kInvalidSourceId; @@ -1259,7 +1259,7 @@ break; } if (app_type == apps::mojom::AppType::kSystemWeb || - install_source == apps::mojom::InstallSource::kSystem) { + install_reason == apps::mojom::InstallReason::kSystem) { // For system web apps, call GetSourceIdForChromeApp to record the app // id because the url could be filtered by the server side. source_id = ukm::AppSourceUrlRecorder::GetSourceIdForChromeApp(app_id);
diff --git a/chrome/browser/apps/app_service/app_platform_metrics.h b/chrome/browser/apps/app_service/app_platform_metrics.h index fbe9ee60..27d2b17 100644 --- a/chrome/browser/apps/app_service/app_platform_metrics.h +++ b/chrome/browser/apps/app_service/app_platform_metrics.h
@@ -146,7 +146,7 @@ // UMA metrics name for installed apps count per InstallSource in Chrome OS. static std::string GetAppsCountPerInstallSourceHistogramNameForTest( AppTypeName app_type_name, - apps::mojom::InstallSource install_source); + apps::mojom::InstallReason install_reason); // UMA metrics name for apps running duration in Chrome OS. static std::string GetAppsRunningDurationHistogramNameForTest(
diff --git a/chrome/browser/apps/app_service/app_platform_metrics_service_unittest.cc b/chrome/browser/apps/app_service/app_platform_metrics_service_unittest.cc index 47185133..43663e8 100644 --- a/chrome/browser/apps/app_service/app_platform_metrics_service_unittest.cc +++ b/chrome/browser/apps/app_service/app_platform_metrics_service_unittest.cc
@@ -73,13 +73,13 @@ apps::mojom::AppType app_type, const std::string& publisher_id, apps::mojom::Readiness readiness, - apps::mojom::InstallSource install_source) { + apps::mojom::InstallReason install_reason) { apps::mojom::AppPtr app = apps::mojom::App::New(); app->app_id = app_id; app->app_type = app_type; app->publisher_id = publisher_id; app->readiness = readiness; - app->install_source = install_source; + app->install_reason = install_reason; return app; } @@ -162,67 +162,67 @@ deltas.push_back(MakeApp(/*app_id=*/"a", apps::mojom::AppType::kArc, "com.google.A", apps::mojom::Readiness::kReady, - apps::mojom::InstallSource::kUser)); + apps::mojom::InstallReason::kUser)); cache.OnApps(std::move(deltas), apps::mojom::AppType::kArc, true /* should_notify_initialized */); deltas.clear(); deltas.push_back(MakeApp(/*app_id=*/"bu", apps::mojom::AppType::kBuiltIn, "", apps::mojom::Readiness::kReady, - apps::mojom::InstallSource::kSystem)); + apps::mojom::InstallReason::kSystem)); cache.OnApps(std::move(deltas), apps::mojom::AppType::kBuiltIn, true /* should_notify_initialized */); deltas.clear(); deltas.push_back(MakeApp(/*app_id=*/"c", apps::mojom::AppType::kCrostini, "", apps::mojom::Readiness::kReady, - apps::mojom::InstallSource::kUser)); + apps::mojom::InstallReason::kUser)); cache.OnApps(std::move(deltas), apps::mojom::AppType::kCrostini, true /* should_notify_initialized */); deltas.clear(); deltas.push_back(MakeApp(/*app_id=*/"w", apps::mojom::AppType::kWeb, "https://foo.com", apps::mojom::Readiness::kReady, - apps::mojom::InstallSource::kSync)); + apps::mojom::InstallReason::kSync)); cache.OnApps(std::move(deltas), apps::mojom::AppType::kWeb, false /* should_notify_initialized */); deltas.clear(); deltas.push_back(MakeApp(/*app_id=*/"w2", apps::mojom::AppType::kWeb, "https://foo2.com", apps::mojom::Readiness::kReady, - apps::mojom::InstallSource::kSync)); + apps::mojom::InstallReason::kSync)); cache.OnApps(std::move(deltas), apps::mojom::AppType::kWeb, true /* should_notify_initialized */); deltas.clear(); deltas.push_back(MakeApp( /*app_id=*/"s", apps::mojom::AppType::kSystemWeb, "https://os-settings", - apps::mojom::Readiness::kReady, apps::mojom::InstallSource::kSystem)); + apps::mojom::Readiness::kReady, apps::mojom::InstallReason::kSystem)); cache.OnApps(std::move(deltas), apps::mojom::AppType::kWeb, true /* should_notify_initialized */); deltas.clear(); deltas.push_back(MakeApp(/*app_id=*/"u", apps::mojom::AppType::kUnknown, "", apps::mojom::Readiness::kReady, - apps::mojom::InstallSource::kUnknown)); + apps::mojom::InstallReason::kUnknown)); deltas.push_back(MakeApp( /*app_id=*/"m", apps::mojom::AppType::kMacOs, "", - apps::mojom::Readiness::kReady, apps::mojom::InstallSource::kUnknown)); + apps::mojom::Readiness::kReady, apps::mojom::InstallReason::kUnknown)); deltas.push_back(MakeApp( /*app_id=*/"p", apps::mojom::AppType::kPluginVm, "", - apps::mojom::Readiness::kReady, apps::mojom::InstallSource::kUser)); + apps::mojom::Readiness::kReady, apps::mojom::InstallReason::kUser)); deltas.push_back(MakeApp( /*app_id=*/"l", apps::mojom::AppType::kStandaloneBrowser, "", - apps::mojom::Readiness::kReady, apps::mojom::InstallSource::kSystem)); + apps::mojom::Readiness::kReady, apps::mojom::InstallReason::kSystem)); deltas.push_back(MakeApp( /*app_id=*/"lcr", apps::mojom::AppType::kStandaloneBrowserExtension, "", - apps::mojom::Readiness::kReady, apps::mojom::InstallSource::kUser)); + apps::mojom::Readiness::kReady, apps::mojom::InstallReason::kUser)); deltas.push_back(MakeApp( /*app_id=*/"r", apps::mojom::AppType::kRemote, "", - apps::mojom::Readiness::kReady, apps::mojom::InstallSource::kPolicy)); + apps::mojom::Readiness::kReady, apps::mojom::InstallReason::kPolicy)); deltas.push_back(MakeApp(/*app_id=*/"bo", apps::mojom::AppType::kBorealis, "", apps::mojom::Readiness::kReady, - apps::mojom::InstallSource::kOem)); + apps::mojom::InstallReason::kOem)); cache.OnApps(std::move(deltas), apps::mojom::AppType::kUnknown, false /* should_notify_initialized */); } @@ -236,7 +236,7 @@ std::vector<apps::mojom::AppPtr> deltas; apps::AppRegistryCache& cache = proxy->AppRegistryCache(); deltas.push_back(MakeApp(app_id.c_str(), app_type, publisher_id, readiness, - apps::mojom::InstallSource::kUser)); + apps::mojom::InstallReason::kUser)); cache.OnApps(std::move(deltas), apps::mojom::AppType::kUnknown, false /* should_notify_initialized */); } @@ -247,7 +247,7 @@ /*expected_count=*/1); histogram_tester_.ExpectTotalCount( AppPlatformMetrics::GetAppsCountPerInstallSourceHistogramNameForTest( - AppTypeName::kArc, apps::mojom::InstallSource::kUser), + AppTypeName::kArc, apps::mojom::InstallReason::kUser), /*expected_count=*/1); histogram_tester_.ExpectTotalCount( AppPlatformMetrics::GetAppsCountHistogramNameForTest( @@ -255,7 +255,7 @@ /*expected_count=*/1); histogram_tester_.ExpectTotalCount( AppPlatformMetrics::GetAppsCountPerInstallSourceHistogramNameForTest( - AppTypeName::kBuiltIn, apps::mojom::InstallSource::kSystem), + AppTypeName::kBuiltIn, apps::mojom::InstallReason::kSystem), /*expected_count=*/1); histogram_tester_.ExpectTotalCount( AppPlatformMetrics::GetAppsCountHistogramNameForTest( @@ -263,7 +263,7 @@ /*expected_count=*/1); histogram_tester_.ExpectTotalCount( AppPlatformMetrics::GetAppsCountPerInstallSourceHistogramNameForTest( - AppTypeName::kCrostini, apps::mojom::InstallSource::kUser), + AppTypeName::kCrostini, apps::mojom::InstallReason::kUser), /*expected_count=*/1); histogram_tester_.ExpectTotalCount( AppPlatformMetrics::GetAppsCountHistogramNameForTest( @@ -274,7 +274,7 @@ /*expected_count=*/1); histogram_tester_.ExpectTotalCount( AppPlatformMetrics::GetAppsCountPerInstallSourceHistogramNameForTest( - AppTypeName::kWeb, apps::mojom::InstallSource::kSync), + AppTypeName::kWeb, apps::mojom::InstallReason::kSync), /*expected_count=*/1); histogram_tester_.ExpectTotalCount( AppPlatformMetrics::GetAppsCountHistogramNameForTest( @@ -282,7 +282,7 @@ /*expected_count=*/1); histogram_tester_.ExpectTotalCount( AppPlatformMetrics::GetAppsCountPerInstallSourceHistogramNameForTest( - AppTypeName::kMacOs, apps::mojom::InstallSource::kUnknown), + AppTypeName::kMacOs, apps::mojom::InstallReason::kUnknown), /*expected_count=*/1); histogram_tester_.ExpectTotalCount( AppPlatformMetrics::GetAppsCountHistogramNameForTest( @@ -290,7 +290,7 @@ /*expected_count=*/1); histogram_tester_.ExpectTotalCount( AppPlatformMetrics::GetAppsCountPerInstallSourceHistogramNameForTest( - AppTypeName::kPluginVm, apps::mojom::InstallSource::kUser), + AppTypeName::kPluginVm, apps::mojom::InstallReason::kUser), /*expected_count=*/1); histogram_tester_.ExpectTotalCount( AppPlatformMetrics::GetAppsCountHistogramNameForTest( @@ -299,7 +299,7 @@ histogram_tester_.ExpectTotalCount( AppPlatformMetrics::GetAppsCountPerInstallSourceHistogramNameForTest( AppTypeName::kStandaloneBrowser, - apps::mojom::InstallSource::kSystem), + apps::mojom::InstallReason::kSystem), /*expected_count=*/1); histogram_tester_.ExpectTotalCount( AppPlatformMetrics::GetAppsCountHistogramNameForTest( @@ -308,7 +308,7 @@ histogram_tester_.ExpectTotalCount( AppPlatformMetrics::GetAppsCountPerInstallSourceHistogramNameForTest( AppTypeName::kStandaloneBrowserExtension, - apps::mojom::InstallSource::kUser), + apps::mojom::InstallReason::kUser), /*expected_count=*/1); histogram_tester_.ExpectTotalCount( AppPlatformMetrics::GetAppsCountHistogramNameForTest( @@ -317,7 +317,7 @@ histogram_tester_.ExpectTotalCount( AppPlatformMetrics::GetAppsCountPerInstallSourceHistogramNameForTest( AppTypeName::kStandaloneBrowserExtension, - apps::mojom::InstallSource::kUser), + apps::mojom::InstallReason::kUser), /*expected_count=*/1); histogram_tester_.ExpectTotalCount( AppPlatformMetrics::GetAppsCountHistogramNameForTest( @@ -325,7 +325,7 @@ /*expected_count=*/1); histogram_tester_.ExpectTotalCount( AppPlatformMetrics::GetAppsCountPerInstallSourceHistogramNameForTest( - AppTypeName::kRemote, apps::mojom::InstallSource::kPolicy), + AppTypeName::kRemote, apps::mojom::InstallReason::kPolicy), /*expected_count=*/1); histogram_tester_.ExpectTotalCount( AppPlatformMetrics::GetAppsCountHistogramNameForTest( @@ -333,7 +333,7 @@ /*expected_count=*/1); histogram_tester_.ExpectTotalCount( AppPlatformMetrics::GetAppsCountPerInstallSourceHistogramNameForTest( - AppTypeName::kBorealis, apps::mojom::InstallSource::kOem), + AppTypeName::kBorealis, apps::mojom::InstallReason::kOem), /*expected_count=*/1); histogram_tester_.ExpectTotalCount( AppPlatformMetrics::GetAppsCountHistogramNameForTest( @@ -341,7 +341,7 @@ /*expected_count=*/1); histogram_tester_.ExpectTotalCount( AppPlatformMetrics::GetAppsCountPerInstallSourceHistogramNameForTest( - AppTypeName::kSystemWeb, apps::mojom::InstallSource::kSystem), + AppTypeName::kSystemWeb, apps::mojom::InstallReason::kSystem), /*expected_count=*/1); } @@ -568,7 +568,7 @@ void VerifyInstalledAppsUkm(const std::string& app_info, AppTypeName app_type_name, - apps::mojom::InstallSource install_source, + apps::mojom::InstallReason install_reason, InstallTime install_time) { const auto entries = test_ukm_recorder()->GetEntriesByName("ChromeOSApp.InstalledApp"); @@ -583,7 +583,7 @@ test_ukm_recorder()->ExpectEntryMetric(entry, "AppType", (int)app_type_name); test_ukm_recorder()->ExpectEntryMetric(entry, "InstallSource", - (int)install_source); + (int)install_reason); test_ukm_recorder()->ExpectEntryMetric(entry, "InstallTime", (int)install_time); } @@ -1399,15 +1399,15 @@ TEST_F(AppPlatformMetricsServiceTest, InstalledAppsUkm) { // Verify the apps installed during the init phase. VerifyInstalledAppsUkm("app://com.google.A", AppTypeName::kArc, - apps::mojom::InstallSource::kUser, InstallTime::kInit); + apps::mojom::InstallReason::kUser, InstallTime::kInit); VerifyInstalledAppsUkm("app://bu", AppTypeName::kBuiltIn, - apps::mojom::InstallSource::kSystem, + apps::mojom::InstallReason::kSystem, InstallTime::kInit); VerifyInstalledAppsUkm("app://s", AppTypeName::kSystemWeb, - apps::mojom::InstallSource::kSystem, + apps::mojom::InstallReason::kSystem, InstallTime::kInit); VerifyInstalledAppsUkm("https://foo.com", AppTypeName::kWeb, - apps::mojom::InstallSource::kSync, InstallTime::kInit); + apps::mojom::InstallReason::kSync, InstallTime::kInit); // Install a new ARC app during the running time. InstallOneApp("aa", apps::mojom::AppType::kArc, "com.google.AA", @@ -1415,7 +1415,7 @@ // Verify the ARC app installed during the running time. VerifyInstalledAppsUkm("app://com.google.AA", AppTypeName::kArc, - apps::mojom::InstallSource::kUser, + apps::mojom::InstallReason::kUser, InstallTime::kRunning); }
diff --git a/chrome/browser/apps/app_service/app_service_proxy_unittest.cc b/chrome/browser/apps/app_service/app_service_proxy_unittest.cc index 144e56c..43ebc9c 100644 --- a/chrome/browser/apps/app_service/app_service_proxy_unittest.cc +++ b/chrome/browser/apps/app_service/app_service_proxy_unittest.cc
@@ -270,7 +270,7 @@ std::vector<mojom::AppPtr> apps; mojom::AppPtr app = PublisherBase::MakeApp( mojom::AppType::kWeb, kTestAppId, mojom::Readiness::kReady, "Test App", - mojom::InstallSource::kUser); + mojom::InstallReason::kUser); app->intent_filters.push_back( apps_util::CreateIntentFilterForUrlScope(kTestUrl)); apps.push_back(std::move(app)); @@ -334,7 +334,7 @@ std::vector<mojom::AppPtr> apps; mojom::AppPtr app1 = PublisherBase::MakeApp( mojom::AppType::kWeb, kTestAppId1, mojom::Readiness::kReady, "Test App", - mojom::InstallSource::kUser); + mojom::InstallReason::kUser); app1->intent_filters.push_back(url_filter_1.Clone()); app1->intent_filters.push_back(url_filter_2.Clone()); app1->intent_filters.push_back(send_filter.Clone()); @@ -342,7 +342,7 @@ mojom::AppPtr app2 = PublisherBase::MakeApp( mojom::AppType::kWeb, kTestAppId2, mojom::Readiness::kReady, "Test App", - mojom::InstallSource::kUser); + mojom::InstallReason::kUser); app2->intent_filters.push_back(url_filter_1.Clone()); apps.push_back(std::move(app2));
diff --git a/chrome/browser/apps/app_service/publishers/arc_apps.cc b/chrome/browser/apps/app_service/publishers/arc_apps.cc index adb543e..5528608e 100644 --- a/chrome/browser/apps/app_service/publishers/arc_apps.cc +++ b/chrome/browser/apps/app_service/publishers/arc_apps.cc
@@ -1338,29 +1338,29 @@ is_placeholder_icon, icon_effects, std::move(callback)); } -apps::mojom::InstallSource GetInstallSource( +apps::mojom::InstallReason GetInstallSource( const ArcAppListPrefs* prefs, const std::string& app_id, const ArcAppListPrefs::AppInfo& app_info) { // Sticky represents apps that cannot be uninstalled and are installed by the // system. if (app_info.sticky) { - return apps::mojom::InstallSource::kSystem; + return apps::mojom::InstallReason::kSystem; } if (prefs->IsOem(app_id)) { - return apps::mojom::InstallSource::kOem; + return apps::mojom::InstallReason::kOem; } if (prefs->IsDefault(app_id)) { - return apps::mojom::InstallSource::kDefault; + return apps::mojom::InstallReason::kDefault; } if (prefs->IsControlledByPolicy(app_info.package_name)) { - return apps::mojom::InstallSource::kPolicy; + return apps::mojom::InstallReason::kPolicy; } - return apps::mojom::InstallSource::kUser; + return apps::mojom::InstallReason::kUser; } apps::mojom::AppPtr ArcApps::Convert(ArcAppListPrefs* prefs,
diff --git a/chrome/browser/apps/app_service/publishers/borealis_apps.cc b/chrome/browser/apps/app_service/publishers/borealis_apps.cc index 36b6a3e..67f0087 100644 --- a/chrome/browser/apps/app_service/publishers/borealis_apps.cc +++ b/chrome/browser/apps/app_service/publishers/borealis_apps.cc
@@ -70,7 +70,7 @@ allowed ? apps::mojom::Readiness::kReady : apps::mojom::Readiness::kDisabledByPolicy, l10n_util::GetStringUTF8(IDS_BOREALIS_APP_NAME), - apps::mojom::InstallSource::kUser); + apps::mojom::InstallReason::kUser); app->icon_key = apps::mojom::IconKey::New( apps::mojom::IconKey::kDoesNotChangeOverTime, @@ -139,7 +139,7 @@ apps::mojom::AppPtr app = PublisherBase::MakeApp( apps::mojom::AppType::kBorealis, registration.app_id(), apps::mojom::Readiness::kReady, registration.Name(), - apps::mojom::InstallSource::kUser); + apps::mojom::InstallReason::kUser); const std::string& executable_file_name = registration.ExecutableFileName(); if (!executable_file_name.empty()) { @@ -288,7 +288,7 @@ apps::mojom::AppPtr app = apps::PublisherBase::MakeApp( apps::mojom::AppType::kBorealis, shelf_app_id, apps::mojom::Readiness::kReady, shelf_app_name, - apps::mojom::InstallSource::kUser); + apps::mojom::InstallReason::kUser); app->icon_key = apps::mojom::IconKey::New( apps::mojom::IconKey::kDoesNotChangeOverTime,
diff --git a/chrome/browser/apps/app_service/publishers/built_in_chromeos_apps.cc b/chrome/browser/apps/app_service/publishers/built_in_chromeos_apps.cc index ebb6ea46..c0eb450 100644 --- a/chrome/browser/apps/app_service/publishers/built_in_chromeos_apps.cc +++ b/chrome/browser/apps/app_service/publishers/built_in_chromeos_apps.cc
@@ -35,7 +35,7 @@ apps::mojom::AppType::kBuiltIn, internal_app.app_id, apps::mojom::Readiness::kReady, l10n_util::GetStringUTF8(internal_app.name_string_resource_id), - apps::mojom::InstallSource::kSystem); + apps::mojom::InstallReason::kSystem); if (internal_app.searchable_string_resource_id != 0) { app->additional_search_terms.push_back(
diff --git a/chrome/browser/apps/app_service/publishers/crostini_apps.cc b/chrome/browser/apps/app_service/publishers/crostini_apps.cc index 3dfb610..13f6979 100644 --- a/chrome/browser/apps/app_service/publishers/crostini_apps.cc +++ b/chrome/browser/apps/app_service/publishers/crostini_apps.cc
@@ -263,7 +263,7 @@ apps::mojom::AppPtr app = PublisherBase::MakeApp( apps::mojom::AppType::kCrostini, registration.app_id(), apps::mojom::Readiness::kReady, registration.Name(), - apps::mojom::InstallSource::kUser); + apps::mojom::InstallReason::kUser); const std::string& executable_file_name = registration.ExecutableFileName(); if (!executable_file_name.empty()) {
diff --git a/chrome/browser/apps/app_service/publishers/extension_apps_base.cc b/chrome/browser/apps/app_service/publishers/extension_apps_base.cc index 605bcc8..0950b79a 100644 --- a/chrome/browser/apps/app_service/publishers/extension_apps_base.cc +++ b/chrome/browser/apps/app_service/publishers/extension_apps_base.cc
@@ -113,26 +113,26 @@ } } -apps::mojom::InstallSource GetInstallSource( +apps::mojom::InstallReason GetInstallSource( const Profile* profile, const extensions::Extension* extension) { if (extensions::Manifest::IsComponentLocation(extension->location())) { - return apps::mojom::InstallSource::kSystem; + return apps::mojom::InstallReason::kSystem; } if (extensions::Manifest::IsPolicyLocation(extension->location())) { - return apps::mojom::InstallSource::kPolicy; + return apps::mojom::InstallReason::kPolicy; } if (extension->was_installed_by_oem()) { - return apps::mojom::InstallSource::kOem; + return apps::mojom::InstallReason::kOem; } if (extension->was_installed_by_default()) { - return apps::mojom::InstallSource::kDefault; + return apps::mojom::InstallReason::kDefault; } - return apps::mojom::InstallSource::kUser; + return apps::mojom::InstallReason::kUser; } } // namespace @@ -535,7 +535,7 @@ app->app_id = extension->id(); app->readiness = apps::mojom::Readiness::kReady; app->name = extension->name(); - app->install_source = GetInstallSource(profile_, extension); + app->install_reason = GetInstallSource(profile_, extension); Publish(std::move(app), subscribers_); }
diff --git a/chrome/browser/apps/app_service/publishers/plugin_vm_apps.cc b/chrome/browser/apps/app_service/publishers/plugin_vm_apps.cc index c78cb88..63e8db60 100644 --- a/chrome/browser/apps/app_service/publishers/plugin_vm_apps.cc +++ b/chrome/browser/apps/app_service/publishers/plugin_vm_apps.cc
@@ -94,7 +94,7 @@ allowed ? apps::mojom::Readiness::kReady : apps::mojom::Readiness::kDisabledByPolicy, l10n_util::GetStringUTF8(IDS_PLUGIN_VM_APP_NAME), - apps::mojom::InstallSource::kUser); + apps::mojom::InstallReason::kUser); app->icon_key = apps::mojom::IconKey::New( apps::mojom::IconKey::kDoesNotChangeOverTime, @@ -292,7 +292,7 @@ apps::mojom::AppPtr app = PublisherBase::MakeApp( apps::mojom::AppType::kPluginVm, registration.app_id(), apps::mojom::Readiness::kReady, registration.Name(), - apps::mojom::InstallSource::kUser); + apps::mojom::InstallReason::kUser); if (new_icon_key) { auto icon_effects = IconEffects::kCrOsStandardIcon;
diff --git a/chrome/browser/apps/app_service/publishers/remote_apps.cc b/chrome/browser/apps/app_service/publishers/remote_apps.cc index d1a0d51b..d6d9dc9 100644 --- a/chrome/browser/apps/app_service/publishers/remote_apps.cc +++ b/chrome/browser/apps/app_service/publishers/remote_apps.cc
@@ -55,7 +55,7 @@ const ash::RemoteAppsModel::AppInfo& info) { apps::mojom::AppPtr app = PublisherBase::MakeApp( mojom::AppType::kRemote, info.id, mojom::Readiness::kReady, info.name, - mojom::InstallSource::kUser); + mojom::InstallReason::kUser); app->show_in_launcher = mojom::OptionalBool::kTrue; app->show_in_management = mojom::OptionalBool::kFalse; app->show_in_search = mojom::OptionalBool::kTrue;
diff --git a/chrome/browser/apps/app_service/publishers/standalone_browser_apps.cc b/chrome/browser/apps/app_service/publishers/standalone_browser_apps.cc index 7da65c6..f0829dd 100644 --- a/chrome/browser/apps/app_service/publishers/standalone_browser_apps.cc +++ b/chrome/browser/apps/app_service/publishers/standalone_browser_apps.cc
@@ -40,7 +40,7 @@ apps::mojom::AppType::kStandaloneBrowser, extension_misc::kLacrosAppId, apps::mojom::Readiness::kReady, "Lacros", // TODO(jamescook): Localized name. - apps::mojom::InstallSource::kSystem); + apps::mojom::InstallReason::kSystem); // Make Lacros searchable with the term "chrome", too. app->additional_search_terms.push_back("chrome"); app->icon_key = NewIconKey(State::kReady);
diff --git a/chrome/browser/apps/app_service/publishers/web_apps_crosapi.cc b/chrome/browser/apps/app_service/publishers/web_apps_crosapi.cc index 1a7645c..f83b2d4 100644 --- a/chrome/browser/apps/app_service/publishers/web_apps_crosapi.cc +++ b/chrome/browser/apps/app_service/publishers/web_apps_crosapi.cc
@@ -134,11 +134,11 @@ proxy->AppRegistryCache().ForOneApp( app_id, [&is_system_web_app, &can_use_uninstall, &display_mode](const apps::AppUpdate& update) { - if (update.InstallSource() == apps::mojom::InstallSource::kSystem) { + if (update.InstallSource() == apps::mojom::InstallReason::kSystem) { is_system_web_app = true; can_use_uninstall = false; } else if (update.InstallSource() == - apps::mojom::InstallSource::kPolicy) { + apps::mojom::InstallReason::kPolicy) { can_use_uninstall = false; } display_mode = update.WindowMode();
diff --git a/chrome/browser/apps/app_service/webapk/webapk_manager.cc b/chrome/browser/apps/app_service/webapk/webapk_manager.cc index 8111b48e1..d3c6d33 100644 --- a/chrome/browser/apps/app_service/webapk/webapk_manager.cc +++ b/chrome/browser/apps/app_service/webapk/webapk_manager.cc
@@ -271,7 +271,7 @@ return false; } - if (app.InstallSource() == apps::mojom::InstallSource::kSystem) { + if (app.InstallSource() == apps::mojom::InstallReason::kSystem) { return false; }
diff --git a/chrome/browser/apps/app_shim/web_app_shim_manager_delegate_mac.cc b/chrome/browser/apps/app_shim/web_app_shim_manager_delegate_mac.cc index 82f7f7ac..959ff680 100644 --- a/chrome/browser/apps/app_shim/web_app_shim_manager_delegate_mac.cc +++ b/chrome/browser/apps/app_shim/web_app_shim_manager_delegate_mac.cc
@@ -245,7 +245,7 @@ return; } - if (!registrar.IsApprovedLaunchProtocol(app_id, protocol_url.scheme())) { + if (!registrar.IsAllowedLaunchProtocol(app_id, protocol_url.scheme())) { auto launch_callback = base::BindOnce(&OnProtocolHandlerDialogCompleted, std::move(params), profile);
diff --git a/chrome/browser/ash/app_restore/arc_ghost_window_view_unittest.cc b/chrome/browser/ash/app_restore/arc_ghost_window_view_unittest.cc index 65f682fb..e0ef5b3 100644 --- a/chrome/browser/ash/app_restore/arc_ghost_window_view_unittest.cc +++ b/chrome/browser/ash/app_restore/arc_ghost_window_view_unittest.cc
@@ -36,11 +36,11 @@ apps::mojom::AppPtr MakeApp(const char* app_id, apps::mojom::AppType app_type, - apps::mojom::InstallSource install_source) { + apps::mojom::InstallReason install_reason) { apps::mojom::AppPtr app = apps::mojom::App::New(); app->app_id = app_id; app->app_type = app_type; - app->install_source = install_source; + app->install_reason = install_reason; return app; } @@ -82,7 +82,7 @@ std::vector<apps::mojom::AppPtr> deltas; apps::AppRegistryCache& cache = proxy->AppRegistryCache(); deltas.push_back(MakeApp(app_id.c_str(), apps::mojom::AppType::kArc, - apps::mojom::InstallSource::kUser)); + apps::mojom::InstallReason::kUser)); cache.OnApps(std::move(deltas), apps::mojom::AppType::kUnknown, false /* should_notify_initialized */); }
diff --git a/chrome/browser/ash/apps/intent_helper/common_apps_navigation_throttle.cc b/chrome/browser/ash/apps/intent_helper/common_apps_navigation_throttle.cc index 9b058a95..c709323 100644 --- a/chrome/browser/ash/apps/intent_helper/common_apps_navigation_throttle.cc +++ b/chrome/browser/ash/apps/intent_helper/common_apps_navigation_throttle.cc
@@ -101,7 +101,7 @@ apps::AppServiceProxyFactory::GetForProfile(profile) ->AppRegistryCache() .ForOneApp(app_id, [&is_system_web_app](const apps::AppUpdate& update) { - if (update.InstallSource() == apps::mojom::InstallSource::kSystem) { + if (update.InstallSource() == apps::mojom::InstallReason::kSystem) { is_system_web_app = true; } });
diff --git a/chrome/browser/ash/login/easy_unlock/smartlock_feature_usage_metrics.cc b/chrome/browser/ash/login/easy_unlock/smartlock_feature_usage_metrics.cc new file mode 100644 index 0000000..b4f5e02 --- /dev/null +++ b/chrome/browser/ash/login/easy_unlock/smartlock_feature_usage_metrics.cc
@@ -0,0 +1,79 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ash/login/easy_unlock/smartlock_feature_usage_metrics.h" + +#include "chromeos/components/feature_usage/feature_usage_metrics.h" +#include "chromeos/services/multidevice_setup/public/cpp/multidevice_setup_client.h" + +namespace ash { +namespace { +using chromeos::multidevice_setup::mojom::Feature; +using chromeos::multidevice_setup::mojom::FeatureState; + +const char kFeatureName[] = "SmartLock"; +} // namespace + +SmartLockFeatureUsageMetrics::SmartLockFeatureUsageMetrics( + chromeos::multidevice_setup::MultiDeviceSetupClient* + multi_device_setup_client) + : multi_device_setup_client_(multi_device_setup_client), + feature_usage_metrics_(kFeatureName, this) {} + +void SmartLockFeatureUsageMetrics::RecordUsage(bool success) { + feature_usage_metrics_.RecordUsage(success); +} + +bool SmartLockFeatureUsageMetrics::IsEligible() const { + if (!multi_device_setup_client_) { + // EasyUnlockServiceSignin cannot determine Eligible/Enabled values, so + // it injects a null MultiDeviceSetupClient reference. Therefore, a null + // MultiDeviceSetupClient reference implies that Eligible/Enabled are always + // true. + return true; + } + + switch (multi_device_setup_client_->GetFeatureState(Feature::kSmartLock)) { + case FeatureState::kUnavailableNoVerifiedHost: + FALLTHROUGH; + case FeatureState::kNotSupportedByChromebook: + FALLTHROUGH; + case FeatureState::kNotSupportedByPhone: + return false; + + case FeatureState::kProhibitedByPolicy: + FALLTHROUGH; + case FeatureState::kDisabledByUser: + FALLTHROUGH; + case FeatureState::kEnabledByUser: + FALLTHROUGH; + case FeatureState::kUnavailableInsufficientSecurity: + FALLTHROUGH; + case FeatureState::kUnavailableSuiteDisabled: + FALLTHROUGH; + case FeatureState::kFurtherSetupRequired: + FALLTHROUGH; + case FeatureState::kUnavailableTopLevelFeatureDisabled: + return true; + } +} + +bool SmartLockFeatureUsageMetrics::IsEnabled() const { + if (!multi_device_setup_client_) { + // EasyUnlockServiceSignin cannot determine Eligible/Enabled values, so + // it injects a null MultiDeviceSetupClient reference. Therefore, a null + // MultiDeviceSetupClient reference implies that Eligible/Enabled are always + // true. + return true; + } + + if (multi_device_setup_client_->GetFeatureState(Feature::kSmartLock) == + FeatureState::kEnabledByUser) { + return true; + } + + return false; +} + +} // namespace ash
diff --git a/chrome/browser/ash/login/easy_unlock/smartlock_feature_usage_metrics.h b/chrome/browser/ash/login/easy_unlock/smartlock_feature_usage_metrics.h new file mode 100644 index 0000000..72e597f --- /dev/null +++ b/chrome/browser/ash/login/easy_unlock/smartlock_feature_usage_metrics.h
@@ -0,0 +1,43 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_ASH_LOGIN_EASY_UNLOCK_SMARTLOCK_FEATURE_USAGE_METRICS_H_ +#define CHROME_BROWSER_ASH_LOGIN_EASY_UNLOCK_SMARTLOCK_FEATURE_USAGE_METRICS_H_ + +#include "chromeos/components/feature_usage/feature_usage_metrics.h" + +namespace chromeos { +namespace multidevice_setup { +class MultiDeviceSetupClient; +} // namespace multidevice_setup +} // namespace chromeos + +namespace ash { + +// Tracks Smart Lock feature usage for the Standard Feature Usage Logging +// (SFUL) framework. +class SmartLockFeatureUsageMetrics + : public feature_usage::FeatureUsageMetrics::Delegate { + public: + explicit SmartLockFeatureUsageMetrics( + chromeos::multidevice_setup::MultiDeviceSetupClient* + multi_device_setup_client); + + // To be called by the owner of this SmartLockFeatureUsageMetrics + // instance when the user uses the feature. + void RecordUsage(bool success); + + private: + // feature_usage::FeatureUsageMetrics::Delegate: + bool IsEligible() const override; + bool IsEnabled() const override; + + chromeos::multidevice_setup::MultiDeviceSetupClient* + multi_device_setup_client_; + feature_usage::FeatureUsageMetrics feature_usage_metrics_; +}; + +} // namespace ash + +#endif // CHROME_BROWSER_ASH_LOGIN_EASY_UNLOCK_SMARTLOCK_FEATURE_USAGE_METRICS_H_
diff --git a/chrome/browser/ash/login/easy_unlock/smartlock_feature_usage_metrics_unittest.cc b/chrome/browser/ash/login/easy_unlock/smartlock_feature_usage_metrics_unittest.cc new file mode 100644 index 0000000..7bd0fc6 --- /dev/null +++ b/chrome/browser/ash/login/easy_unlock/smartlock_feature_usage_metrics_unittest.cc
@@ -0,0 +1,121 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <memory> + +#include "base/test/metrics/histogram_tester.h" +#include "base/test/task_environment.h" +#include "chrome/browser/ash/login/easy_unlock/smartlock_feature_usage_metrics.h" +#include "chromeos/components/feature_usage/feature_usage_metrics.h" +#include "chromeos/services/multidevice_setup/public/cpp/fake_multidevice_setup_client.h" +#include "chromeos/services/multidevice_setup/public/cpp/multidevice_setup_client_impl.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace ash { +namespace { + +using chromeos::multidevice_setup::mojom::Feature; +using chromeos::multidevice_setup::mojom::FeatureState; + +class SmartLockFeatureUsageMetricsTest : public ::testing::Test { + protected: + SmartLockFeatureUsageMetricsTest() = default; + ~SmartLockFeatureUsageMetricsTest() override = default; + + void TestFeatureState(FeatureState feature_state, + bool expected_eligible_value, + bool expected_enabled_value) { + fake_multidevice_setup_client_.SetFeatureState(Feature::kSmartLock, + feature_state); + EXPECT_EQ(expected_eligible_value, feature_usage_metrics_->IsEligible()); + EXPECT_EQ(expected_enabled_value, feature_usage_metrics_->IsEnabled()); + } + + chromeos::multidevice_setup::FakeMultiDeviceSetupClient + fake_multidevice_setup_client_; + std::unique_ptr<feature_usage::FeatureUsageMetrics::Delegate> + feature_usage_metrics_; + base::test::TaskEnvironment task_environment_; +}; + +TEST_F(SmartLockFeatureUsageMetricsTest, NullMultiDeviceSetupClient) { + feature_usage_metrics_ = + std::make_unique<SmartLockFeatureUsageMetrics>(nullptr); + + EXPECT_TRUE(feature_usage_metrics_->IsEnabled()); + EXPECT_TRUE(feature_usage_metrics_->IsEligible()); +} + +TEST_F(SmartLockFeatureUsageMetricsTest, EnabledAndEligibleFeatureStates) { + feature_usage_metrics_ = std::make_unique<SmartLockFeatureUsageMetrics>( + &fake_multidevice_setup_client_); + + TestFeatureState(FeatureState::kProhibitedByPolicy, + /*expected_eligible_value=*/true, + /*expected_enabled_value=*/false); + TestFeatureState(FeatureState::kDisabledByUser, + /*expected_eligible_value=*/true, + /*expected_enabled_value=*/false); + TestFeatureState(FeatureState::kEnabledByUser, + /*expected_eligible_value=*/true, + /*expected_enabled_value=*/true); + TestFeatureState(FeatureState::kNotSupportedByChromebook, + /*expected_eligible_value=*/false, + /*expected_enabled_value=*/false); + TestFeatureState(FeatureState::kNotSupportedByPhone, + /*expected_eligible_value=*/false, + /*expected_enabled_value=*/false); + TestFeatureState(FeatureState::kUnavailableNoVerifiedHost, + /*expected_eligible_value=*/false, + /*expected_enabled_value=*/false); + TestFeatureState(FeatureState::kUnavailableInsufficientSecurity, + /*expected_eligible_value=*/true, + /*expected_enabled_value=*/false); + TestFeatureState(FeatureState::kUnavailableSuiteDisabled, + /*expected_eligible_value=*/true, + /*expected_enabled_value=*/false); + TestFeatureState(FeatureState::kFurtherSetupRequired, + /*expected_eligible_value=*/true, + /*expected_enabled_value=*/false); + TestFeatureState(FeatureState::kUnavailableTopLevelFeatureDisabled, + /*expected_eligible_value=*/true, + /*expected_enabled_value=*/false); +} + +TEST_F(SmartLockFeatureUsageMetricsTest, RecordUsage) { + SmartLockFeatureUsageMetrics feature_usage_metrics_( + &fake_multidevice_setup_client_); + base::HistogramTester histograms; + + // feature_usage_metrics_ must be both eligible and enabled in order for + // RecordUsage method to be used. + fake_multidevice_setup_client_.SetFeatureState(Feature::kSmartLock, + FeatureState::kEnabledByUser); + + histograms.ExpectBucketCount( + "ChromeOS.FeatureUsage.SmartLock", + feature_usage::FeatureUsageMetrics::Event::kUsedWithSuccess, 0); + histograms.ExpectBucketCount( + "ChromeOS.FeatureUsage.SmartLock", + feature_usage::FeatureUsageMetrics::Event::kUsedWithFailure, 0); + + feature_usage_metrics_.RecordUsage(/*success=*/true); + histograms.ExpectBucketCount( + "ChromeOS.FeatureUsage.SmartLock", + feature_usage::FeatureUsageMetrics::Event::kUsedWithSuccess, 1); + histograms.ExpectBucketCount( + "ChromeOS.FeatureUsage.SmartLock", + feature_usage::FeatureUsageMetrics::Event::kUsedWithFailure, 0); + + feature_usage_metrics_.RecordUsage(/*success=*/false); + histograms.ExpectBucketCount( + "ChromeOS.FeatureUsage.SmartLock", + feature_usage::FeatureUsageMetrics::Event::kUsedWithSuccess, 1); + histograms.ExpectBucketCount( + "ChromeOS.FeatureUsage.SmartLock", + feature_usage::FeatureUsageMetrics::Event::kUsedWithFailure, 1); +} + +} // namespace +} // namespace ash
diff --git a/chrome/browser/ash/login/reporting/login_logout_record.proto b/chrome/browser/ash/login/reporting/login_logout_record.proto index aa26cf5..af3d9e03 100644 --- a/chrome/browser/ash/login/reporting/login_logout_record.proto +++ b/chrome/browser/ash/login/reporting/login_logout_record.proto
@@ -6,11 +6,9 @@ option optimize_for = LITE_RUNTIME; -package ash.reporting; +import "components/reporting/proto/common_event_support/session_affiliated_user.proto"; -message SessionAffiliatedUser { - optional string user_email = 1; -} +package ash.reporting; enum LoginFailureReason { UNKNOWN = 0; @@ -36,7 +34,7 @@ message LoginLogoutRecord { optional int64 event_timestamp = 1; - optional SessionAffiliatedUser affiliated_user = 2; + optional .reporting.SessionAffiliatedUser affiliated_user = 2; optional bool is_guest_session = 3;
diff --git a/chrome/browser/ash/policy/reporting/user_added_removed/user_added_removed_record.proto b/chrome/browser/ash/policy/reporting/user_added_removed/user_added_removed_record.proto index 3e86007..1181d20 100644 --- a/chrome/browser/ash/policy/reporting/user_added_removed/user_added_removed_record.proto +++ b/chrome/browser/ash/policy/reporting/user_added_removed/user_added_removed_record.proto
@@ -6,11 +6,9 @@ option optimize_for = LITE_RUNTIME; -package reporting; +import "components/reporting/proto/common_event_support/session_affiliated_user.proto"; -message User { - optional string email = 1; -} +package reporting; enum UserRemovalReason { UNKNOWN = 0; @@ -34,7 +32,7 @@ optional int64 event_timestamp_sec = 1; // Omitted if the user is not affiliated. - optional User user = 2; + optional SessionAffiliatedUser affiliated_user = 2; oneof event { UserAddedEvent user_added_event = 3;
diff --git a/chrome/browser/ash/policy/reporting/user_added_removed/user_added_removed_reporter.cc b/chrome/browser/ash/policy/reporting/user_added_removed/user_added_removed_reporter.cc index ab61d835..bdf9725 100644 --- a/chrome/browser/ash/policy/reporting/user_added_removed/user_added_removed_reporter.cc +++ b/chrome/browser/ash/policy/reporting/user_added_removed/user_added_removed_reporter.cc
@@ -54,7 +54,7 @@ UserAddedRemovedRecord record; record.mutable_user_added_event(); if (helper_->ShouldReportUser(email)) { - record.mutable_user()->set_email(email); + record.mutable_affiliated_user()->set_user_email(email); } record.set_event_timestamp_sec(base::Time::Now().ToTimeT()); @@ -95,7 +95,7 @@ UserAddedRemovedRecord record; record.mutable_user_removed_event()->set_reason(UserRemovalReason(reason)); if (is_affiliated_user) { - record.mutable_user()->set_email(account_id.GetUserEmail()); + record.mutable_affiliated_user()->set_user_email(account_id.GetUserEmail()); } record.set_event_timestamp_sec(base::Time::Now().ToTimeT()); @@ -112,7 +112,7 @@ record.mutable_user_removed_event()->set_reason( UserRemovalReason(user.second)); if (user.first != "") { - record.mutable_user()->set_email(user.first); + record.mutable_affiliated_user()->set_user_email(user.first); } helper_->ReportEvent(&record, ::reporting::Priority::IMMEDIATE);
diff --git a/chrome/browser/ash/policy/reporting/user_added_removed/user_added_removed_reporter_unittest.cc b/chrome/browser/ash/policy/reporting/user_added_removed/user_added_removed_reporter_unittest.cc index e51e5d8..9ae94b0 100644 --- a/chrome/browser/ash/policy/reporting/user_added_removed/user_added_removed_reporter_unittest.cc +++ b/chrome/browser/ash/policy/reporting/user_added_removed/user_added_removed_reporter_unittest.cc
@@ -154,8 +154,8 @@ EXPECT_THAT(priority, testing::Eq(::reporting::Priority::IMMEDIATE)); EXPECT_TRUE(record.has_event_timestamp_sec()); EXPECT_TRUE(record.has_user_added_event()); - EXPECT_TRUE(record.has_user()); - ASSERT_EQ(record.user().email(), user_email); + EXPECT_TRUE(record.has_affiliated_user()); + ASSERT_EQ(record.affiliated_user().user_email(), user_email); } TEST_F(UserAddedRemovedReporterTest, TestUnaffiliatedUserAdded) { @@ -187,7 +187,7 @@ EXPECT_THAT(priority, testing::Eq(::reporting::Priority::IMMEDIATE)); EXPECT_TRUE(record.has_event_timestamp_sec()); EXPECT_TRUE(record.has_user_added_event()); - ASSERT_FALSE(record.has_user()); + ASSERT_FALSE(record.has_affiliated_user()); } TEST_F(UserAddedRemovedReporterTest, TestReportingDisabled) { @@ -302,8 +302,9 @@ EXPECT_THAT(priority, testing::Eq(::reporting::Priority::IMMEDIATE)); EXPECT_TRUE(record.has_event_timestamp_sec()); EXPECT_TRUE(record.has_user_removed_event()); - EXPECT_TRUE(record.has_user()); - EXPECT_THAT(record.user().email(), ::testing::StrEq(user_email)); + EXPECT_TRUE(record.has_affiliated_user()); + EXPECT_THAT(record.affiliated_user().user_email(), + ::testing::StrEq(user_email)); EXPECT_THAT(record.user_removed_event().reason(), ::testing::Eq(UserRemovalReason::GAIA_REMOVED)); } @@ -341,7 +342,7 @@ EXPECT_THAT(priority, testing::Eq(::reporting::Priority::IMMEDIATE)); EXPECT_TRUE(record.has_event_timestamp_sec()); EXPECT_TRUE(record.has_user_removed_event()); - EXPECT_FALSE(record.has_user()); + EXPECT_FALSE(record.has_affiliated_user()); EXPECT_THAT(record.user_removed_event().reason(), ::testing::Eq(UserRemovalReason::GAIA_REMOVED)); } @@ -397,8 +398,8 @@ EXPECT_THAT(priority, testing::Eq(::reporting::Priority::IMMEDIATE)); EXPECT_TRUE(record.has_event_timestamp_sec()); EXPECT_TRUE(record.has_user_removed_event()); - EXPECT_TRUE(record.has_user()); - EXPECT_TRUE(record.user().email() == user_email); + EXPECT_TRUE(record.has_affiliated_user()); + EXPECT_EQ(record.affiliated_user().user_email(), user_email); EXPECT_THAT(record.user_removed_event().reason(), ::testing::Eq(UserRemovalReason::REMOTE_ADMIN_INITIATED)); }
diff --git a/chrome/browser/ash/policy/status_collector/device_status_collector.cc b/chrome/browser/ash/policy/status_collector/device_status_collector.cc index 5e0664b..315de2d 100644 --- a/chrome/browser/ash/policy/status_collector/device_status_collector.cc +++ b/chrome/browser/ash/policy/status_collector/device_status_collector.cc
@@ -453,6 +453,10 @@ ::tpm_manager::GetDictionaryAttackInfoRequest(), base::BindOnce(&::policy::TpmStatusCombiner::OnGetDictionaryAttackInfo, tpm_status_combiner)); + chromeos::TpmManagerClient::Get()->GetSupportedFeatures( + ::tpm_manager::GetSupportedFeaturesRequest(), + base::BindOnce(&::policy::TpmStatusCombiner::OnGetSupportedFeatures, + tpm_status_combiner)); } base::Version GetPlatformVersion() {
diff --git a/chrome/browser/ash/policy/status_collector/device_status_collector_browsertest.cc b/chrome/browser/ash/policy/status_collector/device_status_collector_browsertest.cc index 1c908714..273f7a48 100644 --- a/chrome/browser/ash/policy/status_collector/device_status_collector_browsertest.cc +++ b/chrome/browser/ash/policy/status_collector/device_status_collector_browsertest.cc
@@ -2410,6 +2410,13 @@ da_info_reply->set_dictionary_attack_threshold(10); da_info_reply->set_dictionary_attack_lockout_in_effect(false); da_info_reply->set_dictionary_attack_lockout_seconds_remaining(0); + auto* supported_features_reply = chromeos::TpmManagerClient::Get() + ->GetTestInterface() + ->mutable_supported_features_reply(); + supported_features_reply->set_is_allowed(false); + supported_features_reply->set_support_pinweaver(false); + supported_features_reply->set_support_runtime_selection(false); + supported_features_reply->set_support_u2f(false); GetStatus(); @@ -2439,6 +2446,20 @@ EXPECT_EQ(false, device_status_.tpm_status_info().boot_lockbox_finalized()); EXPECT_EQ(tpm_status_reply->is_owner_password_present(), device_status_.tpm_status_info().owner_password_is_present()); + EXPECT_EQ( + supported_features_reply->is_allowed(), + device_status_.tpm_status_info().tpm_supported_features().is_allowed()); + EXPECT_EQ(supported_features_reply->support_pinweaver(), + device_status_.tpm_status_info() + .tpm_supported_features() + .support_pinweaver()); + EXPECT_EQ(supported_features_reply->support_runtime_selection(), + device_status_.tpm_status_info() + .tpm_supported_features() + .support_runtime_selection()); + EXPECT_EQ( + supported_features_reply->support_u2f(), + device_status_.tpm_status_info().tpm_supported_features().support_u2f()); } // Checks if tpm status is partially reported even if any error happens @@ -2455,12 +2476,16 @@ auto* da_info_reply = chromeos::TpmManagerClient::Get() ->GetTestInterface() ->mutable_dictionary_attack_info_reply(); + auto* supported_features_reply = chromeos::TpmManagerClient::Get() + ->GetTestInterface() + ->mutable_supported_features_reply(); tpm_status_reply->set_status(::tpm_manager::STATUS_DBUS_ERROR); enrollment_status_reply->set_prepared_for_enrollment(true); GetStatus(); EXPECT_EQ(enrollment_status_reply->prepared_for_enrollment(), device_status_.tpm_status_info().attestation_prepared()); + EXPECT_TRUE(device_status_.tpm_status_info().has_tpm_supported_features()); // Reset the error status. tpm_status_reply->set_status(::tpm_manager::STATUS_SUCCESS); @@ -2483,8 +2508,20 @@ EXPECT_TRUE(device_status_.has_tpm_status_info()); EXPECT_EQ(tpm_status_reply->is_enabled(), device_status_.tpm_status_info().enabled()); - // Reset the error status (for symmetry). + // Reset the error status. da_info_reply->set_status(::tpm_manager::STATUS_SUCCESS); + + RestartStatusCollector(); + + supported_features_reply->set_status(::tpm_manager::STATUS_DBUS_ERROR); + tpm_status_reply->set_is_enabled(true); + GetStatus(); + EXPECT_TRUE(device_status_.has_tpm_status_info()); + EXPECT_EQ(tpm_status_reply->is_enabled(), + device_status_.tpm_status_info().enabled()); + EXPECT_FALSE(device_status_.tpm_status_info().has_tpm_supported_features()); + // Reset the error status (for symmetry). + supported_features_reply->set_status(::tpm_manager::STATUS_SUCCESS); } TEST_F(DeviceStatusCollectorTest, NoTimeZoneReporting) {
diff --git a/chrome/browser/ash/policy/status_collector/legacy_device_status_collector.cc b/chrome/browser/ash/policy/status_collector/legacy_device_status_collector.cc index 711ad46..046c9bb 100644 --- a/chrome/browser/ash/policy/status_collector/legacy_device_status_collector.cc +++ b/chrome/browser/ash/policy/status_collector/legacy_device_status_collector.cc
@@ -453,6 +453,10 @@ ::tpm_manager::GetDictionaryAttackInfoRequest(), base::BindOnce(&::policy::TpmStatusCombiner::OnGetDictionaryAttackInfo, tpm_status_combiner)); + chromeos::TpmManagerClient::Get()->GetSupportedFeatures( + ::tpm_manager::GetSupportedFeaturesRequest(), + base::BindOnce(&::policy::TpmStatusCombiner::OnGetSupportedFeatures, + tpm_status_combiner)); } base::Version GetPlatformVersion() {
diff --git a/chrome/browser/ash/policy/status_collector/legacy_device_status_collector_browsertest.cc b/chrome/browser/ash/policy/status_collector/legacy_device_status_collector_browsertest.cc index 9a55d087..1810de2 100644 --- a/chrome/browser/ash/policy/status_collector/legacy_device_status_collector_browsertest.cc +++ b/chrome/browser/ash/policy/status_collector/legacy_device_status_collector_browsertest.cc
@@ -2431,6 +2431,13 @@ da_info_reply->set_dictionary_attack_threshold(10); da_info_reply->set_dictionary_attack_lockout_in_effect(false); da_info_reply->set_dictionary_attack_lockout_seconds_remaining(0); + auto* supported_features_reply = chromeos::TpmManagerClient::Get() + ->GetTestInterface() + ->mutable_supported_features_reply(); + supported_features_reply->set_is_allowed(false); + supported_features_reply->set_support_pinweaver(false); + supported_features_reply->set_support_runtime_selection(false); + supported_features_reply->set_support_u2f(false); GetStatus(); @@ -2458,6 +2465,22 @@ device_status_.tpm_status_info() .dictionary_attack_lockout_seconds_remaining()); EXPECT_EQ(false, device_status_.tpm_status_info().boot_lockbox_finalized()); + EXPECT_EQ(tpm_status_reply->is_owner_password_present(), + device_status_.tpm_status_info().owner_password_is_present()); + EXPECT_EQ( + supported_features_reply->is_allowed(), + device_status_.tpm_status_info().tpm_supported_features().is_allowed()); + EXPECT_EQ(supported_features_reply->support_pinweaver(), + device_status_.tpm_status_info() + .tpm_supported_features() + .support_pinweaver()); + EXPECT_EQ(supported_features_reply->support_runtime_selection(), + device_status_.tpm_status_info() + .tpm_supported_features() + .support_runtime_selection()); + EXPECT_EQ( + supported_features_reply->support_u2f(), + device_status_.tpm_status_info().tpm_supported_features().support_u2f()); } // Checks if tpm status is partially reported even if any error happens @@ -2472,12 +2495,16 @@ auto* da_info_reply = chromeos::TpmManagerClient::Get() ->GetTestInterface() ->mutable_dictionary_attack_info_reply(); + auto* supported_features_reply = chromeos::TpmManagerClient::Get() + ->GetTestInterface() + ->mutable_supported_features_reply(); tpm_status_reply->set_status(::tpm_manager::STATUS_DBUS_ERROR); enrollment_status_reply->set_prepared_for_enrollment(true); GetStatus(); EXPECT_EQ(enrollment_status_reply->prepared_for_enrollment(), device_status_.tpm_status_info().attestation_prepared()); + EXPECT_TRUE(device_status_.tpm_status_info().has_tpm_supported_features()); // Reset the error status. tpm_status_reply->set_status(::tpm_manager::STATUS_SUCCESS); @@ -2500,8 +2527,20 @@ EXPECT_TRUE(device_status_.has_tpm_status_info()); EXPECT_EQ(tpm_status_reply->is_enabled(), device_status_.tpm_status_info().enabled()); - // Reset the error status (for symmetry). + // Reset the error status. da_info_reply->set_status(::tpm_manager::STATUS_SUCCESS); + + RestartStatusCollector(); + + supported_features_reply->set_status(::tpm_manager::STATUS_DBUS_ERROR); + tpm_status_reply->set_is_enabled(true); + GetStatus(); + EXPECT_TRUE(device_status_.has_tpm_status_info()); + EXPECT_EQ(tpm_status_reply->is_enabled(), + device_status_.tpm_status_info().enabled()); + EXPECT_FALSE(device_status_.tpm_status_info().has_tpm_supported_features()); + // Reset the error status (for symmetry). + supported_features_reply->set_status(::tpm_manager::STATUS_SUCCESS); } TEST_F(LegacyDeviceStatusCollectorTest, NoTimeZoneReporting) {
diff --git a/chrome/browser/ash/policy/status_collector/tpm_status_combiner.cc b/chrome/browser/ash/policy/status_collector/tpm_status_combiner.cc index e598190..4bc25cb0 100644 --- a/chrome/browser/ash/policy/status_collector/tpm_status_combiner.cc +++ b/chrome/browser/ash/policy/status_collector/tpm_status_combiner.cc
@@ -68,9 +68,29 @@ RunCallbackIfComplete(); } +void TpmStatusCombiner::OnGetSupportedFeatures( + const ::tpm_manager::GetSupportedFeaturesReply& reply) { + has_supported_features_ = true; + if (reply.status() == ::tpm_manager::STATUS_SUCCESS) { + enterprise_management::TpmSupportedFeatures* const + tpm_supported_features_proto = + tpm_status_info_.mutable_tpm_supported_features(); + tpm_supported_features_proto->set_is_allowed(reply.is_allowed()); + tpm_supported_features_proto->set_support_pinweaver( + reply.support_pinweaver()); + tpm_supported_features_proto->set_support_runtime_selection( + reply.support_runtime_selection()); + tpm_supported_features_proto->set_support_u2f(reply.support_u2f()); + } else { + LOG(WARNING) << "Failed to get supported features."; + } + + RunCallbackIfComplete(); +} + void TpmStatusCombiner::RunCallbackIfComplete() { if (!has_tpm_status_ || !has_enrollment_status_ || - !has_dictionary_attack_info_) + !has_dictionary_attack_info_ || !has_supported_features_) return; std::move(callback_).Run(tpm_status_info_); }
diff --git a/chrome/browser/ash/policy/status_collector/tpm_status_combiner.h b/chrome/browser/ash/policy/status_collector/tpm_status_combiner.h index ed3ff15..9819f7a8 100644 --- a/chrome/browser/ash/policy/status_collector/tpm_status_combiner.h +++ b/chrome/browser/ash/policy/status_collector/tpm_status_combiner.h
@@ -48,6 +48,10 @@ // `AttestationClient::GetDictionaryAttackInfoReply()`. void OnGetDictionaryAttackInfo( const ::tpm_manager::GetDictionaryAttackInfoReply& reply); + // Designed to be the callback of + // `TpmManagerClient::OnGetSupportedFeatures()`. + void OnGetSupportedFeatures( + const ::tpm_manager::GetSupportedFeaturesReply& reply); private: // `RefCounted` subclass requires the destructor to be non-public. @@ -68,6 +72,7 @@ bool has_tpm_status_ = false; bool has_enrollment_status_ = false; bool has_dictionary_attack_info_ = false; + bool has_supported_features_ = false; }; } // namespace policy
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 5f0fb87..d26bcbc9 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -1688,6 +1688,8 @@ "../ash/login/easy_unlock/easy_unlock_types.h", "../ash/login/easy_unlock/easy_unlock_user_login_flow.cc", "../ash/login/easy_unlock/easy_unlock_user_login_flow.h", + "../ash/login/easy_unlock/smartlock_feature_usage_metrics.cc", + "../ash/login/easy_unlock/smartlock_feature_usage_metrics.h", "../ash/login/easy_unlock/smartlock_state_handler.cc", "../ash/login/easy_unlock/smartlock_state_handler.h", "../ash/login/enrollment/auto_enrollment_check_screen.cc", @@ -4666,6 +4668,10 @@ proto_library("user_added_removed_record_proto") { sources = [ "../ash/policy/reporting/user_added_removed/user_added_removed_record.proto" ] + proto_in_dir = "//" + deps = [ + "//components/reporting/proto/common_event_support:session_affiliated_user", + ] } proto_library("device_configuration_proto") { @@ -4690,6 +4696,10 @@ proto_library("login_logout_record_proto") { sources = [ "../ash/login/reporting/login_logout_record.proto" ] + proto_in_dir = "//" + deps = [ + "//components/reporting/proto/common_event_support:session_affiliated_user", + ] } proto_library("user_event_reporter_testing_record_proto") {
diff --git a/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc b/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc index 7f153f6f..33543132 100644 --- a/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc +++ b/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc
@@ -359,23 +359,23 @@ } api::autotest_private::AppInstallSource GetAppInstallSource( - apps::mojom::InstallSource source) { - switch (source) { - case apps::mojom::InstallSource::kUnknown: + apps::mojom::InstallReason install_reason) { + switch (install_reason) { + case apps::mojom::InstallReason::kUnknown: return api::autotest_private::AppInstallSource:: APP_INSTALL_SOURCE_UNKNOWN; - case apps::mojom::InstallSource::kSystem: + case apps::mojom::InstallReason::kSystem: return api::autotest_private::AppInstallSource::APP_INSTALL_SOURCE_SYSTEM; - case apps::mojom::InstallSource::kPolicy: + case apps::mojom::InstallReason::kPolicy: return api::autotest_private::AppInstallSource::APP_INSTALL_SOURCE_POLICY; - case apps::mojom::InstallSource::kOem: + case apps::mojom::InstallReason::kOem: return api::autotest_private::AppInstallSource::APP_INSTALL_SOURCE_OEM; - case apps::mojom::InstallSource::kDefault: + case apps::mojom::InstallReason::kDefault: return api::autotest_private::AppInstallSource:: APP_INSTALL_SOURCE_DEFAULT; - case apps::mojom::InstallSource::kSync: + case apps::mojom::InstallReason::kSync: return api::autotest_private::AppInstallSource::APP_INSTALL_SOURCE_SYNC; - case apps::mojom::InstallSource::kUser: + case apps::mojom::InstallReason::kUser: return api::autotest_private::AppInstallSource::APP_INSTALL_SOURCE_USER; } NOTREACHED();
diff --git a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc index f8ce870..4ac93cd4 100644 --- a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc +++ b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc
@@ -888,3 +888,8 @@ Respond(TwoArguments(Value::FromUniquePtrValue(image_info.ToValue()), Value(next_resume_token))); } + +ExtensionFunction::ResponseAction WallpaperPrivateIsSwaEnabledFunction::Run() { + return RespondNow( + OneArgument(base::Value(ash::features::IsWallpaperWebUIEnabled()))); +}
diff --git a/chrome/browser/chromeos/extensions/wallpaper_private_api.h b/chrome/browser/chromeos/extensions/wallpaper_private_api.h index f0cb515..6331683 100644 --- a/chrome/browser/chromeos/extensions/wallpaper_private_api.h +++ b/chrome/browser/chromeos/extensions/wallpaper_private_api.h
@@ -435,4 +435,16 @@ DISALLOW_COPY_AND_ASSIGN(WallpaperPrivateGetSurpriseMeImageFunction); }; +class WallpaperPrivateIsSwaEnabledFunction : public ExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("wallpaperPrivate.isSwaEnabled", + WALLPAPERPRIVATE_ISSWAENABLED) + + protected: + ~WallpaperPrivateIsSwaEnabledFunction() override = default; + + // ExtensionFunction: + ResponseAction Run() override; +}; + #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_PRIVATE_API_H_
diff --git a/chrome/browser/commerce/shopping_list/shopping_data_provider.cc b/chrome/browser/commerce/shopping_list/shopping_data_provider.cc index dd139bb..648dab6 100644 --- a/chrome/browser/commerce/shopping_list/shopping_data_provider.cc +++ b/chrome/browser/commerce/shopping_list/shopping_data_provider.cc
@@ -17,8 +17,10 @@ #include "chrome/common/chrome_isolated_world_ids.h" #include "chrome/grit/browser_resources.h" #include "components/commerce/core/proto/price_tracking.pb.h" +#include "components/optimization_guide/core/optimization_guide_util.h" #include "components/optimization_guide/proto/hints.pb.h" #include "content/public/browser/navigation_handle.h" +#include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" #include "ui/base/resource/resource_bundle.h" @@ -34,6 +36,7 @@ content::WebContents* content, optimization_guide::OptimizationGuideDecider* optimization_guide) : content::WebContentsObserver(content), + run_javascript_on_load_(false), optimization_guide_(optimization_guide), weak_ptr_factory_(this) { std::vector<optimization_guide::proto::OptimizationType> types; @@ -50,6 +53,7 @@ return; } + run_javascript_on_load_ = false; meta_for_navigation_.reset(); // This will cancel the callbacks holding a reference to this object so that // they do not conflict with the new ones for this navigation. @@ -62,41 +66,13 @@ weak_ptr_factory_.GetWeakPtr())); } -void ShoppingDataProvider::OnOptimizationGuideDecision( - optimization_guide::OptimizationGuideDecision decision, - const optimization_guide::OptimizationMetadata& metadata) { - base::UmaHistogramBoolean( - "Commerce.PowerBookmarks.ShoppingDataProvider.IsProductPage", - decision == optimization_guide::OptimizationGuideDecision::kTrue); - - // If the page was determined to be shopping related, run the on-page - // extractor. - if (decision != optimization_guide::OptimizationGuideDecision::kTrue) +void ShoppingDataProvider::DidFinishLoad( + content::RenderFrameHost* render_frame_host, + const GURL& validated_url) { + if (!run_javascript_on_load_) return; - // We should only be creating one bookmark meta object per navigation. - DCHECK(!meta_for_navigation_); - - meta_for_navigation_ = std::make_unique<power_bookmarks::PowerBookmarkMeta>(); - meta_for_navigation_->set_type(power_bookmarks::PowerBookmarkType::SHOPPING); - - if (metadata.any_metadata().has_value()) { - commerce::PriceTrackingData price_data; - // Optimization Guide's metadata provides an absl::optional which holds a - // proto::Any value -- each having a .value() function. Consequently, the - // parse logic below looks a bit strange. - price_data.ParseFromString(metadata.any_metadata().value().value()); - if (price_data.IsInitialized()) { - commerce::BuyableProduct buyable_product = price_data.buyable_product(); - - if (buyable_product.has_image_url()) { - meta_for_navigation_->mutable_lead_image()->set_url( - buyable_product.image_url()); - } - meta_for_navigation_->mutable_shopping_specifics()->CopyFrom( - buyable_product); - } - } + run_javascript_on_load_ = false; std::string script = ui::ResourceBundle::GetSharedInstance().LoadDataResourceString( @@ -113,6 +89,44 @@ ISOLATED_WORLD_ID_CHROME_INTERNAL); } +void ShoppingDataProvider::OnOptimizationGuideDecision( + optimization_guide::OptimizationGuideDecision decision, + const optimization_guide::OptimizationMetadata& metadata) { + base::UmaHistogramBoolean( + "Commerce.PowerBookmarks.ShoppingDataProvider.IsProductPage", + decision == optimization_guide::OptimizationGuideDecision::kTrue); + + // If the page was determined to be shopping related, run the on-page + // extractor. + if (decision != optimization_guide::OptimizationGuideDecision::kTrue) + return; + + run_javascript_on_load_ = true; + + // We should only be creating one bookmark meta object per navigation. + DCHECK(!meta_for_navigation_); + + meta_for_navigation_ = std::make_unique<power_bookmarks::PowerBookmarkMeta>(); + meta_for_navigation_->set_type(power_bookmarks::PowerBookmarkType::SHOPPING); + + if (metadata.any_metadata().has_value()) { + absl::optional<commerce::PriceTrackingData> parsed_any = + optimization_guide::ParsedAnyMetadata<commerce::PriceTrackingData>( + metadata.any_metadata().value()); + commerce::PriceTrackingData price_data = parsed_any.value(); + if (parsed_any.has_value() && price_data.IsInitialized()) { + commerce::BuyableProduct buyable_product = price_data.buyable_product(); + + if (buyable_product.has_image_url()) { + meta_for_navigation_->mutable_lead_image()->set_url( + buyable_product.image_url()); + } + meta_for_navigation_->mutable_shopping_specifics()->CopyFrom( + buyable_product); + } + } +} + void ShoppingDataProvider::OnJavascriptExecutionCompleted(base::Value result) { absl::optional<base::Value> json_root = base::JSONReader::Read(result.GetString());
diff --git a/chrome/browser/commerce/shopping_list/shopping_data_provider.h b/chrome/browser/commerce/shopping_list/shopping_data_provider.h index 83e725c..19d0342 100644 --- a/chrome/browser/commerce/shopping_list/shopping_data_provider.h +++ b/chrome/browser/commerce/shopping_list/shopping_data_provider.h
@@ -18,6 +18,7 @@ namespace content { class NavigationHandle; +class RenderFrameHost; class WebContents; } // namespace content @@ -59,6 +60,9 @@ void DidFinishNavigation( content::NavigationHandle* navigation_handle) override; + void DidFinishLoad(content::RenderFrameHost* render_frame_host, + const GURL& validated_url) override; + private: friend class content::WebContentsUserData<ShoppingDataProvider>; @@ -73,6 +77,10 @@ // Handle the result of javascript on-page heuristics. void OnJavascriptExecutionCompleted(base::Value result); + // Whether the javascript heuristics should be run when the page has finished + // loading. + bool run_javascript_on_load_; + // The metadata for the last navigation in the associated web contents. std::unique_ptr<power_bookmarks::PowerBookmarkMeta> meta_for_navigation_;
diff --git a/chrome/browser/component_updater/cros_component_installer_chromeos.cc b/chrome/browser/component_updater/cros_component_installer_chromeos.cc index 9c2045d..b5a38276 100644 --- a/chrome/browser/component_updater/cros_component_installer_chromeos.cc +++ b/chrome/browser/component_updater/cros_component_installer_chromeos.cc
@@ -37,9 +37,9 @@ const ComponentConfig kConfigs[] = { {"cros-termina", ComponentConfig::PolicyType::kEnvVersion, "960.1", "e9d960f84f628e1f42d05de4046bb5b3154b6f1f65c08412c6af57a29aecaffb"}, - {"rtanalytics-light", ComponentConfig::PolicyType::kEnvVersion, "94.0", + {"rtanalytics-light", ComponentConfig::PolicyType::kEnvVersion, "96.0", "69f09d33c439c2ab55bbbe24b47ab55cb3f6c0bd1f1ef46eefea3216ec925038"}, - {"rtanalytics-full", ComponentConfig::PolicyType::kEnvVersion, "94.0", + {"rtanalytics-full", ComponentConfig::PolicyType::kEnvVersion, "96.0", "c93c3e1013c52100a20038b405ac854d69fa889f6dc4fa6f188267051e05e444"}, {"demo-mode-resources", ComponentConfig::PolicyType::kEnvVersion, "1.0", "93c093ebac788581389015e9c59c5af111d2fa5174d206eb795042e6376cbd10"},
diff --git a/chrome/browser/content_creation/reactions/internal/android/java/res/layout/scene.xml b/chrome/browser/content_creation/reactions/internal/android/java/res/layout/scene.xml index 346273ae..45d315e 100644 --- a/chrome/browser/content_creation/reactions/internal/android/java/res/layout/scene.xml +++ b/chrome/browser/content_creation/reactions/internal/android/java/res/layout/scene.xml
@@ -6,16 +6,16 @@ <!-- TODO(crbug.com/1252182): Add android:contentDescription="@string/foo" attributes --> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="@color/default_scrim_color" android:importantForAccessibility="yes"> <ImageView + tools:ignore="ContentDescription" android:id="@+id/lightweight_reactions_background" - android:src="@drawable/qrcode_background" - android:contentDescription="@string/" android:layout_centerInParent="true" - android:layout_height="wrap_content" + android:layout_height="match_parent" android:layout_width="wrap_content" /> </RelativeLayout> \ No newline at end of file
diff --git a/chrome/browser/content_creation/reactions/internal/android/java/src/org/chromium/chrome/browser/content_creation/reactions/LightweightReactionsCoordinatorImpl.java b/chrome/browser/content_creation/reactions/internal/android/java/src/org/chromium/chrome/browser/content_creation/reactions/LightweightReactionsCoordinatorImpl.java index 320a3b8d..ff8a4cd57 100644 --- a/chrome/browser/content_creation/reactions/internal/android/java/src/org/chromium/chrome/browser/content_creation/reactions/LightweightReactionsCoordinatorImpl.java +++ b/chrome/browser/content_creation/reactions/internal/android/java/src/org/chromium/chrome/browser/content_creation/reactions/LightweightReactionsCoordinatorImpl.java
@@ -44,6 +44,7 @@ @Override protected void handleScreenshot() { + mDialog.init(mScreenshot); showDialog(); } }
diff --git a/chrome/browser/content_creation/reactions/internal/android/java/src/org/chromium/chrome/browser/content_creation/reactions/LightweightReactionsDialog.java b/chrome/browser/content_creation/reactions/internal/android/java/src/org/chromium/chrome/browser/content_creation/reactions/LightweightReactionsDialog.java index 5cbfb1e..822ee1e 100644 --- a/chrome/browser/content_creation/reactions/internal/android/java/src/org/chromium/chrome/browser/content_creation/reactions/LightweightReactionsDialog.java +++ b/chrome/browser/content_creation/reactions/internal/android/java/src/org/chromium/chrome/browser/content_creation/reactions/LightweightReactionsDialog.java
@@ -5,8 +5,12 @@ package org.chromium.chrome.browser.content_creation.reactions; import android.app.Dialog; +import android.graphics.Bitmap; +import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.View; +import android.widget.ImageView; import androidx.annotation.NonNull; import androidx.appcompat.app.AlertDialog; @@ -18,18 +22,37 @@ * Dialog for the reactions creation. */ public class LightweightReactionsDialog extends DialogFragment { + private Bitmap mScreenshot; private LightweightReactionsSceneCoordinator mSceneCoordinator; private View mContentView; + /** + * Initialize the dialog outside of the constructor as fragments require default constructor. + * + * @param screenshot A {@link Bitmap} of the screenshot of the page to set as the background. + */ + void init(Bitmap screenshot) { + mScreenshot = screenshot; + } + @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.Theme_Chromium_Fullscreen); - mContentView = getActivity().getLayoutInflater().inflate(R.layout.reactions_dialog, null); mSceneCoordinator = new LightweightReactionsSceneCoordinator(); + + mContentView = getActivity().getLayoutInflater().inflate(R.layout.reactions_dialog, null); + setBackgroundImage(); builder.setView(mContentView); return builder.create(); } + + private void setBackgroundImage() { + ImageView sceneBackground = + mContentView.findViewById(R.id.lightweight_reactions_background); + Drawable background = new BitmapDrawable(getResources(), mScreenshot); + sceneBackground.setImageDrawable(background); + } } \ No newline at end of file
diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc index 7141303f..065421a 100644 --- a/chrome/browser/download/chrome_download_manager_delegate.cc +++ b/chrome/browser/download/chrome_download_manager_delegate.cc
@@ -346,7 +346,9 @@ if (download_restriction != DownloadPrefs::DownloadRestriction::POTENTIALLY_DANGEROUS_FILES && download_restriction != - DownloadPrefs::DownloadRestriction::DANGEROUS_FILES) { + DownloadPrefs::DownloadRestriction::DANGEROUS_FILES && + download_restriction != + DownloadPrefs::DownloadRestriction::MALICIOUS_FILES) { return; }
diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn index a18d538..be011e54 100644 --- a/chrome/browser/extensions/BUILD.gn +++ b/chrome/browser/extensions/BUILD.gn
@@ -1155,8 +1155,28 @@ "//chromeos/services/chromebox_for_meetings/public/mojom", ] } + } else if (is_chromeos_lacros) { + sources += [ + "api/enterprise_reporting_private/chrome_desktop_report_request_helper.cc", + "api/enterprise_reporting_private/chrome_desktop_report_request_helper.h", + "api/enterprise_reporting_private/keychain_data_helper_mac.h", + "api/enterprise_reporting_private/keychain_data_helper_mac.mm", + "api/image_writer_private/operation_nonchromeos.cc", + "api/image_writer_private/removable_storage_provider_linux.cc", + "api/tabs/tabs_util_chromeos.cc", + "chrome_kiosk_delegate.cc", + "preinstalled_apps.cc", + "preinstalled_apps.h", + ] + deps += [ + "//chromeos/ui/base", + "//components/enterprise", + "//components/enterprise/common/proto:connectors_proto", + "//components/keep_alive_registry", + ] } else { assert(!is_chromeos_ash) + assert(!is_chromeos_lacros) sources += [ "api/enterprise_reporting_private/chrome_desktop_report_request_helper.cc", "api/enterprise_reporting_private/chrome_desktop_report_request_helper.h", @@ -1173,7 +1193,7 @@ "//components/enterprise/common/proto:connectors_proto", "//components/keep_alive_registry", ] - if (is_linux || is_chromeos) { + if (is_linux) { sources += [ "api/image_writer_private/removable_storage_provider_linux.cc" ] }
diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc index c5fa4d76..ec454a2 100644 --- a/chrome/browser/extensions/api/tabs/tabs_api.cc +++ b/chrome/browser/extensions/api/tabs/tabs_api.cc
@@ -734,7 +734,8 @@ // (otherwise that resets the locked mode for devices in tablet mode). if (create_data && create_data->state == windows::WINDOW_STATE_LOCKED_FULLSCREEN) { - tabs_util::SetLockedFullscreenState(new_window, true); + tabs_util::SetLockedFullscreenState( + new_window, chromeos::WindowPinType::kTrustedPinned); } std::unique_ptr<base::Value> result; @@ -834,11 +835,13 @@ if (is_locked_fullscreen && params->update_info.state != windows::WINDOW_STATE_LOCKED_FULLSCREEN && params->update_info.state != windows::WINDOW_STATE_NONE) { - tabs_util::SetLockedFullscreenState(browser, false); + tabs_util::SetLockedFullscreenState(browser, + chromeos::WindowPinType::kNone); } else if (!is_locked_fullscreen && params->update_info.state == windows::WINDOW_STATE_LOCKED_FULLSCREEN) { - tabs_util::SetLockedFullscreenState(browser, true); + tabs_util::SetLockedFullscreenState( + browser, chromeos::WindowPinType::kTrustedPinned); } if (show_state != ui::SHOW_STATE_FULLSCREEN &&
diff --git a/chrome/browser/extensions/api/tabs/tabs_util.cc b/chrome/browser/extensions/api/tabs/tabs_util.cc index f4da46bff..bf9778a 100644 --- a/chrome/browser/extensions/api/tabs/tabs_util.cc +++ b/chrome/browser/extensions/api/tabs/tabs_util.cc
@@ -3,11 +3,16 @@ // found in the LICENSE file. #include "chrome/browser/extensions/api/tabs/tabs_util.h" +#include "chromeos/ui/base/window_pin_type.h" namespace extensions { namespace tabs_util { -void SetLockedFullscreenState(Browser* browser, bool locked) {} +void SetLockedFullscreenState(Browser* browser, chromeos::WindowPinType style) { +} + +void SetLockedFullscreenStateFromExo(aura::Window* window, + chromeos::WindowPinType type) {} bool IsScreenshotRestricted(content::WebContents* web_contents) { return false;
diff --git a/chrome/browser/extensions/api/tabs/tabs_util.h b/chrome/browser/extensions/api/tabs/tabs_util.h index 95de5f5..9979f44 100644 --- a/chrome/browser/extensions/api/tabs/tabs_util.h +++ b/chrome/browser/extensions/api/tabs/tabs_util.h
@@ -9,8 +9,14 @@ // then define an empty implementation in tabs_util.cc, and put the actual code // in eg. tabs_util_chromeos.cc. +#include "chromeos/ui/base/window_pin_type.h" + class Browser; +namespace aura { +class Window; +} + namespace content { class WebContents; } @@ -20,7 +26,12 @@ // Set up the browser in the locked fullscreen state, and do any additional // necessary adjustments. -void SetLockedFullscreenState(Browser* browser, bool locked); +void SetLockedFullscreenState(Browser* browser, chromeos::WindowPinType type); + +// A call from a wayland/Exo client (ARC++, Lacros) is asking to put the system +// into a locked fullscreen state. +void SetLockedFullscreenStateFromExo(aura::Window* window, + chromeos::WindowPinType type); // Checks whether screenshot of |web_contents| is restricted due to Data Leak // Prevention policy.
diff --git a/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc b/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc index 8552078..17e02f6 100644 --- a/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc +++ b/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc
@@ -4,17 +4,10 @@ #include "chrome/browser/extensions/api/tabs/tabs_util.h" -#include "ash/public/cpp/assistant/assistant_state.h" -#include "chrome/browser/ash/accessibility/accessibility_manager.h" -#include "chrome/browser/ash/arc/arc_util.h" -#include "chrome/browser/ash/arc/session/arc_session_manager.h" -#include "chrome/browser/ash/assistant/assistant_util.h" -#include "chrome/browser/ash/policy/dlp/dlp_content_manager.h" -#include "chrome/browser/ui/ash/capture_mode/chrome_capture_mode_delegate.h" +#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_command_controller.h" #include "chrome/browser/ui/browser_window.h" -#include "chromeos/ui/base/window_pin_type.h" #include "chromeos/ui/base/window_properties.h" #include "content/public/browser/devtools_agent_host.h" #include "content/public/browser/web_contents.h" @@ -22,33 +15,79 @@ #include "ui/base/clipboard/clipboard.h" #include "ui/base/clipboard/clipboard_buffer.h" -namespace extensions { -namespace tabs_util { +#if !BUILDFLAG(IS_CHROMEOS_LACROS) +#include "ash/public/cpp/assistant/assistant_state.h" +#include "chrome/browser/ash/accessibility/accessibility_manager.h" +#include "chrome/browser/ash/arc/arc_util.h" +#include "chrome/browser/ash/arc/session/arc_session_manager.h" +#include "chrome/browser/ash/assistant/assistant_util.h" +#include "chrome/browser/ash/policy/dlp/dlp_content_manager.h" +#include "chrome/browser/ui/ash/capture_mode/chrome_capture_mode_delegate.h" +#else +#include "ui/platform_window/extensions/pinned_mode_extension.h" +#include "ui/views/widget/desktop_aura/desktop_window_tree_host_linux.h" +#endif -void SetLockedFullscreenState(Browser* browser, bool locked) { - aura::Window* window = browser->window()->GetNativeWindow(); - // TRUSTED_PINNED is used here because that one locks the window fullscreen - // without allowing the user to exit (as opposed to regular PINNED). - window->SetProperty(chromeos::kWindowPinTypeKey, - locked ? chromeos::WindowPinType::kTrustedPinned - : chromeos::WindowPinType::kNone); +namespace { - // Update the set of available browser commands. - browser->command_controller()->LockedFullscreenStateChanged(); +// This is the common code for either of the two SetLockedFullscreenState calls. +// It will make sure that all the non browser related tasks will be turned off/ +// cleared when the lock mode starts (or ends). +void SetLockedFullscreenStateCommon(Browser* browser, + aura::Window* window, + Profile* const profile, + chromeos::WindowPinType new_type) { + DCHECK(window); + const chromeos::WindowPinType previous_type = + window->GetProperty(chromeos::kWindowPinTypeKey); + // As this gets triggered from extensions, we might encounter this case. + if (previous_type == new_type) + return; - // Disable both screenshots and video screen captures via the capture mode - // feature. - ChromeCaptureModeDelegate::Get()->SetIsScreenCaptureLocked(locked); + window->SetProperty(chromeos::kWindowPinTypeKey, new_type); + + if (browser) { + // This should only be called when called from inside the browser and not + // when called through Exo. +#if BUILDFLAG(IS_CHROMEOS_LACROS) + auto* pinned_mode_extension = + views::DesktopWindowTreeHostLinux::From(window->GetHost()) + ->GetPinnedModeExtension(); + if (new_type != chromeos::WindowPinType::kNone) { + pinned_mode_extension->Pin(/*trusted=*/ + new_type == + chromeos::WindowPinType::kTrustedPinned); + } else { + pinned_mode_extension->Unpin(); + } +#endif + + // Update the set of available browser commands. + browser->command_controller()->LockedFullscreenStateChanged(); + } + + const bool locked = new_type == chromeos::WindowPinType::kTrustedPinned; + const bool previous_locked = + previous_type == chromeos::WindowPinType::kTrustedPinned; + // Make sure that we only proceed if we switch from locked to unlocked or + // vice versa. + if (locked == previous_locked) + return; // Reset the clipboard and kill dev tools when entering or exiting locked // fullscreen (security concerns). ui::Clipboard::GetForCurrentThread()->Clear(ui::ClipboardBuffer::kCopyPaste); content::DevToolsAgentHost::DetachAllClients(); +#if !BUILDFLAG(IS_CHROMEOS_LACROS) + // TODO(crbug/1243104): This might be interesting for DLP to change. + // Disable both screenshots and video screen captures via the capture mode + // feature. + ChromeCaptureModeDelegate::Get()->SetIsScreenCaptureLocked(locked); + // Disable ARC while in the locked fullscreen mode. arc::ArcSessionManager* const arc_session_manager = arc::ArcSessionManager::Get(); - Profile* const profile = browser->profile(); if (arc_session_manager && arc::IsArcAllowedForProfile(profile)) { if (locked) { // Disable ARC, preserve data. @@ -64,11 +103,33 @@ chromeos::assistant::AssistantAllowedState::ALLOWED) { ash::AssistantState::Get()->NotifyLockedFullScreenStateChanged(locked); } +#endif +} + +} // namespace + +namespace extensions { +namespace tabs_util { + +void SetLockedFullscreenStateFromExo(aura::Window* window, + chromeos::WindowPinType type) { + SetLockedFullscreenStateCommon(nullptr, window, + ProfileManager::GetPrimaryUserProfile(), type); +} + +void SetLockedFullscreenState(Browser* browser, chromeos::WindowPinType type) { + SetLockedFullscreenStateCommon(browser, browser->window()->GetNativeWindow(), + browser->profile(), type); } bool IsScreenshotRestricted(content::WebContents* web_contents) { +#if BUILDFLAG(IS_CHROMEOS_LACROS) + // TODO(crbug/1243104): This might be interesting for DLP to change. + return false; +#else return policy::DlpContentManager::Get()->IsScreenshotApiRestricted( ScreenshotArea::CreateForWindow(web_contents->GetNativeView())); +#endif } } // namespace tabs_util
diff --git a/chrome/browser/extensions/window_open_apitest.cc b/chrome/browser/extensions/window_open_apitest.cc index 57c7025..21c36c2 100644 --- a/chrome/browser/extensions/window_open_apitest.cc +++ b/chrome/browser/extensions/window_open_apitest.cc
@@ -39,7 +39,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/base_window.h" -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if defined(OS_CHROMEOS) #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/extensions/window_controller.h" #include "chrome/browser/extensions/window_controller_list.h" @@ -355,7 +355,7 @@ EXPECT_EQ("HOWDIE!!!", result); } -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if defined(OS_CHROMEOS) namespace { @@ -368,7 +368,13 @@ break; } } + +#if BUILDFLAG(IS_CHROMEOS_LACROS) + if (!controller || !controller->window()) + return nullptr; +#else EXPECT_TRUE(controller); +#endif return controller->window()->GetNativeWindow(); } @@ -378,12 +384,19 @@ return type; } +// Disabling this test temporarily - Ash needs to be built to make this test +// work. Will enable after this landed. +#if !BUILDFLAG(IS_CHROMEOS_LACROS) void SetCurrentWindowPinType(chromeos::WindowPinType type) { GetCurrentWindow()->SetProperty(chromeos::kWindowPinTypeKey, type); } +#endif } // namespace +// Disabling this test temporarily - Ash needs to be built to make this test +// work. Will enable after this landed. +#if !BUILDFLAG(IS_CHROMEOS_LACROS) IN_PROC_BROWSER_TEST_F(WindowOpenApiTest, OpenLockedFullscreenWindow) { ASSERT_TRUE(RunExtensionTest("locked_fullscreen/with_permission", {.custom_arg = "openLockedFullscreenWindow"})) @@ -393,6 +406,7 @@ // it's in locked fullscreen mode). EXPECT_EQ(chromeos::WindowPinType::kTrustedPinned, GetCurrentWindowPinType()); } +#endif // !BUILDFLAG(IS_CHROMEOS_LACROS) IN_PROC_BROWSER_TEST_F(WindowOpenApiTest, UpdateWindowToLockedFullscreen) { ASSERT_TRUE( @@ -404,6 +418,9 @@ EXPECT_EQ(chromeos::WindowPinType::kTrustedPinned, GetCurrentWindowPinType()); } +// Disabling this test temporarily - Ash needs to be built to make this test +// work. Will enable after this landed. +#if !BUILDFLAG(IS_CHROMEOS_LACROS) IN_PROC_BROWSER_TEST_F(WindowOpenApiTest, RemoveLockedFullscreenFromWindow) { // After locking the window, do a LockedFullscreenStateChanged so the // command_controller state catches up as well. @@ -418,6 +435,7 @@ // Make sure the current window is removed from locked-fullscreen state. EXPECT_EQ(chromeos::WindowPinType::kNone, GetCurrentWindowPinType()); } +#endif // !BUILDFLAG(IS_CHROMEOS_LACROS) // Make sure that commands disabling code works in locked fullscreen mode. IN_PROC_BROWSER_TEST_F(WindowOpenApiTest, VerifyCommandsInLockedFullscreen) { @@ -467,6 +485,9 @@ EXPECT_EQ(chromeos::WindowPinType::kNone, GetCurrentWindowPinType()); } +// Disabling this test temporarily - Ash needs to be built to make this test +// work. Will enable after this landed. +#if !BUILDFLAG(IS_CHROMEOS_LACROS) IN_PROC_BROWSER_TEST_F(WindowOpenApiTest, RemoveLockedFullscreenFromWindowWithoutPermission) { SetCurrentWindowPinType(chromeos::WindowPinType::kTrustedPinned); @@ -480,9 +501,10 @@ // The current window is still locked-fullscreen. EXPECT_EQ(chromeos::WindowPinType::kTrustedPinned, GetCurrentWindowPinType()); } -#endif // BUILDFLAG(IS_CHROMEOS_ASH) +#endif // !BUILDFLAG(IS_CHROMEOS_LACROS) +#endif // defined(OS_CHROMEOS) -#if !BUILDFLAG(IS_CHROMEOS_ASH) +#if !defined(OS_CHROMEOS) // Loading an extension requiring the 'lockWindowFullscreenPrivate' permission // on non Chrome OS platforms should always fail since the API is available only // on Chrome OS.
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index bf893c8..80037de 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -2489,11 +2489,6 @@ "expiry_milestone": 100 }, { - "name": "enable-safe-browsing-per-profile-network-contexts", - "owners": [ "drubery" ], - "expiry_milestone": 95 - }, - { "name": "enable-save-data", "owners": [ "//components/data_reduction_proxy/OWNERS" ], // This flag is used for frequent manual testing and should not be removed. @@ -3115,17 +3110,17 @@ }, { "name": "font-access", - "owners": [ "cmp", "oyiptong" ], + "owners": [ "cmp", "pwnall" ], "expiry_milestone": 96 }, { "name": "font-access-chooser", - "owners": [ "oyiptong" ], + "owners": [ "pwnall" ], "expiry_milestone": 96 }, { "name": "font-access-persistent", - "owners": [ "oyiptong" ], + "owners": [ "pwnall" ], "expiry_milestone": 96 }, { @@ -4188,11 +4183,6 @@ "expiry_milestone": 95 }, { - "name": "omnibox-rich-entities-in-launcher", - "owners": ["jiameng", "thanhdng", "wrong"], - "expiry_milestone": 95 - }, - { "name": "omnibox-spare-renderer", "owners": [ "instant-nav@google.com" ], "expiry_milestone": 92 @@ -4690,14 +4680,6 @@ "expiry_milestone": 95 }, { - "name": "safe-browsing-client-side-detection-android", - "owners": [ - "bdea", - "chrome-safebrowsing-core@google.com" - ], - "expiry_milestone": 93 - }, - { "name": "safe-browsing-enhanced-protection-promo-android", "owners": [ "bdea", "chrome-safebrowsing-core@google.com" ], "expiry_milestone": 100
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 4d13bed..e81d3c0 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -1603,11 +1603,11 @@ "Adds new actions into Media Session for video conferencing."; const char kMemoriesName[] = "Memories"; -const char kMemoriesDescription[] = "Enables chrome://history/journeys."; +const char kMemoriesDescription[] = "Enables the history clusters UI."; const char kMemoriesDebugName[] = "Memories Debug"; const char kMemoriesDebugDescription[] = - "Shows visit metadata in chrome://history to debug history clustering."; + "Shows debug information in the history clusters UI."; const char kMetricsSettingsAndroidName[] = "Metrics Settings on Android"; const char kMetricsSettingsAndroidDescription[] = @@ -1824,11 +1824,6 @@ "Allow autocompletion for titles and non-prefixes; see Omnibox Rich " "Autocompletion."; -const char kOmniboxRichEntitiesInLauncherName[] = - "Omnibox rich entities in the launcher"; -const char kOmniboxRichEntitiesInLauncherDescription[] = - "Enable rich entity formatting for Omnibox results in the launcher."; - const char kOmniboxOnFocusSuggestionsContextualWebAllowSRPName[] = "Allow Omnibox contextual web on-focus suggestions on the SRP"; const char kOmniboxOnFocusSuggestionsContextualWebAllowSRPDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 37c5a4f..23bb3984 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -1032,9 +1032,6 @@ extern const char kOmniboxRichAutocompletionPromisingName[]; extern const char kOmniboxRichAutocompletionPromisingDescription[]; -extern const char kOmniboxRichEntitiesInLauncherName[]; -extern const char kOmniboxRichEntitiesInLauncherDescription[]; - extern const char kOmniboxOnFocusSuggestionsContextualWebAllowSRPName[]; extern const char kOmniboxOnFocusSuggestionsContextualWebAllowSRPDescription[];
diff --git a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/CachedFeatureFlags.java b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/CachedFeatureFlags.java index fa57eba5..9cacc04f5 100644 --- a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/CachedFeatureFlags.java +++ b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/CachedFeatureFlags.java
@@ -450,7 +450,7 @@ public static void resetFlagsForTesting() { sValuesReturned = new ValuesReturned(); sValuesOverridden.clear(); - sSafeMode.clearForTesting(); + sSafeMode.clearMemoryForTesting(); } @VisibleForTesting
diff --git a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/CachedFeatureFlagsSafeModeUnitTest.java b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/CachedFeatureFlagsSafeModeUnitTest.java index b6efedf5..ec4d2e7 100644 --- a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/CachedFeatureFlagsSafeModeUnitTest.java +++ b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/CachedFeatureFlagsSafeModeUnitTest.java
@@ -16,8 +16,6 @@ import org.chromium.base.FeatureList; import org.chromium.base.test.BaseRobolectricTestRunner; import org.chromium.chrome.browser.flags.CachedFlagsSafeMode.Behavior; -import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; -import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import java.util.Arrays; import java.util.HashMap; @@ -49,6 +47,7 @@ CachedFeatureFlags.swapDefaultsForTesting(mDefaultsSwapped); FeatureList.setTestFeatures(null); + CachedFlagsSafeMode.clearDiskForTesting(); } @Test @@ -103,8 +102,8 @@ // Crash streak is 2. Engage Safe Mode. // Safe values are false/true, and are used during this run. // Cached values remain true(crashy)/true, but are not used because Safe Mode is engaged. - // TODO(crbug.com/1217708): Assert CachedFeatureFlags.getSafeModeBehaviorForTesting()) is - // Behavior.ENGAGED_WITH_SAFE_VALUES. + assertEquals(Behavior.ENGAGED_WITH_SAFE_VALUES, + CachedFeatureFlags.getSafeModeBehaviorForTesting()); // TODO(crbug.com/1217708): Assert cached flags values are false/true. endCleanRun(false, false); // Cached values became false/false, cached from native. @@ -271,8 +270,10 @@ // Cached values became true(crashy)/true. // Pretend safe values are from an older version - SharedPreferencesManager.getInstance().writeString( - ChromePreferenceKeys.FLAGS_CACHED_SAFE_VALUES_VERSION, "1.0.0.0"); + CachedFlagsSafeMode.getSafeValuePreferences() + .edit() + .putString(CachedFlagsSafeMode.PREF_SAFE_VALUES_VERSION, "1.0.0.0") + .apply(); startRun(); // Crash streak is 0. Do not engage Safe Mode.
diff --git a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/CachedFlagsSafeMode.java b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/CachedFlagsSafeMode.java index 896e42a..723ab98a 100644 --- a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/CachedFlagsSafeMode.java +++ b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/CachedFlagsSafeMode.java
@@ -4,21 +4,25 @@ package org.chromium.chrome.browser.flags; +import android.annotation.SuppressLint; +import android.content.Context; +import android.content.SharedPreferences; + import androidx.annotation.AnyThread; import androidx.annotation.IntDef; import androidx.annotation.VisibleForTesting; +import org.chromium.base.ContextUtils; import org.chromium.base.Log; +import org.chromium.base.TraceEvent; import org.chromium.base.metrics.RecordHistogram; import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; -import org.chromium.chrome.browser.preferences.KeyPrefix; import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.browser.version.ChromeVersionInfo; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -import java.util.HashMap; -import java.util.Map; +import java.util.Map.Entry; import java.util.concurrent.atomic.AtomicInteger; /** @@ -34,6 +38,11 @@ private static final String TAG = "Flags"; private static final int CRASH_STREAK_TO_ENTER_SAFE_MODE = 2; + private static final String SAFE_VALUES_FILE = + "org.chromium.chrome.browser.flags.SafeModeValues"; + @VisibleForTesting + static final String PREF_SAFE_VALUES_VERSION = "Chrome.Flags.SafeValuesVersion"; + // These values are persisted to logs. Entries should not be renumbered and numeric values // should never be reused. @VisibleForTesting @@ -64,8 +73,8 @@ synchronized (mBehavior) { if (mBehavior.get() != Behavior.UNKNOWN) return; if (shouldEnterSafeMode()) { - String cachedVersion = SharedPreferencesManager.getInstance().readString( - ChromePreferenceKeys.FLAGS_CACHED_SAFE_VALUES_VERSION, ""); + String cachedVersion = + getSafeValuePreferences().getString(PREF_SAFE_VALUES_VERSION, ""); int behavior; if (cachedVersion.isEmpty()) { behavior = Behavior.ENGAGED_WITHOUT_SAFE_VALUES; @@ -149,17 +158,40 @@ } } - private void writeSafeValues(ValuesReturned safeValuesReturned) { - // TODO(crbug.com/1217708): Write safe values. + @VisibleForTesting + static SharedPreferences getSafeValuePreferences() { + return ContextUtils.getApplicationContext().getSharedPreferences( + SAFE_VALUES_FILE, Context.MODE_PRIVATE); } - private static <T> Map<String, T> prependPrefixToKeys(KeyPrefix prefix, Map<String, T> map) { - Map<String, T> prefixed = new HashMap<>(); - for (Map.Entry<String, T> kv : map.entrySet()) { - String safeKey = prefix.createKey(kv.getKey()); - prefixed.put(safeKey, kv.getValue()); + private void writeSafeValues(ValuesReturned safeValuesReturned) { + TraceEvent.begin("writeSafeValues"); + SharedPreferences.Editor editor = getSafeValuePreferences().edit(); + + synchronized (safeValuesReturned.boolValues) { + for (Entry<String, Boolean> pair : safeValuesReturned.boolValues.entrySet()) { + editor.putBoolean(pair.getKey(), pair.getValue()); + } } - return prefixed; + synchronized (safeValuesReturned.intValues) { + for (Entry<String, Integer> pair : safeValuesReturned.intValues.entrySet()) { + editor.putInt(pair.getKey(), pair.getValue()); + } + } + synchronized (safeValuesReturned.doubleValues) { + for (Entry<String, Double> pair : safeValuesReturned.doubleValues.entrySet()) { + long ieee754LongValue = Double.doubleToRawLongBits(pair.getValue()); + editor.putLong(pair.getKey(), ieee754LongValue); + } + } + synchronized (safeValuesReturned.stringValues) { + for (Entry<String, String> pair : safeValuesReturned.stringValues.entrySet()) { + editor.putString(pair.getKey(), pair.getValue()); + } + } + editor.putString(PREF_SAFE_VALUES_VERSION, ChromeVersionInfo.getProductVersion()); + editor.apply(); + TraceEvent.end("writeSafeValues"); } @Behavior @@ -167,7 +199,12 @@ return mBehavior.get(); } - void clearForTesting() { + void clearMemoryForTesting() { mBehavior.set(Behavior.UNKNOWN); } + + @SuppressLint({"ApplySharedPref"}) + static void clearDiskForTesting() { + getSafeValuePreferences().edit().clear().commit(); + } }
diff --git a/chrome/browser/history_clusters/history_clusters_metrics_browsertest.cc b/chrome/browser/history_clusters/history_clusters_metrics_browsertest.cc index ffb127f6..ed2cd51 100644 --- a/chrome/browser/history_clusters/history_clusters_metrics_browsertest.cc +++ b/chrome/browser/history_clusters/history_clusters_metrics_browsertest.cc
@@ -157,11 +157,19 @@ EXPECT_TRUE(ui_test_utils::NavigateToURL( browser(), GURL(chrome::kChromeUIHistoryClustersURL))); - EXPECT_TRUE(content::ExecJs( - browser()->tab_strip_model()->GetActiveWebContents(), - "document.querySelector('#history-app').shadowRoot.querySelector('#" - "content-side-bar').shadowRoot.querySelector('#history').click()", - content::EXECUTE_SCRIPT_DEFAULT_OPTIONS, 1 /* world_id */)); + bool toggled_to_basic = false; + EXPECT_TRUE(content::ExecuteScriptAndExtractBool( + browser()->tab_strip_model()->GetActiveWebContents(), R"( + const polymerPath = + 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + import(polymerPath).then((polymerModule)=> { + polymerModule.flush(); + const historyApp = document.querySelector('#history-app'); + historyApp.shadowRoot.querySelector('cr-tabs').selected = 0; + window.domAutomationController.send(true); + });)", + &toggled_to_basic)); + EXPECT_TRUE(toggled_to_basic); EXPECT_TRUE(ui_test_utils::NavigateToURL(browser(), GURL("https://foo.com"))); auto entries = @@ -181,7 +189,9 @@ histogram_tester.ExpectTotalCount("History.Clusters.Actions.NumQueries", 0); } -IN_PROC_BROWSER_TEST_F(HistoryClustersMetricsBrowserTest, IndirectNavigation) { +// TODO(manukh): Adjust the expectations for the navigation tests. +IN_PROC_BROWSER_TEST_F(HistoryClustersMetricsBrowserTest, + DISABLED_IndirectNavigation) { base::HistogramTester histogram_tester; ukm::TestAutoSetUkmRecorder ukm_recorder;
diff --git a/chrome/browser/lacros/lacros_extension_apps_publisher.cc b/chrome/browser/lacros/lacros_extension_apps_publisher.cc index ec714998..fd05cd82 100644 --- a/chrome/browser/lacros/lacros_extension_apps_publisher.cc +++ b/chrome/browser/lacros/lacros_extension_apps_publisher.cc
@@ -32,21 +32,21 @@ return extension->is_platform_app(); } -apps::mojom::InstallSource GetInstallSource( +apps::mojom::InstallReason GetInstallReason( const extensions::Extension* extension) { if (extensions::Manifest::IsComponentLocation(extension->location())) - return apps::mojom::InstallSource::kSystem; + return apps::mojom::InstallReason::kSystem; if (extensions::Manifest::IsPolicyLocation(extension->location())) - return apps::mojom::InstallSource::kPolicy; + return apps::mojom::InstallReason::kPolicy; if (extension->was_installed_by_oem()) - return apps::mojom::InstallSource::kOem; + return apps::mojom::InstallReason::kOem; if (extension->was_installed_by_default()) - return apps::mojom::InstallSource::kDefault; + return apps::mojom::InstallReason::kDefault; - return apps::mojom::InstallSource::kUser; + return apps::mojom::InstallReason::kUser; } } // namespace @@ -271,7 +271,7 @@ app->install_time = base::Time(); } - app->install_source = GetInstallSource(extension); + app->install_reason = GetInstallReason(extension); app->recommendable = apps::mojom::OptionalBool::kTrue; app->searchable = apps::mojom::OptionalBool::kTrue; app->paused = apps::mojom::OptionalBool::kFalse;
diff --git a/chrome/browser/notifications/arc_application_notifier_controller.cc b/chrome/browser/notifications/arc_application_notifier_controller.cc index 492e5a30..71df57bf 100644 --- a/chrome/browser/notifications/arc_application_notifier_controller.cc +++ b/chrome/browser/notifications/arc_application_notifier_controller.cc
@@ -55,7 +55,7 @@ } DCHECK(permission->value_type == apps::mojom::PermissionValueType::kBool); // Do not include notifier metadata for system apps. - if (update.InstallSource() == apps::mojom::InstallSource::kSystem) { + if (update.InstallSource() == apps::mojom::InstallReason::kSystem) { return; } notifier_dataset.push_back(NotifierDataset{
diff --git a/chrome/browser/notifications/pwa_notifier_controller.cc b/chrome/browser/notifications/pwa_notifier_controller.cc index 815e978..8dc33c0 100644 --- a/chrome/browser/notifications/pwa_notifier_controller.cc +++ b/chrome/browser/notifications/pwa_notifier_controller.cc
@@ -48,7 +48,7 @@ DCHECK(permission->value_type == apps::mojom::PermissionValueType::kTriState); // Do not include notifier metadata for system apps. - if (update.InstallSource() == apps::mojom::InstallSource::kSystem) { + if (update.InstallSource() == apps::mojom::InstallReason::kSystem) { return; } notifier_dataset.push_back(NotifierDataset{
diff --git a/chrome/browser/platform_util.cc b/chrome/browser/platform_util.cc index e105e55..b9b46b90 100644 --- a/chrome/browser/platform_util.cc +++ b/chrome/browser/platform_util.cc
@@ -13,6 +13,14 @@ #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" +#if BUILDFLAG(IS_CHROMEOS_LACROS) +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_window.h" +#include "chromeos/ui/base/window_pin_type.h" +#include "chromeos/ui/base/window_properties.h" +#include "ui/aura/window.h" +#endif + using content::BrowserThread; namespace platform_util { @@ -80,7 +88,17 @@ } bool IsBrowserLockedFullscreen(const Browser* browser) { +#if BUILDFLAG(IS_CHROMEOS_LACROS) + aura::Window* window = browser->window()->GetNativeWindow(); + // |window| can be nullptr inside of unit tests. + if (!window) + return false; + + return window->GetProperty(chromeos::kWindowPinTypeKey) == + chromeos::WindowPinType::kTrustedPinned; +#else return false; +#endif } } // namespace platform_util
diff --git a/chrome/browser/power_bookmarks/power_bookmark_utils.cc b/chrome/browser/power_bookmarks/power_bookmark_utils.cc index 28a91ad6..9543fc4 100644 --- a/chrome/browser/power_bookmarks/power_bookmark_utils.cc +++ b/chrome/browser/power_bookmarks/power_bookmark_utils.cc
@@ -7,6 +7,7 @@ #include <string> #include <vector> +#include "base/base64.h" #include "base/guid.h" #include "base/i18n/string_search.h" #include "base/strings/utf_string_conversions.h" @@ -54,9 +55,9 @@ if (!meta_info) meta_info = &local_meta_info; - std::string proto_bytes; - meta->SerializeToString(&proto_bytes); - (*meta_info)[kPowerBookmarkMetaKey] = proto_bytes; + std::string data; + EncodeMetaForStorage(*meta.get(), &data); + (*meta_info)[kPowerBookmarkMetaKey] = data; } } @@ -67,15 +68,21 @@ } std::unique_ptr<PowerBookmarkMeta> GetNodePowerBookmarkMeta( + bookmarks::BookmarkModel* model, const bookmarks::BookmarkNode* node) { - std::string proto_string; - if (!node || !node->GetMetaInfo(kPowerBookmarkMetaKey, &proto_string)) + if (!model) + return nullptr; + + std::string raw_meta; + if (!node || !node->GetMetaInfo(kPowerBookmarkMetaKey, &raw_meta)) return nullptr; std::unique_ptr<PowerBookmarkMeta> meta = std::make_unique<PowerBookmarkMeta>(); - if (!meta->ParseFromString(proto_string)) + if (!DecodeMetaFromStorage(raw_meta, meta.get())) { meta.reset(); + DeleteNodePowerBookmarkMeta(model, node); + } return meta; } @@ -88,9 +95,9 @@ CHECK(meta); - std::string proto_string; - meta->SerializeToString(&proto_string); - model->SetNodeMetaInfo(node, kPowerBookmarkMetaKey, proto_string); + std::string data; + EncodeMetaForStorage(*meta.get(), &data); + model->SetNodeMetaInfo(node, kPowerBookmarkMetaKey, data); } void DeleteNodePowerBookmarkMeta(bookmarks::BookmarkModel* model, @@ -123,7 +130,7 @@ template <class type> void GetBookmarksMatchingPropertiesImpl( type& iterator, - const bookmarks::BookmarkModel* model, + bookmarks::BookmarkModel* model, const PowerBookmarkQueryFields& query, const std::vector<std::u16string>& query_words, size_t max_count, @@ -136,7 +143,8 @@ query_words.empty() || bookmarks::DoesBookmarkContainWords( node->GetTitle(), node->url(), query_words); - std::unique_ptr<PowerBookmarkMeta> meta = GetNodePowerBookmarkMeta(node); + std::unique_ptr<PowerBookmarkMeta> meta = + GetNodePowerBookmarkMeta(model, node); // Similarly, if the query is empty, we want this test to pass. bool tags_match_query = @@ -217,4 +225,22 @@ } } +void EncodeMetaForStorage(const PowerBookmarkMeta& meta, std::string* out) { + std::string data; + meta.SerializeToString(&data); + base::Base64Encode(data, out); +} + +bool DecodeMetaFromStorage(const std::string& data, PowerBookmarkMeta* out) { + if (!out) + return false; + + std::string decoded_data; + + if (!base::Base64Decode(data, &decoded_data)) + return false; + + return out->ParseFromString(decoded_data); +} + } // namespace power_bookmarks
diff --git a/chrome/browser/power_bookmarks/power_bookmark_utils.h b/chrome/browser/power_bookmarks/power_bookmark_utils.h index 2f76eb6..aff778f 100644 --- a/chrome/browser/power_bookmarks/power_bookmark_utils.h +++ b/chrome/browser/power_bookmarks/power_bookmark_utils.h
@@ -62,6 +62,7 @@ // is transferred to the caller and a new instance is created each time this is // called. If the node has no meta, nullprt is returned. std::unique_ptr<PowerBookmarkMeta> GetNodePowerBookmarkMeta( + bookmarks::BookmarkModel* model, const bookmarks::BookmarkNode* node); // Set or overwrite the PowerBookmarkMeta for a node. @@ -85,6 +86,13 @@ size_t max_count, std::vector<const bookmarks::BookmarkNode*>* nodes); +// Encode the provided metadata into |out| so it can be safely stored as JSON +// in the persistence layer. +void EncodeMetaForStorage(const PowerBookmarkMeta& meta, std::string* out); + +// Decode metadata into |out| and return whether the operation was successful. +bool DecodeMetaFromStorage(const std::string& data, PowerBookmarkMeta* out); + } // namespace power_bookmarks #endif // CHROME_BROWSER_POWER_BOOKMARKS_POWER_BOOKMARK_UTILS_H_
diff --git a/chrome/browser/power_bookmarks/power_bookmark_utils_unittest.cc b/chrome/browser/power_bookmarks/power_bookmark_utils_unittest.cc index 95c3a0d..8488c91a5 100644 --- a/chrome/browser/power_bookmarks/power_bookmark_utils_unittest.cc +++ b/chrome/browser/power_bookmarks/power_bookmark_utils_unittest.cc
@@ -41,7 +41,7 @@ SetNodePowerBookmarkMeta(model, node, std::move(meta)); const std::unique_ptr<PowerBookmarkMeta> fetched_meta = - GetNodePowerBookmarkMeta(node); + GetNodePowerBookmarkMeta(model, node); EXPECT_EQ(kLeadImageUrl, fetched_meta->lead_image().url()); } @@ -60,7 +60,7 @@ DeleteNodePowerBookmarkMeta(model, node); const std::unique_ptr<PowerBookmarkMeta> fetched_meta = - GetNodePowerBookmarkMeta(node); + GetNodePowerBookmarkMeta(model, node); EXPECT_EQ(nullptr, fetched_meta.get()); } @@ -320,5 +320,21 @@ nodes.clear(); } +TEST_F(PowerBookmarkUtilsTest, EncodeAndDecodeForPersistence) { + PowerBookmarkMeta meta; + meta.set_type(PowerBookmarkType::SHOPPING); + meta.mutable_shopping_specifics()->set_title("Example Title"); + + std::string encoded_data; + EncodeMetaForStorage(meta, &encoded_data); + + PowerBookmarkMeta out_meta; + EXPECT_TRUE(DecodeMetaFromStorage(encoded_data, &out_meta)); + + ASSERT_EQ(meta.type(), out_meta.type()); + ASSERT_EQ(meta.shopping_specifics().title(), + out_meta.shopping_specifics().title()); +} + } // namespace } // namespace power_bookmarks
diff --git a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java index 90da181..0c2cd887 100644 --- a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java +++ b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java
@@ -440,24 +440,6 @@ "Chrome.Flags.CrashStreakBeforeCache"; /** - * Streak of crashes before caching flags from native. This controls Safe Mode for Cached Flags. - */ - public static final String FLAGS_CACHED_SAFE_VALUES_VERSION = "Chrome.Flags.SafeValuesVersion"; - - /** - * Cached feature flag and field trial parameter values considered safe because they last - * allowed Chrome to cache new ones from native. - */ - public static final KeyPrefix FLAGS_CACHED_SAFE_VALUES_BOOL = - new KeyPrefix("Chrome.Flags.SafeBool.*"); - public static final KeyPrefix FLAGS_CACHED_SAFE_VALUES_DOUBLE = - new KeyPrefix("Chrome.Flags.SafeDouble.*"); - public static final KeyPrefix FLAGS_CACHED_SAFE_VALUES_INT = - new KeyPrefix("Chrome.Flags.SafeInt.*"); - public static final KeyPrefix FLAGS_CACHED_SAFE_VALUES_STRING = - new KeyPrefix("Chrome.Flags.SafeString.*"); - - /** * Cached field trial parameters generated by CachedFeatureFlags use this prefix. */ public static final KeyPrefix FLAGS_FIELD_TRIAL_PARAM_CACHED = @@ -797,7 +779,19 @@ */ public static final String QUERY_TILES_SHOW_ON_NTP = "Chrome.Querytiles.ShowOnNTP"; + /** + * Keys used to store user actions for behavioral targeting of showing Start surface on startup. + */ public static final String PRIMARY_ACCOUNT_SYNC = "Chrome.StartSurface.PrimaryAccountSync"; + public static final String START_SHOW_ON_STARTUP = "Chrome.StartSurface.ShownOnStartup"; + public static final String START_NEXT_SHOW_ON_STARTUP_DECISION_MS = + "Chrome.StartSurface.ShownOnStartupDecisionMs"; + public static final String TAP_MV_TILES_COUNT = "Chrome.StartSurface.TapMVTilesCount"; + public static final String TAP_FEED_CARDS_COUNT = "Chrome.StartSurface.TapFeedCardsCount"; + public static final String OPEN_NEW_TAB_PAGE_COUNT = "Chrome.StartSurface.OpenNewTabPageCount"; + public static final String OPEN_HISTORY_COUNT = "Chrome.StartSurface.OpenHistoryCount"; + public static final String OPEN_RECENT_TABS_COUNT = "Chrome.StartSurface.OpenRecentTabCount"; + /** * Contains a trial group that was used to determine whether the reached code profiler should be * enabled. @@ -1072,11 +1066,6 @@ FIRST_RUN_FIELD_TRIAL_GROUP, FIRST_RUN_SKIPPED_BY_POLICY, FLAGS_CACHED.pattern(), - FLAGS_CACHED_SAFE_VALUES_BOOL.pattern(), - FLAGS_CACHED_SAFE_VALUES_DOUBLE.pattern(), - FLAGS_CACHED_SAFE_VALUES_INT.pattern(), - FLAGS_CACHED_SAFE_VALUES_STRING.pattern(), - FLAGS_CACHED_SAFE_VALUES_VERSION, FLAGS_CRASH_STREAK_BEFORE_CACHE, FLAGS_FIELD_TRIAL_PARAM_CACHED.pattern(), FLAGS_LAST_CACHED_MINIMAL_BROWSER_FLAGS_TIME_MILLIS, @@ -1109,6 +1098,9 @@ OFFLINE_MEASUREMENTS_LAST_CHECK_MILLIS, OFFLINE_MEASUREMENTS_SYSTEM_STATE_LIST, OFFLINE_MEASUREMENTS_USER_AGENT_STRING, + OPEN_HISTORY_COUNT, + OPEN_NEW_TAB_PAGE_COUNT, + OPEN_RECENT_TABS_COUNT, OPTIMIZATION_GUIDE_PUSH_NOTIFICATION_CACHE.pattern(), PERSISTENT_OFFLINE_CONTENT_AVAILABILITY_STATUS, PRICE_TRACKING_PRICE_ALERTS_MESSAGE_CARD, @@ -1128,6 +1120,10 @@ SHARING_LAST_SHARED_COMPONENT_NAME, SIGNIN_PROMO_IMPRESSIONS_COUNT_NTP, SIGNIN_PROMO_NTP_PROMO_EXPIRED, + START_NEXT_SHOW_ON_STARTUP_DECISION_MS, + START_SHOW_ON_STARTUP, + TAP_FEED_CARDS_COUNT, + TAP_MV_TILES_COUNT, TWA_DISCLOSURE_SEEN_PACKAGES, VIDEO_TUTORIALS_SHARE_URL_SET, WEB_FEED_INTRO_LAST_SHOWN_TIME_MS,
diff --git a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/DeprecatedChromePreferenceKeys.java b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/DeprecatedChromePreferenceKeys.java index 0d2342f8ba..56f9d14 100644 --- a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/DeprecatedChromePreferenceKeys.java +++ b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/DeprecatedChromePreferenceKeys.java
@@ -20,6 +20,11 @@ // clang-format off return Arrays.asList( "Chrome.Flags.PaintPreviewTestEnabled", + "Chrome.Flags.SafeBool.*", + "Chrome.Flags.SafeDouble.*", + "Chrome.Flags.SafeInt.*", + "Chrome.Flags.SafeString.*", + "Chrome.Flags.SafeValuesVersion", "Chrome.OfflineMeasurements.HttpProbeResultsList", "Chrome.OfflineMeasurements.IsAirplaneModeEnabledList", "Chrome.OfflineMeasurements.IsRoaming",
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc index 6bfac708..e993f8d4 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc
@@ -18,6 +18,7 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/test/bind.h" +#include "base/test/with_feature_override.h" #include "base/threading/thread_restrictions.h" #include "base/values.h" #include "build/build_config.h" @@ -84,6 +85,7 @@ #include "net/test/embedded_test_server/embedded_test_server.h" #include "net/test/embedded_test_server/http_request.h" #include "net/test/embedded_test_server/http_response.h" +#include "pdf/pdf_features.h" #include "services/service_manager/public/cpp/interface_provider.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -408,6 +410,14 @@ guest_view::TestGuestViewManager* test_guest_view_manager_; }; +class PdfPluginContextMenuBrowserTestWithUnseasonedOverride + : public base::test::WithFeatureOverride, + public PdfPluginContextMenuBrowserTest { + public: + PdfPluginContextMenuBrowserTestWithUnseasonedOverride() + : base::test::WithFeatureOverride(chrome_pdf::features::kPdfUnseasoned) {} +}; + IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, NonExtensionMenuItemsAlwaysVisible) { std::unique_ptr<TestRenderViewContextMenu> menu1 = @@ -1613,7 +1623,7 @@ EXPECT_EQ(GetLensImageSearchURL(), new_tab->GetURL()); } -IN_PROC_BROWSER_TEST_F(PdfPluginContextMenuBrowserTest, +IN_PROC_BROWSER_TEST_P(PdfPluginContextMenuBrowserTestWithUnseasonedOverride, FullPagePdfHasPageItems) { std::unique_ptr<TestRenderViewContextMenu> menu = SetupAndCreateMenu(); @@ -1621,7 +1631,7 @@ ASSERT_TRUE(menu->IsItemPresent(IDC_RELOAD)); } -IN_PROC_BROWSER_TEST_F(PdfPluginContextMenuBrowserTest, +IN_PROC_BROWSER_TEST_P(PdfPluginContextMenuBrowserTestWithUnseasonedOverride, FullPagePdfFullscreenItems) { std::unique_ptr<TestRenderViewContextMenu> menu = SetupAndCreateMenu(); @@ -1640,11 +1650,14 @@ ASSERT_FALSE(menu->IsCommandIdEnabled(IDC_CONTENT_CONTEXT_ROTATECCW)); } -IN_PROC_BROWSER_TEST_F(PdfPluginContextMenuBrowserTest, +IN_PROC_BROWSER_TEST_P(PdfPluginContextMenuBrowserTestWithUnseasonedOverride, IframedPdfHasNoPageItems) { TestContextMenuOfPdfInsideWebPage(FILE_PATH_LITERAL("test-iframe-pdf.html")); } +INSTANTIATE_FEATURE_OVERRIDE_TEST_SUITE( + PdfPluginContextMenuBrowserTestWithUnseasonedOverride); + class LoadImageRequestObserver : public content::WebContentsObserver { public: LoadImageRequestObserver(content::WebContents* web_contents,
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/background_test.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/background_test.js index 14c3174..1a72430 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/background_test.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/background_test.js
@@ -3706,3 +3706,22 @@ .replay(); }); }); + +TEST_F('ChromeVoxBackgroundTest', 'GroupNavigation', function() { + const mockFeedback = this.createMockFeedback(); + const site = ` + <p><span>hello</span><a href="a.com">hi</a><a href="a.com">hey</a></p> + <p><span>goodbye</span><a href="a.com">bye</a><a href="a.com">chow</a></p> + `; + this.runWithLoadedTree(site, function() { + mockFeedback.call(doCmd('nextGroup')) + .expectSpeech('goodbye', 'bye', 'Link', 'chow', 'Link') + .call(doCmd('nextObject')) + .expectSpeech('goodbye') + .call(doCmd('nextObject')) + .expectSpeech('bye', 'Link') + .call(doCmd('previousGroup')) + .expectSpeech('hello', 'hi', 'Link', 'hey', 'Link') + .replay(); + }); +});
diff --git a/chrome/browser/resources/chromeos/accessibility/common/automation_predicate.js b/chrome/browser/resources/chromeos/accessibility/common/automation_predicate.js index e8ef1b6..1460df3 100644 --- a/chrome/browser/resources/chromeos/accessibility/common/automation_predicate.js +++ b/chrome/browser/resources/chromeos/accessibility/common/automation_predicate.js
@@ -653,6 +653,25 @@ } /** + * Matches against nodes visited during group navigation. + * @param {!AutomationNode} node + * @return {boolean} + */ + static group(node) { + if (AutomationPredicate.text(node) || node.display === 'inline') { + return false; + } + + return AutomationPredicate.match({ + anyRole: [Role.HEADING, Role.LIST, Role.PARAGRAPH], + anyPredicate: [ + AutomationPredicate.editText, AutomationPredicate.formField, + AutomationPredicate.object, AutomationPredicate.table + ] + })(node); + } + + /** * Matches against editable nodes, that should not be treated in the usual * fashion. * Instead, only output the contents around the selection in braille. @@ -773,21 +792,6 @@ Role.FORM, Role.MAIN, Role.NAVIGATION, Role.REGION, Role.SEARCH ]); - -/** - * Matches against nodes visited during group navigation. An object as - * @param {!AutomationNode} node - * @return {boolean} - */ -AutomationPredicate.group = AutomationPredicate.match({ - anyRole: [Role.HEADING, Role.LIST, Role.PARAGRAPH], - anyPredicate: [ - AutomationPredicate.editText, AutomationPredicate.formField, - AutomationPredicate.object, AutomationPredicate.table - ] -}); - - /** * Matches against nodes that contain interesting nodes, but should never be * visited.
diff --git a/chrome/browser/resources/chromeos/wallpaper_manager/js/event_page.js b/chrome/browser/resources/chromeos/wallpaper_manager/js/event_page.js index e35cec3..9909953 100644 --- a/chrome/browser/resources/chromeos/wallpaper_manager/js/event_page.js +++ b/chrome/browser/resources/chromeos/wallpaper_manager/js/event_page.js
@@ -230,6 +230,14 @@ }); }); +chrome.wallpaperPrivate.isSwaEnabled(function(swaEnabled) { + // If the new SWA picker is enabled, this extension should not be syncing and + // running daily updates in the background. + if (swaEnabled) + return; + +// TODO(qasid): run git cl format --js to indent this appropriately. Didn't do +// so the first time to make the diff easier to review. chrome.syncFileSystem.onFileStatusChanged.addListener(function(detail) { WallpaperUtil.enabledSyncThemesCallback(function(syncEnabled) { if (!syncEnabled) @@ -496,3 +504,4 @@ wallpaperPickerWindow.contentWindow.dispatchEvent(event); } }); +});
diff --git a/chrome/browser/resources/history/BUILD.gn b/chrome/browser/resources/history/BUILD.gn index 56a5ce4..49ece03e 100644 --- a/chrome/browser/resources/history/BUILD.gn +++ b/chrome/browser/resources/history/BUILD.gn
@@ -45,6 +45,8 @@ out_grd = "$target_gen_dir/${grd_prefix}_resources.grd" input_files = [ "history.html", + "images/journeys.svg", + "images/list.svg", "images/sign_in_promo_dark.svg", "images/sign_in_promo.svg", ]
diff --git a/chrome/browser/resources/history/app.html b/chrome/browser/resources/history/app.html index b6d422c1..bf9159f 100644 --- a/chrome/browser/resources/history/app.html +++ b/chrome/browser/resources/history/app.html
@@ -27,6 +27,28 @@ height: 100%; } + #tabs-container { + --cr-tabs-height: 48px; + } + + #tabs { + --cr-tabs-icon-margin-end: 8px; + --cr-tabs-margin-end: 16px; + --cr-tabs-margin-start: 16px; + border-bottom: 1px solid var(--separator-color); + display: flex; + justify-content: center; + } + + #tabs-content, + #tabs-content > * { + height: 100%; + } + + :host([history-clusters-enabled_]) #tabs-content { + height: calc(100% - var(--cr-tabs-height)); + } + :host([toolbar-shadow_]) #drop-shadow { opacity: var(--cr-container-shadow-max-opacity); } @@ -51,30 +73,46 @@ queryState_.incremental, queryState_.searchTerm)]]"> </history-toolbar> - <div id="drop-shadow" class="cr-container-shadow"></div> <div id="main-container"> <history-side-bar id="content-side-bar" selected-page="{{selectedPage_}}" + selected-tab="[[selectedTab_]]" footer-info="[[footerInfo]]" hidden$="[[hasDrawer_]]"> </history-side-bar> <iron-pages id="content" attr-for-selected="path" fallback-selection="history" selected="[[getSelectedPage_(selectedPage_, items)]]" - selected-item="{{scrollTarget}}" + on-selected-item-changed="selectedItemChanged_" items="{{items}}"> - <history-list id="history" query-state="[[queryState_]]" - searched-term="[[queryResult_.info.term]]" - pending-delete="{{pendingDelete_}}" - query-result="[[queryResult_]]" - path="history"> - </history-list> - <template is="dom-if" if="[[historyClustersSelected_(selectedPage_)]]"> - <history-clusters id="history-clusters" - query="[[queryState_.searchTerm]]" - path="journeys"> - </history-clusters> - </template> + <div id="tabs-container" path="history"> + <template is="dom-if" if="[[historyClustersEnabled_]]"> + <div id="tabs"> + <cr-tabs tab-names="[[tabsNames_]]" + tab-icons="[[tabsIcons_]]" + selected="{{selectedTab_}}"> + </cr-tabs> + </div> + </template> + <iron-pages id="tabs-content" attr-for-selected="path" + fallback-selection="history" + selected="[[getSelectedPage_(selectedPage_, items)]]" + items="{{items}}"> + <history-list id="history" query-state="[[queryState_]]" + searched-term="[[queryResult_.info.term]]" + pending-delete="{{pendingDelete_}}" + query-result="[[queryResult_]]" + path="history"> + </history-list> + <template is="dom-if" + if="[[historyClustersSelected_(selectedPage_, historyClustersEnabled_)]]"> + <history-clusters id="history-clusters" + query="[[queryState_.searchTerm]]" + path="journeys"> + </history-clusters> + </template> + </iron-pages> + </div> <template is="dom-if" if="[[syncedTabsSelected_(selectedPage_)]]"> <history-synced-device-manager id="synced-devices" session-list="[[queryResult_.sessionList]]" @@ -91,6 +129,7 @@ <cr-drawer heading="$i18n{title}" align="$i18n{textdirection}"> <history-side-bar id="drawer-side-bar" slot="body" selected-page="{{selectedPage_}}" + selected-tab="[[selectedTab_]]" footer-info="[[footerInfo]]"> </history-side-bar> </cr-drawer>
diff --git a/chrome/browser/resources/history/app.ts b/chrome/browser/resources/history/app.ts index 4b8e1e5..9cca703f 100644 --- a/chrome/browser/resources/history/app.ts +++ b/chrome/browser/resources/history/app.ts
@@ -5,14 +5,13 @@ import 'chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.m.js'; import 'chrome://resources/cr_elements/shared_style_css.m.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js'; +import 'chrome://resources/cr_elements/cr_tabs/cr_tabs.js'; import 'chrome://resources/polymer/v3_0/iron-media-query/iron-media-query.js'; import 'chrome://resources/polymer/v3_0/iron-pages/iron-pages.js'; - import './history_clusters/clusters.js'; import './history_list.js'; import './history_toolbar.js'; import './query_manager.js'; -import './router.js'; import './shared_style.js'; import './side_bar.js'; import './strings.m.js'; @@ -25,6 +24,7 @@ import {hasKeyModifiers} from 'chrome://resources/js/util.m.js'; import {WebUIListenerBehavior} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import {IronA11yAnnouncer} from 'chrome://resources/polymer/v3_0/iron-a11y-announcer/iron-a11y-announcer.js'; +import {IronPagesElement} from 'chrome://resources/polymer/v3_0/iron-pages/iron-pages.js'; import {IronScrollTargetBehavior} from 'chrome://resources/polymer/v3_0/iron-scroll-target-behavior/iron-scroll-target-behavior.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; @@ -34,6 +34,7 @@ import {HistoryListElement} from './history_list.js'; import {HistoryToolbarElement} from './history_toolbar.js'; import {HistoryQueryManagerElement} from './query_manager.js'; +import {Page, TABBED_PAGES} from './router.js'; import {FooterInfo} from './side_bar.js'; let lazyLoadPromise: Promise<void>|null = null; @@ -119,6 +120,8 @@ $: { 'drawer': CrLazyRenderElement<CrDrawerElement>, 'history': HistoryListElement, + 'tabs-container': Element, + 'tabs-content': IronPagesElement, 'toolbar': HistoryToolbarElement, }; } @@ -158,7 +161,6 @@ notify: true, }, - /** @type {!QueryState} */ queryState_: Object, // True if the window is narrow enough for the page to have a drawer. @@ -167,7 +169,6 @@ observer: 'hasDrawerChanged_', }, - /** @type {FooterInfo} */ footerInfo: { type: Object, value() { @@ -177,16 +178,49 @@ }; }, }, + + historyClustersEnabled_: { + type: Boolean, + reflectToAttribute: true, + value: () => loadTimeData.getBoolean('isHistoryClustersEnabled'), + }, + + // The index of the currently selected tab. + selectedTab_: { + type: Number, + observer: 'selectedTabChanged_', + }, + + tabsIcons_: { + type: Array, + value: () => ['images/list.svg', 'images/journeys.svg'], + }, + + tabsNames_: { + type: Array, + value: () => { + return [ + loadTimeData.getString('historyListTabLabel'), + loadTimeData.getString('historyClustersTabLabel') + ]; + }, + }, }; } - private eventTracker_: EventTracker = new EventTracker(); + footerInfo: FooterInfo; private browserService_: BrowserService|null = null; - private queryResult_: QueryResult; + private eventTracker_: EventTracker = new EventTracker(); + private hasDrawer_: boolean; + private historyClustersEnabled_: boolean; private isUserSignedIn_: boolean = loadTimeData.getBoolean('isUserSignedIn'); private pendingDelete_: boolean; - private hasDrawer_: boolean; - private selectedPage_: string; + private queryResult_: QueryResult; + private queryState_: QueryState; + private selectedPage_: Page; + private selectedTab_: number; + private tabsIcons_: Array<string>; + private tabsNames_: Array<string>; private toolbarShadow_: boolean; constructor() { @@ -246,9 +280,10 @@ new CustomEvent(eventName, {bubbles: true, composed: true, detail})); } - private historyClustersSelected_(selectedPage: string): boolean { - return selectedPage === 'journeys' && - loadTimeData.getBoolean('isHistoryClustersEnabled'); + private historyClustersSelected_( + _selectedPage: Page, _historyClustersEnabled: boolean): boolean { + return this.selectedPage_ === Page.HISTORY_CLUSTERS && + this.historyClustersEnabled_; } private onFirstRender_() { @@ -259,8 +294,7 @@ // Focus the search field on load. Done here to ensure the history page // is rendered before we try to take focus. - const searchField = - /** @type {HistoryToolbarElement} */ (this.$.toolbar).searchField; + const searchField = this.$.toolbar.searchField; if (!searchField.narrow) { searchField.getSearchInput().focus(); } @@ -277,7 +311,11 @@ /** Overridden from IronScrollTargetBehavior */ _scrollHandler() { if (this.scrollTarget) { - this.toolbarShadow_ = this.scrollTarget.scrollTop !== 0; + // When the tabs are visible, show the toolbar shadow for the synced + // devices page only. + this.toolbarShadow_ = this.scrollTarget.scrollTop !== 0 && + (!this.historyClustersEnabled_ || + this.syncedTabsSelected_(this.selectedPage_!)); } } @@ -290,16 +328,12 @@ * and changes the view of the top toolbar. */ checkboxSelected() { - const toolbar = /** @type {HistoryToolbarElement} */ (this.$.toolbar); - toolbar.count = /** @type {HistoryListElement} */ (this.$.history) - .getSelectedItemCount(); + this.$.toolbar.count = this.$.history.getSelectedItemCount(); } selectOrUnselectAll() { - const list = /** @type {HistoryListElement} */ (this.$.history); - const toolbar = /** @type {HistoryToolbarElement} */ (this.$.toolbar); - list.selectOrUnselectAll(); - toolbar.count = list.getSelectedItemCount(); + this.$.history.selectOrUnselectAll(); + this.$.toolbar.count = this.$.history.getSelectedItemCount(); } /** @@ -307,10 +341,8 @@ * checkbox to be unselected. */ private unselectAll() { - const list = /** @type {HistoryListElement} */ (this.$.history); - const toolbar = /** @type {HistoryToolbarElement} */ (this.$.toolbar); - list.unselectAllItems(); - toolbar.count = 0; + this.$.history.unselectAllItems(); + this.$.toolbar.count = 0; } deleteSelected() { @@ -318,8 +350,8 @@ } private onQueryFinished_() { - const list = /** @type {HistoryListElement} */ (this.$['history']); - list.historyResult(this.queryResult_.info!, this.queryResult_.results!); + this.$.history.historyResult( + this.queryResult_.info!, this.queryResult_.results!); if (document.body.classList.contains('loading')) { document.body.classList.remove('loading'); this.onFirstRender_(); @@ -364,7 +396,8 @@ private onSelectAllCommand_(): boolean { if (this.$.toolbar.searchField.isSearchFocused() || this.syncedTabsSelected_(this.selectedPage_!) || - this.historyClustersSelected_(this.selectedPage_!)) { + this.historyClustersSelected_( + this.selectedPage_!, this.historyClustersEnabled_)) { return false; } this.selectOrUnselectAll(); @@ -393,8 +426,8 @@ this.set('footerInfo.otherFormsOfHistory', hasOtherForms); } - private syncedTabsSelected_(selectedPage: string): boolean { - return selectedPage === 'syncedTabs'; + private syncedTabsSelected_(_selectedPage: Page): boolean { + return this.selectedPage_ === Page.SYNCED_TABS; } /** @@ -409,6 +442,33 @@ private selectedPageChanged_() { this.unselectAll(); this.historyViewChanged_(); + this.maybeUpdateSelectedHistoryTab_(); + } + + private selectedItemChanged_(e: Event) { + // <history-list> and <history-clusters> are inside two nested <iron-pages>. + // Adjust the scroll target when the selection on the outer one changes. + const selectedItem = + ((e.target as IronPagesElement).selectedItem as HTMLElement); + if (selectedItem && selectedItem !== this.$['tabs-container']) { + this.scrollTarget = selectedItem; + } else if (this.$['tabs-content'].selectedItem) { + this.scrollTarget = (this.$['tabs-content'].selectedItem as HTMLElement); + } + } + + private selectedTabChanged_() { + // Change in the currently selected tab requires change in the currently + // selected page. + this.selectedPage_ = TABBED_PAGES[this.selectedTab_]; + } + + private maybeUpdateSelectedHistoryTab_() { + // Change in the currently selected page may require change in the currently + // selected tab. + if (TABBED_PAGES.includes(this.selectedPage_)) { + this.selectedTab_ = TABBED_PAGES.indexOf(this.selectedPage_); + } } private historyViewChanged_() { @@ -429,9 +489,9 @@ /** * This computed binding is needed to make the iron-pages selector update - * when the synced-device-manager is instantiated for the first time. - * Otherwise the fallback selection will continue to be used after the - * corresponding item is added as a child of iron-pages. + * when <synced-device-manager> or <history-clusters> is instantiated for the + * first time. Otherwise the fallback selection will continue to be used after + * the corresponding item is added as a child of iron-pages. */ private getSelectedPage_(selectedPage: string, _items: Array<any>): string { return selectedPage; @@ -447,10 +507,10 @@ private recordHistoryPageView_() { let histogramValue = HistoryPageViewHistogram.END; switch (this.selectedPage_) { - case 'journeys': + case Page.HISTORY_CLUSTERS: histogramValue = HistoryPageViewHistogram.JOURNEYS; break; - case 'syncedTabs': + case Page.SYNCED_TABS: histogramValue = this.isUserSignedIn_ ? HistoryPageViewHistogram.SYNCED_TABS : HistoryPageViewHistogram.SIGNIN_PROMO;
diff --git a/chrome/browser/resources/history/images/journeys.svg b/chrome/browser/resources/history/images/journeys.svg new file mode 100644 index 0000000..df7b0bf --- /dev/null +++ b/chrome/browser/resources/history/images/journeys.svg
@@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M19 15c-1.3 0-2.4.84-2.82 2H11c-1.1 0-2-.9-2-2s.9-2 2-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4H7.82C7.4 3.84 6.3 3 5 3 3.34 3 2 4.34 2 6s1.34 3 3 3c1.3 0 2.4-.84 2.82-2H13c1.1 0 2 .9 2 2s-.9 2-2 2h-2c-2.21 0-4 1.79-4 4s1.79 4 4 4h5.18A2.996 2.996 0 0 0 22 18c0-1.66-1.34-3-3-3zM5 7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1z"/></svg> \ No newline at end of file
diff --git a/chrome/browser/resources/history/images/list.svg b/chrome/browser/resources/history/images/list.svg new file mode 100644 index 0000000..1eabfd9 --- /dev/null +++ b/chrome/browser/resources/history/images/list.svg
@@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="M0 0h24v24H0V0z" fill="none" opacity=".87"/><path d="M0 0h24v24H0V0z" fill="none"/><path d="M4 13c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zm0 4c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zm0-8c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zm3 4h14v-2H7v2zm0 4h14v-2H7v2zM7 7v2h14V7H7z"/></svg> \ No newline at end of file
diff --git a/chrome/browser/resources/history/router.ts b/chrome/browser/resources/history/router.ts index be33436e..6dc5a821 100644 --- a/chrome/browser/resources/history/router.ts +++ b/chrome/browser/resources/history/router.ts
@@ -9,6 +9,16 @@ import {QueryState} from './externs.js'; +// All valid pages. +export enum Page { + HISTORY = 'history', + HISTORY_CLUSTERS = 'journeys', + SYNCED_TABS = 'syncedTabs', +} + +// The ids of pages with corresponding tabs in the order of their tab indices. +export const TABBED_PAGES = [Page.HISTORY, Page.HISTORY_CLUSTERS]; + export class HistoryRouterElement extends PolymerElement { static get is() { return 'history-router'; @@ -88,7 +98,7 @@ serializeUrl() { let path = this.selectedPage; - if (path === 'history') { + if (path === Page.HISTORY) { path = ''; } @@ -110,7 +120,7 @@ this.parsing_ = true; const changes: {search: string} = {search: ''}; const sections = this.path_.substr(1).split('/'); - const page = sections[0] || 'history'; + const page = sections[0] || Page.HISTORY; changes.search = this.queryParams_.q || '';
diff --git a/chrome/browser/resources/history/side_bar.html b/chrome/browser/resources/history/side_bar.html index 95639fc..5308ce8 100644 --- a/chrome/browser/resources/history/side_bar.html +++ b/chrome/browser/resources/history/side_bar.html
@@ -99,18 +99,13 @@ <iron-selector id="menu" selected="{{selectedPage}}" selectable=".page-item" attr-for-selected="path" on-iron-activate="onSelectorActivate_"> - <a id="history" role="menuitem" href="/" class="page-item" - path="history" on-click="onItemClick_"> + <a id="history" role="menuitem" class="page-item" + href="[[getHistoryItemHref_(selectedTab, historyClustersEnabled_)]]" + path="[[getHistoryItemPath_(selectedTab, historyClustersEnabled_)]]" + on-click="onItemClick_"> $i18n{historyMenuItem} <paper-ripple></paper-ripple> </a> - <template is="dom-if" if="[[historyClustersEnabled_]]"> - <a id="historyClusters" role="menuitem" href="/journeys" - class="page-item" path="journeys" on-click="onItemClick_"> - $i18n{historyClustersMenuItem} - <paper-ripple></paper-ripple> - </a> - </template> <a id="syncedTabs" role="menuitem" href="/syncedTabs" class="page-item" path="syncedTabs" on-click="onItemClick_"> $i18n{openTabsMenuItem}
diff --git a/chrome/browser/resources/history/side_bar.ts b/chrome/browser/resources/history/side_bar.ts index bc5c4f7..58af7595 100644 --- a/chrome/browser/resources/history/side_bar.ts +++ b/chrome/browser/resources/history/side_bar.ts
@@ -19,6 +19,7 @@ import {html, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {BrowserService} from './browser_service.js'; +import {Page, TABBED_PAGES} from './router.js'; export type FooterInfo = { managed: boolean, @@ -42,14 +43,18 @@ static get properties() { return { + footerInfo: Object, + + /* The id of the currently selected page. */ selectedPage: { type: String, notify: true, }, - guestSession_: Boolean, + /* The index of the currently selected tab. */ + selectedTab: Number, - footerInfo: Object, + guestSession_: Boolean, historyClustersEnabled_: { type: Boolean, @@ -67,8 +72,12 @@ }; } - private guestSession_ = loadTimeData.getBoolean('isGuestSession'); footerInfo: FooterInfo; + selectedPage: Page; + selectedTab: number; + private guestSession_ = loadTimeData.getBoolean('isGuestSession'); + private historyClustersEnabled_: boolean; + private showFooter_: boolean; /** @override */ ready() { @@ -110,6 +119,30 @@ e.preventDefault(); } + /** + * @returns The url to navigate to when the history menu item is clicked. It + * reflects the currently selected tab. + */ + private getHistoryItemHref_( + _selectedHistoryTab: number, _historyClustersEnabled: boolean): string { + return this.historyClustersEnabled_ && + TABBED_PAGES[this.selectedTab] === Page.HISTORY_CLUSTERS ? + '/' + Page.HISTORY_CLUSTERS : + '/'; + } + + /** + * @returns The path that determines if the history menu item is selected. It + * reflects the currently selected tab. + */ + private getHistoryItemPath_( + _selectedHistoryTab: number, _historyClustersEnabled: boolean): string { + return this.historyClustersEnabled_ && + TABBED_PAGES[this.selectedTab] === Page.HISTORY_CLUSTERS ? + Page.HISTORY_CLUSTERS : + Page.HISTORY; + } + private computeShowFooter_( includeOtherFormsOfBrowsingHistory: boolean, managed: boolean): boolean { return includeOtherFormsOfBrowsingHistory || managed;
diff --git a/chrome/browser/resources/new_tab_page/modules/photos/module.html b/chrome/browser/resources/new_tab_page/modules/photos/module.html index 1a82cdc3..70f3e41 100644 --- a/chrome/browser/resources/new_tab_page/modules/photos/module.html +++ b/chrome/browser/resources/new_tab_page/modules/photos/module.html
@@ -81,6 +81,7 @@ position: absolute; right: 0; top: 0; + z-index: 1; } .memory-title { @@ -96,6 +97,7 @@ position: absolute; right: 0; top: 0; + z-index: 2; } .memory-img { @@ -309,9 +311,13 @@ show-info-button="[[!showOptInScreen]]" on-info-button-click="onInfoButtonClick_" show-dismiss-button on-dismiss-button-click="onDismissButtonClick_" - dismiss-text="[[i18n('modulesPhotosMemoriesHideToday')]]" + dismiss-text="[[i18nRecursive('', + 'modulesDismissButtonText', + 'modulesPhotosMemoriesHideToday')]]" on-disable-button-click="onDisableButtonClick_" - disable-text="[[i18n('modulesPhotosMemoriesDisable')]]"> + disable-text="[[i18nRecursive('', + 'modulesDisableButtonText', + 'modulesPhotosMemoriesDisable')]]"> [[i18n('modulesPhotosTitle')]] </ntp-module-header> <div id="memories">
diff --git a/chrome/browser/resources/new_tab_page/modules/photos/module.js b/chrome/browser/resources/new_tab_page/modules/photos/module.js index c46c9d6..20ad0ee0 100644 --- a/chrome/browser/resources/new_tab_page/modules/photos/module.js +++ b/chrome/browser/resources/new_tab_page/modules/photos/module.js
@@ -97,7 +97,9 @@ bubbles: true, composed: true, detail: { - message: loadTimeData.getString('modulesPhotosMemoriesDisabled'), + message: loadTimeData.getStringF( + 'disableModuleToastMessage', + loadTimeData.getString('modulesPhotosMemoriesDisabled')), }, })); }
diff --git a/chrome/browser/resources/settings/chromeos/crostini_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/crostini_page/BUILD.gn index 64404e9..0790c01e 100644 --- a/chrome/browser/resources/settings/chromeos/crostini_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/crostini_page/BUILD.gn
@@ -143,7 +143,6 @@ ":crostini_browser_proxy", ":crostini_port_forwarding_add_port_dialog", "..:metrics_recorder.m", - "../../controls:settings_toggle_button", "../../prefs:prefs_behavior", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_elements/cr_action_menu:cr_action_menu", @@ -181,7 +180,6 @@ "..:os_route.m", "..:route_origin_behavior.m", "../..:router", - "../../controls:settings_toggle_button", "../../prefs:prefs_behavior", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", "//ui/webui/resources/cr_elements/cr_link_row:cr_link_row", @@ -189,6 +187,7 @@ "//ui/webui/resources/js:load_time_data.m", "//ui/webui/resources/js:web_ui_listener_behavior.m", ] + externs_list = [ "../settings_controls_types.js" ] } html_to_js("web_components") {
diff --git a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_subpage.js b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_subpage.js index 7bc8fd9..5ea9072d 100644 --- a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_subpage.js +++ b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_subpage.js
@@ -21,11 +21,12 @@ import '//resources/cr_elements/cr_button/cr_button.m.js'; import '//resources/cr_elements/cr_link_row/cr_link_row.js'; import '//resources/cr_elements/icons.m.js'; +import '../../controls/settings_toggle_button.js'; + import {I18nBehavior} from '//resources/js/i18n_behavior.m.js'; import {loadTimeData} from '//resources/js/load_time_data.m.js'; import {DEFAULT_CROSTINI_VM, DEFAULT_CROSTINI_CONTAINER, CrostiniPortProtocol, CrostiniPortSetting, CrostiniDiskInfo, CrostiniPortActiveSetting, CrostiniBrowserProxy, CrostiniBrowserProxyImpl, PortState, MIN_VALID_PORT_NUMBER, MAX_VALID_PORT_NUMBER} from './crostini_browser_proxy.js'; import './crostini_confirmation_dialog.js'; -import {SettingsToggleButtonElement} from '../../controls/settings_toggle_button.js'; import {PrefsBehavior} from '../../prefs/prefs_behavior.js'; import {DeepLinkingBehavior} from '../deep_linking_behavior.m.js'; import {routes} from '../os_route.m.js';
diff --git a/chrome/browser/resources/settings/chromeos/date_time_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/date_time_page/BUILD.gn index b922527..8a416da 100644 --- a/chrome/browser/resources/settings/chromeos/date_time_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/date_time_page/BUILD.gn
@@ -48,12 +48,12 @@ js_library("timezone_selector") { deps = [ ":timezone_browser_proxy", - "../../controls:settings_dropdown_menu", "../../prefs:prefs_behavior", "../../prefs:prefs_types", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/js:load_time_data.m", ] + externs_list = [ "../settings_controls_types.js" ] } js_library("timezone_subpage") {
diff --git a/chrome/browser/resources/settings/chromeos/date_time_page/timezone_selector.js b/chrome/browser/resources/settings/chromeos/date_time_page/timezone_selector.js index c0ce3a4..0ac96bf 100644 --- a/chrome/browser/resources/settings/chromeos/date_time_page/timezone_selector.js +++ b/chrome/browser/resources/settings/chromeos/date_time_page/timezone_selector.js
@@ -7,11 +7,11 @@ */ import '../../settings_shared_css.js'; +import '../../controls/settings_dropdown_menu.js'; import {addWebUIListener, removeWebUIListener, sendWithPromise, WebUIListener} from '//resources/js/cr.m.js'; import {afterNextRender, flush, html, Polymer, TemplateInstanceBase, Templatizer} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {DropdownMenuOptionList} from '../../controls/settings_dropdown_menu.js'; import {loadTimeData} from '../../i18n_setup.js'; import {PrefsBehavior} from '../../prefs/prefs_behavior.js'; import {CrSettingsPrefs} from '../../prefs/prefs_types.js';
diff --git a/chrome/browser/resources/settings/chromeos/device_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/device_page/BUILD.gn index f1ffb956..603b4957 100644 --- a/chrome/browser/resources/settings/chromeos/device_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/device_page/BUILD.gn
@@ -49,7 +49,6 @@ deps = [ "..:os_route.m", "../..:router", - "../../controls:settings_slider", "../settings_scheduler_slider:settings_scheduler_slider", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_elements/cr_slider:cr_slider", @@ -58,6 +57,7 @@ externs_list = chrome_extension_public_externs + [ "$externs_path/settings_private.js", "$externs_path/system_display.js", + "../settings_controls_types.js", ] } @@ -89,10 +89,10 @@ "..:os_route.m", "../..:i18n_setup", "../..:router", - "../../controls:settings_dropdown_menu", "//ui/webui/resources/js:assert.m", "//ui/webui/resources/js/cr/ui:focus_without_ink.m", ] + externs_list = [ "../settings_controls_types.js" ] } js_library("layout_behavior") { @@ -112,7 +112,6 @@ "..:deep_linking_behavior.m", "..:os_route.m", "../..:router", - "../../controls:settings_toggle_button", "//ui/webui/resources/cr_components/chromeos/localized_link:localized_link", ] }
diff --git a/chrome/browser/resources/settings/chromeos/device_page/display.js b/chrome/browser/resources/settings/chromeos/device_page/display.js index 30f3075f..911d5b7 100644 --- a/chrome/browser/resources/settings/chromeos/device_page/display.js +++ b/chrome/browser/resources/settings/chromeos/device_page/display.js
@@ -19,6 +19,7 @@ import '../../controls/settings_slider.js'; import '../../settings_shared_css.js'; import '../../settings_vars_css.js'; +import '../../controls/settings_dropdown_menu.js'; import {SliderTick} from '//resources/cr_elements/cr_slider/cr_slider.js'; import {assert, assertNotReached} from '//resources/js/assert.m.js'; @@ -27,7 +28,6 @@ import {loadTimeData} from '//resources/js/load_time_data.m.js'; import {afterNextRender, flush, html, Polymer, TemplateInstanceBase, Templatizer} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {DropdownMenuOptionList} from '../../controls/settings_dropdown_menu.js'; import {PrefsBehavior} from '../../prefs/prefs_behavior.js'; import {Route, RouteObserverBehavior, Router} from '../../router.js'; import {DeepLinkingBehavior} from '../deep_linking_behavior.m.js';
diff --git a/chrome/browser/resources/settings/chromeos/device_page/keyboard.js b/chrome/browser/resources/settings/chromeos/device_page/keyboard.js index 230a3d1..835fd35 100644 --- a/chrome/browser/resources/settings/chromeos/device_page/keyboard.js +++ b/chrome/browser/resources/settings/chromeos/device_page/keyboard.js
@@ -7,13 +7,13 @@ import '../../controls/settings_slider.js'; import '../../controls/settings_toggle_button.js'; import '../../settings_shared_css.js'; +import '../../controls/settings_dropdown_menu.js'; import {assert, assertNotReached} from '//resources/js/assert.m.js'; import {addWebUIListener, removeWebUIListener, sendWithPromise, WebUIListener} from '//resources/js/cr.m.js'; import {focusWithoutInk} from '//resources/js/cr/ui/focus_without_ink.m.js'; import {afterNextRender, flush, html, Polymer, TemplateInstanceBase, Templatizer} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {DropdownMenuOptionList} from '../../controls/settings_dropdown_menu.js'; import {loadTimeData} from '../../i18n_setup.js'; import {Route, RouteObserverBehavior, Router} from '../../router.js'; import {DeepLinkingBehavior} from '../deep_linking_behavior.m.js';
diff --git a/chrome/browser/resources/settings/chromeos/device_page/pointers.js b/chrome/browser/resources/settings/chromeos/device_page/pointers.js index ffebad5..ea946f2 100644 --- a/chrome/browser/resources/settings/chromeos/device_page/pointers.js +++ b/chrome/browser/resources/settings/chromeos/device_page/pointers.js
@@ -17,7 +17,6 @@ import {loadTimeData} from '//resources/js/load_time_data.m.js'; import {afterNextRender, flush, html, Polymer, TemplateInstanceBase, Templatizer} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {DropdownMenuOptionList} from '../../controls/settings_dropdown_menu.js'; import {PrefsBehavior} from '../../prefs/prefs_behavior.js'; import {Route, RouteObserverBehavior, Router} from '../../router.js'; import {DeepLinkingBehavior} from '../deep_linking_behavior.m.js';
diff --git a/chrome/browser/resources/settings/chromeos/google_assistant_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/google_assistant_page/BUILD.gn index 5cbfd7af..a5563794 100644 --- a/chrome/browser/resources/settings/chromeos/google_assistant_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/google_assistant_page/BUILD.gn
@@ -27,8 +27,6 @@ "//chrome/browser/resources/settings/chromeos:deep_linking_behavior.m", "//chrome/browser/resources/settings/chromeos:metrics_recorder.m", "//chrome/browser/resources/settings/chromeos:os_route.m", - "//chrome/browser/resources/settings/controls:controlled_button", - "//chrome/browser/resources/settings/controls:settings_toggle_button", "//chrome/browser/resources/settings/prefs:pref_util", "//chrome/browser/resources/settings/prefs:prefs", "//chrome/browser/resources/settings/prefs:prefs_behavior",
diff --git a/chrome/browser/resources/settings/chromeos/internet_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/internet_page/BUILD.gn index 3db8668..72f18c2 100644 --- a/chrome/browser/resources/settings/chromeos/internet_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/internet_page/BUILD.gn
@@ -85,8 +85,6 @@ "//chrome/browser/resources/settings/chromeos:deep_linking_behavior.m", "//chrome/browser/resources/settings/chromeos:metrics_recorder.m", "//chrome/browser/resources/settings/chromeos/os_people_page:os_sync_browser_proxy.m", - "//chrome/browser/resources/settings/controls:controlled_button", - "//chrome/browser/resources/settings/controls:settings_toggle_button", "//chrome/browser/resources/settings/people_page:sync_browser_proxy", "//chrome/browser/resources/settings/prefs:prefs", "//third_party/polymer/v3_0/components-chromium/iron-collapse:iron-collapse", @@ -227,7 +225,6 @@ "//chrome/browser/resources/settings:router", "//chrome/browser/resources/settings/chromeos:os_route.m", "//chrome/browser/resources/settings/controls:extension_controlled_indicator", - "//chrome/browser/resources/settings/controls:settings_toggle_button", "//chrome/browser/resources/settings/prefs:prefs_behavior", "//third_party/polymer/v3_0/components-chromium/iron-flex-layout:iron-flex-layout-classes", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", @@ -238,6 +235,7 @@ "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", "//ui/webui/resources/js:i18n_behavior.m", ] + externs_list = [ "../settings_controls_types.js" ] } js_library("network_summary") { @@ -305,7 +303,6 @@ deps = [ ":internet_shared_css", "//chrome/browser/resources/settings/chromeos:metrics_recorder.m", - "//chrome/browser/resources/settings/controls:settings_toggle_button", "//chrome/browser/resources/settings/prefs:prefs", "//chrome/browser/resources/settings/prefs:prefs_behavior", "//third_party/polymer/v3_0/components-chromium/iron-flex-layout:iron-flex-layout",
diff --git a/chrome/browser/resources/settings/chromeos/internet_page/network_proxy_section.js b/chrome/browser/resources/settings/chromeos/internet_page/network_proxy_section.js index 1e92388..2da82ea 100644 --- a/chrome/browser/resources/settings/chromeos/internet_page/network_proxy_section.js +++ b/chrome/browser/resources/settings/chromeos/internet_page/network_proxy_section.js
@@ -17,12 +17,12 @@ import '../../controls/extension_controlled_indicator.js'; import '../../settings_vars_css.js'; import './internet_shared_css.js'; +import '../../controls/settings_toggle_button.js'; import {CrPolicyNetworkBehaviorMojo} from '//resources/cr_components/chromeos/network/cr_policy_network_behavior_mojo.m.js'; import {I18nBehavior} from '//resources/js/i18n_behavior.m.js'; import {afterNextRender, flush, html, Polymer, TemplateInstanceBase, Templatizer} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {SettingsToggleButtonElement} from '../../controls/settings_toggle_button.js'; import {PrefsBehavior} from '../../prefs/prefs_behavior.js'; import {Route, RouteObserverBehavior, Router} from '../../router.js'; import {routes} from '../os_route.m.js';
diff --git a/chrome/browser/resources/settings/chromeos/kerberos_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/kerberos_page/BUILD.gn index 916e8b0..bb17b4a 100644 --- a/chrome/browser/resources/settings/chromeos/kerberos_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/kerberos_page/BUILD.gn
@@ -45,7 +45,6 @@ deps = [ ":kerberos_accounts_browser_proxy", "..:metrics_recorder.m", - "//chrome/browser/resources/settings/controls:settings_textarea", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m", "//ui/webui/resources/cr_elements/cr_input:cr_input.m",
diff --git a/chrome/browser/resources/settings/chromeos/os_a11y_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/os_a11y_page/BUILD.gn index 66a27bc..ba9da8f 100644 --- a/chrome/browser/resources/settings/chromeos/os_a11y_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/os_a11y_page/BUILD.gn
@@ -54,8 +54,6 @@ "//chrome/browser/resources/settings/chromeos:os_route.m", "//chrome/browser/resources/settings/chromeos:route_origin_behavior.m", "//chrome/browser/resources/settings/chromeos/device_page:device_page_browser_proxy", - "//chrome/browser/resources/settings/controls:settings_slider", - "//chrome/browser/resources/settings/controls:settings_toggle_button", "//ui/webui/resources/js:i18n_behavior.m", "//ui/webui/resources/js:load_time_data.m", "//ui/webui/resources/js:web_ui_listener_behavior.m", @@ -78,6 +76,7 @@ "//ui/webui/resources/js:load_time_data.m", "//ui/webui/resources/js:web_ui_listener_behavior.m", ] + externs_list = [ "../settings_controls_types.js" ] } js_library("os_a11y_page_browser_proxy") { @@ -118,7 +117,6 @@ js_library("switch_access_setup_guide_dialog") { deps = [ ":switch_access_constants", - "//chrome/browser/resources/settings/controls:settings_slider", "//chrome/browser/resources/settings/prefs:prefs_behavior", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", @@ -165,7 +163,6 @@ "//chrome/browser/resources/settings/chromeos:deep_linking_behavior.m", "//chrome/browser/resources/settings/chromeos:os_route.m", "//chrome/browser/resources/settings/chromeos/os_languages_page:languages_browser_proxy", - "//chrome/browser/resources/settings/controls:settings_slider", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_elements/cr_button:cr_button.m", "//ui/webui/resources/cr_elements/cr_expand_button:cr_expand_button.m",
diff --git a/chrome/browser/resources/settings/chromeos/os_a11y_page/os_a11y_page.js b/chrome/browser/resources/settings/chromeos/os_a11y_page/os_a11y_page.js index 438bc62e..6336528 100644 --- a/chrome/browser/resources/settings/chromeos/os_a11y_page/os_a11y_page.js +++ b/chrome/browser/resources/settings/chromeos/os_a11y_page/os_a11y_page.js
@@ -21,7 +21,6 @@ import {WebUIListenerBehavior} from '//resources/js/web_ui_listener_behavior.m.js'; import {afterNextRender, flush, html, Polymer, TemplateInstanceBase, Templatizer} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {SettingsToggleButtonElement} from '../../controls/settings_toggle_button.js'; import {Route, RouteObserverBehavior, Router} from '../../router.js'; import {DeepLinkingBehavior} from '../deep_linking_behavior.m.js'; import {routes} from '../os_route.m.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/os_apps_page/BUILD.gn index 8e847c0..7992546b 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/BUILD.gn
@@ -41,7 +41,6 @@ "..:deep_linking_behavior.m", "..:os_route.m", "../../:router", - "../../controls:settings_dropdown_menu", "../../prefs:prefs_behavior", "../../settings_page:settings_animated_pages", "./app_management_page:constants", @@ -53,7 +52,10 @@ "//ui/webui/resources/js:cr.m", "//ui/webui/resources/js:i18n_behavior.m", ] - externs_list = [ "$externs_path/metrics_private.js" ] + externs_list = [ + "$externs_path/metrics_private.js", + "../settings_controls_types.js", + ] } html_to_js("web_components") {
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/app_detail_view.js b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/app_detail_view.js index 432b69c..fc88fba 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/app_detail_view.js +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/app_detail_view.js
@@ -17,7 +17,7 @@ import {routes} from '../../os_route.m.js'; import {updateSelectedAppId} from './actions.js'; -import {AppManagementEntryPoint, AppManagementEntryPointsHistogramName, AppManagementUserAction, AppType, ArcPermissionType, Bool, BorealisPermissionType, InstallSource, OptionalBool, PermissionValueType, PluginVmPermissionType, PwaPermissionType, TriState} from './constants.js'; +import {AppManagementEntryPoint, AppManagementEntryPointsHistogramName, AppManagementUserAction, AppType, ArcPermissionType, Bool, BorealisPermissionType, InstallReason, OptionalBool, PermissionValueType, PluginVmPermissionType, PwaPermissionType, TriState} from './constants.js'; import {AppManagementStoreClient} from './store_client.js'; import {alphabeticalSort, convertOptionalBoolToBool, createPermission, getAppIcon, getPermission, getPermissionValueBool, getSelectedApp, openAppDetailPage, openMainPage, permissionTypeHandle, recordAppManagementUserAction, toggleOptionalBool} from './util.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/app_item.js b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/app_item.js index c8b94e1..fcd314d 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/app_item.js +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/app_item.js
@@ -9,7 +9,7 @@ import {afterNextRender, flush, html, Polymer, TemplateInstanceBase, Templatizer} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {updateSelectedAppId} from './actions.js'; -import {AppManagementEntryPoint, AppManagementEntryPointsHistogramName, AppManagementUserAction, AppType, ArcPermissionType, Bool, BorealisPermissionType, InstallSource, OptionalBool, PermissionValueType, PluginVmPermissionType, PwaPermissionType, TriState} from './constants.js'; +import {AppManagementEntryPoint, AppManagementEntryPointsHistogramName, AppManagementUserAction, AppType, ArcPermissionType, Bool, BorealisPermissionType, InstallReason, OptionalBool, PermissionValueType, PluginVmPermissionType, PwaPermissionType, TriState} from './constants.js'; import {AppManagementStoreClient} from './store_client.js'; import {alphabeticalSort, convertOptionalBoolToBool, createPermission, getAppIcon, getPermission, getPermissionValueBool, getSelectedApp, openAppDetailPage, openMainPage, permissionTypeHandle, recordAppManagementUserAction, toggleOptionalBool} from './util.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/arc_detail_view.js b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/arc_detail_view.js index 2211e81..532cd1c 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/arc_detail_view.js +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/arc_detail_view.js
@@ -13,7 +13,7 @@ import {afterNextRender, flush, html, Polymer, TemplateInstanceBase, Templatizer} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {BrowserProxy} from './browser_proxy.js'; -import {AppManagementEntryPoint, AppManagementEntryPointsHistogramName, AppManagementUserAction, AppType, ArcPermissionType, Bool, BorealisPermissionType, InstallSource, OptionalBool, PermissionValueType, PluginVmPermissionType, PwaPermissionType, TriState} from './constants.js'; +import {AppManagementEntryPoint, AppManagementEntryPointsHistogramName, AppManagementUserAction, AppType, ArcPermissionType, Bool, BorealisPermissionType, InstallReason, OptionalBool, PermissionValueType, PluginVmPermissionType, PwaPermissionType, TriState} from './constants.js'; import {AppManagementStoreClient} from './store_client.js'; import {alphabeticalSort, convertOptionalBoolToBool, createPermission, getAppIcon, getPermission, getPermissionValueBool, getSelectedApp, openAppDetailPage, openMainPage, permissionTypeHandle, recordAppManagementUserAction, toggleOptionalBool} from './util.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/browser_proxy.js b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/browser_proxy.js index 6273e9f8..fe0a7ae 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/browser_proxy.js +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/browser_proxy.js
@@ -14,7 +14,7 @@ import {addSingletonGetter} from 'chrome://resources/js/cr.m.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; -import {AppType, InstallSource, PwaPermissionType, TriState} from './constants.js'; +import {AppType, InstallReason, PwaPermissionType, TriState} from './constants.js'; import {FakePageHandler} from './fake_page_handler.js'; export class BrowserProxy { @@ -49,7 +49,7 @@ { title: 'Built in app, not implemented', type: AppType.kBuiltIn, - installSource: InstallSource.kSystem, + installReason: InstallReason.kSystem, }, ), FakePageHandler.createApp( @@ -57,7 +57,7 @@ { title: 'Arc app', type: AppType.kArc, - installSource: InstallSource.kUser, + installReason: InstallReason.kUser, }, ), FakePageHandler.createApp( @@ -65,7 +65,7 @@ { title: 'Crostini app, not implemented', type: AppType.kCrostini, - installSource: InstallSource.kUser, + installReason: InstallReason.kUser, }, ), FakePageHandler.createApp( @@ -89,7 +89,7 @@ title: 'Chrome App, OEM installed', type: AppType.kExtension, description: 'A Chrome App installed by an OEM.', - installSource: InstallSource.kOem, + installReason: InstallReason.kOem, }, ), FakePageHandler.createApp( @@ -99,7 +99,7 @@ type: AppType.kWeb, isPinned: apps.mojom.OptionalBool.kTrue, isPolicyPinned: apps.mojom.OptionalBool.kTrue, - installSource: apps.mojom.InstallSource.kPolicy, + installReason: apps.mojom.InstallReason.kPolicy, permissions: FakePageHandler.createWebPermissions(permissionOptions), },
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/chrome_app_detail_view.js b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/chrome_app_detail_view.js index 527e2f4..9100dd55 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/chrome_app_detail_view.js +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/chrome_app_detail_view.js
@@ -8,7 +8,7 @@ import {afterNextRender, flush, html, Polymer, TemplateInstanceBase, Templatizer} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {BrowserProxy} from './browser_proxy.js'; -import {AppManagementEntryPoint, AppManagementEntryPointsHistogramName, AppManagementUserAction, AppType, ArcPermissionType, Bool, BorealisPermissionType, InstallSource, OptionalBool, PermissionValueType, PluginVmPermissionType, PwaPermissionType, TriState} from './constants.js'; +import {AppManagementEntryPoint, AppManagementEntryPointsHistogramName, AppManagementUserAction, AppType, ArcPermissionType, Bool, BorealisPermissionType, InstallReason, OptionalBool, PermissionValueType, PluginVmPermissionType, PwaPermissionType, TriState} from './constants.js'; import {AppManagementStoreClient} from './store_client.js'; import {alphabeticalSort, convertOptionalBoolToBool, createPermission, getAppIcon, getPermission, getPermissionValueBool, getSelectedApp, openAppDetailPage, openMainPage, permissionTypeHandle, recordAppManagementUserAction, toggleOptionalBool} from './util.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/constants.js b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/constants.js index 84668bf..87afd68 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/constants.js +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/constants.js
@@ -57,7 +57,7 @@ export const OptionalBool = apps.mojom.OptionalBool; -export const InstallSource = apps.mojom.InstallSource; +export const InstallReason = apps.mojom.InstallReason; export const WindowMode = apps.mojom.WindowMode;
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/fake_page_handler.js b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/fake_page_handler.js index 0283b7c..7af59cb 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/fake_page_handler.js +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/fake_page_handler.js
@@ -98,7 +98,7 @@ size: '9.0MB', isPinned: apps.mojom.OptionalBool.kFalse, isPolicyPinned: apps.mojom.OptionalBool.kFalse, - installSource: apps.mojom.InstallSource.kUser, + installReason: apps.mojom.InstallReason.kUser, permissions: {}, hideMoreSettings: false, hidePinToShelf: false,
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/more_permissions_item.js b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/more_permissions_item.js index a957936..70f3a25 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/more_permissions_item.js +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/more_permissions_item.js
@@ -8,7 +8,7 @@ import {afterNextRender, flush, html, Polymer, TemplateInstanceBase, Templatizer} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {BrowserProxy} from './browser_proxy.js'; -import {AppManagementEntryPoint, AppManagementEntryPointsHistogramName, AppManagementUserAction, AppType, ArcPermissionType, Bool, BorealisPermissionType, InstallSource, OptionalBool, PermissionValueType, PluginVmPermissionType, PwaPermissionType, TriState} from './constants.js'; +import {AppManagementEntryPoint, AppManagementEntryPointsHistogramName, AppManagementUserAction, AppType, ArcPermissionType, Bool, BorealisPermissionType, InstallReason, OptionalBool, PermissionValueType, PluginVmPermissionType, PwaPermissionType, TriState} from './constants.js'; import {alphabeticalSort, convertOptionalBoolToBool, createPermission, getAppIcon, getPermission, getPermissionValueBool, getSelectedApp, openAppDetailPage, openMainPage, permissionTypeHandle, recordAppManagementUserAction, toggleOptionalBool} from './util.js'; Polymer({
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/permission_item.js b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/permission_item.js index f60ca47..cfa11442 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/permission_item.js +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/permission_item.js
@@ -10,7 +10,7 @@ import {recordClick, recordNavigation, recordPageBlur, recordPageFocus, recordSearch, recordSettingChange, setUserActionRecorderForTesting} from '../../metrics_recorder.m.js'; import {BrowserProxy} from './browser_proxy.js'; -import {AppManagementEntryPoint, AppManagementEntryPointsHistogramName, AppManagementUserAction, AppType, ArcPermissionType, Bool, BorealisPermissionType, InstallSource, OptionalBool, PermissionValueType, PluginVmPermissionType, PwaPermissionType, TriState} from './constants.js'; +import {AppManagementEntryPoint, AppManagementEntryPointsHistogramName, AppManagementUserAction, AppType, ArcPermissionType, Bool, BorealisPermissionType, InstallReason, OptionalBool, PermissionValueType, PluginVmPermissionType, PwaPermissionType, TriState} from './constants.js'; import {AppManagementStoreClient} from './store_client.js'; import {alphabeticalSort, convertOptionalBoolToBool, createPermission, getAppIcon, getPermission, getPermissionValueBool, getSelectedApp, openAppDetailPage, openMainPage, permissionTypeHandle, recordAppManagementUserAction, toggleOptionalBool} from './util.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/pin_to_shelf_item.js b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/pin_to_shelf_item.js index b95afb1..4ab1ea5 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/pin_to_shelf_item.js +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/pin_to_shelf_item.js
@@ -9,7 +9,7 @@ import {recordClick, recordNavigation, recordPageBlur, recordPageFocus, recordSearch, recordSettingChange, setUserActionRecorderForTesting} from '../../metrics_recorder.m.js'; import {BrowserProxy} from './browser_proxy.js'; -import {AppManagementEntryPoint, AppManagementEntryPointsHistogramName, AppManagementUserAction, AppType, ArcPermissionType, Bool, BorealisPermissionType, InstallSource, OptionalBool, PermissionValueType, PluginVmPermissionType, PwaPermissionType, TriState} from './constants.js'; +import {AppManagementEntryPoint, AppManagementEntryPointsHistogramName, AppManagementUserAction, AppType, ArcPermissionType, Bool, BorealisPermissionType, InstallReason, OptionalBool, PermissionValueType, PluginVmPermissionType, PwaPermissionType, TriState} from './constants.js'; import {alphabeticalSort, convertOptionalBoolToBool, createPermission, getAppIcon, getPermission, getPermissionValueBool, getSelectedApp, openAppDetailPage, openMainPage, permissionTypeHandle, recordAppManagementUserAction, toggleOptionalBool} from './util.js'; Polymer({
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/pwa_detail_view.js b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/pwa_detail_view.js index d1bdd4a..7b5acaa 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/pwa_detail_view.js +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/pwa_detail_view.js
@@ -12,7 +12,7 @@ import {afterNextRender, flush, html, Polymer, TemplateInstanceBase, Templatizer} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {BrowserProxy} from './browser_proxy.js'; -import {AppManagementEntryPoint, AppManagementEntryPointsHistogramName, AppManagementUserAction, AppType, ArcPermissionType, Bool, BorealisPermissionType, InstallSource, OptionalBool, PermissionValueType, PluginVmPermissionType, PwaPermissionType, TriState} from './constants.js'; +import {AppManagementEntryPoint, AppManagementEntryPointsHistogramName, AppManagementUserAction, AppType, ArcPermissionType, Bool, BorealisPermissionType, InstallReason, OptionalBool, PermissionValueType, PluginVmPermissionType, PwaPermissionType, TriState} from './constants.js'; import {AppManagementStoreClient} from './store_client.js'; import {alphabeticalSort, convertOptionalBoolToBool, createPermission, getAppIcon, getPermission, getPermissionValueBool, getSelectedApp, openAppDetailPage, openMainPage, permissionTypeHandle, recordAppManagementUserAction, toggleOptionalBool} from './util.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/reducers.js b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/reducers.js index 4f6a9024..7df7705 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/reducers.js +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/reducers.js
@@ -22,7 +22,7 @@ if (apps[action.app.id]) { const stringifyApp = (app) => { return `id: ${app.id}, type: ${app.type}, install source: ${ - app.installSource} title: ${app.title}`; + app.installReason} title: ${app.title}`; }; const errorMessage = `Attempted to add an app that already exists. New app: ${stringifyApp(action.app)}.
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/resize_lock_item.js b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/resize_lock_item.js index 13c45e0..94f2ef52c 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/resize_lock_item.js +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/resize_lock_item.js
@@ -9,7 +9,7 @@ import {recordClick, recordNavigation, recordPageBlur, recordPageFocus, recordSearch, recordSettingChange, setUserActionRecorderForTesting} from '../../metrics_recorder.m.js'; import {BrowserProxy} from './browser_proxy.js'; -import {AppManagementEntryPoint, AppManagementEntryPointsHistogramName, AppManagementUserAction, AppType, ArcPermissionType, Bool, BorealisPermissionType, InstallSource, OptionalBool, PermissionValueType, PluginVmPermissionType, PwaPermissionType, TriState} from './constants.js'; +import {AppManagementEntryPoint, AppManagementEntryPointsHistogramName, AppManagementUserAction, AppType, ArcPermissionType, Bool, BorealisPermissionType, InstallReason, OptionalBool, PermissionValueType, PluginVmPermissionType, PwaPermissionType, TriState} from './constants.js'; import {alphabeticalSort, convertOptionalBoolToBool, createPermission, getAppIcon, getPermission, getPermissionValueBool, getSelectedApp, openAppDetailPage, openMainPage, permissionTypeHandle, recordAppManagementUserAction, toggleOptionalBool} from './util.js'; Polymer({
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/uninstall_button.js b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/uninstall_button.js index c55c63f..d3bfb99 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/uninstall_button.js +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/uninstall_button.js
@@ -12,7 +12,7 @@ import {recordClick, recordNavigation, recordPageBlur, recordPageFocus, recordSearch, recordSettingChange, setUserActionRecorderForTesting} from '../../metrics_recorder.m.js'; import {BrowserProxy} from './browser_proxy.js'; -import {AppManagementEntryPoint, AppManagementEntryPointsHistogramName, AppManagementUserAction, AppType, ArcPermissionType, Bool, BorealisPermissionType, InstallSource, OptionalBool, PermissionValueType, PluginVmPermissionType, PwaPermissionType, TriState} from './constants.js'; +import {AppManagementEntryPoint, AppManagementEntryPointsHistogramName, AppManagementUserAction, AppType, ArcPermissionType, Bool, BorealisPermissionType, InstallReason, OptionalBool, PermissionValueType, PluginVmPermissionType, PwaPermissionType, TriState} from './constants.js'; import {AppManagementStoreClient} from './store_client.js'; import {alphabeticalSort, convertOptionalBoolToBool, createPermission, getAppIcon, getPermission, getPermissionValueBool, getSelectedApp, openAppDetailPage, openMainPage, permissionTypeHandle, recordAppManagementUserAction, toggleOptionalBool} from './util.js'; @@ -48,15 +48,15 @@ return true; } - switch (app.installSource) { - case InstallSource.kSystem: - case InstallSource.kPolicy: + switch (app.installReason) { + case InstallReason.kSystem: + case InstallReason.kPolicy: return true; - case InstallSource.kOem: - case InstallSource.kDefault: - case InstallSource.kSync: - case InstallSource.kUser: - case InstallSource.kUnknown: + case InstallReason.kOem: + case InstallReason.kDefault: + case InstallReason.kSync: + case InstallReason.kUser: + case InstallReason.kUnknown: return false; default: assertNotReached(); @@ -74,7 +74,7 @@ if (!app) { return false; } - return app.installSource === InstallSource.kPolicy; + return app.installReason === InstallReason.kPolicy; }, /** @@ -86,7 +86,7 @@ if (!app) { return false; } - return app.installSource !== InstallSource.kSystem; + return app.installReason !== InstallReason.kSystem; }, /**
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/os_apps_page.js b/chrome/browser/resources/settings/chromeos/os_apps_page/os_apps_page.js index 1b08147e..10e761bc 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/os_apps_page.js +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/os_apps_page.js
@@ -23,12 +23,12 @@ import './app_management_page/app_management_page.js'; import './app_management_page/app_detail_view.js'; import './app_management_page/uninstall_button.js'; +import '../../controls/settings_dropdown_menu.js'; import {I18nBehavior} from '//resources/js/i18n_behavior.m.js'; import {afterNextRender, flush, html, Polymer, TemplateInstanceBase, Templatizer} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {assert, assertNotReached} from 'chrome://resources/js/assert.m.js'; -import {DropdownMenuOptionList} from '../../controls/settings_dropdown_menu.js'; import {loadTimeData} from '../../i18n_setup.js'; import {PrefsBehavior} from '../../prefs/prefs_behavior.js'; import {Route, RouteObserverBehavior, Router} from '../../router.js'; @@ -36,7 +36,7 @@ import {routes} from '../os_route.m.js'; import {AndroidAppsBrowserProxyImpl, AndroidAppsInfo} from './android_apps_browser_proxy.js'; -import {AppManagementEntryPoint, AppManagementEntryPointsHistogramName, AppManagementUserAction, AppType, ArcPermissionType, Bool, BorealisPermissionType, InstallSource, OptionalBool, PermissionValueType, PluginVmPermissionType, PwaPermissionType, TriState} from './app_management_page/constants.js'; +import {AppManagementEntryPoint, AppManagementEntryPointsHistogramName, AppManagementUserAction, AppType, ArcPermissionType, Bool, BorealisPermissionType, InstallReason, OptionalBool, PermissionValueType, PluginVmPermissionType, PwaPermissionType, TriState} from './app_management_page/constants.js'; import {AppManagementStoreClient} from './app_management_page/store_client.js'; import {alphabeticalSort, convertOptionalBoolToBool, createPermission, getAppIcon, getPermission, getPermissionValueBool, getSelectedApp, openAppDetailPage, openMainPage, permissionTypeHandle, recordAppManagementUserAction, toggleOptionalBool} from './app_management_page/util.js'; import {getAppNotificationProvider} from './app_notifications_page/mojo_interface_provider.js';
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/os_languages_page/BUILD.gn index cfdb5b7..1c63049 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/BUILD.gn
@@ -155,7 +155,6 @@ "..:os_route.m", "../..:i18n_setup", "../..:router", - "../../controls:settings_toggle_button", "../keyboard_shortcut_banner:keyboard_shortcut_banner", "//ui/webui/resources/cr_components/chromeos/localized_link:localized_link", "//ui/webui/resources/js:assert.m", @@ -164,6 +163,7 @@ "//ui/webui/resources/js/cr/ui:focus_without_ink.m", ] extra_deps = [ ":input_page_module" ] + externs_list = [ "../settings_controls_types.js" ] } js_library("languages_metrics_proxy.m") { @@ -353,10 +353,7 @@ html_type = "dom-module" migrated_imports = os_settings_migrated_imports namespace_rewrites = os_settings_namespace_rewrites - auto_imports = os_settings_auto_imports + [ - "chrome/browser/resources/settings/controls/settings_toggle_button.html|SettingsToggleButtonElement", - "chrome/browser/resources/settings/chromeos/os_languages_page/languages_types.html|LanguageHelper,LanguagesModel,LanguageState,SpellCheckLanguageState", - ] + auto_imports = os_settings_auto_imports + [ "chrome/browser/resources/settings/chromeos/os_languages_page/languages_types.html|LanguageHelper,LanguagesModel,LanguageState,SpellCheckLanguageState" ] } polymer_modulizer("shared_style") {
diff --git a/chrome/browser/resources/settings/chromeos/os_people_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/os_people_page/BUILD.gn index d3599a3..93398de 100644 --- a/chrome/browser/resources/settings/chromeos/os_people_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/os_people_page/BUILD.gn
@@ -85,8 +85,6 @@ "..:deep_linking_behavior.m", "..:os_route.m", "../..:router", - "../../controls:settings_dropdown_menu", - "../../controls:settings_toggle_button", "../multidevice_page:multidevice_smartlock_item.m", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_components/chromeos/quick_unlock:lock_screen_constants.m", @@ -98,6 +96,7 @@ "//ui/webui/resources/js/cr/ui:focus_without_ink.m", ] extra_deps = [ ":lock_screen_module" ] + externs_list = [ "../settings_controls_types.js" ] } js_library("lock_screen_password_prompt_dialog.m") { @@ -297,7 +296,7 @@ html_type = "dom-module" migrated_imports = os_settings_migrated_imports namespace_rewrites = os_settings_namespace_rewrites - auto_imports = os_settings_auto_imports + [ "chrome/browser/resources/settings/controls/settings_toggle_button.html|SettingsToggleButtonElement" ] + auto_imports = os_settings_auto_imports } polymer_modulizer("lock_screen_password_prompt_dialog") {
diff --git a/chrome/browser/resources/settings/chromeos/personalization_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/personalization_page/BUILD.gn index baa6ab42..ebfbea0 100644 --- a/chrome/browser/resources/settings/chromeos/personalization_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/personalization_page/BUILD.gn
@@ -52,7 +52,6 @@ deps = [ "..:os_route.m", "../..:router", - "../../controls:settings_toggle_button", "../../prefs:prefs", "../../prefs:prefs_behavior", "//ui/webui/resources/js:load_time_data",
diff --git a/chrome/browser/resources/settings/chromeos/personalization_page/change_picture.html b/chrome/browser/resources/settings/chromeos/personalization_page/change_picture.html index 97d4372..2f6834c 100644 --- a/chrome/browser/resources/settings/chromeos/personalization_page/change_picture.html +++ b/chrome/browser/resources/settings/chromeos/personalization_page/change_picture.html
@@ -66,11 +66,13 @@ #pictureList { /* TODO(reveman): Find a way to have height align to viewport without using fixed position. */ + --bottom-padding: 48px; height: calc(100vh - var(--cr-toolbar-height) - var(--cr-settings-header-height) - var(--title-padding) - - var(--title-height)); + var(--title-height) - + var(--bottom-padding)); margin-inline-end: 16px; margin-top: 0; min-height: 332px;
diff --git a/chrome/browser/resources/settings/chromeos/settings_controls_types.js b/chrome/browser/resources/settings/chromeos/settings_controls_types.js new file mode 100644 index 0000000..4efe14e --- /dev/null +++ b/chrome/browser/resources/settings/chromeos/settings_controls_types.js
@@ -0,0 +1,56 @@ +// 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. + +/** + * Externs for files shared with Browser Settings and have been migrated to + * TypeScript. Remove if ever CrOS Settings is migrated to TS. + * @externs + */ + +/** @interface */ +function PrefControlMixinInterface() {} + +/** @type {!chrome.settingsPrivate.PrefObject|undefined} */ +PrefControlMixinInterface.prototype.pref; + +/** + * @interface + * @extends {PrefControlMixinInterface} + */ +function SettingsBooleanControlMixinInterface() {} + +/** @type {boolean} */ +SettingsBooleanControlMixinInterface.prototype.checked; + +/** @type {string} */ +SettingsBooleanControlMixinInterface.prototype.label; + +/** @return {boolean} */ +SettingsBooleanControlMixinInterface.prototype.controlDisabled = function() {}; + +SettingsBooleanControlMixinInterface.prototype.notifyChangedByUserInteraction = + function() {}; +SettingsBooleanControlMixinInterface.prototype.resetToPrefValue = function() {}; +SettingsBooleanControlMixinInterface.prototype.sendPrefChange = function() {}; + +/** + * @constructor + * @implements {SettingsBooleanControlMixinInterface} + * @extends {HTMLElement} + */ +function SettingsToggleButtonElement() {} + + +/** + * @typedef {{ + * name: string, + * value: (number|string) + * }} + */ +let DropdownMenuOption; + +/** + * @typedef {!Array<!DropdownMenuOption>} + */ +let DropdownMenuOptionList;
diff --git a/chrome/browser/resources/settings/site_settings/protocol_handlers.html b/chrome/browser/resources/settings/site_settings/protocol_handlers.html index e13cf8a6..0cb4cc6 100644 --- a/chrome/browser/resources/settings/site_settings/protocol_handlers.html +++ b/chrome/browser/resources/settings/site_settings/protocol_handlers.html
@@ -123,13 +123,13 @@ <h2>$i18n{siteSettingsAppProtocolHandlers}</h2> </div> - <div class="column-header" hidden$="[[!appApprovedProtocols.length]]"> + <div class="column-header" hidden$="[[!appAllowedProtocols.length]]"> <div id="appHandlerSubHeading" class="secondary"> - $i18n{siteSettingsAppApprovedProtocolHandlersDescription} + $i18n{siteSettingsAppAllowedProtocolHandlersDescription} </div> </div> - <template is="dom-repeat" items="[[appApprovedProtocols]]" as="appProtocol"> + <template is="dom-repeat" items="[[appAllowedProtocols]]" as="appProtocol"> <div class="column-header">[[appProtocol.protocol_display_name]]</div> <div class="list-frame menu-content vertical-list"> <template is="dom-repeat" items="[[appProtocol.handlers]]"> @@ -139,7 +139,7 @@ <span class="url-directionality">[[item.host]]</span> </div> <cr-icon-button class="icon-clear" id="removeAppHandlerButton" - on-click="onRemoveAppApprovedHandlerButtonClick_" + on-click="onRemoveAppAllowedHandlerButtonClick_" title="$i18n{handlerRemove}"> </cr-icon-button> </div>
diff --git a/chrome/browser/resources/settings/site_settings/protocol_handlers.ts b/chrome/browser/resources/settings/site_settings/protocol_handlers.ts index cb35e547..bf9bf86e 100644 --- a/chrome/browser/resources/settings/site_settings/protocol_handlers.ts +++ b/chrome/browser/resources/settings/site_settings/protocol_handlers.ts
@@ -102,9 +102,9 @@ protocols: Array, /** - * Array of approved app protocols and their handlers. + * Array of allowed app protocols and their handlers. */ - appApprovedProtocols: Array, + appAllowedProtocols: Array, /** * Array of disallowed app protocols and their handlers. @@ -147,7 +147,7 @@ } protocols: Array<ProtocolEntry>; - appApprovedProtocols: Array<AppProtocolEntry>; + appAllowedProtocols: Array<AppProtocolEntry>; appDisallowedProtocols: Array<AppProtocolEntry>; private showAppsProtocolHandlersTitle_: boolean; private actionMenuModel_: HandlerEntry|null; @@ -174,8 +174,8 @@ // Web App Observer this.addWebUIListener( - 'setAppApprovedProtocolHandlers', - this.setAppApprovedProtocolHandlers_.bind(this)); + 'setAppAllowedProtocolHandlers', + this.setAppAllowedProtocolHandlers_.bind(this)); this.addWebUIListener( 'setAppDisallowedProtocolHandlers', this.setAppDisallowedProtocolHandlers_.bind(this)); @@ -216,12 +216,12 @@ } /** - * Updates the list of approved app protocol handlers. - * @param appApprovedProtocols The new approved app protocol handler list. + * Updates the list of allowed app protocol handlers. + * @param appAllowedProtocols The new allowed app protocol handler list. */ - private setAppApprovedProtocolHandlers_(appApprovedProtocols: - Array<AppProtocolEntry>) { - this.appApprovedProtocols = appApprovedProtocols; + private setAppAllowedProtocolHandlers_(appAllowedProtocols: + Array<AppProtocolEntry>) { + this.appAllowedProtocols = appAllowedProtocols; this.updateShowAppsProtocolHandlersTitle_(); } @@ -241,7 +241,7 @@ */ private updateShowAppsProtocolHandlersTitle_() { this.showAppsProtocolHandlersTitle_ = - (this.appApprovedProtocols && this.appApprovedProtocols.length > 0) || + (this.appAllowedProtocols && this.appAllowedProtocols.length > 0) || (this.appDisallowedProtocols && this.appDisallowedProtocols.length > 0); } @@ -280,11 +280,11 @@ } /** - * Handler for removing web app protocol handlers that were approved. + * Handler for removing web app protocol handlers that were allowed. */ - private onRemoveAppApprovedHandlerButtonClick_(event: AppRepeaterEvent) { + private onRemoveAppAllowedHandlerButtonClick_(event: AppRepeaterEvent) { const item = event.model.item; - this.browserProxy.removeAppApprovedHandler( + this.browserProxy.removeAppAllowedHandler( item.protocol, item.spec, item.app_id); }
diff --git a/chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.ts b/chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.ts index f3975a2..97b214ab 100644 --- a/chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.ts +++ b/chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.ts
@@ -328,7 +328,7 @@ /** * observes _all_ of the the app protocol handler state, which includes a - * list that is returned through 'setAppApprovedProtocolHandlers' events. + * list that is returned through 'setAppAllowedProtocolHandlers' events. */ observeAppProtocolHandlers(): void; @@ -365,12 +365,12 @@ removeProtocolHandler(protocol: string, url: string): void; /** - * Deletes a protocol handler by url from the app approved list. + * Deletes a protocol handler by url from the app allowed list. * @param protocol The protocol to delete the url from. * @param url The url to delete. * @param appId The web app's ID to delete. */ - removeAppApprovedHandler(protocol: string, url: string, appId: string): void; + removeAppAllowedHandler(protocol: string, url: string, appId: string): void; /** * Deletes a protocol handler by url from the app approved list. @@ -537,8 +537,8 @@ chrome.send('removeHandler', [protocol, url]); } - removeAppApprovedHandler(protocol: string, url: string, appId: string) { - chrome.send('removeAppApprovedHandler', [protocol, url, appId]); + removeAppAllowedHandler(protocol: string, url: string, appId: string) { + chrome.send('removeAppAllowedHandler', [protocol, url, appId]); } removeAppDisallowedHandler(protocol: string, url: string, app_id: string) {
diff --git a/chrome/browser/share/share_submenu_model.cc b/chrome/browser/share/share_submenu_model.cc index aa06bfd..39aef6c 100644 --- a/chrome/browser/share/share_submenu_model.cc +++ b/chrome/browser/share/share_submenu_model.cc
@@ -87,23 +87,45 @@ ShareSubmenuModel::~ShareSubmenuModel() = default; void ShareSubmenuModel::ExecuteCommand(int id, int event_flags) { + any_option_selected_for_metrics_ = true; switch (id) { case IDC_CONTENT_CONTEXT_GENERATE_QR_CODE: + base::RecordAction( + base::UserMetricsAction("ShareSubmenu.QRCodeSelected")); GenerateQRCode(); break; case IDC_SEND_TAB_TO_SELF: + base::RecordAction( + base::UserMetricsAction("ShareSubmenu.SendTabToSelfSelected")); SendTabToSelf(); break; case IDC_CONTENT_CONTEXT_COPYLINKLOCATION: case IDC_CONTENT_CONTEXT_COPYIMAGELOCATION: + base::RecordAction( + base::UserMetricsAction("ShareSubmenu.CopyLinkSelected")); CopyLink(); break; default: + base::RecordAction( + base::UserMetricsAction("ShareSubmenu.ThirdPartySelected")); ShareToThirdParty(id); break; } } +void ShareSubmenuModel::OnMenuWillShow(SimpleMenuModel* source) { + menu_opened_for_metrics_ = true; +} + +void ShareSubmenuModel::MenuClosed(SimpleMenuModel* source) { + if (menu_opened_for_metrics_ && !any_option_selected_for_metrics_) + base::RecordAction(base::UserMetricsAction("ShareSubmenu.Abandoned")); + + // Reset the opened flag - it's possible for the same MenuModel to be opened & + // closed multiple times and we want to log each separate abandon or choice. + menu_opened_for_metrics_ = false; +} + void ShareSubmenuModel::AddGenerateQRCodeItem() { switch (context_) { case Context::IMAGE:
diff --git a/chrome/browser/share/share_submenu_model.h b/chrome/browser/share/share_submenu_model.h index 32b27e1f..5e073f54 100644 --- a/chrome/browser/share/share_submenu_model.h +++ b/chrome/browser/share/share_submenu_model.h
@@ -57,6 +57,8 @@ // ui::SimpleMenuModel::Delegate: void ExecuteCommand(int id, int event_flags) override; + void OnMenuWillShow(SimpleMenuModel* source) override; + void MenuClosed(SimpleMenuModel* source) override; private: void AddGenerateQRCodeItem(); @@ -76,6 +78,9 @@ Context context_; GURL url_; std::u16string text_; + + bool menu_opened_for_metrics_ = false; + bool any_option_selected_for_metrics_ = false; }; } // namespace share
diff --git a/chrome/browser/share/share_submenu_model_unittest.cc b/chrome/browser/share/share_submenu_model_unittest.cc index 9ac8c21..bce82072 100644 --- a/chrome/browser/share/share_submenu_model_unittest.cc +++ b/chrome/browser/share/share_submenu_model_unittest.cc
@@ -2,13 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/browser/share/share_submenu_model.h" + +#include "base/test/metrics/user_action_tester.h" #include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/l10n/l10n_util.h" -#include "chrome/browser/share/share_submenu_model.h" - namespace share { namespace { @@ -41,5 +42,33 @@ EXPECT_TRUE(HasItemWithName(model, IDS_CONTENT_CONTEXT_COPYEMAILADDRESS)); } +class ShareSubmenuModelMetricsTest : public ::testing::Test { + public: + ShareSubmenuModelMetricsTest() : + model_(nullptr, nullptr, ShareSubmenuModel::Context::PAGE, + GURL("https://www.chromium.org/"), u"") {} + ~ShareSubmenuModelMetricsTest() override = default; + + ShareSubmenuModel* model() { return &model_; } + + int GetActionCount(const std::string& name) const { + return action_tester_.GetActionCount(name); + } + + private: + ShareSubmenuModel model_; + base::UserActionTester action_tester_; +}; + +TEST_F(ShareSubmenuModelMetricsTest, UserAction_AbandonLoggedTwice) { + EXPECT_EQ(0, GetActionCount("ShareSubmenu.Abandoned")); + model()->OnMenuWillShow(model()); + model()->MenuClosed(model()); + EXPECT_EQ(1, GetActionCount("ShareSubmenu.Abandoned")); + model()->OnMenuWillShow(model()); + model()->MenuClosed(model()); + EXPECT_EQ(2, GetActionCount("ShareSubmenu.Abandoned")); +} + } // namespace } // namespace share
diff --git a/chrome/browser/ui/android/autofill/internal/BUILD.gn b/chrome/browser/ui/android/autofill/internal/BUILD.gn index 0a95065c..c50df9f 100644 --- a/chrome/browser/ui/android/autofill/internal/BUILD.gn +++ b/chrome/browser/ui/android/autofill/internal/BUILD.gn
@@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/android/config.gni") import("//build/config/android/rules.gni") android_library("java") { @@ -13,6 +14,7 @@ "java/src/org/chromium/chrome/browser/ui/autofill/AuthenticatorOptionsAdapter.java", "java/src/org/chromium/chrome/browser/ui/autofill/AuthenticatorSelectionDialog.java", "java/src/org/chromium/chrome/browser/ui/autofill/AutofillErrorDialogBridge.java", + "java/src/org/chromium/chrome/browser/ui/autofill/OtpVerificationDialog.java", "java/src/org/chromium/chrome/browser/ui/autofill/data/AuthenticatorOption.java", ] deps = [ @@ -43,6 +45,7 @@ sources = [ "java/src/org/chromium/chrome/browser/ui/autofill/AuthenticatorSelectionDialogTest.java", "java/src/org/chromium/chrome/browser/ui/autofill/AutofillErrorDialogBridgeTest.java", + "java/src/org/chromium/chrome/browser/ui/autofill/OtpVerificationDialogTest.java", ] deps = [ ":java", @@ -65,6 +68,9 @@ "java/res/layout/authenticator_option.xml", "java/res/layout/authenticator_selection_dialog.xml", "java/res/layout/autofill_error_dialog.xml", + "java/res/layout/otp_verification_dialog.xml", + "java/res/layout/progress_bar.xml", + "java/res/values/dimens.xml", ] deps = [ "//chrome/android:chrome_app_java_resources",
diff --git a/chrome/browser/ui/android/autofill/internal/java/res/layout/otp_verification_dialog.xml b/chrome/browser/ui/android/autofill/internal/java/res/layout/otp_verification_dialog.xml new file mode 100644 index 0000000..819ca06 --- /dev/null +++ b/chrome/browser/ui/android/autofill/internal/java/res/layout/otp_verification_dialog.xml
@@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2021 The Chromium Authors. All rights reserved. + Use of this source code is governed by a BSD-style license that can be + found in the LICENSE file. --> +<RelativeLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools"> + + <LinearLayout + android:id="@+id/otp_verification_dialog_contents" + android:layout_height="wrap_content" + android:layout_width="match_parent" + android:orientation="vertical" + style="@style/AlertDialogContent"> + + <EditText + android:id="@+id/otp_input" + tools:ignore="LabelFor" + android:autofillHints="sms_otp" + android:digits="0123456789" + android:inputType="phone" + android:layout_height="wrap_content" + android:layout_width="match_parent"/> + + <TextView + android:id="@+id/otp_error_message" + android:layout_height="wrap_content" + android:layout_width="match_parent" + android:textAppearance="@style/TextAppearance.ErrorCaption"/> + + <TextView + android:id="@+id/otp_resend_message" + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/otp_verification_dialog_resend_message_margin_top" + android:layout_width="match_parent"/> + </LinearLayout> + + <include layout="@layout/progress_bar" + android:id="@+id/progress_bar_overlay" + android:layout_alignBottom="@+id/otp_verification_dialog_contents" + android:layout_alignEnd="@+id/otp_verification_dialog_contents" + android:layout_alignTop="@+id/otp_verification_dialog_contents" + android:layout_alignStart="@+id/otp_verification_dialog_contents" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:visibility="gone"/> +</RelativeLayout>
diff --git a/chrome/browser/ui/android/autofill/internal/java/res/layout/progress_bar.xml b/chrome/browser/ui/android/autofill/internal/java/res/layout/progress_bar.xml new file mode 100644 index 0000000..cb4d35ab --- /dev/null +++ b/chrome/browser/ui/android/autofill/internal/java/res/layout/progress_bar.xml
@@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2021 The Chromium Authors. All rights reserved. + Use of this source code is governed by a BSD-style license that can be + found in the LICENSE file. --> + <LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/progress_bar_overlay" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="vertical" + android:gravity="center" + android:visibility="gone"> + + <ProgressBar + android:id="@+id/progress_bar" + android:layout_height="@dimen/progress_bar_size" + android:layout_marginBottom="@dimen/progress_bar_margin_bottom" + android:layout_marginTop="@dimen/progress_bar_margin_top" + android:layout_width="@dimen/progress_bar_size"/> + + <TextView + android:id="@+id/progress_bar_message" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:textAppearance="@style/TextAppearance.TextMediumThick.Blue" /> + </LinearLayout>
diff --git a/chrome/browser/ui/android/autofill/internal/java/res/values/dimens.xml b/chrome/browser/ui/android/autofill/internal/java/res/values/dimens.xml new file mode 100644 index 0000000..79527139 --- /dev/null +++ b/chrome/browser/ui/android/autofill/internal/java/res/values/dimens.xml
@@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2021 The Chromium Authors. All rights reserved. + Use of this source code is governed by a BSD-style license that can be + found in the LICENSE file. --> + +<resources> + <dimen name="otp_verification_dialog_resend_message_margin_top">12dp</dimen> + <dimen name="progress_bar_size">36dp</dimen> + <dimen name="progress_bar_margin_top">16dp</dimen> + <dimen name="progress_bar_margin_bottom">8dp</dimen> +</resources>
diff --git a/chrome/browser/ui/android/autofill/internal/java/src/org/chromium/chrome/browser/ui/autofill/OtpVerificationDialog.java b/chrome/browser/ui/android/autofill/internal/java/src/org/chromium/chrome/browser/ui/autofill/OtpVerificationDialog.java new file mode 100644 index 0000000..ec0dc17 --- /dev/null +++ b/chrome/browser/ui/android/autofill/internal/java/src/org/chromium/chrome/browser/ui/autofill/OtpVerificationDialog.java
@@ -0,0 +1,177 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.ui.autofill; +import android.content.Context; +import android.text.Editable; +import android.text.SpannableString; +import android.text.TextWatcher; +import android.text.method.LinkMovementMethod; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.EditText; +import android.widget.TextView; + +import androidx.core.content.res.ResourcesCompat; + +import org.chromium.chrome.browser.ui.autofill.internal.R; +import org.chromium.ui.modaldialog.DialogDismissalCause; +import org.chromium.ui.modaldialog.ModalDialogManager; +import org.chromium.ui.modaldialog.ModalDialogProperties; +import org.chromium.ui.modelutil.PropertyModel; +import org.chromium.ui.text.NoUnderlineClickableSpan; +import org.chromium.ui.text.SpanApplier; +import org.chromium.ui.text.SpanApplier.SpanInfo; + +/** Dialog shown to the user for credit card unmasking using OTP-based verification. */ +public class OtpVerificationDialog { + private static final int ANIMATION_DURATION_MS = 250; + + /** Interface for the caller to be notified of user actions. */ + public interface Listener { + /** + * Notify that the user clicked on the positive button after entering the otp. + * + * @param otp The OTP entered by the user. + */ + void onConfirm(String otp); + /** Notify that a new otp was requested by the user. */ + void onNewOtpRequested(); + /** Notify the caller that the dialog was dismissed. */ + void onDialogDismissed(); + } + + private final ModalDialogProperties.Controller mModalDialogController = + new ModalDialogProperties.Controller() { + @Override + public void onClick(PropertyModel model, int buttonType) { + switch (buttonType) { + case ModalDialogProperties.ButtonType.POSITIVE: + mListener.onConfirm(mOtpEditText.getText().toString()); + showProgressBarOverlay(); + break; + case ModalDialogProperties.ButtonType.NEGATIVE: + mModalDialogManager.dismissDialog( + model, DialogDismissalCause.NEGATIVE_BUTTON_CLICKED); + break; + } + } + + @Override + public void onDismiss(PropertyModel model, int dismissalCause) { + mListener.onDialogDismissed(); + } + }; + + private TextWatcher mOtpTextWatcher = new TextWatcher() { + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + // Hide the error message view if it is visible, as the user is editing the OTP. + mOtpErrorMessageTextView.setVisibility(View.GONE); + // Disable the positive button if the length of the text is not equal to the OTP length. + mDialogModel.set( + ModalDialogProperties.POSITIVE_BUTTON_DISABLED, s.length() != mOtpLength); + } + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) {} + + @Override + public void afterTextChanged(Editable s) {} + }; + + private final Context mContext; + private final Listener mListener; + private final ModalDialogManager mModalDialogManager; + private View mProgressBarOverlayView; + private View mOtpVerificationDialogContents; + private EditText mOtpEditText; + private TextView mOtpErrorMessageTextView; + private TextView mOtpResendMessageTextView; + private PropertyModel mDialogModel; + private int mOtpLength; + + public OtpVerificationDialog( + Context context, Listener listener, ModalDialogManager modalDialogManager) { + this.mContext = context; + this.mListener = listener; + this.mModalDialogManager = modalDialogManager; + } + + /** + * Show the OtpVerification dialog. + * + * @param otpLength The expected length of the OTP input field. + */ + public void show(int otpLength) { + mOtpLength = otpLength; + View view = LayoutInflater.from(mContext).inflate(R.layout.otp_verification_dialog, null); + mOtpEditText = view.findViewById(R.id.otp_input); + mOtpErrorMessageTextView = view.findViewById(R.id.otp_error_message); + mOtpResendMessageTextView = view.findViewById(R.id.otp_resend_message); + mOtpVerificationDialogContents = view.findViewById(R.id.otp_verification_dialog_contents); + mProgressBarOverlayView = view.findViewById(R.id.progress_bar_overlay); + + mOtpEditText.setHint(mContext.getResources().getString( + R.string.autofill_payments_otp_verification_dialog_otp_input_hint, otpLength)); + mOtpEditText.addTextChangedListener(mOtpTextWatcher); + mOtpErrorMessageTextView.setVisibility(View.GONE); + + mOtpResendMessageTextView.setText(getOtpResendMessage()); + mOtpResendMessageTextView.setMovementMethod(LinkMovementMethod.getInstance()); + + mDialogModel = buildDialogModel(view); + mModalDialogManager.showDialog(mDialogModel, ModalDialogManager.ModalDialogType.TAB); + } + + private PropertyModel buildDialogModel(View customView) { + return new PropertyModel.Builder(ModalDialogProperties.ALL_KEYS) + .with(ModalDialogProperties.CONTROLLER, mModalDialogController) + .with(ModalDialogProperties.CUSTOM_VIEW, customView) + .with(ModalDialogProperties.TITLE, + mContext.getResources().getString( + R.string.autofill_payments_otp_verification_dialog_title)) + .with(ModalDialogProperties.TITLE_ICON, + ResourcesCompat.getDrawable(mContext.getResources(), + R.drawable.google_pay_with_divider, mContext.getTheme())) + .with(ModalDialogProperties.NEGATIVE_BUTTON_TEXT, + mContext.getResources().getString( + R.string.autofill_payments_otp_verification_dialog_negative_button_label)) + .with(ModalDialogProperties.POSITIVE_BUTTON_TEXT, + mContext.getResources().getString( + R.string.autofill_payments_otp_verification_dialog_positive_button_label)) + .with(ModalDialogProperties.POSITIVE_BUTTON_DISABLED, true) + .build(); + } + + private SpannableString getOtpResendMessage() { + return SpanApplier.applySpans( + mContext.getResources().getString( + R.string.autofill_payments_otp_verification_dialog_cant_find_code_message), + new SpanInfo("<link>", "</link>", + new NoUnderlineClickableSpan(mContext.getResources(), + textView -> mListener.onNewOtpRequested()))); + } + + /** Show an error message for the submitted otp. */ + public void showOtpErrorMessage(String errorMessage) { + hideProgressBarOverlay(); + mOtpErrorMessageTextView.setVisibility(View.VISIBLE); + mOtpErrorMessageTextView.setText(errorMessage); + } + + private void showProgressBarOverlay() { + mProgressBarOverlayView.setVisibility(View.VISIBLE); + mProgressBarOverlayView.setAlpha(0f); + mProgressBarOverlayView.animate().alpha(1f).setDuration(ANIMATION_DURATION_MS); + mOtpVerificationDialogContents.animate().alpha(0f).setDuration(ANIMATION_DURATION_MS); + mDialogModel.set(ModalDialogProperties.POSITIVE_BUTTON_DISABLED, true); + } + + private void hideProgressBarOverlay() { + mProgressBarOverlayView.setVisibility(View.GONE); + mProgressBarOverlayView.animate().alpha(0f).setDuration(ANIMATION_DURATION_MS); + mOtpVerificationDialogContents.animate().alpha(1f).setDuration(ANIMATION_DURATION_MS); + mDialogModel.set(ModalDialogProperties.POSITIVE_BUTTON_DISABLED, false); + } +}
diff --git a/chrome/browser/ui/android/autofill/internal/java/src/org/chromium/chrome/browser/ui/autofill/OtpVerificationDialogTest.java b/chrome/browser/ui/android/autofill/internal/java/src/org/chromium/chrome/browser/ui/autofill/OtpVerificationDialogTest.java new file mode 100644 index 0000000..56c505d --- /dev/null +++ b/chrome/browser/ui/android/autofill/internal/java/src/org/chromium/chrome/browser/ui/autofill/OtpVerificationDialogTest.java
@@ -0,0 +1,183 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.ui.autofill; +import static com.google.common.truth.Truth.assertThat; + +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import android.text.SpannableString; +import android.text.style.ClickableSpan; +import android.view.View; +import android.widget.EditText; +import android.widget.TextView; + +import androidx.test.core.app.ApplicationProvider; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; + +import org.chromium.base.test.BaseRobolectricTestRunner; +import org.chromium.chrome.browser.ui.autofill.internal.R; +import org.chromium.ui.modaldialog.DialogDismissalCause; +import org.chromium.ui.modaldialog.ModalDialogManager; +import org.chromium.ui.modaldialog.ModalDialogProperties; +import org.chromium.ui.modelutil.PropertyModel; + +/** + * Unit tests for {@link OtpVerificationDialog}. + */ +@RunWith(BaseRobolectricTestRunner.class) +public class OtpVerificationDialogTest { + private static final String ERROR_MESSAGE = "Error message"; + private static final String VALID_OTP = "123456"; + + private OtpVerificationDialog mOtpVerificationDialog; + private FakeModalDialogManager mModalDialogManager; + + @Mock + private OtpVerificationDialog.Listener mListener; + private class FakeModalDialogManager extends ModalDialogManager { + private PropertyModel mShownDialogModel; + + public FakeModalDialogManager() { + super(Mockito.mock(Presenter.class), 0); + } + + @Override + public void showDialog(PropertyModel model, int dialogType) { + mShownDialogModel = model; + } + + @Override + public void dismissDialog(PropertyModel model, int dismissalCause) { + model.get(ModalDialogProperties.CONTROLLER).onDismiss(model, dismissalCause); + mShownDialogModel = null; + } + + public void clickPositiveButton() { + mShownDialogModel.get(ModalDialogProperties.CONTROLLER) + .onClick(mShownDialogModel, ModalDialogProperties.ButtonType.POSITIVE); + } + + public PropertyModel getShownDialogModel() { + return mShownDialogModel; + } + } + + @Before + public void setUp() { + MockitoAnnotations.initMocks(this); + mModalDialogManager = new FakeModalDialogManager(); + mOtpVerificationDialog = new OtpVerificationDialog( + ApplicationProvider.getApplicationContext(), mListener, mModalDialogManager); + } + + @Test + public void testDefaultState() { + int otpLength = 6; + + mOtpVerificationDialog.show(otpLength); + + PropertyModel model = mModalDialogManager.getShownDialogModel(); + View view = model.get(ModalDialogProperties.CUSTOM_VIEW); + // Verify that the error message is not shown. + assertThat(view.findViewById(R.id.otp_error_message).getVisibility()).isEqualTo(View.GONE); + // Verify that the hint shown in the OTP input field contains the value of the otpLength set + // above. + assertThat(((EditText) view.findViewById(R.id.otp_input)).getHint()) + .isEqualTo(ApplicationProvider.getApplicationContext().getString( + R.string.autofill_payments_otp_verification_dialog_otp_input_hint, + otpLength)); + // Verify that the positive button is disabled. + assertThat(model.get(ModalDialogProperties.POSITIVE_BUTTON_DISABLED)).isTrue(); + } + + @Test + public void testShowHideErrorMessage() { + mOtpVerificationDialog.show(/*otpLength= */ 6); + + mOtpVerificationDialog.showOtpErrorMessage(ERROR_MESSAGE); + + PropertyModel model = mModalDialogManager.getShownDialogModel(); + View view = model.get(ModalDialogProperties.CUSTOM_VIEW); + // Verify that the error message is shown. + TextView errorMessageTextView = (TextView) view.findViewById(R.id.otp_error_message); + assertThat(errorMessageTextView.getVisibility()).isEqualTo(View.VISIBLE); + assertThat(errorMessageTextView.getText()).isEqualTo(ERROR_MESSAGE); + + // Verify that editing the error test, hides the error message. + EditText otpInputEditText = (EditText) view.findViewById(R.id.otp_input); + otpInputEditText.setText("123"); + assertThat(errorMessageTextView.getVisibility()).isEqualTo(View.GONE); + } + + @Test + public void testPositiveButtonDisabledState() { + mOtpVerificationDialog.show(/*otpLength= */ 6); + PropertyModel model = mModalDialogManager.getShownDialogModel(); + View view = model.get(ModalDialogProperties.CUSTOM_VIEW); + + EditText otpInputEditText = (EditText) view.findViewById(R.id.otp_input); + + // Verify that the positive button is disabled for input length < otpLength. + otpInputEditText.setText("123"); + assertThat(model.get(ModalDialogProperties.POSITIVE_BUTTON_DISABLED)).isTrue(); + + // Verify that the positive button is enabled for input length == otpLength. + otpInputEditText.setText("123456"); + assertThat(model.get(ModalDialogProperties.POSITIVE_BUTTON_DISABLED)).isFalse(); + + // Verify that the positive button is disabled for input length > otpLength. + otpInputEditText.setText("1234567"); + assertThat(model.get(ModalDialogProperties.POSITIVE_BUTTON_DISABLED)).isTrue(); + } + + @Test + public void testOtpSubmission() { + mOtpVerificationDialog.show(/*otpLength= */ 6); + PropertyModel model = mModalDialogManager.getShownDialogModel(); + View view = model.get(ModalDialogProperties.CUSTOM_VIEW); + EditText otpInputEditText = (EditText) view.findViewById(R.id.otp_input); + otpInputEditText.setText(VALID_OTP); + + mModalDialogManager.clickPositiveButton(); + + // Verify that the listener is called with the text entered in the OTP input field. + verify(mListener, times(1)).onConfirm(VALID_OTP); + // Verify that the progress bar is shown. + assertThat(view.findViewById(R.id.progress_bar_overlay).getVisibility()) + .isEqualTo(View.VISIBLE); + } + + @Test + public void testGetNewCode() { + mOtpVerificationDialog.show(/*otpLength= */ 6); + PropertyModel model = mModalDialogManager.getShownDialogModel(); + View view = model.get(ModalDialogProperties.CUSTOM_VIEW); + TextView otpResendMessageTextView = (TextView) view.findViewById(R.id.otp_resend_message); + SpannableString otpResendMessage = (SpannableString) otpResendMessageTextView.getText(); + ClickableSpan getNewCodeSpan = + otpResendMessage.getSpans(0, otpResendMessage.length(), ClickableSpan.class)[0]; + + getNewCodeSpan.onClick(otpResendMessageTextView); + + verify(mListener, times(1)).onNewOtpRequested(); + } + + @Test + public void testDialogDismissal() { + mOtpVerificationDialog.show(/*otpLength= */ 6); + + mModalDialogManager.dismissDialog(mModalDialogManager.getShownDialogModel(), + DialogDismissalCause.NEGATIVE_BUTTON_CLICKED); + + verify(mListener, times(1)).onDialogDismissed(); + } +}
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd index a64be1d8..0dbb5a8 100644 --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd
@@ -1222,21 +1222,6 @@ <message name="IDS_ACCESSIBILITY_CAPTIONS_TITLE" desc="Title of the preference that allows the user to update caption settings."> Captions </message> - <message name="IDS_ACCESSIBILITY_PAGE_ZOOM_TITLE" desc="Title of the preference that allows the user to update the accessibility page zoom feature that applies to the web contents." translateable="false"> - Page Zoom - </message> - <message name="IDS_ACCESSIBILITY_PAGE_ZOOM_SUMMARY" desc="Summary of the preference that allows the user to update the accessibility page zoom feature that applies to the web contents." translateable="false"> - Use this setting to increase/decrease the zoom factor for a given page. - </message> - <message name="IDS_ACCESSIBILITY_PAGE_ZOOM_DECREASE_ZOOM_BUTTON_TEXT" desc="Accessibility label for button to allow user to decrease page zoom" translateable="false"> - Decrease zoom - </message> - <message name="IDS_ACCESSIBILITY_PAGE_ZOOM_INCREASE_ZOOM_BUTTON_TEXT" desc="Accessibility label for button to allow user to increase page zoom" translateable="false"> - Increase zoom - </message> - <message name="IDS_ACCESSIBILITY_PAGE_ZOOM_FACTOR" desc="Text description of the current page zoom factor set by the user" translateable="false"> - <ph name="ZOOM_FACTOR">%1$d<ex>100</ex></ph> %% - </message> <!-- Language Settings --> <message name="IDS_LANGUAGE_SETTINGS" desc="Title for the Languages settings screen that allows users to manage their languages preferences. [CHAR_LIMIT=32]">
diff --git a/chrome/browser/ui/app_list/app_list_syncable_service.cc b/chrome/browser/ui/app_list/app_list_syncable_service.cc index 519439d5..f4e26fe34 100644 --- a/chrome/browser/ui/app_list/app_list_syncable_service.cc +++ b/chrome/browser/ui/app_list/app_list_syncable_service.cc
@@ -105,7 +105,7 @@ apps::AppServiceProxyFactory::GetForProfile(profile) ->AppRegistryCache() .ForOneApp(id, [&result](const apps::AppUpdate& update) { - result = update.InstallSource() == apps::mojom::InstallSource::kDefault; + result = update.InstallSource() == apps::mojom::InstallReason::kDefault; }); return result; } @@ -114,7 +114,7 @@ apps::mojom::AppPtr delta = apps::mojom::App::New(); delta->app_type = apps::mojom::AppType::kExtension; delta->app_id = id; - delta->install_source = apps::mojom::InstallSource::kDefault; + delta->install_reason = apps::mojom::InstallReason::kDefault; std::vector<apps::mojom::AppPtr> deltas; deltas.push_back(std::move(delta)); @@ -1398,14 +1398,14 @@ bool AppListSyncableService::AppIsOem(const std::string& id) { // For Arc and web apps, it is sufficient to check the install source. - apps::mojom::InstallSource install_source = - apps::mojom::InstallSource::kUnknown; + apps::mojom::InstallReason install_reason = + apps::mojom::InstallReason::kUnknown; apps::AppServiceProxyFactory::GetForProfile(profile_) ->AppRegistryCache() - .ForOneApp(id, [&install_source](const apps::AppUpdate& update) { - install_source = update.InstallSource(); + .ForOneApp(id, [&install_reason](const apps::AppUpdate& update) { + install_reason = update.InstallSource(); }); - if (install_source == apps::mojom::InstallSource::kOem) + if (install_reason == apps::mojom::InstallReason::kOem) return true; if (!extension_system_->extension_service())
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.cc b/chrome/browser/ui/ash/chrome_shell_delegate.cc index b3fdbc0..748a922 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate.cc +++ b/chrome/browser/ui/ash/chrome_shell_delegate.cc
@@ -21,6 +21,7 @@ #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part_chromeos.h" +#include "chrome/browser/extensions/api/tabs/tabs_util.h" #include "chrome/browser/nearby_sharing/nearby_share_delegate_impl.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" @@ -423,6 +424,11 @@ /*description_template=*/"#BentoBar\n\n"); } +void ChromeShellDelegate::SetPinnedFromExo(aura::Window* window, + chromeos::WindowPinType type) { + extensions::tabs_util::SetLockedFullscreenStateFromExo(window, type); +} + // static void ChromeShellDelegate::SetDisableLoggingRedirectForTesting(bool value) { disable_logging_redirect_for_testing = value;
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.h b/chrome/browser/ui/ash/chrome_shell_delegate.h index 84507b67..8cd64fc 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate.h +++ b/chrome/browser/ui/ash/chrome_shell_delegate.h
@@ -60,6 +60,8 @@ std::unique_ptr<app_restore::AppLaunchInfo> GetAppLaunchDataForDeskTemplate( aura::Window* window) const override; desks_storage::DeskModel* GetDeskModel() override; + void SetPinnedFromExo(aura::Window* window, + chromeos::WindowPinType type) override; static void SetDisableLoggingRedirectForTesting(bool value); static void ResetDisableLoggingRedirectForTesting();
diff --git a/chrome/browser/ui/ash/shelf/chrome_shelf_controller.cc b/chrome/browser/ui/ash/shelf/chrome_shelf_controller.cc index 14a42179..757e43f 100644 --- a/chrome/browser/ui/ash/shelf/chrome_shelf_controller.cc +++ b/chrome/browser/ui/ash/shelf/chrome_shelf_controller.cc
@@ -377,6 +377,24 @@ SetItemStatus(id, status); } +bool ChromeShelfController::ShouldSyncItemWithReentrancy( + const ash::ShelfItem& item) { + return should_sync_pin_changes_ && ShouldSyncItem(item); +} + +bool ChromeShelfController::ShouldSyncItem(const ash::ShelfItem& item) { + // Syncing is only enabled for pinned items. + if (!ItemTypeIsPinned(item)) + return false; + + // Syncing is disabled for standalone-browser based chrome apps for now. + // See https://crbug.com/1250480. + apps::AppServiceProxyChromeOs* proxy = + apps::AppServiceProxyFactory::GetForProfile(profile()); + auto app_type = proxy->AppRegistryCache().GetAppType(item.id.app_id); + return app_type != apps::mojom::AppType::kStandaloneBrowserExtension; +} + bool ChromeShelfController::IsPinned(const ash::ShelfID& id) { const ash::ShelfItem* item = GetItem(id); return item && ItemTypeIsPinned(*item); @@ -1091,14 +1109,15 @@ std::vector<ash::ShelfID> shelf_ids_after; for (int i = index - 1; i >= 0; --i) { - shelf_id_before = model_->items()[i].id; - if (IsPinned(shelf_id_before)) + if (ShouldSyncItem(model_->items()[i])) { + shelf_id_before = model_->items()[i].id; break; + } } for (int i = index + 1; i < max_index; ++i) { const ash::ShelfID& shelf_id_after = model_->items()[i].id; - if (IsPinned(shelf_id_after)) + if (ShouldSyncItem(model_->items()[i])) shelf_ids_after.push_back(shelf_id_after); } @@ -1459,14 +1478,14 @@ } // Update the pin position preference as needed. - if (ItemTypeIsPinned(item) && should_sync_pin_changes_) + if (ShouldSyncItemWithReentrancy(item)) SyncPinPosition(item.id); } void ChromeShelfController::ShelfItemRemoved(int index, const ash::ShelfItem& old_item) { // Remove the pin position from preferences as needed. - if (ItemTypeIsPinned(old_item) && should_sync_pin_changes_) + if (ShouldSyncItemWithReentrancy(old_item)) shelf_prefs_->RemovePinPosition(profile(), old_item.id); if (auto* app_icon_loader = GetAppIconLoaderForApp(old_item.id.app_id)) app_icon_loader->ClearImage(old_item.id.app_id); @@ -1475,19 +1494,16 @@ void ChromeShelfController::ShelfItemMoved(int start_index, int target_index) { // Update the pin position preference as needed. const ash::ShelfItem& item = model_->items()[target_index]; - if (ItemTypeIsPinned(item) && should_sync_pin_changes_) + if (ShouldSyncItemWithReentrancy(item)) SyncPinPosition(item.id); } void ChromeShelfController::ShelfItemChanged(int index, const ash::ShelfItem& old_item) { - if (!should_sync_pin_changes_) - return; - // Add or remove the pin position from preferences as needed. const ash::ShelfItem& item = model_->items()[index]; - if (!ItemTypeIsPinned(old_item) && ItemTypeIsPinned(item)) + if (!ItemTypeIsPinned(old_item) && ShouldSyncItemWithReentrancy(item)) SyncPinPosition(item.id); - else if (ItemTypeIsPinned(old_item) && !ItemTypeIsPinned(item)) + else if (ShouldSyncItemWithReentrancy(old_item) && !ItemTypeIsPinned(item)) shelf_prefs_->RemovePinPosition(profile(), old_item.id); }
diff --git a/chrome/browser/ui/ash/shelf/chrome_shelf_controller.h b/chrome/browser/ui/ash/shelf/chrome_shelf_controller.h index b4f490d..1e26a387 100644 --- a/chrome/browser/ui/ash/shelf/chrome_shelf_controller.h +++ b/chrome/browser/ui/ash/shelf/chrome_shelf_controller.h
@@ -402,6 +402,14 @@ void SetItemStatusOrRemove(const ash::ShelfID& id, ash::ShelfItemStatus status); + // Returns whether the pin position of the item should be synced, taking into + // account re-entrancy limitations. + bool ShouldSyncItemWithReentrancy(const ash::ShelfItem& item); + + // Returns whether the pin position of the item should be synced, ignoring + // re-entrancy limitations. + bool ShouldSyncItem(const ash::ShelfItem& item); + // Resolves the app icon image loader for the app. AppIconLoader* GetAppIconLoaderForApp(const std::string& app_id);
diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc index f4cda962..f7290f43 100644 --- a/chrome/browser/ui/browser_command_controller.cc +++ b/chrome/browser/ui/browser_command_controller.cc
@@ -290,7 +290,7 @@ UpdateCommandsForFullscreenMode(); } -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if defined(OS_CHROMEOS) void BrowserCommandController::LockedFullscreenStateChanged() { UpdateCommandsForLockedFullscreenMode(); } @@ -1454,7 +1454,7 @@ command_updater_.UpdateCommandEnabled(IDC_SHOW_APP_MENU, has_toolbar); } -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if defined(OS_CHROMEOS) namespace { #if DCHECK_IS_ON()
diff --git a/chrome/browser/ui/browser_command_controller.h b/chrome/browser/ui/browser_command_controller.h index 9f606f4..b07191a 100644 --- a/chrome/browser/ui/browser_command_controller.h +++ b/chrome/browser/ui/browser_command_controller.h
@@ -53,7 +53,7 @@ void ZoomStateChanged(); void ContentRestrictionsChanged(); void FullscreenStateChanged(); -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if defined(OS_CHROMEOS) // Called when the browser goes in or out of the special locked fullscreen // mode. In this mode the user is basically locked into the current browser // window and tab hence we disable most keyboard shortcuts and we also @@ -159,7 +159,7 @@ // app windows. void UpdateCommandsForHostedAppAvailability(); -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if defined(OS_CHROMEOS) // Update commands whose state depends on whether the window is in locked // fullscreen mode or not. void UpdateCommandsForLockedFullscreenMode();
diff --git a/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc b/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc index 955d3b7..483faf3d 100644 --- a/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc +++ b/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc
@@ -112,7 +112,7 @@ BrowserWithTestWindowTest::SetUp(); AddTab(browser(), GURL("http://www.google.com")); controller_ = &web_contents()->GetController(); - NavigateAndCommit(controller_, GURL("http://www.google.com")); + NavigateAndCommit(web_contents(), GURL("http://www.google.com")); permissions::PermissionRequestManager::CreateForWebContents(web_contents()); manager_ = permissions::PermissionRequestManager::FromWebContents(web_contents()); @@ -245,7 +245,7 @@ /* is_visible = */ false, /* tooltip_empty = */ true); - NavigateAndCommit(controller_, GURL("http://www.google.com")); + NavigateAndCommit(web_contents(), GURL("http://www.google.com")); content_settings = PageSpecificContentSettings::GetForFrame(web_contents()->GetMainFrame()); @@ -259,7 +259,7 @@ content_setting_image_model.get(), /* is_visible = */ true, /* tooltip_empty = */ false, IDS_SENSORS_BLOCKED_TOOLTIP, 0); - NavigateAndCommit(controller_, GURL("http://www.google.com")); + NavigateAndCommit(web_contents(), GURL("http://www.google.com")); content_settings = PageSpecificContentSettings::GetForFrame(web_contents()->GetMainFrame()); @@ -273,7 +273,7 @@ content_setting_image_model.get(), /* is_visible = */ true, /* tooltip_empty = */ false, IDS_SENSORS_ALLOWED_TOOLTIP, 0); - NavigateAndCommit(controller_, GURL("http://www.google.com")); + NavigateAndCommit(web_contents(), GURL("http://www.google.com")); content_settings = PageSpecificContentSettings::GetForFrame(web_contents()->GetMainFrame()); @@ -306,7 +306,7 @@ std::make_unique<chrome::PageSpecificContentSettingsDelegate>( web_contents())); GURL requesting_origin = GURL("https://www.example.com"); - NavigateAndCommit(controller_, requesting_origin); + NavigateAndCommit(web_contents(), requesting_origin); PageSpecificContentSettings* content_settings = PageSpecificContentSettings::GetForFrame(web_contents()->GetMainFrame()); HostContentSettingsMap* settings_map = @@ -363,7 +363,7 @@ std::make_unique<chrome::PageSpecificContentSettingsDelegate>( web_contents())); GURL requesting_origin = GURL("https://www.example.com"); - NavigateAndCommit(controller_, requesting_origin); + NavigateAndCommit(web_contents(), requesting_origin); PageSpecificContentSettings* content_settings = PageSpecificContentSettings::GetForFrame(web_contents()->GetMainFrame()); HostContentSettingsMap* settings_map = @@ -411,7 +411,7 @@ std::make_unique<chrome::PageSpecificContentSettingsDelegate>( web_contents())); GURL requesting_origin = GURL("https://www.example.com"); - NavigateAndCommit(controller_, requesting_origin); + NavigateAndCommit(web_contents(), requesting_origin); PageSpecificContentSettings* content_settings = PageSpecificContentSettings::GetForFrame(web_contents()->GetMainFrame()); @@ -475,7 +475,7 @@ web_contents(), std::make_unique<chrome::PageSpecificContentSettingsDelegate>( web_contents())); - NavigateAndCommit(controller_, GURL("https://www.example.com")); + NavigateAndCommit(web_contents(), GURL("https://www.example.com")); PageSpecificContentSettings* content_settings = PageSpecificContentSettings::GetForFrame(web_contents()->GetMainFrame()); HostContentSettingsMap* settings_map = @@ -513,7 +513,7 @@ EXPECT_FALSE(content_setting_image_model->is_visible()); } - NavigateAndCommit(controller_, GURL("https://www.example.com")); + NavigateAndCommit(web_contents(), GURL("https://www.example.com")); content_settings = PageSpecificContentSettings::GetForFrame(web_contents()->GetMainFrame()); @@ -542,7 +542,7 @@ /* tooltip_empty = */ false, IDS_SENSORS_BLOCKED_TOOLTIP, 0); } - NavigateAndCommit(controller_, GURL("https://www.example.com")); + NavigateAndCommit(web_contents(), GURL("https://www.example.com")); content_settings = PageSpecificContentSettings::GetForFrame(web_contents()->GetMainFrame()); @@ -560,7 +560,7 @@ /* tooltip_empty = */ false, IDS_SENSORS_ALLOWED_TOOLTIP, 0); } - NavigateAndCommit(controller_, GURL("https://www.example.com")); + NavigateAndCommit(web_contents(), GURL("https://www.example.com")); content_settings = PageSpecificContentSettings::GetForFrame(web_contents()->GetMainFrame()); // Clear site-specific exceptions.
diff --git a/chrome/browser/ui/side_search/side_search_side_contents_helper.cc b/chrome/browser/ui/side_search/side_search_side_contents_helper.cc index 982f214..22bed6b 100644 --- a/chrome/browser/ui/side_search/side_search_side_contents_helper.cc +++ b/chrome/browser/ui/side_search/side_search_side_contents_helper.cc
@@ -56,12 +56,8 @@ auto* side_contents_helper = SideSearchSideContentsHelper::FromWebContents( navigation_handle()->GetWebContents()); DCHECK(side_contents_helper); - content::OpenURLParams params = - content::OpenURLParams::FromNavigationHandle(navigation_handle()); - // TODO(tluk): Remove this when landing on trunk (fix landing at - // https://crrev.com/c/3171921). - params.redirect_chain.pop_back(); - side_contents_helper->NavigateInTabContents(params); + side_contents_helper->NavigateInTabContents( + content::OpenURLParams::FromNavigationHandle(navigation_handle())); return content::NavigationThrottle::CANCEL; } };
diff --git a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc index 9043ba4a..d5a7f7ea 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
@@ -2444,10 +2444,10 @@ protocol_handler.url = GURL(handler_url); protocol_handler.protocol = "web+test"; web_app::AppId app_id = InstallWebAppWithProtocolHandlers({protocol_handler}); - bool approved_protocols_notified = false; + bool allowed_protocols_notified = false; web_app::WebAppTestRegistryObserverAdapter observer(browser()->profile()); - observer.SetWebAppProtocolSettingsChangedDelegate(base::BindLambdaForTesting( - [&]() { approved_protocols_notified = true; })); + observer.SetWebAppProtocolSettingsChangedDelegate( + base::BindLambdaForTesting([&]() { allowed_protocols_notified = true; })); WebAppProtocolHandlerIntentPickerView::SetDefaultRememberSelectionForTesting( true); @@ -2464,11 +2464,11 @@ // Wait for app launch task to complete. content::RunAllTasksUntilIdle(); - // Check that we added this protocol to web app's approved_launch_protocols + // Check that we added this protocol to web app's allowed_launch_protocols // on accept. web_app::WebAppRegistrar& registrar = provider()->registrar(); - EXPECT_TRUE(registrar.IsApprovedLaunchProtocol(app_id, "web+test")); - EXPECT_TRUE(approved_protocols_notified); + EXPECT_TRUE(registrar.IsAllowedLaunchProtocol(app_id, "web+test")); + EXPECT_TRUE(allowed_protocols_notified); // Check for new app window. ASSERT_EQ(2u, chrome::GetBrowserCount(browser()->profile())); @@ -2520,7 +2520,7 @@ IN_PROC_BROWSER_TEST_F( StartupBrowserWebAppProtocolHandlingTest, - WebAppLaunch_WebAppIsLaunchedWithApprovedProtocolUrlPref) { + WebAppLaunch_WebAppIsLaunchedWithAllowedProtocolUrlPref) { if (!AreProtocolHandlersSupported()) return; @@ -2549,10 +2549,10 @@ // Wait for app launch task to complete and launches a new browser. ui_test_utils::WaitForBrowserToOpen(); - // Check that we added this protocol to web app's approved_launch_protocols + // Check that we added this protocol to web app's allowed_launch_protocols // on accept. web_app::WebAppRegistrar& registrar = provider()->registrar(); - EXPECT_TRUE(registrar.IsApprovedLaunchProtocol(app_id, "web+test")); + EXPECT_TRUE(registrar.IsAllowedLaunchProtocol(app_id, "web+test")); // Check the first app window is created. ASSERT_EQ(2u, chrome::GetBrowserCount(browser()->profile())); @@ -2568,7 +2568,7 @@ ui_test_utils::WaitForBrowserToOpen(); // Check the second app window is launched directly this time. The dialog - // is skipped because we have the approved protocol scheme for the same + // is skipped because we have the allowed protocol scheme for the same // app launch. Browser* app_browser2; // There should be 3 browser windows opened at the moment. @@ -2589,7 +2589,7 @@ } IN_PROC_BROWSER_TEST_F(StartupBrowserWebAppProtocolHandlingTest, - WebAppLaunch_WebAppIsLaunchedWithApprovedProtocol) { + WebAppLaunch_WebAppIsLaunchedWithAllowedProtocol) { if (!AreProtocolHandlersSupported()) return; @@ -2617,9 +2617,9 @@ ui_test_utils::WaitForBrowserToOpen(); // Check that we did not add this protocol to web app's - // approved_launch_protocols on accept. + // allowed_launch_protocols on accept. web_app::WebAppRegistrar& registrar = provider()->registrar(); - EXPECT_FALSE(registrar.IsApprovedLaunchProtocol(app_id, "web+test")); + EXPECT_FALSE(registrar.IsAllowedLaunchProtocol(app_id, "web+test")); // Check the first app window is created. ASSERT_EQ(2u, chrome::GetBrowserCount(browser()->profile())); @@ -2689,7 +2689,7 @@ WebAppProtocolHandlerIntentPickerView::SetDefaultRememberSelectionForTesting( false); - // Check that we added this protocol to web app's approved_launch_protocols + // Check that we added this protocol to web app's allowed_launch_protocols // on accept. web_app::WebAppRegistrar& registrar = provider()->registrar(); EXPECT_TRUE(registrar.IsDisallowedLaunchProtocol(app_id, "web+test")); @@ -2725,7 +2725,7 @@ } // Check that we did not add this protocol to web app's - // approved_launch_protocols on accept. + // allowed_launch_protocols on accept. web_app::WebAppRegistrar& registrar = provider()->registrar(); EXPECT_FALSE(registrar.IsDisallowedLaunchProtocol(app_id, "web+test"));
diff --git a/chrome/browser/ui/startup/web_app_protocol_handling_startup_utils.cc b/chrome/browser/ui/startup/web_app_protocol_handling_startup_utils.cc index 4d44ff6..945d671 100644 --- a/chrome/browser/ui/startup/web_app_protocol_handling_startup_utils.cc +++ b/chrome/browser/ui/startup/web_app_protocol_handling_startup_utils.cc
@@ -161,7 +161,7 @@ } // Check if we have permission to launch the app directly. - if (registrar.IsApprovedLaunchProtocol(app_id, protocol_url.scheme())) { + if (registrar.IsAllowedLaunchProtocol(app_id, protocol_url.scheme())) { LaunchApp( profile, app_id, command_line, cur_dir, protocol_url, base::BindOnce(&OnProtocolHandlerAppLaunched, std::move(keep_alive),
diff --git a/chrome/browser/ui/tab_sharing/tab_sharing_infobar_delegate_unittest.cc b/chrome/browser/ui/tab_sharing/tab_sharing_infobar_delegate_unittest.cc index bd8c770..fa72c97 100644 --- a/chrome/browser/ui/tab_sharing/tab_sharing_infobar_delegate_unittest.cc +++ b/chrome/browser/ui/tab_sharing/tab_sharing_infobar_delegate_unittest.cc
@@ -255,7 +255,6 @@ infobars::ContentInfoBarManager::FromWebContents(web_contents); CreateInfobar(kSharedTabName, kAppName, false, true); EXPECT_EQ(infobar_manager->infobar_count(), 1u); - content::NavigationController* controller = &web_contents->GetController(); - NavigateAndCommit(controller, GURL("http://bar")); + NavigateAndCommit(web_contents, GURL("http://bar")); EXPECT_EQ(infobar_manager->infobar_count(), 1u); }
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index 8f384c1..6675447 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -221,8 +221,10 @@ #include "ui/views/widget/widget.h" #include "ui/views/window/dialog_delegate.h" -#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) +#if defined(OS_CHROMEOS) #include "chrome/browser/ui/views/frame/top_controls_slide_controller_chromeos.h" +#include "chromeos/ui/base/window_pin_type.h" +#include "chromeos/ui/base/window_properties.h" #endif #if BUILDFLAG(IS_CHROMEOS_ASH) @@ -1471,11 +1473,21 @@ ExclusiveAccessBubbleType bubble_type, ExclusiveAccessBubbleHideCallback bubble_first_hide_callback, bool force_update) { + bool is_trusted_pinned = false; +#if defined(OS_CHROMEOS) + // Trusted pinned mode does not allow to escape. So do not show the bubble. + auto* window = GetNativeWindow(); + is_trusted_pinned = window + ? (window->GetProperty(chromeos::kWindowPinTypeKey) == + chromeos::WindowPinType::kTrustedPinned) + : false; +#endif + // Immersive mode has no exit bubble because it has a visible strip at the // top that gives the user a hover target. In a public session we show the // bubble. // TODO(jamescook): Figure out what to do with mouse-lock. - if (bubble_type == EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE || + if (is_trusted_pinned || bubble_type == EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE || (ShouldUseImmersiveFullscreenForUrl(url) && !profiles::IsPublicSession())) { // |exclusive_access_bubble_.reset()| will trigger callback for current
diff --git a/chrome/browser/ui/views/sharing_hub/screenshot/screenshot_captured_bubble.cc b/chrome/browser/ui/views/sharing_hub/screenshot/screenshot_captured_bubble.cc index c7ba4cc..b305c2dd 100644 --- a/chrome/browser/ui/views/sharing_hub/screenshot/screenshot_captured_bubble.cc +++ b/chrome/browser/ui/views/sharing_hub/screenshot/screenshot_captured_bubble.cc
@@ -30,6 +30,11 @@ namespace { +// The Select->Copy/Save flow can be experimented with, but the edit piece will +// be in development for some time. This flag can be used to enable the edit +// button during development, and may later turn into a feature flag. +constexpr bool kShowEditButton = false; + // Rendered image size, pixels. constexpr int kImageWidthPx = 336; constexpr int kImageHeightPx = 252; @@ -147,21 +152,23 @@ // Padding AddSmallPaddingRow(layout); - // Controls row: edit, share, and download button. + // Controls row: optional edit button and download button. views::ColumnSet* control_columns = layout->AddColumnSet(kDownloadRowColumnSetId); // Column for edit button. - control_columns->AddColumn( - views::GridLayout::LEADING, views::GridLayout::CENTER, 1.0, - views::GridLayout::ColumnSize::kUsePreferred, 0, 0); - layout->StartRow(views::GridLayout::kFixedSize, kDownloadRowColumnSetId); + if (kShowEditButton) { + control_columns->AddColumn( + views::GridLayout::LEADING, views::GridLayout::CENTER, 1.0, + views::GridLayout::ColumnSize::kUsePreferred, 0, 0); + layout->StartRow(views::GridLayout::kFixedSize, kDownloadRowColumnSetId); - int kPaddingEditShareButtonPx = - kImageWidthPx - edit_button->CalculatePreferredSize().width() - - download_button->CalculatePreferredSize().width(); - // Spacing between the edit and share buttons. - control_columns->AddPaddingColumn(views::GridLayout::kFixedSize, - kPaddingEditShareButtonPx); + int kPaddingEditDownloadButtonPx = + kImageWidthPx - edit_button->CalculatePreferredSize().width() - + download_button->CalculatePreferredSize().width(); + // Spacing between the edit and download buttons. + control_columns->AddPaddingColumn(views::GridLayout::kFixedSize, + kPaddingEditDownloadButtonPx); + } // Column for download button control_columns->AddColumn( @@ -169,7 +176,9 @@ views::GridLayout::ColumnSize::kUsePreferred, 0, 0); layout->StartRow(views::GridLayout::kFixedSize, kDownloadRowColumnSetId); - edit_button_ = layout->AddView(std::move(edit_button)); + if (kShowEditButton) { + edit_button_ = layout->AddView(std::move(edit_button)); + } download_button_ = layout->AddView(std::move(download_button)); // End controls row }
diff --git a/chrome/browser/ui/views/web_apps/web_app_integration_browsertest.cc b/chrome/browser/ui/views/web_apps/web_app_integration_browsertest.cc index d7194f5..d351e5e 100644 --- a/chrome/browser/ui/views/web_apps/web_app_integration_browsertest.cc +++ b/chrome/browser/ui/views/web_apps/web_app_integration_browsertest.cc
@@ -1698,10 +1698,9 @@ helper_.AfterStateCheckAction(); } -// Flaky, see http://crbug.com/1250766/. IN_PROC_BROWSER_TEST_F( WebAppIntegrationBrowserTest, - DISABLED_WebAppIntegration_InstPlcyTabNoShctSiteA_InListTabbedSiteA_InstCrtShctWindowedSiteA_InListWinSiteA_WindowCreated_UninstallPlcySiteA_InListWinSiteA) { + WebAppIntegration_InstPlcyTabNoShctSiteA_InListTabbedSiteA_InstCrtShctWindowedSiteA_InListWinSiteA_WindowCreated_UninstallPlcySiteA_InListWinSiteA) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -1734,10 +1733,9 @@ helper_.AfterStateCheckAction(); } -// Flaky, see http://crbug.com/1250766/. IN_PROC_BROWSER_TEST_F( WebAppIntegrationBrowserTest, - DISABLED_WebAppIntegration_InstPlcyTabNoShctSiteA_InListTabbedSiteA_InstOmniboxSiteA_InListWinSiteA_WindowCreated_UninstallPlcySiteA_InListWinSiteA) { + WebAppIntegration_InstPlcyTabNoShctSiteA_InListTabbedSiteA_InstOmniboxSiteA_InListWinSiteA_WindowCreated_UninstallPlcySiteA_InListWinSiteA) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -1770,10 +1768,9 @@ helper_.AfterStateCheckAction(); } -// Flaky, see http://crbug.com/1250766/. IN_PROC_BROWSER_TEST_F( WebAppIntegrationBrowserTest, - DISABLED_WebAppIntegration_InstPlcyTabNoShctSiteA_InListTabbedSiteA_InstMenuOptionSiteA_InListWinSiteA_WindowCreated_UninstallPlcySiteA_InListWinSiteA) { + WebAppIntegration_InstPlcyTabNoShctSiteA_InListTabbedSiteA_InstMenuOptionSiteA_InListWinSiteA_WindowCreated_UninstallPlcySiteA_InListWinSiteA) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -2204,10 +2201,9 @@ helper_.AfterStateCheckAction(); } -// Flaky, see http://crbug.com/1250766/. IN_PROC_BROWSER_TEST_F( WebAppIntegrationBrowserTest, - DISABLED_WebAppIntegration_InstPlcyTabShctSiteA_InListTabbedSiteA_InstCrtShctWindowedSiteA_InListWinSiteA_WindowCreated_UninstallPlcySiteA_InListWinSiteA) { + WebAppIntegration_InstPlcyTabShctSiteA_InListTabbedSiteA_InstCrtShctWindowedSiteA_InListWinSiteA_WindowCreated_UninstallPlcySiteA_InListWinSiteA) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -2240,10 +2236,9 @@ helper_.AfterStateCheckAction(); } -// Flaky, see http://crbug.com/1250766/. IN_PROC_BROWSER_TEST_F( WebAppIntegrationBrowserTest, - DISABLED_WebAppIntegration_InstPlcyTabShctSiteA_InListTabbedSiteA_InstOmniboxSiteA_InListWinSiteA_WindowCreated_UninstallPlcySiteA_InListWinSiteA) { + WebAppIntegration_InstPlcyTabShctSiteA_InListTabbedSiteA_InstOmniboxSiteA_InListWinSiteA_WindowCreated_UninstallPlcySiteA_InListWinSiteA) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -2276,10 +2271,9 @@ helper_.AfterStateCheckAction(); } -// Flaky, see http://crbug.com/1250766/. IN_PROC_BROWSER_TEST_F( WebAppIntegrationBrowserTest, - DISABLED_WebAppIntegration_InstPlcyTabShctSiteA_InListTabbedSiteA_InstMenuOptionSiteA_InListWinSiteA_WindowCreated_UninstallPlcySiteA_InListWinSiteA) { + WebAppIntegration_InstPlcyTabShctSiteA_InListTabbedSiteA_InstMenuOptionSiteA_InListWinSiteA_WindowCreated_UninstallPlcySiteA_InListWinSiteA) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported.
diff --git a/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_base.cc b/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_base.cc index 9650d2d..5c95564c 100644 --- a/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_base.cc +++ b/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_base.cc
@@ -975,13 +975,19 @@ content::NotificationService::AllSources()); CHECK(chrome::ExecuteCommand(browser(), IDC_CREATE_SHORTCUT)); active_app_id_ = observer.Wait(); + chrome::SetAutoAcceptWebAppDialogForTesting(false, false); if (open_in_window) { app_loaded_observer.Wait(); auto* browser_list = BrowserList::GetInstance(); - app_browser_ = browser_list->GetLastActive(); - DCHECK(AppBrowserController::IsWebApp(app_browser_)); + app_browser_ = nullptr; + for (Browser* browser : *browser_list) { + if (AppBrowserController::IsForWebApp(browser, active_app_id_)) { + app_browser_ = browser; + return; + } + } + NOTREACHED() << "Unable to find app browser for app " << active_app_id_; } - chrome::SetAutoAcceptWebAppDialogForTesting(false, false); } bool WebAppIntegrationBrowserTestBase::AreNoAppWindowsOpen(
diff --git a/chrome/browser/ui/webui/app_management/app_management.mojom b/chrome/browser/ui/webui/app_management/app_management.mojom index d2a43f0..6cf056f 100644 --- a/chrome/browser/ui/webui/app_management/app_management.mojom +++ b/chrome/browser/ui/webui/app_management/app_management.mojom
@@ -21,7 +21,7 @@ string? version; string? size; map<uint32, apps.mojom.Permission> permissions; - apps.mojom.InstallSource install_source; + apps.mojom.InstallReason install_reason; bool hide_more_settings; bool hide_pin_to_shelf; bool is_preferred_app;
diff --git a/chrome/browser/ui/webui/app_management/app_management_page_handler.cc b/chrome/browser/ui/webui/app_management/app_management_page_handler.cc index dd1eee9..6f1eb2c 100644 --- a/chrome/browser/ui/webui/app_management/app_management_page_handler.cc +++ b/chrome/browser/ui/webui/app_management/app_management_page_handler.cc
@@ -273,7 +273,7 @@ app->type = update.AppType(); app->title = update.Name(); app->permissions = std::move(permissions); - app->install_source = update.InstallSource(); + app->install_reason = update.InstallSource(); app->description = update.Description();
diff --git a/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler_utils.cc b/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler_utils.cc index 8bc9b023..8e9a82fb 100644 --- a/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler_utils.cc +++ b/chrome/browser/ui/webui/chromeos/add_supervision/add_supervision_handler_utils.cc
@@ -14,7 +14,7 @@ bool ShouldIncludeAppUpdate(const apps::AppUpdate& app_update) { return app_update.AppType() == apps::mojom::AppType::kArc && - app_update.InstallSource() != apps::mojom::InstallSource::kSystem; + app_update.InstallSource() != apps::mojom::InstallReason::kSystem; } void LogOutHelper() {
diff --git a/chrome/browser/ui/webui/history/history_ui.cc b/chrome/browser/ui/webui/history/history_ui.cc index 5dbd19d8..ae6a5db1 100644 --- a/chrome/browser/ui/webui/history/history_ui.cc +++ b/chrome/browser/ui/webui/history/history_ui.cc
@@ -129,13 +129,11 @@ source->AddBoolean("isHistoryClustersDebug", base::FeatureList::IsEnabled(history_clusters::kDebug)); - // TODO(crbug.com/1173908): Change `historyClustersMenuItem` to - // `historyClustersTabLabel` once the UI is updated to tab view. static constexpr webui::LocalizedString kHistoryClustersStrings[] = { {"disableHistoryClusters", IDS_HISTORY_CLUSTERS_DISABLE_MENU_ITEM_LABEL}, {"enableHistoryClusters", IDS_HISTORY_CLUSTERS_ENABLE_MENU_ITEM_LABEL}, {"headerText", IDS_HISTORY_CLUSTERS_HEADER_TEXT}, - {"historyClustersMenuItem", IDS_HISTORY_CLUSTERS_JOURNEYS_TAB_LABEL}, + {"historyClustersTabLabel", IDS_HISTORY_CLUSTERS_JOURNEYS_TAB_LABEL}, {"historyListTabLabel", IDS_HISTORY_CLUSTERS_LIST_TAB_LABEL}, {"relatedSearchesHeader", IDS_HISTORY_CLUSTERS_RELATED_SEARCHES_HEADER}, {"removeAllFromHistory", IDS_HISTORY_CLUSTERS_REMOVE_ALL_ITEMS},
diff --git a/chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.cc b/chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.cc index 26c9578..8422185 100644 --- a/chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.cc +++ b/chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.cc
@@ -229,7 +229,7 @@ {"modulesDummy2Title", IDS_NTP_MODULES_DUMMY2_TITLE}, {"modulesKaleidoscopeTitle", IDS_NTP_MODULES_KALEIDOSCOPE_TITLE}, {"modulesPhotosInfo", IDS_NTP_MODULES_PHOTOS_INFO}, - {"modulesPhotosSentence", IDS_NTP_MODULES_PHOTOS_TITLE}, + {"modulesPhotosSentence", IDS_NTP_MODULES_PHOTOS_MEMORIES_TITLE}, {"modulesPhotosTitle", IDS_NTP_MODULES_PHOTOS_TITLE}, {"modulesPhotosMemoriesDisable", IDS_NTP_MODULES_PHOTOS_MEMORIES_DISABLE}, {"modulesPhotosMemoriesDisabled",
diff --git a/chrome/browser/ui/webui/settings/protocol_handlers_handler.cc b/chrome/browser/ui/webui/settings/protocol_handlers_handler.cc index b6cdd5b..9515ab3 100644 --- a/chrome/browser/ui/webui/settings/protocol_handlers_handler.cc +++ b/chrome/browser/ui/webui/settings/protocol_handlers_handler.cc
@@ -92,9 +92,9 @@ &ProtocolHandlersHandler::HandleObserveAppProtocolHandlers, base::Unretained(this))); web_ui()->RegisterMessageCallback( - "removeAppApprovedHandler", + "removeAppAllowedHandler", base::BindRepeating( - &ProtocolHandlersHandler::HandleRemoveApprovedAppHandler, + &ProtocolHandlersHandler::HandleRemoveAllowedAppHandler, base::Unretained(this))); web_ui()->RegisterMessageCallback( "removeAppDisallowedHandler", @@ -109,7 +109,7 @@ } void ProtocolHandlersHandler::OnWebAppProtocolSettingsChanged() { - UpdateAllApprovedLaunchProtocols(); + UpdateAllAllowedLaunchProtocols(); UpdateAllDisallowedLaunchProtocols(); } @@ -240,22 +240,22 @@ return handlers_value; } -void ProtocolHandlersHandler::UpdateAllApprovedLaunchProtocols() { +void ProtocolHandlersHandler::UpdateAllAllowedLaunchProtocols() { base::flat_set<std::string> protocols( - GetWebAppProvider()->registrar().GetAllApprovedLaunchProtocols()); + GetWebAppProvider()->registrar().GetAllAllowedLaunchProtocols()); web_app::OsIntegrationManager& os_integration_manager = GetWebAppProvider()->os_integration_manager(); base::Value handlers(base::Value::Type::LIST); for (auto& protocol : protocols) { ProtocolHandlerRegistry::ProtocolHandlerList protocol_handlers = - os_integration_manager.GetApprovedHandlersForProtocol(protocol); + os_integration_manager.GetAllowedHandlersForProtocol(protocol); auto handler_value(GetAppHandlersForProtocol(protocol, protocol_handlers)); handlers.Append(std::move(*handler_value)); } - FireWebUIListener("setAppApprovedProtocolHandlers", handlers); + FireWebUIListener("setAppAllowedProtocolHandlers", handlers); } void ProtocolHandlersHandler::UpdateAllDisallowedLaunchProtocols() { @@ -278,19 +278,19 @@ void ProtocolHandlersHandler::HandleObserveAppProtocolHandlers( base::Value::ConstListView args) { AllowJavascript(); - UpdateAllApprovedLaunchProtocols(); + UpdateAllAllowedLaunchProtocols(); UpdateAllDisallowedLaunchProtocols(); } -void ProtocolHandlersHandler::HandleRemoveApprovedAppHandler( +void ProtocolHandlersHandler::HandleRemoveAllowedAppHandler( base::Value::ConstListView args) { content::ProtocolHandler handler(ParseAppHandlerFromArgs(args)); CHECK(!handler.IsEmpty()); - GetWebAppProvider()->sync_bridge().RemoveApprovedLaunchProtocol( + GetWebAppProvider()->sync_bridge().RemoveAllowedLaunchProtocol( handler.web_app_id().value(), handler.protocol()); - // No need to call UpdateAllApprovedLaunchProtocols() - we should receive a + // No need to call UpdateAllAllowedLaunchProtocols() - we should receive a // notification that the Web App Protocol Settings has changed and we will // update the view then. }
diff --git a/chrome/browser/ui/webui/settings/protocol_handlers_handler.h b/chrome/browser/ui/webui/settings/protocol_handlers_handler.h index a43cdad6..063b6fa9 100644 --- a/chrome/browser/ui/webui/settings/protocol_handlers_handler.h +++ b/chrome/browser/ui/webui/settings/protocol_handlers_handler.h
@@ -118,14 +118,14 @@ ProtocolHandlerRegistry::ProtocolHandlerList handlers); // Called when OnWebAppProtocolSettingsChanged() is notified or on page load. - void UpdateAllApprovedLaunchProtocols(); + void UpdateAllAllowedLaunchProtocols(); // Called when OnWebAppProtocolSettingsChanged() is notified or on page load. void UpdateAllDisallowedLaunchProtocols(); // Remove an approved app handler. // |args| is a list of [protocol, url, app_id]. - void HandleRemoveApprovedAppHandler(base::Value::ConstListView args); + void HandleRemoveAllowedAppHandler(base::Value::ConstListView args); // Remove a disallowed app handler. // |args| is a list of [protocol, url, app_id].
diff --git a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc index fa2782a2..3d8aadc 100644 --- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -1909,8 +1909,8 @@ IDS_SETTINGS_SITE_SETTINGS_SITE_REPRESENTATION_SEPARATOR}, {"siteSettingsAppProtocolHandlers", IDS_SETTINGS_SITE_SETTINGS_APP_PROTOCOL_HANDLERS}, - {"siteSettingsAppApprovedProtocolHandlersDescription", - IDS_SETTINGS_SITE_SETTINGS_APP_APPROVED_PROTOCOL_HANDLERS_DESCRIPTION}, + {"siteSettingsAppAllowedProtocolHandlersDescription", + IDS_SETTINGS_SITE_SETTINGS_APP_ALLOWED_PROTOCOL_HANDLERS_DESCRIPTION}, {"siteSettingsAppDisallowedProtocolHandlersDescription", IDS_SETTINGS_SITE_SETTINGS_APP_DISALLOWED_PROTOCOL_HANDLERS_DESCRIPTION}, {"siteSettingsAutomaticDownloads",
diff --git a/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc b/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc index 032f4bb..d0c58c0 100644 --- a/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc +++ b/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc
@@ -116,13 +116,13 @@ apps::mojom::AppType app_type, const std::string& publisher_id, apps::mojom::Readiness readiness, - apps::mojom::InstallSource install_source) { + apps::mojom::InstallReason install_reason) { apps::mojom::AppPtr app = apps::mojom::App::New(); app->app_id = app_id; app->app_type = app_type; app->publisher_id = publisher_id; app->readiness = readiness; - app->install_source = install_source; + app->install_reason = install_reason; return app; } @@ -133,7 +133,7 @@ deltas.push_back(MakeApp( web_app::GenerateAppId(/*manifest_id=*/absl::nullopt, start_url), apps::mojom::AppType::kWeb, start_url.spec(), - apps::mojom::Readiness::kReady, apps::mojom::InstallSource::kSync)); + apps::mojom::Readiness::kReady, apps::mojom::InstallReason::kSync)); cache.OnApps(std::move(deltas), apps::mojom::AppType::kWeb, /*should_notify_initialized=*/true); } @@ -1732,20 +1732,14 @@ // Navigate the |foo| tab to the same origin as |origin_anchor|, and the // |origin_query| tab to a different origin. const GURL origin_path("https://www.example.com/path/to/page.html"); - content::NavigationController* foo_controller = - &browser() - ->tab_strip_model() - ->GetWebContentsAt(/*foo=*/0) - ->GetController(); - NavigateAndCommit(foo_controller, origin_path); + content::WebContents* foo_contents = + browser()->tab_strip_model()->GetWebContentsAt(/*foo=*/0); + NavigateAndCommit(foo_contents, origin_path); const GURL example_without_www("https://example.com/"); - content::NavigationController* origin_query_controller = - &browser2() - ->tab_strip_model() - ->GetWebContentsAt(/*origin_query=*/1) - ->GetController(); - NavigateAndCommit(origin_query_controller, example_without_www); + content::WebContents* origin_query_contents = + browser2()->tab_strip_model()->GetWebContentsAt(/*origin_query=*/1); + NavigateAndCommit(origin_query_contents, example_without_www); // Reset all permissions. base::Value reset_args(base::Value::Type::LIST);
diff --git a/chrome/browser/web_applications/app_service/web_app_publisher_helper.cc b/chrome/browser/web_applications/app_service/web_app_publisher_helper.cc index 820ad19f5..de7eaef 100644 --- a/chrome/browser/web_applications/app_service/web_app_publisher_helper.cc +++ b/chrome/browser/web_applications/app_service/web_app_publisher_helper.cc
@@ -77,7 +77,7 @@ ContentSettingsType::NOTIFICATIONS, }; -apps::mojom::InstallSource GetHighestPriorityInstallSource( +apps::mojom::InstallReason GetHighestPriorityInstallSource( const WebApp* web_app) { // TODO(crbug.com/1189949): Introduce kOem as a new Source::Type value // immediately below web_app::Source::kSystem, so that this custom behavior @@ -86,21 +86,21 @@ auto& chromeos_data = web_app->chromeos_data().value(); if (chromeos_data.oem_installed) { DCHECK(!web_app->IsSystemApp()); - return apps::mojom::InstallSource::kOem; + return apps::mojom::InstallReason::kOem; } } switch (web_app->GetHighestPrioritySource()) { case Source::kSystem: - return apps::mojom::InstallSource::kSystem; + return apps::mojom::InstallReason::kSystem; case Source::kPolicy: - return apps::mojom::InstallSource::kPolicy; + return apps::mojom::InstallReason::kPolicy; case Source::kWebAppStore: - return apps::mojom::InstallSource::kUser; + return apps::mojom::InstallReason::kUser; case Source::kSync: - return apps::mojom::InstallSource::kSync; + return apps::mojom::InstallReason::kSync; case Source::kDefault: - return apps::mojom::InstallSource::kDefault; + return apps::mojom::InstallReason::kDefault; } } @@ -270,7 +270,7 @@ // For system web apps (only), the install source is |kSystem|. DCHECK_EQ(web_app->IsSystemApp(), - app->install_source == apps::mojom::InstallSource::kSystem); + app->install_reason == apps::mojom::InstallReason::kSystem); app->description = web_app->description(); app->additional_search_terms = web_app->additional_search_terms();
diff --git a/chrome/browser/web_applications/app_service/web_apps.cc b/chrome/browser/web_applications/app_service/web_apps.cc index 09041ccc..2acc0de 100644 --- a/chrome/browser/web_applications/app_service/web_apps.cc +++ b/chrome/browser/web_applications/app_service/web_apps.cc
@@ -332,11 +332,11 @@ ->AppRegistryCache() .ForOneApp(app_id, [&is_system_web_app, &can_use_uninstall, &display_mode](const apps::AppUpdate& update) { - if (update.InstallSource() == apps::mojom::InstallSource::kSystem) { + if (update.InstallSource() == apps::mojom::InstallReason::kSystem) { is_system_web_app = true; } - if (update.InstallSource() == apps::mojom::InstallSource::kSystem || - update.InstallSource() == apps::mojom::InstallSource::kPolicy) { + if (update.InstallSource() == apps::mojom::InstallReason::kSystem || + update.InstallSource() == apps::mojom::InstallReason::kPolicy) { can_use_uninstall = false; } display_mode = update.WindowMode();
diff --git a/chrome/browser/web_applications/manifest_update_task.cc b/chrome/browser/web_applications/manifest_update_task.cc index 4486d7bc..b02be47 100644 --- a/chrome/browser/web_applications/manifest_update_task.cc +++ b/chrome/browser/web_applications/manifest_update_task.cc
@@ -429,20 +429,12 @@ // Allow app icon updating for certain apps, or if the existing icons are // empty - this means the app icon download during install failed. if (AllowUnpromptedIconUpdate(app_id_, registrar_)) { - // When kPwaUpdateDialogForNameAndIcon is enabled, the FilterAndResizeIcons - // call has already been made. - if (!base::FeatureList::IsEnabled( - features::kPwaUpdateDialogForNameAndIcon)) { - // This call populates the |web_application_info_| with all icon bitmap - // data. - // If this data does not match what we already have on disk, then an - // update is necessary. - // TODO(https://crbug.com/1184911): Reuse this data in the web app install - // task. - PopulateProductIcons(&web_application_info_.value(), - &downloaded_icons_map); - } - + // This call populates the |web_application_info_| with all icon bitmap + // data. If this data does not match what we already have on disk, then an + // update is necessary. + // TODO(https://crbug.com/1184911): Reuse this data in the web app install + // task. + PopulateProductIcons(&web_application_info_.value(), &downloaded_icons_map); // TODO: compare in a BEST_EFFORT blocking PostTaskAndReply. if (IsUpdateNeededForIconContents(disk_icon_bitmaps).changes_detected) { UpdateAfterWindowsClose();
diff --git a/chrome/browser/web_applications/os_integration_manager.cc b/chrome/browser/web_applications/os_integration_manager.cc index 87ea7c9..f29dee4 100644 --- a/chrome/browser/web_applications/os_integration_manager.cc +++ b/chrome/browser/web_applications/os_integration_manager.cc
@@ -341,12 +341,12 @@ } std::vector<ProtocolHandler> -OsIntegrationManager::GetApprovedHandlersForProtocol( +OsIntegrationManager::GetAllowedHandlersForProtocol( const std::string& protocol) { if (!protocol_handler_manager_) return std::vector<ProtocolHandler>(); - return protocol_handler_manager_->GetApprovedHandlersForProtocol(protocol); + return protocol_handler_manager_->GetAllowedHandlersForProtocol(protocol); } std::vector<ProtocolHandler>
diff --git a/chrome/browser/web_applications/os_integration_manager.h b/chrome/browser/web_applications/os_integration_manager.h index f6c6979c..7bfc2ee 100644 --- a/chrome/browser/web_applications/os_integration_manager.h +++ b/chrome/browser/web_applications/os_integration_manager.h
@@ -155,7 +155,7 @@ const std::string& protocol); virtual std::vector<ProtocolHandler> GetAppProtocolHandlers( const AppId& app_id); - virtual std::vector<ProtocolHandler> GetApprovedHandlersForProtocol( + virtual std::vector<ProtocolHandler> GetAllowedHandlersForProtocol( const std::string& protocol); virtual std::vector<ProtocolHandler> GetDisallowedHandlersForProtocol( const std::string& protocol);
diff --git a/chrome/browser/web_applications/preinstalled_web_app_manager_browsertest.cc b/chrome/browser/web_applications/preinstalled_web_app_manager_browsertest.cc index 7d958db..e521e961 100644 --- a/chrome/browser/web_applications/preinstalled_web_app_manager_browsertest.cc +++ b/chrome/browser/web_applications/preinstalled_web_app_manager_browsertest.cc
@@ -866,15 +866,15 @@ apps::AppServiceProxyFactory::GetForProfile(profile()) ->FlushMojoCallsForTesting(); - apps::mojom::InstallSource install_source = - apps::mojom::InstallSource::kUnknown; + apps::mojom::InstallReason install_reason = + apps::mojom::InstallReason::kUnknown; apps::AppServiceProxyFactory::GetForProfile(browser()->profile()) ->AppRegistryCache() .ForOneApp(app_id, [&](const apps::AppUpdate& update) { - install_source = update.InstallSource(); + install_reason = update.InstallSource(); }); - EXPECT_EQ(install_source, apps::mojom::InstallSource::kOem); + EXPECT_EQ(install_reason, apps::mojom::InstallReason::kOem); } #endif // BUILDFLAG(IS_CHROMEOS_ASH)
diff --git a/chrome/browser/web_applications/proto/web_app.proto b/chrome/browser/web_applications/proto/web_app.proto index f524b1e..0ac82238 100644 --- a/chrome/browser/web_applications/proto/web_app.proto +++ b/chrome/browser/web_applications/proto/web_app.proto
@@ -220,10 +220,10 @@ // Whether the app should be loaded in a dedicated storage partition. optional bool is_storage_isolated = 36; - // A list of approved launch protocols when launching the app with a protocol + // A list of allowed launch protocols when launching the app with a protocol // url. This list is checked to see if we can bypass the permission dialog // when launching the web app. - repeated string approved_launch_protocols = 37; + repeated string allowed_launch_protocols = 37; optional LaunchHandlerProto launch_handler = 38;
diff --git a/chrome/browser/web_applications/test/web_app_test_utils.cc b/chrome/browser/web_applications/test/web_app_test_utils.cc index b96f8b9..4c65ecc 100644 --- a/chrome/browser/web_applications/test/web_app_test_utils.cc +++ b/chrome/browser/web_applications/test/web_app_test_utils.cc
@@ -369,14 +369,14 @@ CreateRandomDownloadedShortcutsMenuIconsSizes(random)); app->SetManifestUrl(base_url.Resolve("/manifest" + seed_str + ".json")); - const int num_approved_launch_protocols = random.next_uint(8); - std::vector<std::string> approved_launch_protocols( - num_approved_launch_protocols); - for (int i = 0; i < num_approved_launch_protocols; ++i) { - approved_launch_protocols[i] = + const int num_allowed_launch_protocols = random.next_uint(8); + std::vector<std::string> allowed_launch_protocols( + num_allowed_launch_protocols); + for (int i = 0; i < num_allowed_launch_protocols; ++i) { + allowed_launch_protocols[i] = "web+test_" + seed_str + "_" + base::NumberToString(i); } - app->SetApprovedLaunchProtocols(std::move(approved_launch_protocols)); + app->SetAllowedLaunchProtocols(std::move(allowed_launch_protocols)); const int num_disallowed_launch_protocols = random.next_uint(8); std::vector<std::string> disallowed_launch_protocols(
diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc index 2db68e85..84647eb 100644 --- a/chrome/browser/web_applications/web_app.cc +++ b/chrome/browser/web_applications/web_app.cc
@@ -249,9 +249,9 @@ protocol_handlers_ = std::move(handlers); } -void WebApp::SetApprovedLaunchProtocols( - base::flat_set<std::string> approved_launch_protocols) { - approved_launch_protocols_ = std::move(approved_launch_protocols); +void WebApp::SetAllowedLaunchProtocols( + base::flat_set<std::string> allowed_launch_protocols) { + allowed_launch_protocols_ = std::move(allowed_launch_protocols); } void WebApp::SetDisallowedLaunchProtocols( @@ -408,7 +408,7 @@ app.share_target_, app.additional_search_terms_, app.protocol_handlers_, - app.approved_launch_protocols_, + app.allowed_launch_protocols_, app.disallowed_launch_protocols_, app.url_handlers_, app.note_taking_new_note_url_, @@ -473,8 +473,8 @@ root.SetStringKey("app_service_icon_url", base::StrCat({"chrome://app-icon/", app_id_, "/32"})); - root.SetKey("approved_launch_protocols", - ConvertList(approved_launch_protocols_)); + root.SetKey("allowed_launch_protocols", + ConvertList(allowed_launch_protocols_)); root.SetKey("disallowed_launch_protocols", ConvertList(disallowed_launch_protocols_));
diff --git a/chrome/browser/web_applications/web_app.h b/chrome/browser/web_applications/web_app.h index e4d0911..949380eb 100644 --- a/chrome/browser/web_applications/web_app.h +++ b/chrome/browser/web_applications/web_app.h
@@ -149,8 +149,8 @@ return protocol_handlers_; } - const base::flat_set<std::string>& approved_launch_protocols() const { - return approved_launch_protocols_; + const base::flat_set<std::string>& allowed_launch_protocols() const { + return allowed_launch_protocols_; } const base::flat_set<std::string>& disallowed_launch_protocols() const { @@ -271,8 +271,8 @@ std::vector<std::string> additional_search_terms); void SetProtocolHandlers( std::vector<apps::ProtocolHandlerInfo> protocol_handlers); - void SetApprovedLaunchProtocols( - base::flat_set<std::string> approved_launch_protocols); + void SetAllowedLaunchProtocols( + base::flat_set<std::string> allowed_launch_protocols); void SetDisallowedLaunchProtocols( base::flat_set<std::string> disallowed_launch_protocols); void SetUrlHandlers(apps::UrlHandlers url_handlers); @@ -339,7 +339,7 @@ absl::optional<apps::ShareTarget> share_target_; std::vector<std::string> additional_search_terms_; std::vector<apps::ProtocolHandlerInfo> protocol_handlers_; - base::flat_set<std::string> approved_launch_protocols_; + base::flat_set<std::string> allowed_launch_protocols_; base::flat_set<std::string> disallowed_launch_protocols_; apps::UrlHandlers url_handlers_; GURL note_taking_new_note_url_;
diff --git a/chrome/browser/web_applications/web_app_database.cc b/chrome/browser/web_applications/web_app_database.cc index e5ac5bc..9bb0ec7 100644 --- a/chrome/browser/web_applications/web_app_database.cc +++ b/chrome/browser/web_applications/web_app_database.cc
@@ -432,10 +432,10 @@ protocol_handler_proto->set_url(protocol_handler.url.spec()); } - for (const auto& approved_launch_protocols : - web_app.approved_launch_protocols()) { - DCHECK(!approved_launch_protocols.empty()); - local_data->add_approved_launch_protocols(approved_launch_protocols); + for (const auto& allowed_launch_protocols : + web_app.allowed_launch_protocols()) { + DCHECK(!allowed_launch_protocols.empty()); + local_data->add_allowed_launch_protocols(allowed_launch_protocols); } for (const auto& disallowed_launch_protocols : @@ -865,16 +865,16 @@ } web_app->SetProtocolHandlers(std::move(protocol_handlers)); - std::vector<std::string> approved_launch_protocols; - for (const std::string& approved_launch_protocol : - local_data.approved_launch_protocols()) { - if (approved_launch_protocol.empty()) { - DLOG(ERROR) << "WebApp ApprovedLaunchProtocols proto action parse error"; + std::vector<std::string> allowed_launch_protocols; + for (const std::string& allowed_launch_protocol : + local_data.allowed_launch_protocols()) { + if (allowed_launch_protocol.empty()) { + DLOG(ERROR) << "WebApp AllowedLaunchProtocols proto action parse error"; return nullptr; } - approved_launch_protocols.push_back(approved_launch_protocol); + allowed_launch_protocols.push_back(allowed_launch_protocol); } - web_app->SetApprovedLaunchProtocols(std::move(approved_launch_protocols)); + web_app->SetAllowedLaunchProtocols(std::move(allowed_launch_protocols)); std::vector<std::string> disallowed_launch_protocols; for (const std::string& disallowed_launch_protocol :
diff --git a/chrome/browser/web_applications/web_app_database_unittest.cc b/chrome/browser/web_applications/web_app_database_unittest.cc index f18833e..e748d82 100644 --- a/chrome/browser/web_applications/web_app_database_unittest.cc +++ b/chrome/browser/web_applications/web_app_database_unittest.cc
@@ -315,7 +315,7 @@ EXPECT_FALSE(app->share_target().has_value()); EXPECT_TRUE(app->additional_search_terms().empty()); EXPECT_TRUE(app->protocol_handlers().empty()); - EXPECT_TRUE(app->approved_launch_protocols().empty()); + EXPECT_TRUE(app->allowed_launch_protocols().empty()); EXPECT_TRUE(app->disallowed_launch_protocols().empty()); EXPECT_TRUE(app->url_handlers().empty()); EXPECT_TRUE(app->last_badging_time().is_null()); @@ -381,7 +381,7 @@ EXPECT_TRUE(app_copy->file_handlers().empty()); EXPECT_FALSE(app_copy->share_target().has_value()); EXPECT_TRUE(app_copy->additional_search_terms().empty()); - EXPECT_TRUE(app_copy->approved_launch_protocols().empty()); + EXPECT_TRUE(app_copy->allowed_launch_protocols().empty()); EXPECT_TRUE(app_copy->disallowed_launch_protocols().empty()); EXPECT_TRUE(app_copy->url_handlers().empty()); EXPECT_TRUE(app_copy->shortcuts_menu_item_infos().empty());
diff --git a/chrome/browser/web_applications/web_app_protocol_handler_manager.cc b/chrome/browser/web_applications/web_app_protocol_handler_manager.cc index f6bcd0d..b7e41589 100644 --- a/chrome/browser/web_applications/web_app_protocol_handler_manager.cc +++ b/chrome/browser/web_applications/web_app_protocol_handler_manager.cc
@@ -94,14 +94,14 @@ } std::vector<ProtocolHandler> -WebAppProtocolHandlerManager::GetApprovedHandlersForProtocol( +WebAppProtocolHandlerManager::GetAllowedHandlersForProtocol( const std::string& protocol) const { std::vector<ProtocolHandler> protocol_handlers; for (const WebApp& web_app : app_registrar_->GetApps()) { web_app::AppId app_id = web_app.app_id(); - if (!app_registrar_->IsApprovedLaunchProtocol(app_id, protocol)) + if (!app_registrar_->IsAllowedLaunchProtocol(app_id, protocol)) continue; for (const auto& info : web_app.protocol_handlers()) {
diff --git a/chrome/browser/web_applications/web_app_protocol_handler_manager.h b/chrome/browser/web_applications/web_app_protocol_handler_manager.h index 2e371cfd..a1e9558 100644 --- a/chrome/browser/web_applications/web_app_protocol_handler_manager.h +++ b/chrome/browser/web_applications/web_app_protocol_handler_manager.h
@@ -45,7 +45,7 @@ const std::string& protocol) const; // Gets the list of handlers with launch permissions for a given protocol. - std::vector<ProtocolHandler> GetApprovedHandlersForProtocol( + std::vector<ProtocolHandler> GetAllowedHandlersForProtocol( const std::string& protocol) const; // Gets the list of disallowed handlers for a given protocol.
diff --git a/chrome/browser/web_applications/web_app_registrar.cc b/chrome/browser/web_applications/web_app_registrar.cc index c4530f3..58d67e2 100644 --- a/chrome/browser/web_applications/web_app_registrar.cc +++ b/chrome/browser/web_applications/web_app_registrar.cc
@@ -457,12 +457,12 @@ web_app->chromeos_data()->oem_installed; } -bool WebAppRegistrar::IsApprovedLaunchProtocol( +bool WebAppRegistrar::IsAllowedLaunchProtocol( const AppId& app_id, std::string protocol_scheme) const { const WebApp* web_app = GetAppById(app_id); return web_app && - base::Contains(web_app->approved_launch_protocols(), protocol_scheme); + base::Contains(web_app->allowed_launch_protocols(), protocol_scheme); } bool WebAppRegistrar::IsDisallowedLaunchProtocol( @@ -473,12 +473,12 @@ protocol_scheme); } -base::flat_set<std::string> WebAppRegistrar::GetAllApprovedLaunchProtocols() +base::flat_set<std::string> WebAppRegistrar::GetAllAllowedLaunchProtocols() const { base::flat_set<std::string> protocols; for (const WebApp& web_app : GetApps()) { - protocols.insert(web_app.approved_launch_protocols().begin(), - web_app.approved_launch_protocols().end()); + protocols.insert(web_app.allowed_launch_protocols().begin(), + web_app.allowed_launch_protocols().end()); } return protocols; }
diff --git a/chrome/browser/web_applications/web_app_registrar.h b/chrome/browser/web_applications/web_app_registrar.h index be1cabe..e8d1c06 100644 --- a/chrome/browser/web_applications/web_app_registrar.h +++ b/chrome/browser/web_applications/web_app_registrar.h
@@ -105,17 +105,17 @@ ExternalInstallSource install_source) const; // Returns true if the web app with the |app_id| contains |protocol_scheme| - // as one of its approved launch protocols. - bool IsApprovedLaunchProtocol(const AppId& app_id, - std::string protocol_scheme) const; + // as one of its allowed launch protocols. + bool IsAllowedLaunchProtocol(const AppId& app_id, + std::string protocol_scheme) const; // Returns true if the web app with the |app_id| contains |protocol_scheme| // as one of its disallowed launch protocols. bool IsDisallowedLaunchProtocol(const AppId& app_id, std::string protocol_scheme) const; - // Gets all approved launch protocols from all installed apps. - base::flat_set<std::string> GetAllApprovedLaunchProtocols() const; + // Gets all allowed launch protocols from all installed apps. + base::flat_set<std::string> GetAllAllowedLaunchProtocols() const; // Gets all disallowed launch protocols from all installed apps. base::flat_set<std::string> GetAllDisallowedLaunchProtocols() const;
diff --git a/chrome/browser/web_applications/web_app_registrar_unittest.cc b/chrome/browser/web_applications/web_app_registrar_unittest.cc index 507f63d5..a58e745 100644 --- a/chrome/browser/web_applications/web_app_registrar_unittest.cc +++ b/chrome/browser/web_applications/web_app_registrar_unittest.cc
@@ -926,7 +926,7 @@ EXPECT_EQ(false, registrar().GetWindowControlsOverlayEnabled(app_id)); } -TEST_F(WebAppRegistrarTest, ApprovedLaunchProtocols) { +TEST_F(WebAppRegistrarTest, AllowedLaunchProtocols) { controller().Init(); auto web_app = test::CreateWebApp(GURL("https://example.com/path")); @@ -939,33 +939,33 @@ const std::string protocol_scheme2 = "test2"; RegisterApp(std::move(web_app2)); - // Test we can add and remove approved protocols. + // Test we can add and remove allowed protocols. EXPECT_EQ(false, - registrar().IsApprovedLaunchProtocol(app_id1, protocol_scheme1)); + registrar().IsAllowedLaunchProtocol(app_id1, protocol_scheme1)); - sync_bridge().AddApprovedLaunchProtocol(app_id1, protocol_scheme1); + sync_bridge().AddAllowedLaunchProtocol(app_id1, protocol_scheme1); EXPECT_EQ(true, - registrar().IsApprovedLaunchProtocol(app_id1, protocol_scheme1)); + registrar().IsAllowedLaunchProtocol(app_id1, protocol_scheme1)); - sync_bridge().RemoveApprovedLaunchProtocol(app_id1, protocol_scheme1); + sync_bridge().RemoveAllowedLaunchProtocol(app_id1, protocol_scheme1); EXPECT_EQ(false, - registrar().IsApprovedLaunchProtocol(app_id1, protocol_scheme1)); + registrar().IsAllowedLaunchProtocol(app_id1, protocol_scheme1)); - // Test that we can get approved protocols from multiple web apps. - sync_bridge().AddApprovedLaunchProtocol(app_id1, protocol_scheme1); - sync_bridge().AddApprovedLaunchProtocol(app_id2, protocol_scheme2); + // Test that we can get allowed protocols from multiple web apps. + sync_bridge().AddAllowedLaunchProtocol(app_id1, protocol_scheme1); + sync_bridge().AddAllowedLaunchProtocol(app_id2, protocol_scheme2); { - auto approved_protocols = registrar().GetAllApprovedLaunchProtocols(); - EXPECT_TRUE(base::Contains(approved_protocols, protocol_scheme1)); - EXPECT_TRUE(base::Contains(approved_protocols, protocol_scheme2)); + auto allowed_protocols = registrar().GetAllAllowedLaunchProtocols(); + EXPECT_TRUE(base::Contains(allowed_protocols, protocol_scheme1)); + EXPECT_TRUE(base::Contains(allowed_protocols, protocol_scheme2)); - sync_bridge().RemoveApprovedLaunchProtocol(app_id2, protocol_scheme2); + sync_bridge().RemoveAllowedLaunchProtocol(app_id2, protocol_scheme2); } { - auto approved_protocols = registrar().GetAllApprovedLaunchProtocols(); - EXPECT_TRUE(base::Contains(approved_protocols, protocol_scheme1)); - EXPECT_FALSE(base::Contains(approved_protocols, protocol_scheme2)); + auto allowed_protocols = registrar().GetAllAllowedLaunchProtocols(); + EXPECT_TRUE(base::Contains(allowed_protocols, protocol_scheme1)); + EXPECT_FALSE(base::Contains(allowed_protocols, protocol_scheme2)); } }
diff --git a/chrome/browser/web_applications/web_app_sync_bridge.cc b/chrome/browser/web_applications/web_app_sync_bridge.cc index 45f526b..2e3cf80 100644 --- a/chrome/browser/web_applications/web_app_sync_bridge.cc +++ b/chrome/browser/web_applications/web_app_sync_bridge.cc
@@ -346,7 +346,7 @@ web_app->SetUserLaunchOrdinal(launch_ordinal); } -void WebAppSyncBridge::AddApprovedLaunchProtocol( +void WebAppSyncBridge::AddAllowedLaunchProtocol( const AppId& app_id, const std::string& protocol_scheme) { // Use a scope here, so that the web app registry is updated when @@ -356,17 +356,17 @@ ScopedRegistryUpdate update(this); web_app::WebApp* app_to_update = update->UpdateApp(app_id); base::flat_set<std::string> protocol_handlers( - app_to_update->approved_launch_protocols()); + app_to_update->allowed_launch_protocols()); DCHECK(!base::Contains(protocol_handlers, protocol_scheme)); protocol_handlers.insert(protocol_scheme); - app_to_update->SetApprovedLaunchProtocols(std::move(protocol_handlers)); + app_to_update->SetAllowedLaunchProtocols(std::move(protocol_handlers)); } - // Notify observers that the list of approved protocols was updated. + // Notify observers that the list of allowed protocols was updated. registrar_->NotifyWebAppProtocolSettingsChanged(); } -void WebAppSyncBridge::RemoveApprovedLaunchProtocol( +void WebAppSyncBridge::RemoveAllowedLaunchProtocol( const AppId& app_id, const std::string& protocol_scheme) { // Use a scope here, so that the web app registry is updated when @@ -376,11 +376,11 @@ ScopedRegistryUpdate update(this); web_app::WebApp* app_to_update = update->UpdateApp(app_id); base::flat_set<std::string> protocol_handlers( - app_to_update->approved_launch_protocols()); + app_to_update->allowed_launch_protocols()); protocol_handlers.erase(protocol_scheme); - app_to_update->SetApprovedLaunchProtocols(std::move(protocol_handlers)); + app_to_update->SetAllowedLaunchProtocols(std::move(protocol_handlers)); } - // Notify observers that the list of approved protocols was updated. + // Notify observers that the list of allowed protocols was updated. registrar_->NotifyWebAppProtocolSettingsChanged(); }
diff --git a/chrome/browser/web_applications/web_app_sync_bridge.h b/chrome/browser/web_applications/web_app_sync_bridge.h index eeb9950..a3d52e0 100644 --- a/chrome/browser/web_applications/web_app_sync_bridge.h +++ b/chrome/browser/web_applications/web_app_sync_bridge.h
@@ -107,14 +107,14 @@ void SetUserLaunchOrdinal(const AppId& app_id, syncer::StringOrdinal user_launch_ordinal); - // These methods are used by web apps to add or remove approved + // These methods are used by web apps to add or remove allowed // protocol schemes based on user approval or withdrawal of that approval. - // Approved protocol schemes will allow web apps to handle launches from + // Allowed protocol schemes will allow web apps to handle launches from // urls that start with that scheme without asking the user. - void AddApprovedLaunchProtocol(const AppId& app_id, - const std::string& protocol_scheme); - void RemoveApprovedLaunchProtocol(const AppId& app_id, - const std::string& protocol_scheme); + void AddAllowedLaunchProtocol(const AppId& app_id, + const std::string& protocol_scheme); + void RemoveAllowedLaunchProtocol(const AppId& app_id, + const std::string& protocol_scheme); // These methods are used by web apps to add or remove disallowed // protocol schemes based on user preference or withdrawal of that preference.
diff --git a/chrome/browser/web_applications/web_app_unittest.cc b/chrome/browser/web_applications/web_app_unittest.cc index 0d0f8db..0c64f8d 100644 --- a/chrome/browser/web_applications/web_app_unittest.cc +++ b/chrome/browser/web_applications/web_app_unittest.cc
@@ -157,7 +157,7 @@ "!name": "", "additional_search_terms": [ ], "app_service_icon_url": "chrome://app-icon/empty_app/32", - "approved_launch_protocols": [ ], + "allowed_launch_protocols": [ ], "background_color": "none", "capture_links": "kUndefined", "chromeos_data": null, @@ -226,7 +226,7 @@ "!name": "Name1234", "additional_search_terms": [ "Foo_1234_0" ], "app_service_icon_url": "chrome://app-icon/eajjdjobhihlgobdfaehiiheinneagde/32", - "approved_launch_protocols": [ "web+test_1234_0", "web+test_1234_1" ], + "allowed_launch_protocols": [ "web+test_1234_0", "web+test_1234_1" ], "background_color": "rgba(77,188,194,0.9686274509803922)", "capture_links": "kNewClient", "chromeos_data": null,
diff --git a/chrome/browser/web_applications/web_app_utils.cc b/chrome/browser/web_applications/web_app_utils.cc index ee0626c..0a25976 100644 --- a/chrome/browser/web_applications/web_app_utils.cc +++ b/chrome/browser/web_applications/web_app_utils.cc
@@ -276,8 +276,8 @@ os_integration_manager.GetAppProtocolHandlers(app_id); if (allowed) { - provider->sync_bridge().AddApprovedLaunchProtocol(app_id, - protocol_url.scheme()); + provider->sync_bridge().AddAllowedLaunchProtocol(app_id, + protocol_url.scheme()); } else { provider->sync_bridge().AddDisallowedLaunchProtocol(app_id, protocol_url.scheme());
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index 5677d8a..e488f425 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-main-1632829572-93a632c358259e3fc9ac3efe9f631b4392ae9bb4.profdata +chrome-linux-main-1632851987-f3786098d40df43d7605f322fc19973a51f35da5.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index 2ac13ef..34cab37 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1632841109-b1cad2c42f07c0ba2cb9cbfdc868d14090e114d0.profdata +chrome-win32-main-1632851987-1fa5419a8499fab23fe8e41e8a988797911ff0b8.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 412f7cc5..c3327f6 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1632841109-f0a14533878a791252af03cf514791f410855ca8.profdata +chrome-win64-main-1632851987-c3e1c270646729febeb924059a539d90189136d7.profdata
diff --git a/chrome/common/extensions/api/_permission_features.json b/chrome/common/extensions/api/_permission_features.json index 70291526..770ad0d6 100644 --- a/chrome/common/extensions/api/_permission_features.json +++ b/chrome/common/extensions/api/_permission_features.json
@@ -446,7 +446,7 @@ "channel": "stable", "component_extensions_auto_granted": false, "extension_types": ["extension"], - "platforms": ["chromeos"], + "platforms": ["chromeos", "lacros"], "allowlist": [ "6A4A0389E8D47118E96E6221B0B7221CA3715801", // Apitest extension "EC8EA268128FECE14CEC68B90686D87755D87083", // Assessment Assistant
diff --git a/chrome/common/extensions/api/wallpaper_private.json b/chrome/common/extensions/api/wallpaper_private.json index a750fe8..f52d16c 100644 --- a/chrome/common/extensions/api/wallpaper_private.json +++ b/chrome/common/extensions/api/wallpaper_private.json
@@ -511,7 +511,25 @@ ] } ] - } + }, + { + "name": "isSwaEnabled", + "type": "function", + "description": "Gets if the new wallpaper picker SWA is enabled.", + "nodoc": true, + "parameters": [ + { + "type": "function", + "name": "callback", + "parameters": [ + { + "type": "boolean", + "name": "swaEnabled" + } + ] + } + ] + } ], "events": [ {
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 5f9085ed..bb28199 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -6955,6 +6955,7 @@ "../browser/ash/login/easy_unlock/easy_unlock_auth_attempt_unittest.cc", "../browser/ash/login/easy_unlock/easy_unlock_notification_controller_unittest.cc", "../browser/ash/login/easy_unlock/easy_unlock_service_regular_unittest.cc", + "../browser/ash/login/easy_unlock/smartlock_feature_usage_metrics_unittest.cc", "../browser/ash/login/easy_unlock/smartlock_state_handler_unittest.cc", "../browser/chromeos/extensions/extensions_permissions_tracker_unittest.cc", "../browser/chromeos/extensions/telemetry/chromeos_permission_messages_unittest.cc",
diff --git a/chrome/test/base/browser_with_test_window_test.cc b/chrome/test/base/browser_with_test_window_test.cc index a1c04e0..3d7846e 100644 --- a/chrome/test/base/browser_with_test_window_test.cc +++ b/chrome/test/base/browser_with_test_window_test.cc
@@ -174,17 +174,13 @@ RenderFrameHostTester::CommitPendingLoad(controller); } -void BrowserWithTestWindowTest::NavigateAndCommit( - NavigationController* controller, - const GURL& url) { - content::NavigationSimulator::NavigateAndCommitFromBrowser( - controller->DeprecatedGetWebContents(), url); +void BrowserWithTestWindowTest::NavigateAndCommit(WebContents* web_contents, + const GURL& url) { + content::NavigationSimulator::NavigateAndCommitFromBrowser(web_contents, url); } void BrowserWithTestWindowTest::NavigateAndCommitActiveTab(const GURL& url) { - NavigateAndCommit(&browser()->tab_strip_model()->GetActiveWebContents()-> - GetController(), - url); + NavigateAndCommit(browser()->tab_strip_model()->GetActiveWebContents(), url); } void BrowserWithTestWindowTest::NavigateAndCommitActiveTabWithTitle( @@ -193,9 +189,9 @@ const std::u16string& title) { WebContents* contents = navigating_browser->tab_strip_model()->GetActiveWebContents(); - NavigationController* controller = &contents->GetController(); - NavigateAndCommit(controller, url); - contents->UpdateTitleForEntry(controller->GetActiveEntry(), title); + NavigateAndCommit(contents, url); + contents->UpdateTitleForEntry(contents->GetController().GetActiveEntry(), + title); } TestingProfile* BrowserWithTestWindowTest::CreateProfile() {
diff --git a/chrome/test/base/browser_with_test_window_test.h b/chrome/test/base/browser_with_test_window_test.h index 7d4bf136..a708928 100644 --- a/chrome/test/base/browser_with_test_window_test.h +++ b/chrome/test/base/browser_with_test_window_test.h
@@ -62,18 +62,17 @@ // // // Add a new tab and navigate it. This will be at index 0. // AddTab(browser(), GURL("http://foo/1")); -// NavigationController* controller = -// &browser()->tab_strip_model()->GetWebContentsAt(0)->GetController(); +// WebContents* contents = browser()->tab_strip_model()->GetWebContentsAt(0); // // // Navigate somewhere else. // GURL url2("http://foo/2"); -// NavigateAndCommit(controller, url2); +// NavigateAndCommit(contents, url2); // // // This is equivalent to the above, and lets you test pending navigations. // browser()->OpenURL(OpenURLParams( // GURL("http://foo/2"), GURL(), WindowOpenDisposition::CURRENT_TAB, // ui::PAGE_TRANSITION_TYPED, false)); -// CommitPendingLoad(controller); +// CommitPendingLoad(&contents->GetController()); // // Subclasses must invoke BrowserWithTestWindowTest::SetUp as it is responsible // for creating the various objects of this class. @@ -159,12 +158,10 @@ // URL of the pending load. If there is no pending load, this does nothing. void CommitPendingLoad(content::NavigationController* controller); - // Creates a pending navigation on the given navigation controller to the - // given URL with the default parameters and the commits the load with a page - // ID one larger than any seen. This emulates what happens on a new - // navigation. - void NavigateAndCommit(content::NavigationController* controller, - const GURL& url); + // Creates a pending navigation on the given WebContents to the given URL with + // the default parameters and the commits the load with a page ID one larger + // than any seen. This emulates what happens on a new navigation. + void NavigateAndCommit(content::WebContents* web_contents, const GURL& url); // Navigates the current tab. This is a wrapper around NavigateAndCommit. void NavigateAndCommitActiveTab(const GURL& url);
diff --git a/chrome/test/data/chromeos/wallpaper_manager/unit_tests/api_mock.js b/chrome/test/data/chromeos/wallpaper_manager/unit_tests/api_mock.js index dc508bb..816fe36 100644 --- a/chrome/test/data/chromeos/wallpaper_manager/unit_tests/api_mock.js +++ b/chrome/test/data/chromeos/wallpaper_manager/unit_tests/api_mock.js
@@ -289,6 +289,9 @@ getSurpriseMeImage: function(collectionId, resumeToken, callback) { callback( {imageUrl: TestConstants.wallpaperUrl}, null /*nextResumeToken=*/); + }, + isSwaEnabled: function(callback) { + callback(false); } }, runtime: {lastError: null}
diff --git a/chrome/test/data/webrtc/peerconnection_getstats.js b/chrome/test/data/webrtc/peerconnection_getstats.js index 9ef1299..bf08085 100644 --- a/chrome/test/data/webrtc/peerconnection_getstats.js +++ b/chrome/test/data/webrtc/peerconnection_getstats.js
@@ -569,6 +569,8 @@ nominated: 'boolean', writable: 'boolean', readable: 'boolean', + packetsSent: 'number', + packetsReceived: 'number', bytesSent: 'number', bytesReceived: 'number', totalRoundTripTime: 'number', @@ -585,6 +587,8 @@ consentRequestsSent: 'number', consentResponsesReceived: 'number', consentResponsesSent: 'number', + packetsDiscardedOnSend: 'number', + bytesDiscardedOnSend: 'number', }); addRTCStatsToWhitelist( Presence.MANDATORY, 'candidate-pair', kRTCIceCandidatePairStats);
diff --git a/chrome/test/data/webui/chromeos/personalization_app/test_mojo_interface_provider.js b/chrome/test/data/webui/chromeos/personalization_app/test_mojo_interface_provider.js index 809e947c..019badf 100644 --- a/chrome/test/data/webui/chromeos/personalization_app/test_mojo_interface_provider.js +++ b/chrome/test/data/webui/chromeos/personalization_app/test_mojo_interface_provider.js
@@ -89,6 +89,9 @@ /** @public */ this.updateDailyRefreshWallpaperResponse = true; + /** @public */ + this.wallpaperObserverUpdateTimeout = 0; + /** * @public * @type {?chromeos.personalizationApp.mojom.WallpaperObserverInterface} @@ -142,7 +145,9 @@ setWallpaperObserver(remote) { this.methodCalled('setWallpaperObserver'); this.wallpaperObserverRemote = remote; - this.wallpaperObserverRemote.onWallpaperChanged(this.currentWallpaper); + window.setTimeout(() => { + this.wallpaperObserverRemote.onWallpaperChanged(this.currentWallpaper); + }, this.wallpaperObserverUpdateTimeout); } /** @override */
diff --git a/chrome/test/data/webui/chromeos/personalization_app/wallpaper_selected_element_test.js b/chrome/test/data/webui/chromeos/personalization_app/wallpaper_selected_element_test.js index c35040e..303747f 100644 --- a/chrome/test/data/webui/chromeos/personalization_app/wallpaper_selected_element_test.js +++ b/chrome/test/data/webui/chromeos/personalization_app/wallpaper_selected_element_test.js
@@ -7,8 +7,8 @@ import {ActionName} from 'chrome://personalization/trusted/personalization_actions.js'; import {emptyState} from 'chrome://personalization/trusted/personalization_reducers.js'; import {Paths} from 'chrome://personalization/trusted/personalization_router_element.js'; -import {WallpaperSelected} from 'chrome://personalization/trusted/wallpaper_selected_element.js'; -import {assertDeepEquals, assertEquals, assertFalse, assertNotEquals, assertTrue} from '../../chai_assert.js'; +import {mockTimeoutForTesting, WallpaperSelected} from 'chrome://personalization/trusted/wallpaper_selected_element.js'; +import {assertDeepEquals, assertEquals, assertFalse, assertNotEquals, assertNotReached, assertTrue} from '../../chai_assert.js'; import {flushTasks, waitAfterNextRender} from '../../test_util.js'; import {baseSetup, initElement} from './personalization_app_test_utils.js'; import {TestWallpaperProvider} from './test_mojo_interface_provider.js'; @@ -289,4 +289,56 @@ 'refreshWallpaper'); assertFalse(newRefreshWallpaper.hidden); }); + + test('sets current image to null after timeout', async () => { + let timeoutCallback; + mockTimeoutForTesting({ + setTimeout(callback, delay) { + assertEquals(120 * 1000, delay); + timeoutCallback = callback; + return 1234; + }, + clearTimeout(id) { + assertNotReached('Should not clear timeout'); + }, + }); + + wallpaperProvider.wallpaperObserverUpdateTimeout = 100; + + wallpaperSelectedElement = + initElement(WallpaperSelected.is, {'path': Paths.CollectionImages}); + await waitAfterNextRender(wallpaperSelectedElement); + + personalizationStore.expectAction(ActionName.SET_SELECTED_IMAGE); + + timeoutCallback.call(wallpaperSelectedElement); + + const action = + await personalizationStore.waitForAction(ActionName.SET_SELECTED_IMAGE); + assertEquals(null, action.image); + }); + + test('cancels timeout after receiving first image', async () => { + const timeoutId = 1234; + const clearTimeoutPromise = new Promise(resolve => { + mockTimeoutForTesting({ + setTimeout(callback, delay) { + return timeoutId; + }, + clearTimeout(id) { + assertEquals(timeoutId, id); + resolve(); + }, + }); + }); + + wallpaperSelectedElement = + initElement(WallpaperSelected.is, {'path': Paths.CollectionImages}); + await waitAfterNextRender(wallpaperSelectedElement); + + wallpaperProvider.wallpaperObserverRemote.onWallpaperChanged( + wallpaperProvider.currentWallpaper); + + await clearTimeoutPromise; + }); }
diff --git a/chrome/test/data/webui/history/history_routing_test.js b/chrome/test/data/webui/history/history_routing_test.js index 324cf7f49..bf58f7e 100644 --- a/chrome/test/data/webui/history/history_routing_test.js +++ b/chrome/test/data/webui/history/history_routing_test.js
@@ -47,50 +47,86 @@ return flushTasks(); }); - test('history clusters menu item visibility', function() { - const historyClusters = - sidebar.shadowRoot.querySelector('#historyClusters'); - assertEquals(!!historyClusters, isHistoryClustersEnabled); - }); - test('changing route changes active view', function() { assertEquals('history', app.$.content.selected); + assertEquals(app.$$('#history'), app.$['tabs-content'].selectedItem); + navigateTo('/syncedTabs'); return flushTasks().then(function() { - assertEquals('syncedTabs', app.$.content.selected); assertEquals('chrome://history/syncedTabs', window.location.href); + + assertEquals('syncedTabs', app.$.content.selected); + assertEquals(app.$$('#synced-devices'), app.$.content.selectedItem); }); }); - test('changing route to /journeys may change active view', function() { + test('routing to /journeys may change active view', function() { assertEquals('history', app.$.content.selected); + assertEquals(app.$$('#history'), app.$['tabs-content'].selectedItem); + navigateTo('/journeys'); return flushTasks().then(function() { - assertEquals( - isHistoryClustersEnabled ? 'journeys' : 'history', - app.$.content.selected); assertEquals('chrome://history/journeys', window.location.href); + + assertEquals('history', app.$.content.selected); + assertEquals(!!app.$$('#history-clusters'), isHistoryClustersEnabled); + assertEquals( + isHistoryClustersEnabled ? app.$$('#history-clusters') : + app.$$('#history'), + app.$['tabs-content'].selectedItem); }); }); - test('route updates from sidebar', function() { - assertEquals('history', app.selectedPage_); + test('routing to /journeys may update sidebar menu item', function() { + assertEquals('chrome://history/', sidebar.$.history.href); + assertEquals('history', sidebar.$.history.path); + + navigateTo('/journeys'); + return flushTasks().then(function() { + // Currently selected history view is preserved in sidebar menu item. + assertEquals( + isHistoryClustersEnabled ? 'chrome://history/journeys' : + 'chrome://history/', + sidebar.$.history.href); + assertEquals( + isHistoryClustersEnabled ? 'journeys' : 'history', + sidebar.$.history.path); + }); + }); + + test('route updates from tabs and sidebar menu items', function() { + assertEquals('history', sidebar.$.menu.selected); assertEquals('chrome://history/', window.location.href); sidebar.$.syncedTabs.click(); - assertEquals('syncedTabs', app.selectedPage_); + assertEquals('syncedTabs', sidebar.$.menu.selected); assertEquals('chrome://history/syncedTabs', window.location.href); - keyDownOn(sidebar.$.history, 32, '', ' '); - assertEquals('history', app.selectedPage_); + // Currently selected history view is preserved in sidebar menu item. + keyDownOn(sidebar.$.history, 0, '', ' '); + assertEquals('history', sidebar.$.menu.selected); assertEquals('chrome://history/', window.location.href); + const historyTabs = app.$$('cr-tabs'); + assertEquals(!!historyTabs, isHistoryClustersEnabled); + if (isHistoryClustersEnabled) { - const historyClusters = - sidebar.shadowRoot.querySelector('#historyClusters'); - keyDownOn(historyClusters, 32, '', ' '); - assertEquals('journeys', app.selectedPage_); + historyTabs.selected = 1; + assertEquals('journeys', sidebar.$.menu.selected); assertEquals('chrome://history/journeys', window.location.href); + + keyDownOn(sidebar.$.syncedTabs, 0, '', ' '); + assertEquals('syncedTabs', sidebar.$.menu.selected); + assertEquals('chrome://history/syncedTabs', window.location.href); + + // Currently selected history view is preserved in sidebar menu item. + keyDownOn(sidebar.$.history, 0, '', ' '); + assertEquals('journeys', sidebar.$.menu.selected); + assertEquals('chrome://history/journeys', window.location.href); + + historyTabs.selected = 0; + assertEquals('history', sidebar.$.menu.selected); + assertEquals('chrome://history/', window.location.href); } }); @@ -109,26 +145,25 @@ assertEquals('chrome://history/?q=' + searchTerm, window.location.href); }); - test('search preserved across menu items', function() { + test('search is preserved across tabs and sidebar menu items', function() { const searchTerm = 'Soldier76'; - const menu = sidebar.$.menu; - assertEquals('history', app.selectedPage_); + assertEquals('history', sidebar.$.menu.selected); navigateTo('/?q=' + searchTerm); sidebar.$.syncedTabs.click(); - assertEquals('syncedTabs', app.selectedPage_); + assertEquals('syncedTabs', sidebar.$.menu.selected); assertEquals(searchTerm, toolbar.searchTerm); assertEquals( 'chrome://history/syncedTabs?q=' + searchTerm, window.location.href); sidebar.$.history.click(); - assertEquals('history', app.selectedPage_); + assertEquals('history', sidebar.$.menu.selected); assertEquals(searchTerm, toolbar.searchTerm); assertEquals('chrome://history/?q=' + searchTerm, window.location.href); if (isHistoryClustersEnabled) { - sidebar.shadowRoot.querySelector('#historyClusters').click(); - assertEquals('journeys', app.selectedPage_); + app.$$('cr-tabs').selected = 1; + assertEquals('journeys', sidebar.$.menu.selected); assertEquals(searchTerm, toolbar.searchTerm); assertEquals( 'chrome://history/journeys?q=' + searchTerm, window.location.href);
diff --git a/chrome/test/data/webui/new_tab_page/modules/photos/module_test.js b/chrome/test/data/webui/new_tab_page/modules/photos/module_test.js index adf67de..97a79cb 100644 --- a/chrome/test/data/webui/new_tab_page/modules/photos/module_test.js +++ b/chrome/test/data/webui/new_tab_page/modules/photos/module_test.js
@@ -176,7 +176,9 @@ // Assert. assertEquals( - loadTimeData.getString('modulesPhotosMemoriesDisabled'), + loadTimeData.getStringF( + 'disableModuleToastMessage', + loadTimeData.getString('modulesPhotosMemoriesDisabled')), disable.event.detail.message); }); @@ -270,7 +272,9 @@ assertEquals(1, handler.getCallCount('onUserOptIn')); assertEquals(false, handler.getArgs('onUserOptIn')[0]); assertEquals( - loadTimeData.getString('modulesPhotosMemoriesDisabled'), + loadTimeData.getStringF( + 'disableModuleToastMessage', + loadTimeData.getString('modulesPhotosMemoriesDisabled')), disable.event.detail.message); });
diff --git a/chrome/test/data/webui/settings/chromeos/app_management/managed_apps_test.js b/chrome/test/data/webui/settings/chromeos/app_management/managed_apps_test.js index 1040c19d..151aa0b 100644 --- a/chrome/test/data/webui/settings/chromeos/app_management/managed_apps_test.js +++ b/chrome/test/data/webui/settings/chromeos/app_management/managed_apps_test.js
@@ -35,7 +35,7 @@ type: apps.mojom.AppType.kWeb, isPinned: apps.mojom.OptionalBool.kTrue, isPolicyPinned: apps.mojom.OptionalBool.kTrue, - installSource: apps.mojom.InstallSource.kPolicy, + installSource: apps.mojom.InstallReason.kPolicy, permissions: app_management.FakePageHandler.createWebPermissions( permissionOptions), };
diff --git a/chrome/test/data/webui/settings/chromeos/app_management/uninstall_button_test.js b/chrome/test/data/webui/settings/chromeos/app_management/uninstall_button_test.js index 305a6ff..11c0b77 100644 --- a/chrome/test/data/webui/settings/chromeos/app_management/uninstall_button_test.js +++ b/chrome/test/data/webui/settings/chromeos/app_management/uninstall_button_test.js
@@ -23,12 +23,11 @@ replaceStore(); }); - async function setupUninstallButton(installSource) { - + async function setupUninstallButton(installReason) { // Create an ARC app options. const arcOptions = { type: apps.mojom.AppType.kArc, - installSource: installSource + installReason: installReason }; // Add an app, and make it the currently selected app. @@ -47,7 +46,7 @@ } test('Click uninstall', async () => { - await setupUninstallButton(apps.mojom.InstallSource.kUser); + await setupUninstallButton(apps.mojom.InstallReason.kUser); uninstallButton.$$('#uninstallButton').click(); await fakeHandler.flushPipesForTesting(); @@ -56,7 +55,7 @@ }); test('Disabled by policy', async () => { - await setupUninstallButton(apps.mojom.InstallSource.kPolicy); + await setupUninstallButton(apps.mojom.InstallReason.kPolicy); uninstallButton.$$('#uninstallButton').click(); await fakeHandler.flushPipesForTesting(); // Disabled by policy, clicking should not remove app. @@ -65,7 +64,7 @@ }); test('System app, button hidden', async () => { - await setupUninstallButton(apps.mojom.InstallSource.kSystem); + await setupUninstallButton(apps.mojom.InstallReason.kSystem); assertFalse(!!uninstallButton.$$('#uninstallButton')); await fakeHandler.flushPipesForTesting(); // Disabled by policy, clicking should not remove app.
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 c665238..725f0f91 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
@@ -381,7 +381,8 @@ ['AppManagementPwaDetailView', 'pwa_detail_view_test.m.js'], ['AppManagementReducers', 'reducers_test.m.js'], ['AppManagementResizeLockItem', 'resize_lock_item_test.m.js'], - ['AppManagementSupportedLinksItem', 'supported_links_item_test.m.js'], + // TODO(crbug/1253891): Re-enable once flakiness is fixed. + // ['AppManagementSupportedLinksItem', 'supported_links_item_test.m.js'], ['AppManagementToggleRow', 'toggle_row_test.m.js'], ['AppManagementUninstallButton', 'uninstall_button_test.m.js'], ['BluetoothPage', 'bluetooth_page_tests.m.js'],
diff --git a/chrome/test/data/webui/settings/protocol_handlers_tests.js b/chrome/test/data/webui/settings/protocol_handlers_tests.js index b10e2e4..0801cc3 100644 --- a/chrome/test/data/webui/settings/protocol_handlers_tests.js +++ b/chrome/test/data/webui/settings/protocol_handlers_tests.js
@@ -58,7 +58,7 @@ * A list of AppProtocolEntry fixtures. * @type {!Array<!AppProtocolEntry>} */ - const appApprovedProtocols = [ + const appAllowedProtocols = [ { handlers: [{ host: 'www.google.com', @@ -92,40 +92,40 @@ /** * A list of AppProtocolEntry fixtures. This list should only contain - * entries that do not overlap `appApprovedProtocols`. + * entries that do not overlap `appAllowedProtocols`. * @type {!Array<!AppProtocolEntry>} */ - const appDisallowedProtocols = [ - { - handlers: [{ - host: 'www.google1.com', - protocol: 'mailto', - protocol_name: 'email', - spec: 'http://www.google1.com/%s', - app_id: 'testID1' - }], - protocol: 'mailto' - }, - { - handlers: [ - { - host: 'www.google.com', - protocol: 'webcal', - protocol_name: 'web calendar', - spec: 'http://www.google.com/%s', - app_id: 'testID' - }, - { - host: 'www.google3.com', - protocol: 'webcal', - protocol_name: 'web calendar', - spec: 'http://www.google3.com/%s', - app_id: 'testID3' - } - ], - protocol: 'webcal' - } - ]; + const appDisallowedProtocols = [ + { + handlers: [{ + host: 'www.google1.com', + protocol: 'mailto', + protocol_name: 'email', + spec: 'http://www.google1.com/%s', + app_id: 'testID1' + }], + protocol: 'mailto' + }, + { + handlers: [ + { + host: 'www.google.com', + protocol: 'webcal', + protocol_name: 'web calendar', + spec: 'http://www.google.com/%s', + app_id: 'testID' + }, + { + host: 'www.google3.com', + protocol: 'webcal', + protocol_name: 'web calendar', + spec: 'http://www.google3.com/%s', + app_id: 'testID3' + } + ], + protocol: 'webcal' + } + ]; /** * A list of IgnoredProtocolEntry fixtures. @@ -302,8 +302,8 @@ }); }); - test('non-empty web app approved protocols', async () => { - browserProxy.setAppApprovedProtocolHandlers(appApprovedProtocols); + test('non-empty web app allowed protocols', async () => { + browserProxy.setAppAllowedProtocolHandlers(appAllowedProtocols); await initPage(); const listFrames = testElement.root.querySelectorAll('.list-frame'); const listItems = testElement.root.querySelectorAll('.list-item'); @@ -319,18 +319,18 @@ assertEquals('www.google2.com', hosts[2].textContent.trim()); }); - test('remove web app approved protocols', async () => { - browserProxy.setAppApprovedProtocolHandlers(appApprovedProtocols); + test('remove web app allowed protocols', async () => { + browserProxy.setAppAllowedProtocolHandlers(appAllowedProtocols); await initPage(); // Remove the first app protocol. testElement.$$('#removeAppHandlerButton').click(); - const args = await browserProxy.whenCalled('removeAppApprovedHandler'); + const args = await browserProxy.whenCalled('removeAppAllowedHandler'); // BrowserProxy's handler is expected to be called with // arguments as [protocol, url, app_id]. - assertEquals(appApprovedProtocols[0].protocol, args[0]); - assertEquals(appApprovedProtocols[0].handlers[0].spec, args[1]); - assertEquals(appApprovedProtocols[0].handlers[0].app_id, args[2]); + assertEquals(appAllowedProtocols[0].protocol, args[0]); + assertEquals(appAllowedProtocols[0].handlers[0].spec, args[1]); + assertEquals(appAllowedProtocols[0].handlers[0].app_id, args[2]); }); test('non-empty web app disallowed protocols', async () => { @@ -364,23 +364,23 @@ assertEquals(appDisallowedProtocols[0].handlers[0].app_id, args[2]); }); - test('non-empty web app approved and disallowed protocols', async () => { - browserProxy.setAppApprovedProtocolHandlers(appApprovedProtocols); + test('non-empty web app allowed and disallowed protocols', async () => { + browserProxy.setAppAllowedProtocolHandlers(appAllowedProtocols); browserProxy.setAppDisallowedProtocolHandlers(appDisallowedProtocols); await initPage(); const listFrames = testElement.root.querySelectorAll('.list-frame'); const listItems = testElement.root.querySelectorAll('.list-item'); - // There are two protocols ["mailto", "webcal"] for both approved, + // There are two protocols ["mailto", "webcal"] for both allowed, // and disallowed lists. assertEquals(4, listFrames.length); // There are three total handlers within the two protocols in both - // the approved and disallowed lists. + // the allowed and disallowed lists. assertEquals(6, listItems.length); // Check that item hosts are rendered correctly. const hosts = testElement.root.querySelectorAll('.protocol-host'); - // Approved list. + // Allowed list. assertEquals('www.google.com', hosts[0].textContent.trim()); assertEquals('www.google1.com', hosts[1].textContent.trim()); assertEquals('www.google2.com', hosts[2].textContent.trim()); @@ -392,7 +392,7 @@ }); test('remove web app allowed then disallowed protocols', async () => { - browserProxy.setAppApprovedProtocolHandlers(appApprovedProtocols); + browserProxy.setAppAllowedProtocolHandlers(appAllowedProtocols); browserProxy.setAppDisallowedProtocolHandlers(appDisallowedProtocols); await initPage(); @@ -400,12 +400,12 @@ testElement.root.querySelectorAll('cr-icon-button.icon-clear'); assertEquals(6, removeButtons.length); - // Remove the first approved app protocol. + // Remove the first allowed app protocol. removeButtons[0].click(); - const args1 = await browserProxy.whenCalled('removeAppApprovedHandler'); - assertEquals(appApprovedProtocols[0].protocol, args1[0]); - assertEquals(appApprovedProtocols[0].handlers[0].spec, args1[1]); - assertEquals(appApprovedProtocols[0].handlers[0].app_id, args1[2]); + const args1 = await browserProxy.whenCalled('removeAppAllowedHandler'); + assertEquals(appAllowedProtocols[0].protocol, args1[0]); + assertEquals(appAllowedProtocols[0].handlers[0].spec, args1[1]); + assertEquals(appAllowedProtocols[0].handlers[0].app_id, args1[2]); // Remove the first disallowed app protocol. removeButtons[3].click();
diff --git a/chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js b/chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js index eb2cd6f..1f0310b 100644 --- a/chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js +++ b/chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js
@@ -37,7 +37,7 @@ 'observeAppProtocolHandlers', 'observeProtocolHandlers', 'observeProtocolHandlersEnabledState', - 'removeAppApprovedHandler', + 'removeAppAllowedHandler', 'removeAppDisallowedHandler', 'removeIgnoredHandler', 'removeProtocolHandler', @@ -99,7 +99,7 @@ this.zoomList_ = []; /** @private {!Array<!AppProtocolEntry>} */ - this.appApprovedProtocolHandlers_ = []; + this.appAllowedProtocolHandlers_ = []; /** @private {!Array<!AppProtocolEntry>} */ this.appDisallowedProtocolHandlers_ = []; @@ -215,9 +215,9 @@ * @param {!Array<AppProtocolEntry>} list The web app protocol handlers * list to set. */ - setAppApprovedProtocolHandlers(list) { + setAppAllowedProtocolHandlers(list) { // Shallow copy of the passed-in array so mutation won't impact the source - this.appApprovedProtocolHandlers_ = list.slice(); + this.appAllowedProtocolHandlers_ = list.slice(); } /** @@ -518,8 +518,7 @@ /** @override */ observeAppProtocolHandlers() { webUIListenerCallback( - 'setAppApprovedProtocolHandlers', - this.appApprovedProtocolHandlers_); + 'setAppAllowedProtocolHandlers', this.appAllowedProtocolHandlers_); webUIListenerCallback( 'setAppDisallowedProtocolHandlers', this.appDisallowedProtocolHandlers_); @@ -543,8 +542,8 @@ } /** @override */ - removeAppApprovedHandler() { - this.methodCalled('removeAppApprovedHandler', arguments); + removeAppAllowedHandler() { + this.methodCalled('removeAppAllowedHandler', arguments); } /** @override */
diff --git a/chrome/updater/BUILD.gn b/chrome/updater/BUILD.gn index 8a512b9e..df6c50d 100644 --- a/chrome/updater/BUILD.gn +++ b/chrome/updater/BUILD.gn
@@ -182,6 +182,8 @@ "mac/net/network.h", "mac/net/network_fetcher.h", "mac/net/network_fetcher.mm", + "mac/setup/keystone.cc", + "mac/setup/keystone.h", "mac/setup/setup.h", "mac/setup/setup.mm", "mac/update_service_internal_proxy.h", @@ -544,6 +546,7 @@ "mac/net/network_unittest.cc", "mac/scoped_xpc_service_mock.h", "mac/scoped_xpc_service_mock.mm", + "mac/setup/keystone_unittest.cc", "mac/setup/setup_unittest.mm", "mac/update_service_proxy_test.mm", "policy/mac/managed_preference_policy_manager_impl_unittest.mm",
diff --git a/chrome/updater/app/app_server.cc b/chrome/updater/app/app_server.cc index 97eb3bfe..0c2cd6d 100644 --- a/chrome/updater/app/app_server.cc +++ b/chrome/updater/app/app_server.cc
@@ -154,9 +154,13 @@ bool AppServer::SwapVersions(GlobalPrefs* global_prefs) { global_prefs->SetSwapping(true); PrefsCommitPendingWrites(global_prefs->GetPrefService()); - bool result = SwapRPCInterfaces(); - if (!result) + if (!SwapRPCInterfaces()) return false; + if (!ConvertLegacyUpdaters(base::BindRepeating( + &PersistedData::RegisterApp, base::MakeRefCounted<PersistedData>( + global_prefs->GetPrefService())))) { + return false; + } global_prefs->SetActiveVersion(kUpdaterVersion); global_prefs->SetSwapping(false); PrefsCommitPendingWrites(global_prefs->GetPrefService());
diff --git a/chrome/updater/app/app_server.h b/chrome/updater/app/app_server.h index bbbd90e8..1f5a7eb 100644 --- a/chrome/updater/app/app_server.h +++ b/chrome/updater/app/app_server.h
@@ -6,6 +6,7 @@ #define CHROME_UPDATER_APP_APP_SERVER_H_ #include "base/bind.h" +#include "base/callback_forward.h" #include "base/memory/scoped_refptr.h" #include "chrome/updater/app/app.h" #include "chrome/updater/external_constants.h" @@ -16,6 +17,7 @@ class UpdateServiceInternal; class GlobalPrefs; class UpdateService; +struct RegistrationRequest; // AppServer runs as the updater server process. Multiple servers of different // application versions can be run side-by-side. Each such server is called a @@ -52,6 +54,12 @@ // server. virtual bool SwapRPCInterfaces() = 0; + // Ingests metadata from incompatible legacy updaters, then replaces those + // updaters with shims. + virtual bool ConvertLegacyUpdaters( + base::RepeatingCallback<void(const RegistrationRequest&)> + register_callback) = 0; + // Uninstalls this candidate version of the updater. virtual void UninstallSelf() = 0;
diff --git a/chrome/updater/app/app_server_unittest.cc b/chrome/updater/app/app_server_unittest.cc index 19f4215..ccc65801 100644 --- a/chrome/updater/app/app_server_unittest.cc +++ b/chrome/updater/app/app_server_unittest.cc
@@ -6,6 +6,7 @@ #include <string> +#include "base/callback.h" #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/memory/scoped_refptr.h" @@ -44,6 +45,10 @@ (scoped_refptr<UpdateServiceInternal>), (override)); MOCK_METHOD(bool, SwapRPCInterfaces, (), (override)); + MOCK_METHOD(bool, + ConvertLegacyUpdaters, + (base::RepeatingCallback<void(const RegistrationRequest&)>), + (override)); MOCK_METHOD(void, UninstallSelf, (), (override)); protected: @@ -104,6 +109,7 @@ // Expect the app to ActiveDuty then SelfUninstall. EXPECT_CALL(*app, ActiveDuty).Times(1); EXPECT_CALL(*app, SwapRPCInterfaces).Times(0); + EXPECT_CALL(*app, ConvertLegacyUpdaters).Times(0); EXPECT_CALL(*app, UninstallSelf).Times(1); EXPECT_EQ(app->Run(), 0); EXPECT_TRUE(CreateLocalPrefs(GetUpdaterScope())->GetQualified()); @@ -121,6 +127,7 @@ // Expect the app to SwapRpcInterfaces and then ActiveDuty then Shutdown(0). EXPECT_CALL(*app, ActiveDuty).Times(1); EXPECT_CALL(*app, SwapRPCInterfaces).WillOnce(Return(true)); + EXPECT_CALL(*app, ConvertLegacyUpdaters).WillOnce(Return(true)); EXPECT_CALL(*app, UninstallSelf).Times(0); EXPECT_EQ(app->Run(), 0); } @@ -138,6 +145,7 @@ // In this case it bypasses qualification. EXPECT_CALL(*app, ActiveDuty).Times(1); EXPECT_CALL(*app, SwapRPCInterfaces).WillOnce(Return(true)); + EXPECT_CALL(*app, ConvertLegacyUpdaters).WillOnce(Return(true)); EXPECT_CALL(*app, UninstallSelf).Times(0); EXPECT_EQ(app->Run(), 0); EXPECT_FALSE(CreateLocalPrefs(GetUpdaterScope())->GetQualified()); @@ -160,6 +168,7 @@ // Expect the app to SwapRpcInterfaces and then Shutdown(2). EXPECT_CALL(*app, ActiveDuty).Times(0); EXPECT_CALL(*app, SwapRPCInterfaces).WillOnce(Return(false)); + EXPECT_CALL(*app, ConvertLegacyUpdaters).Times(0); EXPECT_CALL(*app, UninstallSelf).Times(0); EXPECT_EQ(app->Run(), 2); } @@ -185,6 +194,7 @@ // Expect the app to ActiveDuty and then Shutdown(0). EXPECT_CALL(*app, ActiveDuty).Times(1); EXPECT_CALL(*app, SwapRPCInterfaces).Times(0); + EXPECT_CALL(*app, ConvertLegacyUpdaters).Times(0); EXPECT_CALL(*app, UninstallSelf).Times(0); EXPECT_EQ(app->Run(), 0); } @@ -212,6 +222,7 @@ // Shutdown(0). EXPECT_CALL(*app, ActiveDuty).Times(1); EXPECT_CALL(*app, SwapRPCInterfaces).WillOnce(Return(true)); + EXPECT_CALL(*app, ConvertLegacyUpdaters).WillOnce(Return(true)); EXPECT_CALL(*app, UninstallSelf).Times(0); EXPECT_EQ(app->Run(), 0); } @@ -238,6 +249,7 @@ // Expect the app to SwapRpcInterfaces and Shutdown(2). EXPECT_CALL(*app, ActiveDuty).Times(0); EXPECT_CALL(*app, SwapRPCInterfaces).WillOnce(Return(false)); + EXPECT_CALL(*app, ConvertLegacyUpdaters).Times(0); EXPECT_CALL(*app, UninstallSelf).Times(0); EXPECT_EQ(app->Run(), 2); }
diff --git a/chrome/updater/app/server/mac/app_server.h b/chrome/updater/app/server/mac/app_server.h index 1121492d..745eeae 100644 --- a/chrome/updater/app/server/mac/app_server.h +++ b/chrome/updater/app/server/mac/app_server.h
@@ -10,6 +10,7 @@ #include <xpc/xpc.h> #include "base/atomic_ref_count.h" +#include "base/callback_forward.h" #include "base/mac/scoped_nsobject.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_refptr.h" @@ -18,11 +19,11 @@ #include "chrome/updater/app/server/mac/service_delegate.h" #import "chrome/updater/configurator.h" #import "chrome/updater/mac/xpc_service_names.h" -#include "chrome/updater/prefs.h" #include "chrome/updater/update_service_impl.h" namespace base { class SequencedTaskRunner; +struct RegistrationRequest; } namespace updater { @@ -48,6 +49,9 @@ void ActiveDutyInternal( scoped_refptr<UpdateServiceInternal> update_service_internal) override; bool SwapRPCInterfaces() override; + bool ConvertLegacyUpdaters( + base::RepeatingCallback<void(const RegistrationRequest&)> + register_callback) override; void UninstallSelf() override; void MarkTaskStarted();
diff --git a/chrome/updater/app/server/mac/server.mm b/chrome/updater/app/server/mac/server.mm index 3ff86f6..3134e6f8 100644 --- a/chrome/updater/app/server/mac/server.mm +++ b/chrome/updater/app/server/mac/server.mm
@@ -8,6 +8,7 @@ #include <xpc/xpc.h> #include "base/bind.h" +#include "base/callback.h" #include "base/command_line.h" #include "base/files/file_path.h" #include "base/mac/foundation_util.h" @@ -22,6 +23,7 @@ #include "chrome/updater/app/server/mac/service_delegate.h" #include "chrome/updater/configurator.h" #include "chrome/updater/constants.h" +#include "chrome/updater/mac/setup/keystone.h" #include "chrome/updater/mac/setup/setup.h" #import "chrome/updater/mac/xpc_service_names.h" #include "chrome/updater/prefs.h" @@ -92,6 +94,12 @@ return PromoteCandidate(updater_scope()) == setup_exit_codes::kSuccess; } +bool AppServerMac::ConvertLegacyUpdaters( + base::RepeatingCallback<void(const RegistrationRequest&)> + register_callback) { + return ConvertKeystone(updater_scope(), register_callback); +} + void AppServerMac::TaskStarted() { main_task_runner_->PostTask(FROM_HERE, BindOnce(&AppServerMac::MarkTaskStarted, this));
diff --git a/chrome/updater/app/server/win/server.cc b/chrome/updater/app/server/win/server.cc index fa879de..c663f36 100644 --- a/chrome/updater/app/server/win/server.cc +++ b/chrome/updater/app/server/win/server.cc
@@ -28,6 +28,7 @@ #include "chrome/updater/configurator.h" #include "chrome/updater/constants.h" #include "chrome/updater/prefs.h" +#include "chrome/updater/registration_data.h" #include "chrome/updater/update_service.h" #include "chrome/updater/update_service_internal.h" #include "chrome/updater/updater_scope.h" @@ -242,4 +243,12 @@ return list->Do(); } +bool ComServerApp::ConvertLegacyUpdaters( + base::RepeatingCallback<void(const RegistrationRequest&)> + register_callback) { + // TODO(crbug.com/1250524): Implement. Note we will need both user and system + // scopes here. + return true; +} + } // namespace updater
diff --git a/chrome/updater/app/server/win/server.h b/chrome/updater/app/server/win/server.h index 9f68e6e2..88ffaae 100644 --- a/chrome/updater/app/server/win/server.h +++ b/chrome/updater/app/server/win/server.h
@@ -22,6 +22,7 @@ namespace updater { class Configurator; +struct RegistrationRequest; // The COM objects involved in this server are free threaded. Incoming COM calls // arrive on COM RPC threads. Outgoing COM calls are posted from a blocking @@ -71,6 +72,9 @@ void ActiveDutyInternal( scoped_refptr<UpdateServiceInternal> update_service_internal) override; bool SwapRPCInterfaces() override; + bool ConvertLegacyUpdaters( + base::RepeatingCallback<void(const RegistrationRequest&)> + register_callback) override; void UninstallSelf() override; // Registers and unregisters the out-of-process COM class factories.
diff --git a/chrome/updater/mac/keystone/ksadmin.mm b/chrome/updater/mac/keystone/ksadmin.mm index 01a1c7e..ba5f716 100644 --- a/chrome/updater/mac/keystone/ksadmin.mm +++ b/chrome/updater/mac/keystone/ksadmin.mm
@@ -143,6 +143,8 @@ void KSAdminApp::PrintRequestedInfo() { if (print_usage_) PrintUsage(); + if (print_tickets_) + printf("No tickets\n"); } void KSAdminApp::PrintUsage() {
diff --git a/chrome/updater/mac/setup/keystone.cc b/chrome/updater/mac/setup/keystone.cc new file mode 100644 index 0000000..aaabcd6 --- /dev/null +++ b/chrome/updater/mac/setup/keystone.cc
@@ -0,0 +1,291 @@ +// 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/updater/mac/setup/keystone.h" + +#include <string> +#include <vector> + +#include "base/callback.h" +#include "base/command_line.h" +#include "base/files/file_path.h" +#include "base/files/file_util.h" +#include "base/logging.h" +#include "base/mac/bundle_locations.h" +#include "base/process/launch.h" +#include "base/process/process.h" +#include "base/strings/string_split.h" +#include "base/strings/sys_string_conversions.h" +#include "base/version.h" +#include "chrome/updater/mac/mac_util.h" +#include "chrome/updater/registration_data.h" +#include "chrome/updater/updater_branding.h" +#include "chrome/updater/updater_scope.h" +#include "chrome/updater/util.h" + +namespace updater { + +namespace { + +// Keystone versions look like 1.3.16.180; disregard any Keystone at a version +// greater than 2.0.0.0. +constexpr char kMaxKeystoneVersion[] = "2"; + +bool CopyKeystoneBundle(UpdaterScope scope) { + // The Keystone Bundle is in + // GoogleUpdater.app/Contents/Helpers/GoogleSoftwareUpdate.bundle. + base::FilePath keystone_bundle_path = + base::mac::OuterBundlePath() + .Append(FILE_PATH_LITERAL("Contents")) + .Append(FILE_PATH_LITERAL("Helpers")) + .Append(FILE_PATH_LITERAL(KEYSTONE_NAME ".bundle")); + + if (!base::PathExists(keystone_bundle_path)) { + LOG(ERROR) << "Path to the Keystone bundle does not exist! " + << keystone_bundle_path; + return false; + } + + const absl::optional<base::FilePath> dest_folder_path = + GetKeystoneFolderPath(scope); + if (!dest_folder_path) + return false; + const base::FilePath dest_path = *dest_folder_path; + if (!base::PathExists(dest_path)) { + base::File::Error error; + if (!base::CreateDirectoryAndGetError(dest_path, &error)) { + LOG(ERROR) << "Failed to create '" << dest_path.value().c_str() + << "' directory: " << base::File::ErrorToString(error); + return false; + } + } + + // For system installs, set file permissions to be drwxr-xr-x. + if (scope == UpdaterScope::kSystem) { + constexpr int kPermissionsMask = base::FILE_PERMISSION_USER_MASK | + base::FILE_PERMISSION_READ_BY_GROUP | + base::FILE_PERMISSION_EXECUTE_BY_GROUP | + base::FILE_PERMISSION_READ_BY_OTHERS | + base::FILE_PERMISSION_EXECUTE_BY_OTHERS; + if (!base::SetPosixFilePermissions( + GetLibraryFolderPath(scope)->Append(COMPANY_SHORTNAME_STRING), + kPermissionsMask) || + !base::SetPosixFilePermissions(*GetUpdaterFolderPath(scope), + kPermissionsMask) || + !base::SetPosixFilePermissions(*GetVersionedUpdaterFolderPath(scope), + kPermissionsMask)) { + LOG(ERROR) << "Failed to set permissions to drwxr-xr-x at " + << dest_path.value().c_str(); + return false; + } + } + + if (!base::CopyDirectory(keystone_bundle_path, dest_path, true)) { + LOG(ERROR) << "Copying keystone bundle '" << keystone_bundle_path + << "' to '" << dest_path.value().c_str() << "' failed."; + return false; + } + return true; +} + +absl::optional<base::FilePath> GetKsadminPath(UpdaterScope scope) { + const absl::optional<base::FilePath> keystone_folder_path = + GetKeystoneFolderPath(scope); + if (!keystone_folder_path || !base::PathExists(*keystone_folder_path)) + return absl::nullopt; + base::FilePath ksadmin_path = + keystone_folder_path->Append(FILE_PATH_LITERAL(KEYSTONE_NAME ".bundle")) + .Append(FILE_PATH_LITERAL("Contents")) + .Append(FILE_PATH_LITERAL("Helpers")) + .Append(FILE_PATH_LITERAL("ksadmin")); + if (!base::PathExists(ksadmin_path)) + return absl::nullopt; + return absl::make_optional(ksadmin_path); +} + +// Returns the version of ksadmin. +absl::optional<base::Version> GetKsadminVersion(UpdaterScope scope) { + absl::optional<base::FilePath> ksadmin_path = GetKsadminPath(scope); + if (!ksadmin_path) + return absl::nullopt; + base::CommandLine ksadmin_version(*ksadmin_path); + ksadmin_version.AppendSwitch("ksadmin-version"); + int exit_code = -1; + std::string output; + base::GetAppOutputWithExitCode(ksadmin_version, &output, &exit_code); + if (exit_code != 0) { + VLOG(2) << ksadmin_version.GetCommandLineString() + << " returned exit code: " << exit_code; + return absl::nullopt; + } + base::Version keystone_version(output); + if (!keystone_version.IsValid()) { + VLOG(2) << "Ran " << ksadmin_version.GetCommandLineString() + << " and cannot parse version number from: " << output; + return absl::nullopt; + } + return absl::make_optional(keystone_version); +} + +void MigrateKeystoneTickets( + UpdaterScope scope, + base::RepeatingCallback<void(const RegistrationRequest&)> + register_callback) { + absl::optional<base::Version> ksadmin_version = GetKsadminVersion(scope); + if (!ksadmin_version || + *ksadmin_version > base::Version(kMaxKeystoneVersion)) { + // TODO(crbug.com/1250524): If ksadmin_version > max, we are probably + // communicating with a ksadmin shim, and we should pass an additional + // argument to only get legacy Keystone tickets here (not tickets + // synthesized from Chromium Updater's global prefs). However, that argument + // does not yet exist, so for now, skip any migration from a shim. Note, it + // is not safe to assume that migration has already completed just because + // the ksadmin shim is replaced; it may have been replaced for the other + // updater scope, or migration may have been interrupted. + return; + } + + absl::optional<base::FilePath> ksadmin_path = GetKsadminPath(scope); + if (!ksadmin_path) + return; + base::CommandLine ksadmin_tickets(*ksadmin_path); + ksadmin_tickets.AppendSwitch("print-tickets"); + switch (scope) { + case UpdaterScope::kSystem: + ksadmin_tickets.AppendSwitch("system-store"); + break; + case UpdaterScope::kUser: + ksadmin_tickets.AppendSwitch("user-store"); + break; + } + int exit_code = -1; + std::string output; + base::GetAppOutputWithExitCode(ksadmin_tickets, &output, &exit_code); + if (exit_code != 0) { + VLOG(1) << ksadmin_tickets.GetCommandLineString() + << " returned exit code: " << exit_code; + return; + } + + for (RegistrationRequest registration : internal::TicketsToMigrate(output)) { + // TODO(crbug.com/1250524): Don't register com.google.Keystone. + register_callback.Run(registration); + } +} + +} // namespace + +void UninstallKeystone(UpdaterScope scope) { + const absl::optional<base::FilePath> keystone_folder_path = + GetKeystoneFolderPath(scope); + if (!keystone_folder_path) { + LOG(ERROR) << "Can't find Keystone path."; + return; + } + if (!base::PathExists(*keystone_folder_path)) { + LOG(ERROR) << "Keystone path '" << *keystone_folder_path + << "' doesn't exist."; + return; + } + + base::FilePath ksinstall_path = + keystone_folder_path->Append(FILE_PATH_LITERAL(KEYSTONE_NAME ".bundle")) + .Append(FILE_PATH_LITERAL("Contents")) + .Append(FILE_PATH_LITERAL("Helpers")) + .Append(FILE_PATH_LITERAL("ksinstall")); + base::CommandLine command_line(ksinstall_path); + command_line.AppendSwitch("uninstall"); + if (scope == UpdaterScope::kSystem) + command_line = MakeElevated(command_line); + base::Process process = base::LaunchProcess(command_line, {}); + if (!process.IsValid()) { + LOG(ERROR) << "Failed to launch ksinstall."; + return; + } + int exit_code = 0; + + if (!process.WaitForExitWithTimeout(base::TimeDelta::FromSeconds(30), + &exit_code)) { + LOG(ERROR) << "Uninstall Keystone didn't finish in the allowed time."; + return; + } + if (exit_code != 0) { + LOG(ERROR) << "Uninstall Keystone returned exit code: " << exit_code << "."; + } +} + +bool ConvertKeystone(UpdaterScope scope, + base::RepeatingCallback<void(const RegistrationRequest&)> + register_callback) { + // TODO(crbug.com/1250524): This must not run concurrently with Keystone. + MigrateKeystoneTickets(scope, register_callback); + // TODO(crbug.com/1250524): Flush prefs, then delete the tickets to mitigate + // duplicate imports. + return CopyKeystoneBundle(scope); +} + +namespace internal { + +std::vector<RegistrationRequest> TicketsToMigrate( + const std::string& ksadmin_tickets) { + std::vector<RegistrationRequest> result; + + if (ksadmin_tickets.find("No tickets") != std::string::npos) { + VLOG(1) << "No tickets"; + return result; + } + + constexpr char kXCPath[] = "path="; + + for (const std::string& ticket : + SplitStringUsingSubstr(ksadmin_tickets, "\n>", base::TRIM_WHITESPACE, + base::SPLIT_WANT_NONEMPTY)) { + VLOG(1) << "ticket:\n" << ticket; + if (ticket.empty() || ticket[0] != '<') { + LOG(ERROR) << "Ticket has unexpected format: " << ticket; + break; + } + base::StringPairs key_value_pairs; + base::SplitStringIntoKeyValuePairs(ticket, '=', '\n', &key_value_pairs); + + RegistrationRequest registration; + for (const auto& pair : key_value_pairs) { + const std::string& key = pair.first; + const std::string& value = pair.second; + if (key.empty() || value.empty()) + continue; + VLOG(1) << "kvp: " << key << "=" << value; + if (key == "productID") { + registration.app_id = value; + } else if (key == "version") { + registration.version = base::Version(value); + } else if (key == "xc") { + if (value.find(kXCPath) == std::string::npos || + value.find(">") == std::string::npos) { + LOG(ERROR) << "Existence checker path not found in: " << value; + break; + } + int start_pos = value.find(kXCPath) + strlen(kXCPath); + std::string path = value.substr(start_pos, value.find(">") - start_pos); + VLOG(0) << "path: " << path; + registration.existence_checker_path = base::FilePath(path); + } else if (key == "brandPath") { + // TODO(crbug.com/1250524): Look up the file and read the brand code. + registration.brand_code = ""; + } else if (key == "tag") { + registration.tag = value; + } + // TODO(crbug.com/1250524): Handle tagPath/tagKey. + } + if (!registration.app_id.empty() && + !registration.existence_checker_path.empty() && + registration.version.IsValid()) + result.push_back(registration); + } + return result; +} + +} // namespace internal + +} // namespace updater
diff --git a/chrome/updater/mac/setup/keystone.h b/chrome/updater/mac/setup/keystone.h new file mode 100644 index 0000000..ed561b0 --- /dev/null +++ b/chrome/updater/mac/setup/keystone.h
@@ -0,0 +1,38 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_UPDATER_MAC_SETUP_KEYSTONE_H_ +#define CHROME_UPDATER_MAC_SETUP_KEYSTONE_H_ + +#include <string> +#include <vector> + +#include "base/callback_forward.h" +#include "chrome/updater/updater_scope.h" + +namespace updater { + +struct RegistrationRequest; + +// Replaces a keystone installation with this updater's shims. Calls +// `register_callback` with data from Keystone's ticket store if needed. +// Returns true if conversion succeeded. +bool ConvertKeystone(UpdaterScope scope, + base::RepeatingCallback<void(const RegistrationRequest&)> + register_callback); + +// Uninstalls Keystone from the system. Does not remove Keystone's ticket +// stores. +void UninstallKeystone(UpdaterScope scope); + +namespace internal { + +std::vector<RegistrationRequest> TicketsToMigrate( + const std::string& ksadmin_tickets); + +} // namespace internal + +} // namespace updater + +#endif // CHROME_UPDATER_MAC_SETUP_KEYSTONE_H_
diff --git a/chrome/updater/mac/setup/keystone_unittest.cc b/chrome/updater/mac/setup/keystone_unittest.cc new file mode 100644 index 0000000..367c86ac --- /dev/null +++ b/chrome/updater/mac/setup/keystone_unittest.cc
@@ -0,0 +1,128 @@ +// 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 <string> +#include <vector> + +#include "base/files/file_path.h" +#include "base/version.h" +#include "chrome/updater/mac/setup/keystone.h" +#include "chrome/updater/registration_data.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace updater { + +TEST(KeystoneTest, TicketsToMigrate_NoTickets) { + std::vector<RegistrationRequest> out = + internal::TicketsToMigrate("No tickets\n"); + ASSERT_EQ(out.size(), 0UL); +} + +TEST(KeystoneTest, TicketsToMigrate_Empty) { + std::vector<RegistrationRequest> out = internal::TicketsToMigrate(""); + ASSERT_EQ(out.size(), 0UL); +} + +TEST(KeystoneTest, TicketsToMigrate_Garbled) { + std::vector<RegistrationRequest> out = + internal::TicketsToMigrate("some\nbogus\01nonsense\xffvalue\0\n\n"); + ASSERT_EQ(out.size(), 0UL); +} + +TEST(KeystoneTest, TicketsToMigrate_Tickets) { + std::vector<RegistrationRequest> out = internal::TicketsToMigrate( + "<KSTicket:0x7fda48414e90\n" + "\tproductID=com.google.Keystone\n" + "\tversion=1.3.16.180\n" + "\txc=<KSPathExistenceChecker:0x7fda48414350 " + "path=/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle>\n" + "\turl=https://tools.google.com/service/update2\n" + "\tcreationDate=2019-12-16 17:18:45\n" + "\tcohort=1:0:\n" + "\tcohortName=Everyone\n" + "\tticketVersion=1\n" + ">\n" + "<KSTicket:0x7fda484134a0\n" + "\tproductID=com.google.chrome_remote_desktop\n" + "\tversion=94.0.4606.27\n" + "\txc=<KSPathExistenceChecker:0x7fda48413c30 " + "path=/Library/LaunchAgents/org.chromium.chromoting.plist>\n" + "\tserverType=Omaha\n" + "\turl=https://tools.google.com/service/update2\n" + "\tcreationDate=2020-12-14 20:31:58\n" + "\tcohort=1:10ql:\n" + "\tcohortName=Stable\n" + "\tticketVersion=1\n" + ">\n" + "<KSTicket:0x7fda484151f0\n" + "\tproductID=com.google.Chrome\n" + "\tversion=93.0.4577.82\n" + "\txc=<KSPathExistenceChecker:0x7fda48414d20 path=/Applications/Google " + "Chrome.app>\n" + "\tserverType=Omaha\n" + "\turl=https://tools.google.com/service/update2\n" + "\tcreationDate=2019-12-19 17:15:37\n" + "\ttagPath=/Applications/Google Chrome.app/Contents/Info.plist\n" + "\ttagKey=KSChannelID\n" + "\tbrandPath=/Library/Google/Google Chrome Brand.plist\n" + "\tbrandKey=KSBrandID\n" + "\tversionPath=/Applications/Google Chrome.app/Contents/Info.plist\n" + "\tversionKey=KSVersion\n" + "\tcohort=1:1y5:119f@0.5\n" + "\tcohortName=Stable\n" + "\tticketVersion=1\n" + ">\n" + "<KSTicket:0x7fda48415700\n" + "\tproductID=com.google.Chrome.canary\n" + "\tversion=96.0.4656.0\n" + "\txc=<KSPathExistenceChecker:0x7fda48415810 path=/Applications/Google " + "Chrome Canary.app>\n" + "\tserverType=Omaha\n" + "\turl=https://tools.google.com/service/update2\n" + "\tcreationDate=2020-11-16 20:11:41\n" + "\ttag=canary\n" + "\ttagPath=/Applications/Google Chrome Canary.app/Contents/Info.plist\n" + "\ttagKey=KSChannelID\n" + "\tversionPath=/Applications/Google Chrome " + "Canary.app/Contents/Info.plist\n" + "\tversionKey=KSVersion\n" + "\tcohort=1:0:\n" + "\tcohortName=Canary\n" + "\tticketVersion=1\n" + ">\n"); + ASSERT_EQ(out.size(), 4UL); + + EXPECT_EQ(out[0].app_id, "com.google.Keystone"); + EXPECT_EQ(out[0].brand_code, ""); + EXPECT_EQ(out[0].tag, ""); + EXPECT_EQ(out[0].version, base::Version("1.3.16.180")); + EXPECT_EQ( + out[0].existence_checker_path, + base::FilePath( + "/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle")); + + EXPECT_EQ(out[1].app_id, "com.google.chrome_remote_desktop"); + EXPECT_EQ(out[1].brand_code, ""); + EXPECT_EQ(out[1].tag, ""); + EXPECT_EQ(out[1].version, base::Version("94.0.4606.27")); + EXPECT_EQ( + out[1].existence_checker_path, + base::FilePath("/Library/LaunchAgents/org.chromium.chromoting.plist")); + + EXPECT_EQ(out[2].app_id, "com.google.Chrome"); + EXPECT_EQ(out[2].brand_code, ""); + EXPECT_EQ(out[2].tag, ""); + EXPECT_EQ(out[2].version, base::Version("93.0.4577.82")); + EXPECT_EQ(out[2].existence_checker_path, + base::FilePath("/Applications/Google Chrome.app")); + + EXPECT_EQ(out[3].app_id, "com.google.Chrome.canary"); + EXPECT_EQ(out[3].brand_code, ""); + EXPECT_EQ(out[3].tag, "canary"); + EXPECT_EQ(out[3].version, base::Version("96.0.4656.0")); + EXPECT_EQ(out[3].existence_checker_path, + base::FilePath("/Applications/Google Chrome Canary.app")); +} + +} // namespace updater
diff --git a/chrome/updater/mac/setup/setup.h b/chrome/updater/mac/setup/setup.h index 74a096d..998342c 100644 --- a/chrome/updater/mac/setup/setup.h +++ b/chrome/updater/mac/setup/setup.h
@@ -29,9 +29,6 @@ // Failed to get the installed app bundle path. constexpr int kFailedToGetAppBundlePath = 14; -// Failed to copy the keystone bundle. -constexpr int kFailedToCopyKeystoneBundle = 15; - // Failed to remove the active(unversioned) update service job from Launchd. constexpr int kFailedToRemoveActiveUpdateServiceJobFromLaunchd = 20;
diff --git a/chrome/updater/mac/setup/setup.mm b/chrome/updater/mac/setup/setup.mm index 698c823..4aa79f18 100644 --- a/chrome/updater/mac/setup/setup.mm +++ b/chrome/updater/mac/setup/setup.mm
@@ -31,6 +31,7 @@ #include "chrome/updater/crash_reporter.h" #include "chrome/updater/launchd_util.h" #import "chrome/updater/mac/mac_util.h" +#include "chrome/updater/mac/setup/keystone.h" #import "chrome/updater/mac/xpc_service_names.h" #include "chrome/updater/setup.h" #include "chrome/updater/updater_branding.h" @@ -121,63 +122,6 @@ return true; } -bool CopyKeystoneBundle(UpdaterScope scope) { - // The Keystone Bundle is in - // GoogleUpdater.app/Contents/Helpers/GoogleSoftwareUpdate.bundle. - base::FilePath keystone_bundle_path = - base::mac::OuterBundlePath() - .Append(FILE_PATH_LITERAL("Contents")) - .Append(FILE_PATH_LITERAL("Helpers")) - .Append(FILE_PATH_LITERAL(KEYSTONE_NAME ".bundle")); - - if (!base::PathExists(keystone_bundle_path)) { - LOG(ERROR) << "Path to the Keystone bundle does not exist! " - << keystone_bundle_path; - return false; - } - - const absl::optional<base::FilePath> dest_folder_path = - GetKeystoneFolderPath(scope); - if (!dest_folder_path) - return false; - const base::FilePath dest_path = *dest_folder_path; - if (!base::PathExists(dest_path)) { - base::File::Error error; - if (!base::CreateDirectoryAndGetError(dest_path, &error)) { - LOG(ERROR) << "Failed to create '" << dest_path.value().c_str() - << "' directory: " << base::File::ErrorToString(error); - return false; - } - } - - // For system installs, set file permissions to be drwxr-xr-x - if (scope == UpdaterScope::kSystem) { - constexpr int kPermissionsMask = base::FILE_PERMISSION_USER_MASK | - base::FILE_PERMISSION_READ_BY_GROUP | - base::FILE_PERMISSION_EXECUTE_BY_GROUP | - base::FILE_PERMISSION_READ_BY_OTHERS | - base::FILE_PERMISSION_EXECUTE_BY_OTHERS; - if (!base::SetPosixFilePermissions( - GetLibraryFolderPath(scope)->Append(COMPANY_SHORTNAME_STRING), - kPermissionsMask) || - !base::SetPosixFilePermissions(*GetUpdaterFolderPath(scope), - kPermissionsMask) || - !base::SetPosixFilePermissions(*GetVersionedUpdaterFolderPath(scope), - kPermissionsMask)) { - LOG(ERROR) << "Failed to set permissions to drwxr-xr-x at " - << dest_path.value().c_str(); - return false; - } - } - - if (!base::CopyDirectory(keystone_bundle_path, dest_path, true)) { - LOG(ERROR) << "Copying keystone bundle '" << keystone_bundle_path - << "' to '" << dest_path.value().c_str() << "' failed."; - return false; - } - return true; -} - NSString* MakeProgramArgument(const char* argument) { return base::SysUTF8ToNSString(base::StrCat({"--", argument})); } @@ -452,45 +396,6 @@ return setup_exit_codes::kSuccess; } -void UninstallKeystone(UpdaterScope scope) { - const absl::optional<base::FilePath> keystone_folder_path = - GetKeystoneFolderPath(scope); - if (!keystone_folder_path) { - LOG(ERROR) << "Can't find Keystone path."; - return; - } - if (!base::PathExists(*keystone_folder_path)) { - LOG(ERROR) << "Keystone path '" << *keystone_folder_path - << "' doesn't exist."; - return; - } - - base::FilePath ksinstall_path = - keystone_folder_path->Append(FILE_PATH_LITERAL(KEYSTONE_NAME ".bundle")) - .Append(FILE_PATH_LITERAL("Contents")) - .Append(FILE_PATH_LITERAL("Helpers")) - .Append(FILE_PATH_LITERAL("ksinstall")); - base::CommandLine command_line(ksinstall_path); - command_line.AppendSwitch("uninstall"); - if (scope == UpdaterScope::kSystem) - command_line = MakeElevated(command_line); - base::Process process = base::LaunchProcess(command_line, {}); - if (!process.IsValid()) { - LOG(ERROR) << "Failed to launch ksinstall."; - return; - } - int exit_code = 0; - - if (!process.WaitForExitWithTimeout(base::TimeDelta::FromSeconds(30), - &exit_code)) { - LOG(ERROR) << "Uninstall Keystone didn't finish in the allowed time."; - return; - } - if (exit_code != 0) { - LOG(ERROR) << "Uninstall Keystone returned exit code: " << exit_code << "."; - } -} - } // namespace int Setup(UpdaterScope scope) { @@ -514,9 +419,6 @@ if (!StartLaunchdServiceJob(scope)) return setup_exit_codes::kFailedToStartLaunchdActiveServiceJob; - if (!CopyKeystoneBundle(scope)) - return setup_exit_codes::kFailedToCopyKeystoneBundle; - // Wait for launchd to finish the load operation for the update service. base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(2));
diff --git a/chromeos/chromeos_strings.grd b/chromeos/chromeos_strings.grd index 02a1a902..a03ed87 100644 --- a/chromeos/chromeos_strings.grd +++ b/chromeos/chromeos_strings.grd
@@ -1891,6 +1891,9 @@ <message name="IDS_PERSONALIZATION_APP_NETWORK_ERROR" desc="Label for the error page when wallpaper information cannot be downloaded"> Please connect to a network and reload the page to view wallpaper. </message> + <message name="IDS_PERSONALIZATION_APP_LOAD_WALLPAPER_ERROR" desc="Label for the error toast notification when loading current wallpaper failed"> + Something went wrong. Try reopening the app. + </message> <message name="IDS_PERSONALIZATION_APP_SET_WALLPAPER_ERROR" desc="Label for the error toast notification when setting wallpaper failed"> There was an error. Please try again by choosing other images. </message>
diff --git a/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_LOAD_WALLPAPER_ERROR.png.sha1 b/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_LOAD_WALLPAPER_ERROR.png.sha1 new file mode 100644 index 0000000..f9ed457c --- /dev/null +++ b/chromeos/chromeos_strings_grd/IDS_PERSONALIZATION_APP_LOAD_WALLPAPER_ERROR.png.sha1
@@ -0,0 +1 @@ +7867f53274425e256b9ee5c8e60c34f6f5c9b0ff \ No newline at end of file
diff --git a/chromeos/components/personalization_app/personalization_app_ui.cc b/chromeos/components/personalization_app/personalization_app_ui.cc index 229d8cc..66a6d22 100644 --- a/chromeos/components/personalization_app/personalization_app_ui.cc +++ b/chromeos/components/personalization_app/personalization_app_ui.cc
@@ -77,6 +77,7 @@ // Using old wallpaper app error string pending final revision. // TODO(b/195609442) {"setWallpaperError", IDS_PERSONALIZATION_APP_SET_WALLPAPER_ERROR}, + {"loadWallpaperError", IDS_PERSONALIZATION_APP_LOAD_WALLPAPER_ERROR}, {"dismiss", IDS_PERSONALIZATION_APP_DISMISS}, {"ariaLabelViewFullScreen", IDS_PERSONALIZATION_APP_ARIA_LABEL_VIEW_FULL_SCREEN}};
diff --git a/chromeos/components/personalization_app/resources/trusted/personalization_reducers.js b/chromeos/components/personalization_app/resources/trusted/personalization_reducers.js index 678ae1c..c2e025fb 100644 --- a/chromeos/components/personalization_app/resources/trusted/personalization_reducers.js +++ b/chromeos/components/personalization_app/resources/trusted/personalization_reducers.js
@@ -375,7 +375,13 @@ if (success) { return null; } - return loadTimeData.getString('setWallpaperError'); + return state || loadTimeData.getString('setWallpaperError'); + case ActionName.SET_SELECTED_IMAGE: + const {image} = /** @type {{name: string, image: ?Object}} */(action); + if (image) { + return state; + } + return state || loadTimeData.getString('loadWallpaperError'); case ActionName.DISMISS_ERROR: if (!state) { console.warn(
diff --git a/chromeos/components/personalization_app/resources/trusted/wallpaper_selected_element.js b/chromeos/components/personalization_app/resources/trusted/wallpaper_selected_element.js index d3e187a..189d0bf 100644 --- a/chromeos/components/personalization_app/resources/trusted/wallpaper_selected_element.js +++ b/chromeos/components/personalization_app/resources/trusted/wallpaper_selected_element.js
@@ -22,6 +22,15 @@ import {Paths} from './personalization_router_element.js'; import {WithPersonalizationStore} from './personalization_store.js'; +let setTimeout = window.setTimeout; +let clearTimeout = window.clearTimeout; + +/** @param {{setTimeout: Function, clearTimeout: Function}} mock */ +export function mockTimeoutForTesting(mock) { + setTimeout = mock.setTimeout; + clearTimeout = mock.clearTimeout; +} + /** * Set up the observer to listen for wallpaper changes. * @param {!chromeos.personalizationApp.mojom.WallpaperProviderInterface} @@ -124,6 +133,7 @@ /** @private */ isLoading_: { type: Boolean, + observer: 'onIsLoadingChanged_', }, /** @private */ @@ -223,6 +233,17 @@ 'dailyRefreshCollectionId_', state => state.dailyRefresh.collectionId); this.updateFromStore(); getDailyRefreshCollectionId(this.wallpaperProvider_, this.getStore()); + /** + * Set a 2 minute timer. If no wallpaper information has been received by + * then, dispatch a failure state. + * @type {?number} + */ + this.initialLoadTimeout_ = setTimeout(() => { + // If still loading the initial currently selected wallpaper image after + // 120 seconds, consider this an error and update the store. + this.dispatch(setSelectedImageAction(null)); + this.initialLoadTimeout_ = null; + }, 120 * 1000); } /** @override */ @@ -236,6 +257,11 @@ * currentWallpaper */ onWallpaperChanged(currentWallpaper) { + // Clear the initial load timer if wallpaper information is received. + if (this.initialLoadTimeout_) { + clearTimeout(this.initialLoadTimeout_); + this.initialLoadTimeout_ = null; + } this.dispatch(setSelectedImageAction(currentWallpaper)); }
diff --git a/chromeos/crosapi/mojom/app_service_types_mojom_traits.cc b/chromeos/crosapi/mojom/app_service_types_mojom_traits.cc index 5adddc11..08a6dca 100644 --- a/chromeos/crosapi/mojom/app_service_types_mojom_traits.cc +++ b/chromeos/crosapi/mojom/app_service_types_mojom_traits.cc
@@ -62,8 +62,8 @@ if (!data.ReadInstallTime(&install_time)) return false; - apps::mojom::InstallSource install_source; - if (!data.ReadInstallSource(&install_source)) + apps::mojom::InstallReason install_reason; + if (!data.ReadInstallSource(&install_reason)) return false; apps::mojom::OptionalBool recommendable; @@ -119,7 +119,7 @@ app->icon_key = std::move(icon_key); app->last_launch_time = last_launch_time; app->install_time = install_time; - app->install_source = install_source; + app->install_reason = install_reason; app->recommendable = recommendable; app->searchable = searchable; app->show_in_launcher = show_in_launcher; @@ -260,52 +260,52 @@ } crosapi::mojom::InstallSource -EnumTraits<crosapi::mojom::InstallSource, apps::mojom::InstallSource>::ToMojom( - apps::mojom::InstallSource input) { +EnumTraits<crosapi::mojom::InstallSource, apps::mojom::InstallReason>::ToMojom( + apps::mojom::InstallReason input) { switch (input) { - case apps::mojom::InstallSource::kUnknown: + case apps::mojom::InstallReason::kUnknown: return crosapi::mojom::InstallSource::kUnknown; - case apps::mojom::InstallSource::kSystem: + case apps::mojom::InstallReason::kSystem: return crosapi::mojom::InstallSource::kSystem; - case apps::mojom::InstallSource::kPolicy: + case apps::mojom::InstallReason::kPolicy: return crosapi::mojom::InstallSource::kPolicy; - case apps::mojom::InstallSource::kOem: + case apps::mojom::InstallReason::kOem: return crosapi::mojom::InstallSource::kOem; - case apps::mojom::InstallSource::kDefault: + case apps::mojom::InstallReason::kDefault: return crosapi::mojom::InstallSource::kDefault; - case apps::mojom::InstallSource::kSync: + case apps::mojom::InstallReason::kSync: return crosapi::mojom::InstallSource::kSync; - case apps::mojom::InstallSource::kUser: + case apps::mojom::InstallReason::kUser: return crosapi::mojom::InstallSource::kUser; } NOTREACHED(); } -bool EnumTraits<crosapi::mojom::InstallSource, apps::mojom::InstallSource>:: +bool EnumTraits<crosapi::mojom::InstallSource, apps::mojom::InstallReason>:: FromMojom(crosapi::mojom::InstallSource input, - apps::mojom::InstallSource* output) { + apps::mojom::InstallReason* output) { switch (input) { case crosapi::mojom::InstallSource::kUnknown: - *output = apps::mojom::InstallSource::kUnknown; + *output = apps::mojom::InstallReason::kUnknown; return true; case crosapi::mojom::InstallSource::kSystem: - *output = apps::mojom::InstallSource::kSystem; + *output = apps::mojom::InstallReason::kSystem; return true; case crosapi::mojom::InstallSource::kPolicy: - *output = apps::mojom::InstallSource::kPolicy; + *output = apps::mojom::InstallReason::kPolicy; return true; case crosapi::mojom::InstallSource::kOem: - *output = apps::mojom::InstallSource::kOem; + *output = apps::mojom::InstallReason::kOem; return true; case crosapi::mojom::InstallSource::kDefault: - *output = apps::mojom::InstallSource::kDefault; + *output = apps::mojom::InstallReason::kDefault; return true; case crosapi::mojom::InstallSource::kSync: - *output = apps::mojom::InstallSource::kSync; + *output = apps::mojom::InstallReason::kSync; return true; case crosapi::mojom::InstallSource::kUser: - *output = apps::mojom::InstallSource::kUser; + *output = apps::mojom::InstallReason::kUser; return true; }
diff --git a/chromeos/crosapi/mojom/app_service_types_mojom_traits.h b/chromeos/crosapi/mojom/app_service_types_mojom_traits.h index 101b3fd..e038116 100644 --- a/chromeos/crosapi/mojom/app_service_types_mojom_traits.h +++ b/chromeos/crosapi/mojom/app_service_types_mojom_traits.h
@@ -70,9 +70,9 @@ return r->install_time; } - static const apps::mojom::InstallSource& install_source( + static const apps::mojom::InstallReason& install_source( const apps::mojom::AppPtr& r) { - return r->install_source; + return r->install_reason; } static const apps::mojom::OptionalBool& recommendable( @@ -160,11 +160,11 @@ }; template <> -struct EnumTraits<crosapi::mojom::InstallSource, apps::mojom::InstallSource> { +struct EnumTraits<crosapi::mojom::InstallSource, apps::mojom::InstallReason> { static crosapi::mojom::InstallSource ToMojom( - apps::mojom::InstallSource input); + apps::mojom::InstallReason input); static bool FromMojom(crosapi::mojom::InstallSource input, - apps::mojom::InstallSource* output); + apps::mojom::InstallReason* output); }; template <>
diff --git a/chromeos/crosapi/mojom/app_service_types_traits_unittest.cc b/chromeos/crosapi/mojom/app_service_types_traits_unittest.cc index de7220c..a596293 100644 --- a/chromeos/crosapi/mojom/app_service_types_traits_unittest.cc +++ b/chromeos/crosapi/mojom/app_service_types_traits_unittest.cc
@@ -35,7 +35,7 @@ input->last_launch_time = base::Time() + base::TimeDelta::FromDays(1); input->install_time = base::Time() + base::TimeDelta::FromDays(2); - input->install_source = apps::mojom::InstallSource::kUser; + input->install_reason = apps::mojom::InstallReason::kUser; input->recommendable = apps::mojom::OptionalBool::kTrue; input->searchable = apps::mojom::OptionalBool::kTrue; input->paused = apps::mojom::OptionalBool::kFalse; @@ -77,7 +77,7 @@ base::Time() + base::TimeDelta::FromDays(1)); EXPECT_EQ(output->install_time, base::Time() + base::TimeDelta::FromDays(2)); - EXPECT_EQ(output->install_source, apps::mojom::InstallSource::kUser); + EXPECT_EQ(output->install_reason, apps::mojom::InstallReason::kUser); EXPECT_EQ(output->recommendable, apps::mojom::OptionalBool::kTrue); EXPECT_EQ(output->searchable, apps::mojom::OptionalBool::kTrue); EXPECT_EQ(output->paused, apps::mojom::OptionalBool::kFalse); @@ -112,7 +112,7 @@ input->readiness = apps::mojom::Readiness::kReady; input->additional_search_terms = {"1", "2"}; - input->install_source = apps::mojom::InstallSource::kUser; + input->install_reason = apps::mojom::InstallReason::kUser; input->recommendable = apps::mojom::OptionalBool::kTrue; input->searchable = apps::mojom::OptionalBool::kTrue; input->paused = apps::mojom::OptionalBool::kFalse; @@ -139,7 +139,7 @@ EXPECT_EQ(output->readiness, apps::mojom::Readiness::kReady); EXPECT_EQ(output->additional_search_terms, input->additional_search_terms); - EXPECT_EQ(output->install_source, apps::mojom::InstallSource::kUser); + EXPECT_EQ(output->install_reason, apps::mojom::InstallReason::kUser); EXPECT_EQ(output->recommendable, apps::mojom::OptionalBool::kTrue); EXPECT_EQ(output->searchable, apps::mojom::OptionalBool::kTrue); EXPECT_EQ(output->paused, apps::mojom::OptionalBool::kFalse); @@ -270,57 +270,57 @@ } // Test that serialization and deserialization works with updating install -// source. +// reason. TEST(AppServiceTypesTraitsTest, RoundTripInstallSource) { apps::mojom::AppPtr input = apps::mojom::App::New(); { - input->install_source = apps::mojom::InstallSource::kUnknown; + input->install_reason = apps::mojom::InstallReason::kUnknown; apps::mojom::AppPtr output; ASSERT_TRUE(mojo::test::SerializeAndDeserialize<crosapi::mojom::App>( input, output)); - EXPECT_EQ(output->install_source, apps::mojom::InstallSource::kUnknown); + EXPECT_EQ(output->install_reason, apps::mojom::InstallReason::kUnknown); } { - input->install_source = apps::mojom::InstallSource::kSystem; + input->install_reason = apps::mojom::InstallReason::kSystem; apps::mojom::AppPtr output; ASSERT_TRUE(mojo::test::SerializeAndDeserialize<crosapi::mojom::App>( input, output)); - EXPECT_EQ(output->install_source, apps::mojom::InstallSource::kSystem); + EXPECT_EQ(output->install_reason, apps::mojom::InstallReason::kSystem); } { - input->install_source = apps::mojom::InstallSource::kPolicy; + input->install_reason = apps::mojom::InstallReason::kPolicy; apps::mojom::AppPtr output; ASSERT_TRUE(mojo::test::SerializeAndDeserialize<crosapi::mojom::App>( input, output)); - EXPECT_EQ(output->install_source, apps::mojom::InstallSource::kPolicy); + EXPECT_EQ(output->install_reason, apps::mojom::InstallReason::kPolicy); } { - input->install_source = apps::mojom::InstallSource::kOem; + input->install_reason = apps::mojom::InstallReason::kOem; apps::mojom::AppPtr output; ASSERT_TRUE(mojo::test::SerializeAndDeserialize<crosapi::mojom::App>( input, output)); - EXPECT_EQ(output->install_source, apps::mojom::InstallSource::kOem); + EXPECT_EQ(output->install_reason, apps::mojom::InstallReason::kOem); } { - input->install_source = apps::mojom::InstallSource::kDefault; + input->install_reason = apps::mojom::InstallReason::kDefault; apps::mojom::AppPtr output; ASSERT_TRUE(mojo::test::SerializeAndDeserialize<crosapi::mojom::App>( input, output)); - EXPECT_EQ(output->install_source, apps::mojom::InstallSource::kDefault); + EXPECT_EQ(output->install_reason, apps::mojom::InstallReason::kDefault); } { - input->install_source = apps::mojom::InstallSource::kSync; + input->install_reason = apps::mojom::InstallReason::kSync; apps::mojom::AppPtr output; ASSERT_TRUE(mojo::test::SerializeAndDeserialize<crosapi::mojom::App>( input, output)); - EXPECT_EQ(output->install_source, apps::mojom::InstallSource::kSync); + EXPECT_EQ(output->install_reason, apps::mojom::InstallReason::kSync); } { - input->install_source = apps::mojom::InstallSource::kUser; + input->install_reason = apps::mojom::InstallReason::kUser; apps::mojom::AppPtr output; ASSERT_TRUE(mojo::test::SerializeAndDeserialize<crosapi::mojom::App>( input, output)); - EXPECT_EQ(output->install_source, apps::mojom::InstallSource::kUser); + EXPECT_EQ(output->install_reason, apps::mojom::InstallReason::kUser); } }
diff --git a/components/app_restore/arc_read_handler.cc b/components/app_restore/arc_read_handler.cc index 4e69d16..90ccc3d2 100644 --- a/components/app_restore/arc_read_handler.cc +++ b/components/app_restore/arc_read_handler.cc
@@ -8,15 +8,17 @@ #include "base/containers/contains.h" #include "components/app_restore/app_launch_info.h" #include "components/app_restore/full_restore_info.h" -#include "components/app_restore/full_restore_read_handler.h" #include "components/app_restore/window_info.h" #include "components/app_restore/window_properties.h" #include "ui/aura/window.h" namespace full_restore { -ArcReadHandler::ArcReadHandler(const base::FilePath& profile_path) - : profile_path_(profile_path) {} +ArcReadHandler::ArcReadHandler(const base::FilePath& profile_path, + Delegate* delegate) + : profile_path_(profile_path), delegate_(delegate) { + DCHECK(delegate_); +} ArcReadHandler::~ArcReadHandler() = default; @@ -98,8 +100,7 @@ if (restore_window_id == 0) return nullptr; - return FullRestoreReadHandler::GetInstance()->GetAppLaunchInfo( - profile_path_, app_id, restore_window_id); + return delegate_->GetAppLaunchInfo(profile_path_, app_id, restore_window_id); } std::unique_ptr<app_restore::WindowInfo> ArcReadHandler::GetWindowInfo( @@ -111,8 +112,10 @@ if (it == window_id_to_app_id_.end()) return nullptr; - auto window_info = FullRestoreReadHandler::GetInstance()->GetWindowInfo( - profile_path_, it->second, restore_window_id); + std::unique_ptr<app_restore::WindowInfo> window_info = + delegate_->GetWindowInfo(profile_path_, it->second, restore_window_id); + if (!window_info) + return nullptr; // For ARC windows, Android can restore window bounds, so remove the window // bounds from the window info. @@ -180,9 +183,7 @@ if (it == window_id_to_app_id_.end()) return; - const std::string& app_id = it->second; - FullRestoreReadHandler::GetInstance()->RemoveAppRestoreData( - profile_path_, app_id, window_id); + delegate_->RemoveAppRestoreData(profile_path_, it->second, window_id); window_id_to_app_id_.erase(it); } @@ -209,10 +210,8 @@ // info. std::unique_ptr<app_restore::WindowInfo> window_info = GetWindowInfo(restore_window_id); - if (window_info) { - FullRestoreReadHandler::GetInstance()->ApplyProperties(window_info.get(), - *window_it); - } + if (window_info) + delegate_->ApplyProperties(window_info.get(), *window_it); } // Remove the window from the hidden container.
diff --git a/components/app_restore/arc_read_handler.h b/components/app_restore/arc_read_handler.h index 20d1bab..55cb4a0 100644 --- a/components/app_restore/arc_read_handler.h +++ b/components/app_restore/arc_read_handler.h
@@ -24,11 +24,46 @@ namespace full_restore { -// ArcReadHandler is a helper class for FullRestoreReadHandler to handle ARC app -// windows special cases, e.g. ARC task creation, ARC session id, etc. +// ArcReadHandler is a helper class for a Delegate to read the app and window +// info of ARC apps, which have special cases, e.g. ARC task creation, ARC +// session id, etc. class COMPONENT_EXPORT(APP_RESTORE) ArcReadHandler { public: - explicit ArcReadHandler(const base::FilePath& profile_path); + // A delegate class which allows an owner of ArcReadHandler to have some + // specific behavior. + class Delegate { + public: + virtual ~Delegate() = default; + + // Gets the app launch information from `profile_path` for `app_id` and + // `restore_window_id`. + virtual std::unique_ptr<app_restore::AppLaunchInfo> GetAppLaunchInfo( + const base::FilePath& profile_path, + const std::string& app_id, + int32_t restore_window_id) = 0; + + // Gets the window information from `profile_path` for `app_id` and + // `restore_window_id`. + virtual std::unique_ptr<app_restore::WindowInfo> GetWindowInfo( + const base::FilePath& profile_path, + const std::string& app_id, + int32_t restore_window_id) = 0; + + // Removes AppRestoreData from `profile_path` for `app_id` and + // `restore_window_id`. + virtual void RemoveAppRestoreData(const base::FilePath& profile_path, + const std::string& app_id, + int32_t restore_window_id) = 0; + + // Applies properties from `window_info` to the given `property_handler`. + // This is called from `GetWindowInfo()` when a full restore window is + // created, or from `arc_read_handler_` when a task is ready for a full + // restore window that has already been created. + virtual void ApplyProperties(app_restore::WindowInfo* window_info, + ui::PropertyHandler* property_handler) = 0; + }; + + ArcReadHandler(const base::FilePath& profile_path, Delegate* delegate); ArcReadHandler(const ArcReadHandler&) = delete; ArcReadHandler& operator=(const ArcReadHandler&) = delete; ~ArcReadHandler(); @@ -115,6 +150,8 @@ // process. Once the window is created for the task, the window can be removed // from the hidden container. std::set<int32_t> not_restored_task_ids_; + + Delegate* delegate_; }; } // namespace full_restore
diff --git a/components/app_restore/full_restore_read_handler.cc b/components/app_restore/full_restore_read_handler.cc index cbe5449..7b14ad2 100644 --- a/components/app_restore/full_restore_read_handler.cc +++ b/components/app_restore/full_restore_read_handler.cc
@@ -85,6 +85,69 @@ RemoveAppRestoreData(restore_window_id); } +std::unique_ptr<app_restore::AppLaunchInfo> +FullRestoreReadHandler::GetAppLaunchInfo(const base::FilePath& profile_path, + const std::string& app_id, + int32_t restore_window_id) { + auto* restore_data = GetRestoreData(profile_path); + if (!restore_data) + return nullptr; + + return restore_data->GetAppLaunchInfo(app_id, restore_window_id); +} + +std::unique_ptr<app_restore::WindowInfo> FullRestoreReadHandler::GetWindowInfo( + const base::FilePath& profile_path, + const std::string& app_id, + int32_t restore_window_id) { + auto* restore_data = GetRestoreData(profile_path); + if (!restore_data) + return nullptr; + + return restore_data->GetWindowInfo(app_id, restore_window_id); +} + +void FullRestoreReadHandler::RemoveAppRestoreData( + const base::FilePath& profile_path, + const std::string& app_id, + int32_t restore_window_id) { + auto* restore_data = GetRestoreData(profile_path); + if (!restore_data) + return; + + restore_data->RemoveAppRestoreData(app_id, restore_window_id); +} + +void FullRestoreReadHandler::ApplyProperties( + app_restore::WindowInfo* window_info, + ui::PropertyHandler* property_handler) { + DCHECK(window_info); + DCHECK(property_handler); + + // Create a clone so `property_handler` can have complete ownership of a copy + // of WindowInfo. + app_restore::WindowInfo* window_info_clone = window_info->Clone(); + property_handler->SetProperty(app_restore::kWindowInfoKey, window_info_clone); + + if (window_info->activation_index) { + const int32_t index = *window_info->activation_index; + // kActivationIndexKey is owned, which allows for passing in this raw + // pointer. + property_handler->SetProperty(app_restore::kActivationIndexKey, + std::make_unique<int32_t>(index)); + // Windows opened from full restore should not be activated. Widgets that + // are shown are activated by default. Force the widget to not be + // activatable; the activation will be restored in ash once the window is + // launched. + property_handler->SetProperty(app_restore::kLaunchedFromFullRestoreKey, + true); + } + if (window_info->pre_minimized_show_state_type) { + property_handler->SetProperty(aura::client::kPreMinimizedShowStateKey, + *window_info->pre_minimized_show_state_type); + } +} + void FullRestoreReadHandler::SetActiveProfilePath( const base::FilePath& profile_path) { active_profile_path_ = profile_path; @@ -155,17 +218,6 @@ restore_data->RemoveApp(app_id); } -void FullRestoreReadHandler::RemoveAppRestoreData( - const base::FilePath& profile_path, - const std::string& app_id, - int32_t restore_window_id) { - auto* restore_data = GetRestoreData(profile_path); - if (!restore_data) - return; - - restore_data->RemoveAppRestoreData(app_id, restore_window_id); -} - bool FullRestoreReadHandler::HasAppTypeBrowser( const base::FilePath& profile_path) { auto* restore_data = GetRestoreData(profile_path); @@ -311,36 +363,6 @@ arc_read_handler_->SetArcSessionIdForWindowId(arc_session_id, window_id); } -void FullRestoreReadHandler::ApplyProperties( - app_restore::WindowInfo* window_info, - ui::PropertyHandler* property_handler) { - DCHECK(window_info); - DCHECK(property_handler); - - // Create a clone so `property_handler` can have complete ownership of a copy - // of WindowInfo. - app_restore::WindowInfo* window_info_clone = window_info->Clone(); - property_handler->SetProperty(app_restore::kWindowInfoKey, window_info_clone); - - if (window_info->activation_index) { - const int32_t index = *window_info->activation_index; - // kActivationIndexKey is owned, which allows for passing in this raw - // pointer. - property_handler->SetProperty(app_restore::kActivationIndexKey, - std::make_unique<int32_t>(index)); - // Windows opened from full restore should not be activated. Widgets that - // are shown are activated by default. Force the widget to not be - // activatable; the activation will be restored in ash once the window is - // launched. - property_handler->SetProperty(app_restore::kLaunchedFromFullRestoreKey, - true); - } - if (window_info->pre_minimized_show_state_type) { - property_handler->SetProperty(aura::client::kPreMinimizedShowStateKey, - *window_info->pre_minimized_show_state_type); - } -} - void FullRestoreReadHandler::AddChromeBrowserLaunchInfoForTesting( const base::FilePath& profile_path) { auto session_id = SessionID::NewUnique(); @@ -360,28 +382,6 @@ std::make_pair(profile_path, extension_misc::kChromeAppId); } -std::unique_ptr<app_restore::AppLaunchInfo> -FullRestoreReadHandler::GetAppLaunchInfo(const base::FilePath& profile_path, - const std::string& app_id, - int32_t restore_window_id) { - auto* restore_data = GetRestoreData(profile_path); - if (!restore_data) - return nullptr; - - return restore_data->GetAppLaunchInfo(app_id, restore_window_id); -} - -std::unique_ptr<app_restore::WindowInfo> FullRestoreReadHandler::GetWindowInfo( - const base::FilePath& profile_path, - const std::string& app_id, - int32_t restore_window_id) { - auto* restore_data = GetRestoreData(profile_path); - if (!restore_data) - return nullptr; - - return restore_data->GetWindowInfo(app_id, restore_window_id); -} - std::unique_ptr<app_restore::WindowInfo> FullRestoreReadHandler::GetWindowInfo( int32_t restore_window_id) { if (!SessionID::IsValidValue(restore_window_id)) @@ -411,8 +411,10 @@ int32_t window_id = data_it->first; // Only ARC app launch parameters have event_flag. if (data_it->second->event_flag.has_value()) { - if (!arc_read_handler_) - arc_read_handler_ = std::make_unique<ArcReadHandler>(profile_path); + if (!arc_read_handler_) { + arc_read_handler_ = + std::make_unique<ArcReadHandler>(profile_path, this); + } arc_read_handler_->AddRestoreData(app_id, window_id); } else { window_id_to_app_restore_info_[window_id] =
diff --git a/components/app_restore/full_restore_read_handler.h b/components/app_restore/full_restore_read_handler.h index 530a6fe..488bf0b6 100644 --- a/components/app_restore/full_restore_read_handler.h +++ b/components/app_restore/full_restore_read_handler.h
@@ -47,7 +47,8 @@ // actual reading. class COMPONENT_EXPORT(APP_RESTORE) FullRestoreReadHandler : public aura::EnvObserver, - public aura::WindowObserver { + public aura::WindowObserver, + public ArcReadHandler::Delegate { public: // The callback function to get the restore data when the reading operation is // done. @@ -67,6 +68,21 @@ // aura::WindowObserver: void OnWindowDestroyed(aura::Window* window) override; + // ArcReadHandler::Delegate: + std::unique_ptr<app_restore::AppLaunchInfo> GetAppLaunchInfo( + const base::FilePath& profile_path, + const std::string& app_id, + int32_t restore_window_id) override; + std::unique_ptr<app_restore::WindowInfo> GetWindowInfo( + const base::FilePath& profile_path, + const std::string& app_id, + int32_t restore_window_id) override; + void RemoveAppRestoreData(const base::FilePath& profile_path, + const std::string& app_id, + int32_t restore_window_id) override; + void ApplyProperties(app_restore::WindowInfo* window_info, + ui::PropertyHandler* property_handler) override; + void SetActiveProfilePath(const base::FilePath& profile_path); // Sets whether we should check the restore data for `profile_path`. If the @@ -95,12 +111,6 @@ // from |profile_path_to_restore_data_| for |profile_path| . void RemoveApp(const base::FilePath& profile_path, const std::string& app_id); - // Removes AppRestoreData from |profile_path| for |app_id| and - // |restore_window_id|. - void RemoveAppRestoreData(const base::FilePath& profile_path, - const std::string& app_id, - int32_t restore_window_id); - // Returns true if there are app type browsers from the full restore file. // Otherwise, returns false. bool HasAppTypeBrowser(const base::FilePath& profile_path); @@ -146,37 +156,15 @@ // |arc session id| is assigned when ARC apps are restored. void SetArcSessionIdForWindowId(int32_t arc_session_id, int32_t window_id); - // Applies properties from `window_info` to the given `property_handler`. This - // is called from `GetWindowInfo()` when a full restore window is created, or - // from `arc_read_handler_` when a task is ready for a full restore window - // that has already been created. - void ApplyProperties(app_restore::WindowInfo* window_info, - ui::PropertyHandler* property_handler); - void AddChromeBrowserLaunchInfoForTesting(const base::FilePath& profile_path); private: - friend class ArcReadHandler; friend class ash::full_restore::FullRestoreAppLaunchHandlerBrowserTest; friend class ash::full_restore:: FullRestoreAppLaunchHandlerSystemWebAppsBrowserTest; friend class ash::full_restore::FullRestoreServiceTestHavingFullRestoreFile; friend class FullRestoreReadHandlerTestApi; - // Gets the app launch information from `profile_path` for `app_id` and - // `restore_window_id`. - std::unique_ptr<app_restore::AppLaunchInfo> GetAppLaunchInfo( - const base::FilePath& profile_path, - const std::string& app_id, - int32_t restore_window_id); - - // Gets the window information from `profile_path` for `app_id` and - // `restore_window_id`. - std::unique_ptr<app_restore::WindowInfo> GetWindowInfo( - const base::FilePath& profile_path, - const std::string& app_id, - int32_t restore_window_id); - // Gets the window information for |restore_window_id| for browser windows and // Chrome app windows only. This interface can't be used for ARC app windows. std::unique_ptr<app_restore::WindowInfo> GetWindowInfo(
diff --git a/components/autofill/core/browser/address_profile_save_manager_unittest.cc b/components/autofill/core/browser/address_profile_save_manager_unittest.cc index 401d2ef..ed5bc46 100644 --- a/components/autofill/core/browser/address_profile_save_manager_unittest.cc +++ b/components/autofill/core/browser/address_profile_save_manager_unittest.cc
@@ -4,6 +4,7 @@ #include "components/autofill/core/browser/address_profile_save_manager.h" +#include "base/strings/strcat.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" @@ -328,6 +329,23 @@ test_scenario.expected_affeceted_types_in_merge_for_metrics) { histogram_tester.ExpectBucketCount(kProfileUpdateAffectedTypesHistogram, changed_type, 1); + std::string changed_histogram_suffix; + switch (test_scenario.user_decision) { + case UserDecision::kAccepted: + changed_histogram_suffix = ".Accepted"; + break; + + case UserDecision::kDeclined: + changed_histogram_suffix = ".Declined"; + break; + + default: + NOTREACHED() << "Decision not covered by test logic."; + } + histogram_tester.ExpectBucketCount( + base::StrCat({kProfileUpdateAffectedTypesHistogram, + changed_histogram_suffix}), + changed_type, 1); } histogram_tester.ExpectUniqueSample(
diff --git a/components/autofill/core/browser/autofill_metrics.cc b/components/autofill/core/browser/autofill_metrics.cc index 69417aa..9c17c0d 100644 --- a/components/autofill/core/browser/autofill_metrics.cc +++ b/components/autofill/core/browser/autofill_metrics.cc
@@ -152,6 +152,36 @@ } } +const char* GetSaveAndUpdatePromptDecisionMetricsSuffix( + AutofillClient::SaveAddressProfileOfferUserDecision decision) { + switch (decision) { + case AutofillClient::SaveAddressProfileOfferUserDecision::kUndefined: + return ".Undefined"; + case AutofillClient::SaveAddressProfileOfferUserDecision::kUserNotAsked: + return ".UserNotAsked"; + case AutofillClient::SaveAddressProfileOfferUserDecision::kAccepted: + return ".Accepted"; + case AutofillClient::SaveAddressProfileOfferUserDecision::kDeclined: + return ".Declined"; + case AutofillClient::SaveAddressProfileOfferUserDecision::kEditAccepted: + return ".EditAccepted"; + case AutofillClient::SaveAddressProfileOfferUserDecision::kEditDeclined: + return ".EditDeclined"; + case AutofillClient::SaveAddressProfileOfferUserDecision::kNever: + return ".Never"; + case AutofillClient::SaveAddressProfileOfferUserDecision::kIgnored: + return ".Ignored"; + case AutofillClient::SaveAddressProfileOfferUserDecision::kMessageTimeout: + return ".MessageTimeout"; + case AutofillClient::SaveAddressProfileOfferUserDecision::kMessageDeclined: + return ".MessageDeclined"; + case AutofillClient::SaveAddressProfileOfferUserDecision::kAutoDeclined: + return ".AutoDeclined"; + } + NOTREACHED(); + return ""; +} + } // namespace // First, translates |field_type| to the corresponding logical |group| from @@ -2814,9 +2844,27 @@ } void AutofillMetrics::LogProfileUpdateAffectedType( - ServerFieldType affected_type) { + ServerFieldType affected_type, + AutofillClient::SaveAddressProfileOfferUserDecision decision) { + // TODO(crbug.com/1253798): Remove the special-case metric in favor of more + // general one once the majority of clients contribute to the more general + // one. + if (decision == + AutofillClient::SaveAddressProfileOfferUserDecision::kAccepted) { + base::UmaHistogramEnumeration( + "Autofill.ProfileImport.UpdateProfileAffectedType", + ConvertSettingsVisibleFieldTypeForMetrics(affected_type)); + } + + // Record the decision-specific metric. base::UmaHistogramEnumeration( - "Autofill.ProfileImport.UpdateProfileAffectedType", + base::StrCat({"Autofill.ProfileImport.UpdateProfileAffectedType", + GetSaveAndUpdatePromptDecisionMetricsSuffix(decision)}), + ConvertSettingsVisibleFieldTypeForMetrics(affected_type)); + + // But also collect an histogram for any decision. + base::UmaHistogramEnumeration( + "Autofill.ProfileImport.UpdateProfileAffectedType.Any", ConvertSettingsVisibleFieldTypeForMetrics(affected_type)); } @@ -2834,9 +2882,27 @@ } void AutofillMetrics::LogUpdateProfileNumberOfAffectedFields( - int number_of_edited_fields) { + int number_of_edited_fields, + AutofillClient::SaveAddressProfileOfferUserDecision decision) { + // TODO(crbug.com/1253798): Remove the special-case metric in favor of more + // general one once the majority of clients contribute to the more general + // one. + if (decision == + AutofillClient::SaveAddressProfileOfferUserDecision::kAccepted) { + base::UmaHistogramExactLinear( + "Autofill.ProfileImport.UpdateProfileNumberOfAffectedFields", + number_of_edited_fields, /*exclusive_max=*/15); + } + + // Record the decision-specific metric. base::UmaHistogramExactLinear( - "Autofill.ProfileImport.UpdateProfileNumberOfAffectedFields", + base::StrCat({"Autofill.ProfileImport.UpdateProfileAffectedType", + GetSaveAndUpdatePromptDecisionMetricsSuffix(decision)}), + number_of_edited_fields, /*exclusive_max=*/15); + + // But also collect an histogram for any decision. + base::UmaHistogramExactLinear( + "Autofill.ProfileImport.UpdateProfileAffectedType.Any", number_of_edited_fields, /*exclusive_max=*/15); }
diff --git a/components/autofill/core/browser/autofill_metrics.h b/components/autofill/core/browser/autofill_metrics.h index 3f13ff3..ce07a07 100644 --- a/components/autofill/core/browser/autofill_metrics.h +++ b/components/autofill/core/browser/autofill_metrics.h
@@ -1691,9 +1691,12 @@ static void LogProfileUpdateImportDecision( AutofillClient::SaveAddressProfileOfferUserDecision decision); - // Logs that a specific type changed in a profile update which was accepted - // without manual edits. - static void LogProfileUpdateAffectedType(ServerFieldType affected_type); + // Logs that a specific type changed in a profile update that received the + // user |decision|. Note that additional manual edits in the update prompt are + // not accounted for in this metric. + static void LogProfileUpdateAffectedType( + ServerFieldType affected_type, + AutofillClient::SaveAddressProfileOfferUserDecision decision); // Logs that a specific type was edited in an update prompt. static void LogProfileUpdateEditedType(ServerFieldType edited_type); @@ -1701,10 +1704,12 @@ // Logs the number of edited fields for an accepted profile update. static void LogUpdateProfileNumberOfEditedFields(int number_of_edited_fields); - // Logs the number of changed fields for a profile update that is accepted - // without manual edits. + // Logs the number of changed fields for a profile update that received the + // user |decision|. Note that additional manual edits in the update prompt are + // not accounted for in this metric. static void LogUpdateProfileNumberOfAffectedFields( - int number_of_affected_fields); + int number_of_affected_fields, + AutofillClient::SaveAddressProfileOfferUserDecision decision); // Logs when the virtual card metadata for one card have been updated. static void LogVirtualCardMetadataSynced(bool existing_card);
diff --git a/components/autofill/core/browser/autofill_profile_import_process.cc b/components/autofill/core/browser/autofill_profile_import_process.cc index a447b2d..388df97 100644 --- a/components/autofill/core/browser/autofill_profile_import_process.cc +++ b/components/autofill/core/browser/autofill_profile_import_process.cc
@@ -55,7 +55,6 @@ return user_decision_ == UserDecision::kDeclined || user_decision_ == UserDecision::kEditDeclined || user_decision_ == UserDecision::kMessageDeclined; - ; } bool ProfileImportProcess::UserAccepted() const { @@ -257,7 +256,7 @@ edited_profile->SetRawInfoWithVerificationStatus( type, value, structured_address::VerificationStatus::kUserVerified); - }; + } } edited_profile->FinalizeAfterImport(); @@ -360,20 +359,23 @@ AutofillProfileImportType::kConfirmableMergeAndSilentUpdate) { AutofillMetrics::LogProfileUpdateImportDecision(user_decision_); - if (user_decision_ == UserDecision::kAccepted) { - DCHECK(merge_candidate_.has_value() && import_candidate_.has_value()); + DCHECK(merge_candidate_.has_value() && import_candidate_.has_value()); - const std::vector<ProfileValueDifference> merge_difference = - AutofillProfileComparator::GetSettingsVisibleProfileDifference( - import_candidate_.value(), merge_candidate_.value(), app_locale_); + // For all update prompts, log the field types and total number of fields + // that would change due to the update. Note that this does not include + // additional manual edits the user can perform in the storage dialog. + // Those are covered separately below. + const std::vector<ProfileValueDifference> merge_difference = + AutofillProfileComparator::GetSettingsVisibleProfileDifference( + import_candidate_.value(), merge_candidate_.value(), app_locale_); - for (const auto& difference : merge_difference) { - AutofillMetrics::LogProfileUpdateAffectedType(difference.type); - } - - AutofillMetrics::LogUpdateProfileNumberOfAffectedFields( - merge_difference.size()); + for (const auto& difference : merge_difference) { + AutofillMetrics::LogProfileUpdateAffectedType(difference.type, + user_decision_); } + + AutofillMetrics::LogUpdateProfileNumberOfAffectedFields( + merge_difference.size(), user_decision_); } // If the profile was edited by the user, record a histogram of edited types.
diff --git a/components/autofill/core/browser/payments/credit_card_access_manager.cc b/components/autofill/core/browser/payments/credit_card_access_manager.cc index c53a802..992c83b 100644 --- a/components/autofill/core/browser/payments/credit_card_access_manager.cc +++ b/components/autofill/core/browser/payments/credit_card_access_manager.cc
@@ -211,11 +211,11 @@ if (is_user_verifiable_.value_or(false) && !unmask_details_request_in_progress_) { unmask_details_request_in_progress_ = true; + preflight_call_timestamp_ = AutofillTickClock::NowTicks(); payments_client_->GetUnmaskDetails( base::BindOnce(&CreditCardAccessManager::OnDidGetUnmaskDetails, weak_ptr_factory_.GetWeakPtr()), personal_data_manager_->app_locale()); - preflight_call_timestamp_ = AutofillTickClock::NowTicks(); AutofillMetrics::LogCardUnmaskPreflightCalled(); } } @@ -224,8 +224,10 @@ AutofillClient::PaymentsRpcResult result, payments::PaymentsClient::UnmaskDetails& unmask_details) { // Log latency for preflight call. - AutofillMetrics::LogCardUnmaskPreflightDuration( - AutofillTickClock::NowTicks() - preflight_call_timestamp_); + if (preflight_call_timestamp_.has_value()) { + AutofillMetrics::LogCardUnmaskPreflightDuration( + AutofillTickClock::NowTicks() - *preflight_call_timestamp_); + } unmask_details_request_in_progress_ = false; unmask_details_ = unmask_details; @@ -349,67 +351,61 @@ unmasked_card_cache_[identifier] = card_info; } -UnmaskAuthFlowType CreditCardAccessManager::GetAuthenticationType( - bool get_unmask_details_returned) { - bool fido_auth_enabled = get_unmask_details_returned && +UnmaskAuthFlowType CreditCardAccessManager::GetAndLogAuthenticationType( + bool fido_information_fetched) { + UnmaskAuthFlowType flow_type; + +#if defined(OS_IOS) + // There is no FIDO auth available on iOS, so offer CVC auth immediately. + flow_type = UnmaskAuthFlowType::kCvc; +#else + // FIDO auth is enabled if payments returns FIDO enabled and local pref + // indicates that the user is opted-in. + bool fido_auth_enabled = fido_information_fetched && unmask_details_.unmask_auth_method == - AutofillClient::UnmaskAuthMethod::kFido; -#if !defined(OS_IOS) - // Even if payments return FIDO enabled, we have to double check local pref, - // because if user locally opted out, we need to fall back to CVC flow. - fido_auth_enabled &= GetOrCreateFIDOAuthenticator()->IsUserOptedIn(); + AutofillClient::UnmaskAuthMethod::kFido && + GetOrCreateFIDOAuthenticator()->IsUserOptedIn(); + if (!fido_auth_enabled) { + // If FIDO auth is not enabled we offer CVC auth. + flow_type = UnmaskAuthFlowType::kCvc; + } else if (!IsSelectedCardFidoAuthorized()) { + // If FIDO auth is enabled but the card has not been authorized for FIDO, we + // offer CVC auth followed with a FIDO authorization. + flow_type = UnmaskAuthFlowType::kCvcThenFido; + } else if (!card_->IsExpired(AutofillClock::Now())) { + // If the FIDO auth is enabled and card has been authorized and card is not + // expired, we offer FIDO auth. + flow_type = UnmaskAuthFlowType::kFido; + } else { + // For other cases we offer CVC auth as well. E.g. A card that has been + // authorized but is expired. + flow_type = UnmaskAuthFlowType::kCvc; + } #endif - bool card_is_authorized_for_fido = - fido_auth_enabled && IsSelectedCardFidoAuthorized(); + // If FIDO auth was suggested, log which authentication method was actually + // used. + if (flow_type == UnmaskAuthFlowType::kFido) { + AutofillMetrics::LogCardUnmaskTypeDecision( + AutofillMetrics::CardUnmaskTypeDecisionMetric::kFidoOnly); + } else if (flow_type == UnmaskAuthFlowType::kCvcThenFido) { + AutofillMetrics::LogCardUnmaskTypeDecision( + AutofillMetrics::CardUnmaskTypeDecisionMetric::kCvcThenFido); + } - // If FIDO authentication was suggested, but card is not in authorized list, - // must authenticate with CVC followed by FIDO in order to authorize this card - // for future FIDO use. - bool should_follow_up_cvc_with_fido_auth = - fido_auth_enabled && !card_is_authorized_for_fido; - - // Only use FIDO if card is authorized and not expired. - bool card_is_eligible_for_fido = - card_is_authorized_for_fido && !card_->IsExpired(AutofillClock::Now()); - - if (card_is_eligible_for_fido) - return UnmaskAuthFlowType::kFido; - if (should_follow_up_cvc_with_fido_auth) - return UnmaskAuthFlowType::kCvcThenFido; - return UnmaskAuthFlowType::kCvc; + return flow_type; } -void CreditCardAccessManager::Authenticate(bool get_unmask_details_returned) { +void CreditCardAccessManager::Authenticate(bool fido_information_fetched) { // Reset now that we have started authentication. ready_to_start_authentication_.Reset(); unmask_details_request_in_progress_ = false; - // If the user had to wait for Unmask Details, log the latency. - if (card_selected_without_unmask_details_timestamp_.has_value()) { - AutofillMetrics::LogUserPerceivedLatencyOnCardSelectionDuration( - AutofillTickClock::NowTicks() - - card_selected_without_unmask_details_timestamp_.value()); - AutofillMetrics::LogUserPerceivedLatencyOnCardSelectionTimedOut( - /*did_time_out=*/!get_unmask_details_returned); - card_selected_without_unmask_details_timestamp_ = absl::nullopt; - } - - unmask_auth_flow_type_ = GetAuthenticationType(get_unmask_details_returned); + unmask_auth_flow_type_ = + GetAndLogAuthenticationType(fido_information_fetched); form_event_logger_->LogCardUnmaskAuthenticationPromptShown( unmask_auth_flow_type_); - // If FIDO auth was suggested, logging which authentication method was - // actually used. - if (unmask_auth_flow_type_ == UnmaskAuthFlowType::kFido) { - AutofillMetrics::LogCardUnmaskTypeDecision( - AutofillMetrics::CardUnmaskTypeDecisionMetric::kFidoOnly); - } - if (unmask_auth_flow_type_ == UnmaskAuthFlowType::kCvcThenFido) { - AutofillMetrics::LogCardUnmaskTypeDecision( - AutofillMetrics::CardUnmaskTypeDecisionMetric::kCvcThenFido); - } - if (unmask_auth_flow_type_ == UnmaskAuthFlowType::kFido) { #if defined(OS_IOS) NOTREACHED(); @@ -418,15 +414,18 @@ // been cancelled via the verify pending dialog. Do not run // CreditCardFIDOAuthenticator::Authenticate in this case (should not fall // back to CVC auth either). - if (!is_authentication_in_progress_) + if (!is_authentication_in_progress_) { + Reset(); return; + } DCHECK(unmask_details_.fido_request_options.has_value()); GetOrCreateFIDOAuthenticator()->Authenticate( card_.get(), weak_ptr_factory_.GetWeakPtr(), std::move(unmask_details_.fido_request_options.value())); #endif - } else { + } else if (unmask_auth_flow_type_ == UnmaskAuthFlowType::kCvcThenFido || + unmask_auth_flow_type_ == UnmaskAuthFlowType::kCvc) { #if !defined(OS_ANDROID) && !defined(OS_IOS) // Close the Webauthn verify pending dialog if it enters CVC authentication // flow since the card unmask prompt will pop up. @@ -434,6 +433,10 @@ #endif GetOrCreateCVCAuthenticator()->Authenticate( card_.get(), weak_ptr_factory_.GetWeakPtr(), personal_data_manager_); + } else { + // Run into other unexpected types. + NOTREACHED(); + Reset(); } } @@ -768,9 +771,10 @@ AutofillTickClock::NowTicks(); // Wait for |ready_to_start_authentication_| to be signaled by - // OnDidGetUnmaskDetails() or until timeout before calling Authenticate(). + // OnDidGetUnmaskDetails() or until timeout before calling + // OnStopWaitingForUnmaskDetails(). ready_to_start_authentication_.OnEventOrTimeOut( - base::BindOnce(&CreditCardAccessManager::Authenticate, + base::BindOnce(&CreditCardAccessManager::OnStopWaitingForUnmaskDetails, weak_ptr_factory_.GetWeakPtr()), base::TimeDelta::FromMilliseconds(kUnmaskDetailsResponseTimeoutMs)); } else { @@ -850,4 +854,38 @@ // the error type. } +void CreditCardAccessManager::OnStopWaitingForUnmaskDetails( + bool get_unmask_details_returned) { + // If the user had to wait for Unmask Details, log the latency. + if (card_selected_without_unmask_details_timestamp_.has_value()) { + AutofillMetrics::LogUserPerceivedLatencyOnCardSelectionDuration( + AutofillTickClock::NowTicks() - + card_selected_without_unmask_details_timestamp_.value()); + AutofillMetrics::LogUserPerceivedLatencyOnCardSelectionTimedOut( + /*did_time_out=*/!get_unmask_details_returned); + card_selected_without_unmask_details_timestamp_ = absl::nullopt; + } + + // Start the authentication after the wait ends. + Authenticate(get_unmask_details_returned); +} + +void CreditCardAccessManager::Reset() { + unmask_auth_flow_type_ = UnmaskAuthFlowType::kNone; + is_authentication_in_progress_ = false; + preflight_call_timestamp_ = absl::nullopt; + card_selected_without_unmask_details_timestamp_ = absl::nullopt; + is_user_verifiable_called_timestamp_ = absl::nullopt; +#if !defined(OS_IOS) + opt_in_intention_ = UserOptInIntention::kUnspecified; +#endif + unmask_details_ = payments::PaymentsClient::UnmaskDetails(); + unmask_request_details_ = payments::PaymentsClient::UnmaskRequestDetails(); + ready_to_start_authentication_.Reset(); + can_fetch_unmask_details_ = true; + card_ = nullptr; + cvc_ = std::u16string(); + unmask_details_request_in_progress_ = false; +} + } // namespace autofill
diff --git a/components/autofill/core/browser/payments/credit_card_access_manager.h b/components/autofill/core/browser/payments/credit_card_access_manager.h index feaa79f..193126a 100644 --- a/components/autofill/core/browser/payments/credit_card_access_manager.h +++ b/components/autofill/core/browser/payments/credit_card_access_manager.h
@@ -209,15 +209,14 @@ AutofillClient::PaymentsRpcResult result, payments::PaymentsClient::UnmaskDetails& unmask_details); - // Determines what form of authentication is required. - UnmaskAuthFlowType GetAuthenticationType(bool get_unmask_details_returned); + // Determines what form of authentication is required and log it. + UnmaskAuthFlowType GetAndLogAuthenticationType(bool fido_information_fetched); - // If OnDidGetUnmaskDetails() was invoked by PaymentsClient, then - // |get_unmask_details_returned| should be set to true. Based on the - // contents of |unmask_details_|, either FIDO authentication or CVC - // authentication will be prompted. If |get_unmask_details_returned| is false, - // then only CVC authentication will be prompted. - void Authenticate(bool get_unmask_details_returned = false); + // Start the authentication process. |fido_information_fetched| suggests + // whether necessary information to perform FIDO authentication has been + // fetched. If |fido_information_fetched| is false, then only CVC + // authentication will be prompted. + void Authenticate(bool fido_information_fetched = false); // CreditCardCVCAuthenticator::Requester: void OnCVCAuthenticationComplete( @@ -293,6 +292,14 @@ AutofillClient::PaymentsRpcResult result, payments::PaymentsClient::UnmaskResponseDetails& response_details); + // Invoked when CreditCardAccessManager stops waiting for UnmaskDetails to + // return. If OnDidGetUnmaskDetails() has been invoked, + // |get_unmask_details_returned| should be set to true. + void OnStopWaitingForUnmaskDetails(bool get_unmask_details_returned); + + // Reset all the member variables of |this| and restore initial states. + void Reset(); + // The current form of authentication in progress. UnmaskAuthFlowType unmask_auth_flow_type_ = UnmaskAuthFlowType::kNone; @@ -319,15 +326,14 @@ CreditCardFormEventLogger* form_event_logger_; // Timestamp used for preflight call metrics. - base::TimeTicks preflight_call_timestamp_; + absl::optional<base::TimeTicks> preflight_call_timestamp_; // Timestamp used for user-perceived latency metrics. absl::optional<base::TimeTicks> card_selected_without_unmask_details_timestamp_; // Timestamp for when fido_authenticator_->IsUserVerifiable() is called. - absl::optional<base::TimeTicks> is_user_verifiable_called_timestamp_ = - absl::nullopt; + absl::optional<base::TimeTicks> is_user_verifiable_called_timestamp_; // Authenticators for card unmasking. std::unique_ptr<CreditCardCVCAuthenticator> cvc_authenticator_;
diff --git a/components/autofill/core/browser/payments/payments_client.cc b/components/autofill/core/browser/payments/payments_client.cc index 7102673b..9f6303b5 100644 --- a/components/autofill/core/browser/payments/payments_client.cc +++ b/components/autofill/core/browser/payments/payments_client.cc
@@ -1159,6 +1159,11 @@ PaymentsClient::UnmaskRequestDetails::UnmaskRequestDetails() = default; PaymentsClient::UnmaskRequestDetails::UnmaskRequestDetails( const UnmaskRequestDetails& other) { + *this = other; +} +PaymentsClient::UnmaskRequestDetails& +PaymentsClient::UnmaskRequestDetails::operator=( + const PaymentsClient::UnmaskRequestDetails& other) { billing_customer_number = other.billing_customer_number; reason = other.reason; card = other.card; @@ -1172,6 +1177,7 @@ context_token = other.context_token; otp = other.otp; last_committed_url_origin = other.last_committed_url_origin; + return *this; } PaymentsClient::UnmaskRequestDetails::~UnmaskRequestDetails() = default;
diff --git a/components/autofill/core/browser/payments/payments_client.h b/components/autofill/core/browser/payments/payments_client.h index 4c20015c..9cf07e3 100644 --- a/components/autofill/core/browser/payments/payments_client.h +++ b/components/autofill/core/browser/payments/payments_client.h
@@ -97,6 +97,7 @@ struct UnmaskRequestDetails { UnmaskRequestDetails(); UnmaskRequestDetails(const UnmaskRequestDetails& other); + UnmaskRequestDetails& operator=(const UnmaskRequestDetails& other); ~UnmaskRequestDetails(); int64_t billing_customer_number = 0; @@ -304,7 +305,7 @@ // along with any information to facilitate the authentication. virtual void GetUnmaskDetails( base::OnceCallback<void(AutofillClient::PaymentsRpcResult, - PaymentsClient::UnmaskDetails&)> callback, + UnmaskDetails&)> callback, const std::string& app_locale); // The user has attempted to unmask a card with the given cvc. @@ -315,11 +316,9 @@ // Opts-in or opts-out the user to use FIDO authentication for card unmasking // on this device. - void OptChange( - const OptChangeRequestDetails request_details, - base::OnceCallback<void(AutofillClient::PaymentsRpcResult, - PaymentsClient::OptChangeResponseDetails&)> - callback); + void OptChange(const OptChangeRequestDetails request_details, + base::OnceCallback<void(AutofillClient::PaymentsRpcResult, + OptChangeResponseDetails&)> callback); // Determine if the user meets the Payments service's conditions for upload. // The service uses |addresses| (from which names and phone numbers are
diff --git a/components/autofill_payments_strings.grdp b/components/autofill_payments_strings.grdp index 842ae0a..93bf5bc 100644 --- a/components/autofill_payments_strings.grdp +++ b/components/autofill_payments_strings.grdp
@@ -589,4 +589,22 @@ See details </message> </if> + + <!-- Autofill Payments OTP verification dialog --> + <message name="IDS_AUTOFILL_PAYMENTS_OTP_VERIFICATION_DIALOG_TITLE" desc="Title of the OTP verification dialog which is shown to the user while unmasking a credit card." formatter_data="android_java"> + Enter Verification Code + </message> + <message name="IDS_AUTOFILL_PAYMENTS_OTP_VERIFICATION_DIALOG_CANT_FIND_CODE_MESSAGE" desc="Hint shown to the user in the event they are unable to find the OTP code." formatter_data="android_java"> + Can't find your code? <ph name="BEGIN_LINK"><link></ph>Get new code<ph name="END_LINK"></link></ph> + </message> + <message name="IDS_AUTOFILL_PAYMENTS_OTP_VERIFICATION_DIALOG_OTP_INPUT_HINT" desc="Hint shown in the OTP input field indicating the number of digits expected for the OTP." formatter_data="android_java"> + Enter <ph name="OTP_LENGTH">%1$s<ex>6</ex></ph>-digit code + </message> + <message name="IDS_AUTOFILL_PAYMENTS_OTP_VERIFICATION_DIALOG_POSITIVE_BUTTON_LABEL" desc="Positive button label for the OTP verification dialog." formatter_data="android_java"> + Confirm + </message> + <message name="IDS_AUTOFILL_PAYMENTS_OTP_VERIFICATION_DIALOG_NEGATIVE_BUTTON_LABEL" desc="Negative button label for the OTP verification dialog." formatter_data="android_java"> + Cancel + </message> + </grit-part>
diff --git a/components/autofill_payments_strings_grdp/IDS_AUTOFILL_PAYMENTS_OTP_VERIFICATION_DIALOG_CANT_FIND_CODE_MESSAGE.png.sha1 b/components/autofill_payments_strings_grdp/IDS_AUTOFILL_PAYMENTS_OTP_VERIFICATION_DIALOG_CANT_FIND_CODE_MESSAGE.png.sha1 new file mode 100644 index 0000000..1583825 --- /dev/null +++ b/components/autofill_payments_strings_grdp/IDS_AUTOFILL_PAYMENTS_OTP_VERIFICATION_DIALOG_CANT_FIND_CODE_MESSAGE.png.sha1
@@ -0,0 +1 @@ +b9a38f645cd6136a0bf7ba108571564e71c34818 \ No newline at end of file
diff --git a/components/autofill_payments_strings_grdp/IDS_AUTOFILL_PAYMENTS_OTP_VERIFICATION_DIALOG_NEGATIVE_BUTTON_LABEL.png.sha1 b/components/autofill_payments_strings_grdp/IDS_AUTOFILL_PAYMENTS_OTP_VERIFICATION_DIALOG_NEGATIVE_BUTTON_LABEL.png.sha1 new file mode 100644 index 0000000..1583825 --- /dev/null +++ b/components/autofill_payments_strings_grdp/IDS_AUTOFILL_PAYMENTS_OTP_VERIFICATION_DIALOG_NEGATIVE_BUTTON_LABEL.png.sha1
@@ -0,0 +1 @@ +b9a38f645cd6136a0bf7ba108571564e71c34818 \ No newline at end of file
diff --git a/components/autofill_payments_strings_grdp/IDS_AUTOFILL_PAYMENTS_OTP_VERIFICATION_DIALOG_OTP_INPUT_HINT.png.sha1 b/components/autofill_payments_strings_grdp/IDS_AUTOFILL_PAYMENTS_OTP_VERIFICATION_DIALOG_OTP_INPUT_HINT.png.sha1 new file mode 100644 index 0000000..1583825 --- /dev/null +++ b/components/autofill_payments_strings_grdp/IDS_AUTOFILL_PAYMENTS_OTP_VERIFICATION_DIALOG_OTP_INPUT_HINT.png.sha1
@@ -0,0 +1 @@ +b9a38f645cd6136a0bf7ba108571564e71c34818 \ No newline at end of file
diff --git a/components/autofill_payments_strings_grdp/IDS_AUTOFILL_PAYMENTS_OTP_VERIFICATION_DIALOG_POSITIVE_BUTTON_LABEL.png.sha1 b/components/autofill_payments_strings_grdp/IDS_AUTOFILL_PAYMENTS_OTP_VERIFICATION_DIALOG_POSITIVE_BUTTON_LABEL.png.sha1 new file mode 100644 index 0000000..1583825 --- /dev/null +++ b/components/autofill_payments_strings_grdp/IDS_AUTOFILL_PAYMENTS_OTP_VERIFICATION_DIALOG_POSITIVE_BUTTON_LABEL.png.sha1
@@ -0,0 +1 @@ +b9a38f645cd6136a0bf7ba108571564e71c34818 \ No newline at end of file
diff --git a/components/autofill_payments_strings_grdp/IDS_AUTOFILL_PAYMENTS_OTP_VERIFICATION_DIALOG_TITLE.png.sha1 b/components/autofill_payments_strings_grdp/IDS_AUTOFILL_PAYMENTS_OTP_VERIFICATION_DIALOG_TITLE.png.sha1 new file mode 100644 index 0000000..1583825 --- /dev/null +++ b/components/autofill_payments_strings_grdp/IDS_AUTOFILL_PAYMENTS_OTP_VERIFICATION_DIALOG_TITLE.png.sha1
@@ -0,0 +1 @@ +b9a38f645cd6136a0bf7ba108571564e71c34818 \ No newline at end of file
diff --git a/components/browser_ui/strings/android/browser_ui_strings.grd b/components/browser_ui/strings/android/browser_ui_strings.grd index 8edd720..9e7da82b 100644 --- a/components/browser_ui/strings/android/browser_ui_strings.grd +++ b/components/browser_ui/strings/android/browser_ui_strings.grd
@@ -578,6 +578,21 @@ <message name="IDS_ACCESSIBILITY_TOOLBAR_VIEW_SITE_INFO" desc="Spoken by screen readers to explain that clicking on the status icon will show more site information when clicked. The string is read in the context of the 'Double tap to...' Android screen reader accessibility prompt e.g. 'Double tap to view site information'."> View site information </message> + <message name="IDS_PAGE_ZOOM_TITLE" desc="Title of the preference that allows the user to update the accessibility page zoom feature that applies to the web contents." translateable="false"> + Zoom + </message> + <message name="IDS_PAGE_ZOOM_SUMMARY" desc="Summary of the preference that allows the user to update the accessibility page zoom feature that applies to the web contents." translateable="false"> + Use this setting to increase/decrease the zoom for the page. + </message> + <message name="IDS_PAGE_ZOOM_DECREASE_ZOOM_BUTTON_TEXT" desc="Accessibility label for button to allow user to decrease page zoom" translateable="false"> + Decrease zoom + </message> + <message name="IDS_PAGE_ZOOM_INCREASE_ZOOM_BUTTON_TEXT" desc="Accessibility label for button to allow user to increase page zoom" translateable="false"> + Increase zoom + </message> + <message name="IDS_PAGE_ZOOM_FACTOR" desc="Text description of the current page zoom factor set by the user" translateable="false"> + <ph name="ZOOM_FACTOR">%1$d<ex>100</ex></ph> %% + </message> <!-- Media Capture and Streams --> <message name="IDS_MEDIA_CAPTURE_NOTIFICATION_APP_NAME_SEPARATOR" desc="A separator between the app name and notification message.">
diff --git a/components/browser_ui/styles/android/BUILD.gn b/components/browser_ui/styles/android/BUILD.gn index e63e1921..b22e221 100644 --- a/components/browser_ui/styles/android/BUILD.gn +++ b/components/browser_ui/styles/android/BUILD.gn
@@ -177,6 +177,7 @@ "java/res/drawable/ic_photo_camera_black.xml", "java/res/drawable/ic_play_circle_filled_24dp_on_dark_bg.xml", "java/res/drawable/ic_play_circle_filled_24dp_on_light_bg.xml", + "java/res/drawable/ic_remove.xml", "java/res/drawable/ic_security_grey.xml", "java/res/drawable/ic_settings_black.xml", "java/res/drawable/ic_tune_24dp.xml", @@ -189,6 +190,7 @@ "java/res/drawable/ic_vpn_key_grey.xml", "java/res/drawable/ic_warning_red_16dp.xml", "java/res/drawable/ic_warning_red_24dp.xml", + "java/res/drawable/ic_zoom_in.xml", "java/res/drawable/smartphone_black_24dp.xml", "java/res/drawable/toolbar_hairline.xml", "java/res/values-night/colors.xml",
diff --git a/components/browser_ui/styles/android/java/res/drawable/ic_remove.xml b/components/browser_ui/styles/android/java/res/drawable/ic_remove.xml new file mode 100644 index 0000000..0de675a7 --- /dev/null +++ b/components/browser_ui/styles/android/java/res/drawable/ic_remove.xml
@@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2021 The Chromium Authors. All rights reserved. + Use of this source code is governed by a BSD-style license that can be + found in the LICENSE file. --> + +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + <path + android:fillColor="?attr/default_icon_color" + android:pathData="M19 13H5v-2h14v2z" /> +</vector>
diff --git a/components/browser_ui/styles/android/java/res/drawable/ic_zoom_in.xml b/components/browser_ui/styles/android/java/res/drawable/ic_zoom_in.xml new file mode 100644 index 0000000..6d6f3bb --- /dev/null +++ b/components/browser_ui/styles/android/java/res/drawable/ic_zoom_in.xml
@@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2021 The Chromium Authors. All rights reserved. + Use of this source code is governed by a BSD-style license that can be + found in the LICENSE file. --> + +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + <path + android:fillColor="?attr/default_icon_color" + android:pathData="M15.5 14h-0.79l-0.28-0.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-0.59 4.23-1.57l0.27,0.28v0.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zm0.5-7H9v2H7v1h2v2h1v-2h2V9h-2z" /> +</vector> \ No newline at end of file
diff --git a/components/certificate_transparency/chrome_ct_policy_enforcer_unittest.cc b/components/certificate_transparency/chrome_ct_policy_enforcer_unittest.cc index 01b6fbf..406fe596 100644 --- a/components/certificate_transparency/chrome_ct_policy_enforcer_unittest.cc +++ b/components/certificate_transparency/chrome_ct_policy_enforcer_unittest.cc
@@ -46,7 +46,7 @@ public: void SetUp() override { auto enforcer = std::make_unique<ChromeCTPolicyEnforcer>( - base::GetBuildTime(), GetDisqualifiedLogs(), GetLogsOperatedByGoogle()); + base::Time::Now(), GetDisqualifiedLogs(), GetLogsOperatedByGoogle()); enforcer->SetClockForTesting(&clock_); policy_enforcer_ = std::move(enforcer);
diff --git a/components/exo/shell_surface_base.cc b/components/exo/shell_surface_base.cc index f6417f15..1f77acf 100644 --- a/components/exo/shell_surface_base.cc +++ b/components/exo/shell_surface_base.cc
@@ -15,9 +15,11 @@ #include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/window_properties.h" #include "ash/shell.h" +#include "ash/shell_delegate.h" #include "ash/wm/desks/desks_controller.h" #include "ash/wm/desks/desks_util.h" #include "ash/wm/drag_window_resizer.h" +#include "ash/wm/screen_pinning_controller.h" #include "ash/wm/window_resizer.h" #include "ash/wm/window_state.h" #include "ash/wm/window_state_delegate.h" @@ -588,11 +590,9 @@ return; } if (current_pinned_state_ != pending_pinned_state_) { - // TODO(crbug/1234010) - This will be done in follow up patch: call Ash to - // inform Ash of the change. - // ash::ShellDelegate* shell = ash::Shell::Get()->shell_delegate(); - // auto* window = widget_->GetNativeWindow(); - // shell->SetPinnedFromExo(window, pending_pinned_state_); + ash::ShellDelegate* shell = ash::Shell::Get()->shell_delegate(); + auto* window = widget_->GetNativeWindow(); + shell->SetPinnedFromExo(window, pending_pinned_state_); current_pinned_state_ = pending_pinned_state_; } }
diff --git a/components/feed/core/v2/api_test/feed_api_test.cc b/components/feed/core/v2/api_test/feed_api_test.cc index 0d83ee0e..f292e449 100644 --- a/components/feed/core/v2/api_test/feed_api_test.cc +++ b/components/feed/core/v2/api_test/feed_api_test.cc
@@ -691,6 +691,7 @@ bool loaded_new_content_from_network, base::TimeDelta stored_content_age, const ContentStats& content_stats, + const RequestMetadata& request_metadata, std::unique_ptr<LoadLatencyTimes> latencies) { load_stream_from_store_status = load_from_store_status; load_stream_status = final_status; @@ -699,7 +700,7 @@ MetricsReporter::OnLoadStream( stream_type, load_from_store_status, final_status, is_initial_load, loaded_new_content_from_network, stored_content_age, content_stats, - std::move(latencies)); + request_metadata, std::move(latencies)); } void TestMetricsReporter::OnLoadMoreBegin(const StreamType& stream_type, SurfaceId surface_id) {
diff --git a/components/feed/core/v2/api_test/feed_api_test.h b/components/feed/core/v2/api_test/feed_api_test.h index 9fcf5a1..daee212a 100644 --- a/components/feed/core/v2/api_test/feed_api_test.h +++ b/components/feed/core/v2/api_test/feed_api_test.h
@@ -34,6 +34,7 @@ #include "components/feed/core/v2/test/proto_printer.h" #include "components/feed/core/v2/test/stream_builder.h" #include "components/feed/core/v2/test/test_util.h" +#include "components/feed/core/v2/types.h" #include "components/feed/core/v2/wire_response_translator.h" #include "components/prefs/testing_pref_service.h" #include "net/http/http_status_code.h" @@ -387,6 +388,7 @@ bool loaded_new_content_from_network, base::TimeDelta stored_content_age, const ContentStats& content_stats, + const RequestMetadata& request_metadata, std::unique_ptr<LoadLatencyTimes> latencies) override; void OnLoadMoreBegin(const StreamType& stream_type, SurfaceId surface_id) override;
diff --git a/components/feed/core/v2/feed_stream.cc b/components/feed/core/v2/feed_stream.cc index 245a32a..7e60a89 100644 --- a/components/feed/core/v2/feed_stream.cc +++ b/components/feed/core/v2/feed_stream.cc
@@ -281,7 +281,8 @@ stream.type, result.load_from_store_status, result.final_status, result.load_type == LoadType::kInitialLoad, result.loaded_new_content_from_network, result.stored_content_age, - content_stats, std::move(result.latencies)); + content_stats, GetRequestMetadata(stream.type, false), + std::move(result.latencies)); UpdateIsActivityLoggingEnabled(result.stream_type); stream.model_loading_in_progress = false;
diff --git a/components/feed/core/v2/metrics_reporter.cc b/components/feed/core/v2/metrics_reporter.cc index 136f613..b32af80a 100644 --- a/components/feed/core/v2/metrics_reporter.cc +++ b/components/feed/core/v2/metrics_reporter.cc
@@ -7,6 +7,7 @@ #include <cmath> #include <string> +#include "base/compiler_specific.h" #include "base/logging.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/user_metrics.h" @@ -88,6 +89,18 @@ } } +base::StringPiece ContentOrderToString(ContentOrder content_order) { + switch (content_order) { + case ContentOrder::kUnspecified: + NOTREACHED(); + FALLTHROUGH; + case ContentOrder::kGrouped: + return "Grouped"; + case ContentOrder::kReverseChron: + return "ReverseChron"; + } +} + void ReportLoadLatencies(std::unique_ptr<LoadLatencyTimes> latencies) { for (const LoadLatencyTimes::Step& step : latencies->steps()) { // TODO(crbug/1152592): Add a WebFeed-specific histogram for this. @@ -611,6 +624,7 @@ bool loaded_new_content_from_network, base::TimeDelta stored_content_age, const ContentStats& content_stats, + const RequestMetadata& request_metadata, std::unique_ptr<LoadLatencyTimes> load_latencies) { DVLOG(1) << "OnLoadStream load_from_store_status=" << load_from_store_status << " final_status=" << final_status; @@ -656,6 +670,12 @@ base::StrCat({"ContentSuggestions.", HistogramReplacement(stream_type), "LoadedCardCount"}), content_stats.card_count); + if (stream_type.IsWebFeed()) { + base::UmaHistogramSparse( + base::StrCat({"ContentSuggestions.Feed.WebFeed.LoadedCardCount.", + ContentOrderToString(request_metadata.content_order)}), + content_stats.card_count); + } } if (stream_type.IsWebFeed()) { delegate_->SubscribedWebFeedCount(base::BindOnce(
diff --git a/components/feed/core/v2/metrics_reporter.h b/components/feed/core/v2/metrics_reporter.h index 2504d7d18..af4fcdd 100644 --- a/components/feed/core/v2/metrics_reporter.h +++ b/components/feed/core/v2/metrics_reporter.h
@@ -83,6 +83,7 @@ bool loaded_new_content_from_network, base::TimeDelta stored_content_age, const ContentStats& content_stats, + const RequestMetadata& request_metadata, std::unique_ptr<LoadLatencyTimes> load_latencies); virtual void OnBackgroundRefresh(const StreamType& stream_type, LoadStreamStatus final_status);
diff --git a/components/feed/core/v2/metrics_reporter_unittest.cc b/components/feed/core/v2/metrics_reporter_unittest.cc index 2d5acf6..74cbf90e 100644 --- a/components/feed/core/v2/metrics_reporter_unittest.cc +++ b/components/feed/core/v2/metrics_reporter_unittest.cc
@@ -33,6 +33,12 @@ /*total_content_frame_size_bytes=*/100 * 1024, /*shared_state_size=*/200 * 1024}; +RequestMetadata DefaultRequestMetadata() { + RequestMetadata metadata; + metadata.content_order = ContentOrder::kGrouped; + return metadata; +} + class MetricsReporterTest : public testing::Test, MetricsReporter::Delegate { protected: void SetUp() override { @@ -274,7 +280,8 @@ /*is_initial_load=*/true, /*loaded_new_content_from_network=*/true, /*stored_content_age=*/base::TimeDelta::FromDays(5), - kContentStats, std::make_unique<LoadLatencyTimes>()); + kContentStats, DefaultRequestMetadata(), + std::make_unique<LoadLatencyTimes>()); histogram_.ExpectUniqueSample( "ContentSuggestions.Feed.LoadStreamStatus.Initial", @@ -297,7 +304,8 @@ /*is_initial_load=*/true, /*loaded_new_content_from_network=*/true, /*stored_content_age=*/base::TimeDelta::FromDays(5), - kContentStats, std::make_unique<LoadLatencyTimes>()); + kContentStats, DefaultRequestMetadata(), + std::make_unique<LoadLatencyTimes>()); histogram_.ExpectUniqueSample( "ContentSuggestions.Feed.WebFeed.LoadStreamStatus.Initial", @@ -309,6 +317,11 @@ "ContentSuggestions.Feed.WebFeed.LoadedCardCount", kContentStats.card_count, 1); histogram_.ExpectUniqueSample( + "ContentSuggestions.Feed.WebFeed.LoadedCardCount.Grouped", + kContentStats.card_count, 1); + histogram_.ExpectTotalCount( + "ContentSuggestions.Feed.WebFeed.LoadedCardCount.ReverseChron", 0); + histogram_.ExpectUniqueSample( "ContentSuggestions.Feed.WebFeed.FollowCount.ContentShown", kSubscriptionCount, 1); histogram_.ExpectUniqueSample( @@ -319,13 +332,36 @@ kContentStats.shared_state_size / 1024, 1); } +TEST_F(MetricsReporterTest, WebFeed_ReportsLoadStreamStatus_ReverseChron) { + RequestMetadata request_metadata = DefaultRequestMetadata(); + request_metadata.content_order = ContentOrder::kReverseChron; + + reporter_->OnLoadStream(kWebFeedStream, LoadStreamStatus::kDataInStoreIsStale, + LoadStreamStatus::kLoadedFromNetwork, + /*is_initial_load=*/true, + /*loaded_new_content_from_network=*/true, + /*stored_content_age=*/base::TimeDelta::FromDays(5), + kContentStats, request_metadata, + std::make_unique<LoadLatencyTimes>()); + + histogram_.ExpectUniqueSample( + "ContentSuggestions.Feed.WebFeed.LoadedCardCount", + kContentStats.card_count, 1); + histogram_.ExpectUniqueSample( + "ContentSuggestions.Feed.WebFeed.LoadedCardCount.ReverseChron", + kContentStats.card_count, 1); + histogram_.ExpectTotalCount( + "ContentSuggestions.Feed.WebFeed.LoadedCardCount.Grouped", 0); +} + TEST_F(MetricsReporterTest, WebFeed_ReportsNoContentShown) { reporter_->OnLoadStream(kWebFeedStream, LoadStreamStatus::kDataInStoreIsStale, LoadStreamStatus::kLoadedFromNetwork, /*is_initial_load=*/true, /*loaded_new_content_from_network=*/true, /*stored_content_age=*/base::TimeDelta::FromDays(5), - ContentStats(), std::make_unique<LoadLatencyTimes>()); + ContentStats(), DefaultRequestMetadata(), + std::make_unique<LoadLatencyTimes>()); histogram_.ExpectUniqueSample( "ContentSuggestions.Feed.WebFeed.FollowCount.NoContentShown", @@ -338,7 +374,8 @@ /*is_initial_load=*/true, /*loaded_new_content_from_network=*/false, /*stored_content_age=*/base::TimeDelta::FromDays(5), - kContentStats, std::make_unique<LoadLatencyTimes>()); + kContentStats, DefaultRequestMetadata(), + std::make_unique<LoadLatencyTimes>()); histogram_.ExpectTotalCount("ContentSuggestions.Feed.LoadedCardCount", 0); } @@ -349,7 +386,8 @@ /*is_initial_load=*/false, /*loaded_new_content_from_network=*/true, /*stored_content_age=*/base::TimeDelta::FromDays(5), - kContentStats, std::make_unique<LoadLatencyTimes>()); + kContentStats, DefaultRequestMetadata(), + std::make_unique<LoadLatencyTimes>()); histogram_.ExpectUniqueSample( "ContentSuggestions.Feed.LoadStreamStatus.Initial", @@ -368,7 +406,8 @@ /*is_initial_load=*/true, /*loaded_new_content_from_network=*/true, /*stored_content_age=*/base::TimeDelta(), - kContentStats, std::make_unique<LoadLatencyTimes>()); + kContentStats, DefaultRequestMetadata(), + std::make_unique<LoadLatencyTimes>()); histogram_.ExpectUniqueSample( "ContentSuggestions.Feed.LoadStreamStatus.Initial", @@ -386,7 +425,8 @@ /*is_initial_load=*/true, /*loaded_new_content_from_network=*/true, /*stored_content_age=*/base::TimeDelta::FromDays(5), - kContentStats, std::make_unique<LoadLatencyTimes>()); + kContentStats, DefaultRequestMetadata(), + std::make_unique<LoadLatencyTimes>()); histogram_.ExpectUniqueTimeSample( "ContentSuggestions.Feed.ContentAgeOnLoad.BlockingRefresh", @@ -399,7 +439,8 @@ /*is_initial_load=*/true, /*loaded_new_content_from_network=*/false, /*stored_content_age=*/base::TimeDelta::FromDays(5), - kContentStats, std::make_unique<LoadLatencyTimes>()); + kContentStats, DefaultRequestMetadata(), + std::make_unique<LoadLatencyTimes>()); histogram_.ExpectUniqueTimeSample( "ContentSuggestions.Feed.ContentAgeOnLoad.NotRefreshed", @@ -412,13 +453,14 @@ LoadStreamStatus::kLoadedFromStore, /*is_initial_load=*/true, /*loaded_new_content_from_network=*/false, /*stored_content_age=*/-base::TimeDelta::FromSeconds(1), kContentStats, - std::make_unique<LoadLatencyTimes>()); + DefaultRequestMetadata(), std::make_unique<LoadLatencyTimes>()); reporter_->OnLoadStream(kForYouStream, LoadStreamStatus::kDataInStoreIsStale, LoadStreamStatus::kLoadedFromStore, /*is_initial_load=*/true, /*loaded_new_content_from_network=*/false, /*stored_content_age=*/base::TimeDelta(), - kContentStats, std::make_unique<LoadLatencyTimes>()); + kContentStats, DefaultRequestMetadata(), + std::make_unique<LoadLatencyTimes>()); histogram_.ExpectTotalCount( "ContentSuggestions.Feed.ContentAgeOnLoad.NotRefreshed", 0); histogram_.ExpectTotalCount( @@ -437,7 +479,8 @@ /*is_initial_load=*/true, /*loaded_new_content_from_network=*/true, /*stored_content_age=*/base::TimeDelta(), - kContentStats, std::move(latencies)); + kContentStats, DefaultRequestMetadata(), + std::move(latencies)); } task_environment_.FastForwardBy(base::TimeDelta::FromMilliseconds(300)); reporter_->FeedViewed(kSurfaceId);
diff --git a/components/page_info/android/BUILD.gn b/components/page_info/android/BUILD.gn index 50d69dd..99e4d2e 100644 --- a/components/page_info/android/BUILD.gn +++ b/components/page_info/android/BUILD.gn
@@ -38,6 +38,7 @@ "java/res/layout/page_info_container.xml", "java/res/layout/page_info_row.xml", "java/res/layout/page_info_summary.xml", + "java/res/layout/page_zoom_view.xml", "java/res/values/colors.xml", "java/res/values/dimens.xml", "java/res/values/ids.xml", @@ -67,6 +68,8 @@ "java/src/org/chromium/components/page_info/PageInfoDiscoverabilityMetrics.java", "java/src/org/chromium/components/page_info/PageInfoFeatures.java", "java/src/org/chromium/components/page_info/PageInfoMainController.java", + "java/src/org/chromium/components/page_info/PageInfoPageZoomController.java", + "java/src/org/chromium/components/page_info/PageInfoPageZoomView.java", "java/src/org/chromium/components/page_info/PageInfoPermissionsController.java", "java/src/org/chromium/components/page_info/PageInfoRowView.java", "java/src/org/chromium/components/page_info/PageInfoSubpageController.java",
diff --git a/components/page_info/android/java/res/layout/page_info.xml b/components/page_info/android/java/res/layout/page_info.xml index 2c637681..51b25ca66 100644 --- a/components/page_info/android/java/res/layout/page_info.xml +++ b/components/page_info/android/java/res/layout/page_info.xml
@@ -36,6 +36,11 @@ android:visibility="gone" android:layout_height="wrap_content" android:layout_width="match_parent"/> + <org.chromium.components.page_info.PageInfoRowView + android:id="@+id/page_info_page_zoom_row" + android:visibility="gone" + android:layout_height="wrap_content" + android:layout_width="match_parent"/> </LinearLayout> <org.chromium.ui.widget.ButtonCompat
diff --git a/components/page_info/android/java/res/layout/page_zoom_view.xml b/components/page_info/android/java/res/layout/page_zoom_view.xml new file mode 100644 index 0000000..a532ef7 --- /dev/null +++ b/components/page_info/android/java/res/layout/page_zoom_view.xml
@@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2021 The Chromium Authors. All rights reserved. + Use of this source code is governed by a BSD-style license that can be + found in the LICENSE file. --> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:paddingHorizontal="@dimen/page_info_popup_padding_sides" + android:paddingVertical="@dimen/page_info_popup_padding_vertical" + android:orientation="horizontal" > + + <TextView + style="@style/PreferenceTitle" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/page_zoom_title" /> + + <Space + android:layout_width="0dp" + android:layout_height="1dp" + android:layout_weight="1" /> + + <org.chromium.ui.widget.ChromeImageButton + android:id="@+id/page_zoom_decrease_zoom_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/ic_remove" + android:background="?attr/selectableItemBackground" + android:minWidth="@dimen/page_zoom_minimum_button_size" + android:minHeight="@dimen/page_zoom_minimum_button_size" + android:layout_marginHorizontal="@dimen/page_zoom_control_spacing" + android:contentDescription="@string/page_zoom_decrease_zoom_button_text" + android:tint="@color/default_icon_color_tint_list" /> + + <TextView + android:id="@+id/page_zoom_current_zoom_level_text" + style="@style/PreferenceTitle" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textAlignment="center" /> + + <org.chromium.ui.widget.ChromeImageButton + android:id="@+id/page_zoom_increase_zoom_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/ic_add" + android:background="?attr/selectableItemBackground" + android:minWidth="@dimen/page_zoom_minimum_button_size" + android:minHeight="@dimen/page_zoom_minimum_button_size" + android:layout_marginHorizontal="@dimen/page_zoom_control_spacing" + android:contentDescription="@string/page_zoom_increase_zoom_button_text" + android:tint="@color/default_icon_color_tint_list" /> + + <Space + android:layout_width="0dp" + android:layout_height="1dp" + android:layout_weight="1" /> + + <org.chromium.ui.widget.ButtonCompat + android:id="@+id/page_zoom_reset_zoom_button" + style="@style/TextButton" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/reset" /> + +</LinearLayout>
diff --git a/components/page_info/android/java/res/values/dimens.xml b/components/page_info/android/java/res/values/dimens.xml index afbabd1..ca444c0 100644 --- a/components/page_info/android/java/res/values/dimens.xml +++ b/components/page_info/android/java/res/values/dimens.xml
@@ -10,4 +10,8 @@ <dimen name="page_info_popup_padding_vertical">12dp</dimen> <dimen name="page_info_popup_corners_radius">16dp</dimen> <dimen name="page_info_popup_button_padding_sides">8dp</dimen> + + <!-- Page Zoom dimensions --> + <dimen name="page_zoom_minimum_button_size">44dp</dimen> + <dimen name="page_zoom_control_spacing">10dp</dimen> </resources> \ No newline at end of file
diff --git a/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoController.java b/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoController.java index 900971c..a43e7d12 100644 --- a/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoController.java +++ b/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoController.java
@@ -39,6 +39,7 @@ import org.chromium.components.security_state.SecurityStateModel; import org.chromium.components.url_formatter.UrlFormatter; import org.chromium.content_public.browser.BrowserContextHandle; +import org.chromium.content_public.browser.ContentFeatureList; import org.chromium.content_public.browser.LoadCommittedDetails; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.WebContentsObserver; @@ -126,6 +127,11 @@ // The controller for the cookies section of the page info. private PageInfoCookiesController mCookiesController; + // The controller for the page zoom section of the page info. Instantiated only when + // {@link ContentFeatureList.ACCESSIBILITY_PAGE_ZOOM} is enabled. + @Nullable + private PageInfoPageZoomController mPageZoomController; + // Additional controllers defined by the delegate. private Collection<PageInfoSubpageController> mAdditionalControllers; @@ -255,6 +261,13 @@ this, mView.getPermissionsRowView(), mDelegate, highlightedPermission); mCookiesController = new PageInfoCookiesController(this, mView.getCookiesRowView(), mDelegate); + + // Only create the controller for Page Zoom if feature flag is enabled. + if (ContentFeatureList.isEnabled(ContentFeatureList.ACCESSIBILITY_PAGE_ZOOM)) { + mPageZoomController = new PageInfoPageZoomController( + this, mView.getPageZoomRowView(), mWebContents, mDelegate); + } + mAdditionalControllers = mDelegate.createAdditionalRowViews(this, mView.getRowWrapper()); // TODO(crbug.com/1173154): Setup forget this site button after history delete is // implemented.
diff --git a/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoPageZoomController.java b/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoPageZoomController.java new file mode 100644 index 0000000..4fecde1 --- /dev/null +++ b/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoPageZoomController.java
@@ -0,0 +1,80 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.components.page_info; + +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import org.chromium.content_public.browser.WebContents; + +/** + * Controller to handle creation of {@link PageInfoPageZoomView}. + */ +public class PageInfoPageZoomController implements PageInfoSubpageController { + private final PageInfoMainController mMainController; + private final PageInfoRowView mRowView; + private final PageInfoControllerDelegate mDelegate; + + private final WebContents mWebContents; + + private final String mTitle; + private final String mSubpageTitle; + + private PageInfoPageZoomView mSubPage; + + public PageInfoPageZoomController(PageInfoMainController mainController, + PageInfoRowView pageZoomRowView, WebContents webContents, + PageInfoControllerDelegate delegate) { + mMainController = mainController; + mRowView = pageZoomRowView; + mDelegate = delegate; + + mWebContents = webContents; + + mTitle = mRowView.getContext().getResources().getString(R.string.page_zoom_title); + mSubpageTitle = mRowView.getContext().getResources().getString(R.string.page_zoom_summary); + + // Set the ViewParams for PageInfoRowView. + PageInfoRowView.ViewParams rowParams = new PageInfoRowView.ViewParams(); + rowParams.title = mTitle; + rowParams.visible = true; + rowParams.iconResId = R.drawable.ic_zoom_in; + rowParams.clickCallback = this::launchSubpage; + mRowView.setParams(rowParams); + } + + private void launchSubpage() { + mMainController.launchSubpage(this); + } + + @NonNull + @Override + public String getSubpageTitle() { + return mSubpageTitle; + } + + @Nullable + @Override + public View createViewForSubpage(ViewGroup parent) { + assert mSubPage == null; + mSubPage = new PageInfoPageZoomView(mRowView.getContext()); + return mSubPage.getMainView(); + } + + @Override + public void onSubpageRemoved() { + assert mSubPage != null; + mSubPage = null; + } + + @Override + public void clearData() {} + + @Override + public void updateRowIfNeeded() {} +} \ No newline at end of file
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/accessibility/settings/AccessibilityPageZoomPreference.java b/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoPageZoomView.java similarity index 61% rename from chrome/android/java/src/org/chromium/chrome/browser/accessibility/settings/AccessibilityPageZoomPreference.java rename to components/page_info/android/java/src/org/chromium/components/page_info/PageInfoPageZoomView.java index 60e42ced..0732bbe3 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/accessibility/settings/AccessibilityPageZoomPreference.java +++ b/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoPageZoomView.java
@@ -2,24 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -package org.chromium.chrome.browser.accessibility.settings; +package org.chromium.components.page_info; import android.content.Context; -import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.view.View; import android.widget.Button; import android.widget.ImageButton; import android.widget.TextView; -import androidx.preference.Preference; -import androidx.preference.PreferenceViewHolder; - -import org.chromium.chrome.R; - /** - * Preference that allows a user to change the page zoom factor for web contents. + * View that allows a user to change the page zoom factor for web contents. */ // TODO(mschillaci): This is a placeholder page visible only behind a flag, not finalized UI. -public class AccessibilityPageZoomPreference extends Preference { +public class PageInfoPageZoomView { // Available zoom factors for any page. private static final float[] AVAILABLE_ZOOM_FACTORS = new float[] {0.10f, 0.25f, 0.33f, 0.50f, 0.67f, 0.75f, 0.90f, 1.00f, 1.10f, 1.25f, @@ -31,31 +27,25 @@ // Current zoom factor set by the user. private int mZoomIndex = DEFAULT_ZOOM_FACTOR_INDEX; - private TextView mPageZoomText; - private ImageButton mDecreaseZoomButton; - private ImageButton mIncreaseZoomButton; - private Button mResetZoomButton; + private final View mMainView; + private final Context mContext; - /** - * Constructor for inflating from XML. - */ - public AccessibilityPageZoomPreference(Context context, AttributeSet attrs) { - super(context, attrs); - } + private final TextView mPageZoomText; + private final ImageButton mDecreaseZoomButton; + private final ImageButton mIncreaseZoomButton; + private final Button mResetZoomButton; - @Override - public void onBindViewHolder(PreferenceViewHolder holder) { - super.onBindViewHolder(holder); + public PageInfoPageZoomView(Context context) { + mContext = context; + mMainView = LayoutInflater.from(mContext).inflate(R.layout.page_zoom_view, null); // Bind views and set click listeners. - mPageZoomText = (TextView) holder.findViewById( - R.id.accessibility_page_zoom_current_zoom_level_text); - mDecreaseZoomButton = (ImageButton) holder.findViewById( - R.id.accessibility_page_zoom_decrease_zoom_button); - mIncreaseZoomButton = (ImageButton) holder.findViewById( - R.id.accessibility_page_zoom_increase_zoom_button); - mResetZoomButton = - (Button) holder.findViewById(R.id.accessibility_page_zoom_reset_zoom_button); + mPageZoomText = (TextView) mMainView.findViewById(R.id.page_zoom_current_zoom_level_text); + mDecreaseZoomButton = + (ImageButton) mMainView.findViewById(R.id.page_zoom_decrease_zoom_button); + mIncreaseZoomButton = + (ImageButton) mMainView.findViewById(R.id.page_zoom_increase_zoom_button); + mResetZoomButton = (Button) mMainView.findViewById(R.id.page_zoom_reset_zoom_button); mIncreaseZoomButton.setOnClickListener(view -> { assert canIncreaseZoom(); @@ -78,6 +68,14 @@ updateTextAndButtonStates(); } + /** + * Return the view for Page Zoom + * @return View - Main view that contains the page zoom layout. + */ + public View getMainView() { + return mMainView; + } + // Helper method to update the text of the zoom factor and button states after user actions. private void updateTextAndButtonStates() { mPageZoomText.setText(generateTextFromZoomFactor()); @@ -87,8 +85,8 @@ // Helper method to construct text of the zoom factor after user actions. private String generateTextFromZoomFactor() { - return getContext().getResources().getString(R.string.accessibility_page_zoom_factor, - (int) (100 * AVAILABLE_ZOOM_FACTORS[mZoomIndex])); + return mContext.getResources().getString( + R.string.page_zoom_factor, (int) (100 * AVAILABLE_ZOOM_FACTORS[mZoomIndex])); } // Helper method to determine if user can increase zoom.
diff --git a/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoView.java b/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoView.java index 51046d6c..3c1438f 100644 --- a/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoView.java +++ b/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoView.java
@@ -22,6 +22,7 @@ private PageInfoRowView mConnectionRow; private PageInfoRowView mPermissionsRow; private PageInfoRowView mCookiesRow; + private PageInfoRowView mPageZoomRow; private Button mForgetSiteButton; private TextView mHttpsImageCompressionMessage; private Button mInstantAppButton; @@ -49,6 +50,7 @@ initConnection(); initPermissions(); initCookies(params); + initPageZoom(); initForgetSiteButton(); initHttpsImageCompression(params); initInstantApp(params); @@ -73,6 +75,10 @@ mOnUiClosingCallback = params.onUiClosingCallback; } + private void initPageZoom() { + mPageZoomRow = findViewById(R.id.page_info_page_zoom_row); + } + private void initForgetSiteButton() { mForgetSiteButton = findViewById(R.id.page_info_forget_site_button); initializePageInfoViewChild(mForgetSiteButton, false, null); @@ -110,6 +116,10 @@ return mCookiesRow; } + public PageInfoRowView getPageZoomRowView() { + return mPageZoomRow; + } + public ViewGroup getRowWrapper() { return mRowWrapper; }
diff --git a/components/policy/proto/device_management_backend.proto b/components/policy/proto/device_management_backend.proto index 7a16b3f..1e0a8ea 100644 --- a/components/policy/proto/device_management_backend.proto +++ b/components/policy/proto/device_management_backend.proto
@@ -3016,6 +3016,15 @@ // DEPRECATED: Not filled by the client anymore (since b/172748724). optional bool boot_lockbox_finalized = 10 [deprecated = true]; optional bool owner_password_is_present = 11; + optional TpmSupportedFeatures tpm_supported_features = 12; +} + +// Contains information about specific features of the TPM unit. +message TpmSupportedFeatures { + optional bool is_allowed = 1; + optional bool support_pinweaver = 2; + optional bool support_runtime_selection = 3; + optional bool support_u2f = 4; } // System state included with some log events.
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index 2c78615..034f58e 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -10817,7 +10817,7 @@ 'owners': ['anasr@google.com', 'cros-reporting-team@google.com'], 'type': 'main', 'schema': { 'type': 'boolean' }, - 'future_on': ['chrome_os'], + 'supported_on': ['chrome_os:96-'], 'supported_chrome_os_management': ['google_cloud'], 'device_only': True, 'features': {
diff --git a/components/reporting/proto/common_event_support/BUILD.gn b/components/reporting/proto/common_event_support/BUILD.gn new file mode 100644 index 0000000..e79cf8a9 --- /dev/null +++ b/components/reporting/proto/common_event_support/BUILD.gn
@@ -0,0 +1,11 @@ +# Copyright 2021 The Chromium Authors. All rights reserved. Use +# of this source code is governed by a BSD-style license that can +# be found in the LICENSE file. + +import("//third_party/protobuf/proto_library.gni") + +# Information about Session Affiliated Users +proto_library("session_affiliated_user") { + proto_in_dir = "//" + sources = [ "session_affiliated_user.proto" ] +}
diff --git a/components/reporting/proto/common_event_support/session_affiliated_user.proto b/components/reporting/proto/common_event_support/session_affiliated_user.proto new file mode 100644 index 0000000..aa3fd97 --- /dev/null +++ b/components/reporting/proto/common_event_support/session_affiliated_user.proto
@@ -0,0 +1,15 @@ +// 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. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; + +package reporting; + +// Common information about Session Affiliated User accounts. +message SessionAffiliatedUser { + // Email address associated with the account. + optional string user_email = 1; +}
diff --git a/components/segmentation_platform/internal/selection/segment_selector_impl.cc b/components/segmentation_platform/internal/selection/segment_selector_impl.cc index d6b2555..d23a3b2 100644 --- a/components/segmentation_platform/internal/selection/segment_selector_impl.cc +++ b/components/segmentation_platform/internal/selection/segment_selector_impl.cc
@@ -202,7 +202,7 @@ int SegmentSelectorImpl::ConvertToDiscreteScore( OptimizationTarget segment_id, const std::string& mapping_key, - float score, + float input_score, const proto::SegmentationModelMetadata& metadata) { auto iter = metadata.discrete_mappings().find(mapping_key); if (iter == metadata.discrete_mappings().end()) { @@ -215,15 +215,17 @@ const auto& mapping = iter->second; - // Iterate over the entries and find the last entry whose min result is equal - // to or less than the input. + // Iterate over the entries and find the largest entry whose min result is + // equal to or less than the input. int discrete_result = 0; + float largest_score_below_input_score = std::numeric_limits<float>::min(); for (int i = 0; i < mapping.entries_size(); i++) { const auto& entry = mapping.entries(i); - if (score < entry.min_result()) - break; - - discrete_result = entry.rank(); + if (entry.min_result() <= input_score && + entry.min_result() > largest_score_below_input_score) { + largest_score_below_input_score = entry.min_result(); + discrete_result = entry.rank(); + } } return discrete_result;
diff --git a/components/segmentation_platform/internal/selection/segment_selector_impl.h b/components/segmentation_platform/internal/selection/segment_selector_impl.h index 53ebd4eef..2b13e55d 100644 --- a/components/segmentation_platform/internal/selection/segment_selector_impl.h +++ b/components/segmentation_platform/internal/selection/segment_selector_impl.h
@@ -87,7 +87,7 @@ // Helper method to convert continuous to discrete score. int ConvertToDiscreteScore(OptimizationTarget segment_id, const std::string& mapping_key, - float score, + float input_score, const proto::SegmentationModelMetadata& metadata); // The database storing metadata and results.
diff --git a/components/segmentation_platform/internal/selection/segment_selector_unittest.cc b/components/segmentation_platform/internal/selection/segment_selector_unittest.cc index ffd8abe2..fd63592 100644 --- a/components/segmentation_platform/internal/selection/segment_selector_unittest.cc +++ b/components/segmentation_platform/internal/selection/segment_selector_unittest.cc
@@ -145,6 +145,29 @@ metadata)); } +TEST_F(SegmentSelectorTest, CheckDiscreteMappingInNonAscendingOrder) { + OptimizationTarget segment_id = + OptimizationTarget::OPTIMIZATION_TARGET_SEGMENTATION_NEW_TAB; + float mapping[][2] = {{0.2, 1}, {0.7, 4}, {0.5, 3}}; + segment_database_->AddDiscreteMapping(segment_id, mapping, 3, + config_.segmentation_key); + proto::SegmentInfo* segment_info = + segment_database_->FindOrCreateSegment(segment_id); + const proto::SegmentationModelMetadata& metadata = + segment_info->model_metadata(); + + ASSERT_EQ(0, ConvertToDiscreteScore(segment_id, config_.segmentation_key, 0.1, + metadata)); + ASSERT_EQ(1, ConvertToDiscreteScore(segment_id, config_.segmentation_key, 0.4, + metadata)); + ASSERT_EQ(3, ConvertToDiscreteScore(segment_id, config_.segmentation_key, 0.5, + metadata)); + ASSERT_EQ(3, ConvertToDiscreteScore(segment_id, config_.segmentation_key, 0.6, + metadata)); + ASSERT_EQ(4, ConvertToDiscreteScore(segment_id, config_.segmentation_key, 0.9, + metadata)); +} + TEST_F(SegmentSelectorTest, CheckMissingDiscreteMapping) { OptimizationTarget segment_id = OptimizationTarget::OPTIMIZATION_TARGET_SEGMENTATION_NEW_TAB;
diff --git a/components/services/app_service/public/cpp/app_update.cc b/components/services/app_service/public/cpp/app_update.cc index 17ff97f..1502034 100644 --- a/components/services/app_service/public/cpp/app_update.cc +++ b/components/services/app_service/public/cpp/app_update.cc
@@ -95,8 +95,8 @@ state->permissions.clear(); ClonePermissions(delta->permissions, &state->permissions); } - if (delta->install_source != apps::mojom::InstallSource::kUnknown) { - state->install_source = delta->install_source; + if (delta->install_reason != apps::mojom::InstallReason::kUnknown) { + state->install_reason = delta->install_reason; } if (delta->is_platform_app != apps::mojom::OptionalBool::kUnknown) { state->is_platform_app = delta->is_platform_app; @@ -337,31 +337,31 @@ (!state_ || (delta_->permissions != state_->permissions)); } -apps::mojom::InstallSource AppUpdate::InstallSource() const { +apps::mojom::InstallReason AppUpdate::InstallSource() const { if (delta_ && - (delta_->install_source != apps::mojom::InstallSource::kUnknown)) { - return delta_->install_source; + (delta_->install_reason != apps::mojom::InstallReason::kUnknown)) { + return delta_->install_reason; } if (state_) { - return state_->install_source; + return state_->install_reason; } - return apps::mojom::InstallSource::kUnknown; + return apps::mojom::InstallReason::kUnknown; } bool AppUpdate::InstallSourceChanged() const { return delta_ && - (delta_->install_source != apps::mojom::InstallSource::kUnknown) && - (!state_ || (delta_->install_source != state_->install_source)); + (delta_->install_reason != apps::mojom::InstallReason::kUnknown) && + (!state_ || (delta_->install_reason != state_->install_reason)); } apps::mojom::OptionalBool AppUpdate::InstalledInternally() const { switch (InstallSource()) { - case apps::mojom::InstallSource::kUnknown: + case apps::mojom::InstallReason::kUnknown: return apps::mojom::OptionalBool::kUnknown; - case apps::mojom::InstallSource::kSystem: - case apps::mojom::InstallSource::kPolicy: - case apps::mojom::InstallSource::kOem: - case apps::mojom::InstallSource::kDefault: + case apps::mojom::InstallReason::kSystem: + case apps::mojom::InstallReason::kPolicy: + case apps::mojom::InstallReason::kOem: + case apps::mojom::InstallReason::kDefault: return apps::mojom::OptionalBool::kTrue; default: return apps::mojom::OptionalBool::kFalse;
diff --git a/components/services/app_service/public/cpp/app_update.h b/components/services/app_service/public/cpp/app_update.h index 6155f539..151d80b1 100644 --- a/components/services/app_service/public/cpp/app_update.h +++ b/components/services/app_service/public/cpp/app_update.h
@@ -100,7 +100,7 @@ std::vector<apps::mojom::PermissionPtr> Permissions() const; bool PermissionsChanged() const; - apps::mojom::InstallSource InstallSource() const; + apps::mojom::InstallReason InstallSource() const; bool InstallSourceChanged() const; apps::mojom::OptionalBool InstalledInternally() const;
diff --git a/components/services/app_service/public/cpp/app_update_unittest.cc b/components/services/app_service/public/cpp/app_update_unittest.cc index bf88c66..1ff00001 100644 --- a/components/services/app_service/public/cpp/app_update_unittest.cc +++ b/components/services/app_service/public/cpp/app_update_unittest.cc
@@ -49,7 +49,7 @@ std::vector<apps::mojom::PermissionPtr> expect_permissions_; bool expect_permissions_changed_; - apps::mojom::InstallSource expect_install_source_; + apps::mojom::InstallReason expect_install_source_; bool expect_install_source_changed_; apps::mojom::OptionalBool expect_is_platform_app_; @@ -226,7 +226,7 @@ expect_last_launch_time_ = base::Time(); expect_install_time_ = base::Time(); expect_permissions_.clear(); - expect_install_source_ = apps::mojom::InstallSource::kUnknown; + expect_install_source_ = apps::mojom::InstallReason::kUnknown; expect_is_platform_app_ = apps::mojom::OptionalBool::kUnknown; expect_recommendable_ = apps::mojom::OptionalBool::kUnknown; expect_searchable_ = apps::mojom::OptionalBool::kUnknown; @@ -469,17 +469,17 @@ CheckExpects(u); } - // InstallSource tests. + // InstallReason tests. if (state) { - state->install_source = apps::mojom::InstallSource::kUser; - expect_install_source_ = apps::mojom::InstallSource::kUser; + state->install_reason = apps::mojom::InstallReason::kUser; + expect_install_source_ = apps::mojom::InstallReason::kUser; expect_install_source_changed_ = false; CheckExpects(u); } if (delta) { - delta->install_source = apps::mojom::InstallSource::kPolicy; - expect_install_source_ = apps::mojom::InstallSource::kPolicy; + delta->install_reason = apps::mojom::InstallReason::kPolicy; + expect_install_source_ = apps::mojom::InstallReason::kPolicy; expect_install_source_changed_ = true; CheckExpects(u); }
diff --git a/components/services/app_service/public/cpp/publisher_base.cc b/components/services/app_service/public/cpp/publisher_base.cc index 94f9760d..44e6847 100644 --- a/components/services/app_service/public/cpp/publisher_base.cc +++ b/components/services/app_service/public/cpp/publisher_base.cc
@@ -21,7 +21,7 @@ std::string app_id, apps::mojom::Readiness readiness, const std::string& name, - apps::mojom::InstallSource install_source) { + apps::mojom::InstallReason install_reason) { apps::mojom::AppPtr app = apps::mojom::App::New(); app->app_type = app_type; @@ -33,7 +33,7 @@ app->last_launch_time = base::Time(); app->install_time = base::Time(); - app->install_source = install_source; + app->install_reason = install_reason; app->is_platform_app = apps::mojom::OptionalBool::kFalse; app->recommendable = apps::mojom::OptionalBool::kTrue;
diff --git a/components/services/app_service/public/cpp/publisher_base.h b/components/services/app_service/public/cpp/publisher_base.h index 8f172943..0be4e12 100644 --- a/components/services/app_service/public/cpp/publisher_base.h +++ b/components/services/app_service/public/cpp/publisher_base.h
@@ -34,7 +34,7 @@ std::string app_id, apps::mojom::Readiness readiness, const std::string& name, - apps::mojom::InstallSource install_source); + apps::mojom::InstallReason install_reason); void FlushMojoCallsForTesting();
diff --git a/components/services/app_service/public/mojom/types.mojom b/components/services/app_service/public/mojom/types.mojom index 4a80c20..e123722 100644 --- a/components/services/app_service/public/mojom/types.mojom +++ b/components/services/app_service/public/mojom/types.mojom
@@ -40,7 +40,7 @@ array<Permission> permissions; // Whether the app was installed by sync, policy or as a default app. - InstallSource install_source; + InstallReason install_reason; // Whether the app is an extensions::Extensions where is_platform_app() // returns true. @@ -132,7 +132,7 @@ // enums.xml. // Note the enumeration is used in UMA histogram so entries should not be // re-ordered or removed. New entries should be added at the bottom. -enum InstallSource { +enum InstallReason { kUnknown = 0, kSystem, // Installed with the system and is considered a part of the OS. kPolicy, // Installed by policy.
diff --git a/content/browser/accessibility/accessibility_win_browsertest.cc b/content/browser/accessibility/accessibility_win_browsertest.cc index 16289e8..cd91307 100644 --- a/content/browser/accessibility/accessibility_win_browsertest.cc +++ b/content/browser/accessibility/accessibility_win_browsertest.cc
@@ -5188,7 +5188,12 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinUIASelectivelyEnabledBrowserTest, RequestingTopLevelElementEnablesWebAccessibility) { - EXPECT_TRUE(NavigateToURL(shell(), GURL("about:blank"))); + std::string html = R"HTML(<!DOCTYPE html> + <html> + <div>some text</div> + </html>)HTML"; + GURL html_data_url("data:text/html," + html); + EXPECT_TRUE(NavigateToURL(shell(), html_data_url)); // Ensure accessibility is not enabled before we begin the test. EXPECT_TRUE(content::BrowserAccessibilityStateImpl::GetInstance() @@ -5212,25 +5217,37 @@ EXPECT_EQ(expected_mode, content::BrowserAccessibilityStateImpl::GetInstance() ->GetAccessibilityMode()); - // Now get the fragment root's first (only) child. - Microsoft::WRL::ComPtr<IUIAutomationTreeWalker> tree_walker; - uia->get_RawViewWalker(&tree_walker); - Microsoft::WRL::ComPtr<IUIAutomationElement> first_child; - tree_walker->GetFirstChildElement(root.Get(), &first_child); - ASSERT_NE(nullptr, first_child.Get()); + // Now try to get the text content. + Microsoft::WRL::ComPtr<IUIAutomationCondition> condition; + base::win::ScopedVariant control_type_variant(UIA_TextControlTypeId); + ASSERT_HRESULT_SUCCEEDED(uia->CreatePropertyCondition( + UIA_ControlTypePropertyId, control_type_variant, &condition)); + EXPECT_NE(nullptr, condition.Get()); + Microsoft::WRL::ComPtr<IUIAutomationElement> text_element; - base::win::ScopedBstr name; - ASSERT_HRESULT_SUCCEEDED(first_child->get_CurrentName(name.Receive())); + AccessibilityNotificationWaiter waiter(shell()->web_contents(), + ui::AXMode::kNativeAPIs, + ax::mojom::Event::kLoadComplete); + ASSERT_HRESULT_SUCCEEDED( + root->FindFirst(TreeScope_Subtree, condition.Get(), &text_element)); + // This call failed as web contents was not previously enabled. + EXPECT_EQ(nullptr, text_element.Get()); // Web content accessibility support should now be enabled. expected_mode |= ui::AXMode::kWebContents; EXPECT_EQ(expected_mode, content::BrowserAccessibilityStateImpl::GetInstance() ->GetAccessibilityMode()); + waiter.WaitForNotification(); + + // This call should succeed as web contents have been enabled. + ASSERT_HRESULT_SUCCEEDED( + root->FindFirst(TreeScope_Subtree, condition.Get(), &text_element)); + ASSERT_NE(nullptr, text_element.Get()); Microsoft::WRL::ComPtr<IUnknown> text_pattern_unknown; - ASSERT_HRESULT_SUCCEEDED( - first_child->GetCurrentPattern(UIA_TextPatternId, &text_pattern_unknown)); - EXPECT_EQ(nullptr, text_pattern_unknown.Get()); + ASSERT_HRESULT_SUCCEEDED(text_element->GetCurrentPattern( + UIA_TextPatternId, &text_pattern_unknown)); + EXPECT_NE(nullptr, text_pattern_unknown.Get()); // Now check that inline text box support is enabled as well. expected_mode |= ui::AXMode::kInlineTextBoxes; @@ -5239,7 +5256,7 @@ { base::win::ScopedVariant variant; - ASSERT_HRESULT_SUCCEEDED(first_child->GetCurrentPropertyValue( + ASSERT_HRESULT_SUCCEEDED(text_element->GetCurrentPropertyValue( UIA_LabeledByPropertyId, variant.Receive())); } // Now check that we have complete accessibility support enabled. @@ -5249,7 +5266,7 @@ { base::win::ScopedVariant variant; - ASSERT_HRESULT_SUCCEEDED(first_child->GetCurrentPropertyValue( + ASSERT_HRESULT_SUCCEEDED(text_element->GetCurrentPropertyValue( UIA_AutomationIdPropertyId, variant.Receive())); } // TODO(janewman) UIA_AutomationIdPropertyId currently requires the author
diff --git a/content/browser/android/content_feature_list.cc b/content/browser/android/content_feature_list.cc index a1459bb..3565122 100644 --- a/content/browser/android/content_feature_list.cc +++ b/content/browser/android/content_feature_list.cc
@@ -21,7 +21,6 @@ // in other locations in the code base (e.g. content_features.h). const base::Feature* const kFeaturesExposedToJava[] = { &features::kAccessibilityPageZoom, - &features::kAccessibilityPageZoomUpdatedUI, &features::kBackgroundMediaRendererHasModerateBinding, &features::kBindingManagementWaiveCpu, &features::kExperimentalAccessibilityLabels,
diff --git a/content/browser/attribution_reporting/conversion_manager_impl.cc b/content/browser/attribution_reporting/conversion_manager_impl.cc index e09f266..53ce5ffcb 100644 --- a/content/browser/attribution_reporting/conversion_manager_impl.cc +++ b/content/browser/attribution_reporting/conversion_manager_impl.cc
@@ -350,7 +350,8 @@ manager->reporter_->AddReportsToQueue({std::move(report)}); }, weak_factory_.GetWeakPtr(), info.report)); - } else if (info.status != SentReportInfo::Status::kOffline) { + } else if (info.status != SentReportInfo::Status::kOffline && + info.status != SentReportInfo::Status::kRemovedFromQueue) { RecordDeleteEvent(DeleteEvent::kStarted); conversion_storage_.AsyncCall(&ConversionStorage::DeleteConversion) .WithArgs(*info.report.conversion_id)
diff --git a/content/browser/attribution_reporting/conversion_manager_impl_unittest.cc b/content/browser/attribution_reporting/conversion_manager_impl_unittest.cc index b7efb220..dcf9b49 100644 --- a/content/browser/attribution_reporting/conversion_manager_impl_unittest.cc +++ b/content/browser/attribution_reporting/conversion_manager_impl_unittest.cc
@@ -86,7 +86,12 @@ void ClearDeferredCallbacks() { deferred_callbacks_.clear(); } - void RemoveAllReportsFromQueue() override {} + void RemoveAllReportsFromQueue() override { + for (auto& info : deferred_callbacks_) { + info.status = SentReportInfo::Status::kRemovedFromQueue; + } + RunDeferredCallbacks(); + } void ShouldRunReportSentCallbacks(bool should_run_report_sent_callbacks) { should_run_report_sent_callbacks_ = should_run_report_sent_callbacks; @@ -831,55 +836,6 @@ kMetric, ConversionManagerImpl::DeleteEvent::kSucceeded, 1); } -TEST_F(ConversionManagerImplTest, NoIDReuse_ViaClearData) { - test_reporter_->ShouldRunReportSentCallbacks(false); - - conversion_manager_->HandleImpression( - ImpressionBuilder(clock().Now()).Build()); - conversion_manager_->HandleConversion( - ConversionBuilder().SetConversionData(5).Build()); - ExpectNumStoredReports(1); - - task_environment_.FastForwardBy(kFirstReportingWindow - - kConversionManagerQueueReportsInterval); - ExpectNumStoredReports(1); - EXPECT_EQ(1u, test_reporter_->num_reports()); - EXPECT_EQ(0u, - conversion_manager_->GetSessionStorage().GetSentReports().size()); - // The above report with `conversion_data == 5` has been sent, and the manager - // is waiting for its callback to be invoked. - - // Delete the report and store a new one to ensure that IDs aren't reused. - { - base::RunLoop delete_loop; - conversion_manager_->ClearData( - base::Time::Min(), base::Time::Max(), base::NullCallback(), - base::BindLambdaForTesting([&]() { delete_loop.Quit(); })); - delete_loop.Run(); - ExpectNumStoredReports(0); - - conversion_manager_->HandleImpression( - ImpressionBuilder(clock().Now()).Build()); - conversion_manager_->HandleConversion( - ConversionBuilder().SetConversionData(6).Build()); - ExpectNumStoredReports(1); - EXPECT_EQ(1u, test_reporter_->num_reports()); - EXPECT_EQ(0u, - conversion_manager_->GetSessionStorage().GetSentReports().size()); - } - - // The manager's `OnReportSent` callback is invoked, and the new conversion - // with `conversion_data == 6` would be erroneously deleted if it had been - // given the same ID. - test_reporter_->RunDeferredCallbacks(); - ExpectNumStoredReports(1); - EXPECT_EQ(1u, test_reporter_->num_reports()); - const auto& sent_reports = - conversion_manager_->GetSessionStorage().GetSentReports(); - EXPECT_EQ(1u, sent_reports.size()); - EXPECT_EQ(5u, sent_reports[0].report.conversion_data); -} - TEST_F(ConversionManagerImplTest, ClearData_RequeuesReports) { const auto origin_a = url::Origin::Create(GURL("https://a.example/")); const auto origin_b = url::Origin::Create(GURL("https://b.example/")); @@ -916,4 +872,33 @@ EXPECT_EQ(3u, test_reporter_->num_reports()); } +TEST_F(ConversionManagerImplTest, ClearData_NoDeleteForRemovedFromQueue) { + const auto origin_a = url::Origin::Create(GURL("https://a.example/")); + const auto origin_b = url::Origin::Create(GURL("https://b.example/")); + + conversion_manager_->HandleImpression(ImpressionBuilder(clock().Now()) + .SetExpiry(kImpressionExpiry) + .SetReportingOrigin(origin_a) + .Build()); + conversion_manager_->HandleConversion( + ConversionBuilder().SetReportingOrigin(origin_a).Build()); + + ExpectNumStoredReports(1u); + + task_environment_.FastForwardBy(kFirstReportingWindow - + kConversionManagerQueueReportsInterval); + + test_reporter_->WaitForNumReports(1); + EXPECT_EQ(1u, test_reporter_->num_reports()); + ExpectNumStoredReports(1u); + + conversion_manager_->ClearData( + base::Time::Min(), base::Time::Max(), + base::BindLambdaForTesting( + [&](const url::Origin& origin) { return origin == origin_b; }), + base::DoNothing::Once()); + + ExpectNumStoredReports(1u); +} + } // namespace content
diff --git a/content/browser/attribution_reporting/conversion_reporter_impl.cc b/content/browser/attribution_reporting/conversion_reporter_impl.cc index 353ed23..badd140c 100644 --- a/content/browser/attribution_reporting/conversion_reporter_impl.cc +++ b/content/browser/attribution_reporting/conversion_reporter_impl.cc
@@ -67,7 +67,7 @@ DCHECK(report.conversion_id.has_value()); report_queue_.pop(); OnReportSent(SentReportInfo(std::move(report), - SentReportInfo::Status::kDropped, + SentReportInfo::Status::kRemovedFromQueue, /*http_response_code=*/0)); } queued_reports_.clear();
diff --git a/content/browser/attribution_reporting/conversion_reporter_impl_unittest.cc b/content/browser/attribution_reporting/conversion_reporter_impl_unittest.cc index 6b126dc..c682f16f 100644 --- a/content/browser/attribution_reporting/conversion_reporter_impl_unittest.cc +++ b/content/browser/attribution_reporting/conversion_reporter_impl_unittest.cc
@@ -158,7 +158,7 @@ // sent. task_environment_.FastForwardBy(base::TimeDelta()); EXPECT_EQ(0u, sender_->num_reports_sent()); - EXPECT_EQ(SentReportInfo::Status::kDropped, last_sent_report_info()->status); + EXPECT_EQ(SentReportInfo::Status::kRemovedFromQueue, last_sent_report_info()->status); } TEST_F(ConversionReporterImplTest,
diff --git a/content/browser/attribution_reporting/conversion_test_utils.cc b/content/browser/attribution_reporting/conversion_test_utils.cc index 804ec938..b736f9e 100644 --- a/content/browser/attribution_reporting/conversion_test_utils.cc +++ b/content/browser/attribution_reporting/conversion_test_utils.cc
@@ -521,6 +521,9 @@ case SentReportInfo::Status::kOffline: out << "kOffline"; break; + case SentReportInfo::Status::kRemovedFromQueue: + out << "kRemovedFromQueue"; + break; } return out; }
diff --git a/content/browser/attribution_reporting/sent_report_info.h b/content/browser/attribution_reporting/sent_report_info.h index bb253ef..bea443ef 100644 --- a/content/browser/attribution_reporting/sent_report_info.h +++ b/content/browser/attribution_reporting/sent_report_info.h
@@ -24,6 +24,8 @@ // The report should be retried because the browser is offline. This // shouldn't contribute to the number of report failures. kOffline, + // The report was removed from the queue before being sent. + kRemovedFromQueue, }; SentReportInfo(ConversionReport report,
diff --git a/content/browser/child_process_security_policy_impl.cc b/content/browser/child_process_security_policy_impl.cc index b29dfde..bdf34ac 100644 --- a/content/browser/child_process_security_policy_impl.cc +++ b/content/browser/child_process_security_policy_impl.cc
@@ -687,6 +687,11 @@ browser_context_ = nullptr; } + int render_frame_host_count() const { return render_frame_host_count_; } + void set_render_frame_host_count(int count) { + render_frame_host_count_ = count; + } + private: enum class CommitRequestPolicy { kRequestOnly, @@ -755,6 +760,10 @@ // SecurityState's RenderProcessHost, for metrics. unsigned max_browsing_instance_count_ = 0; + // Diagnostic code for https://crbug.com/1148542. + // TODO(wjmaclean): Remove once that issue is resolved. + int render_frame_host_count_ = 0; + // The set of isolated filesystems the child process is permitted to access. FileSystemMap filesystem_permissions_; @@ -1880,6 +1889,15 @@ state->AddBrowsingInstanceId(isolation_context.browsing_instance_id()); } +void ChildProcessSecurityPolicyImpl::SetRenderFrameHostCount(int child_id, + int count) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + base::AutoLock lock(lock_); + auto state = security_state_.find(child_id); + DCHECK(state != security_state_.end()); + state->second->set_render_frame_host_count(count); +} + void ChildProcessSecurityPolicyImpl::LockProcess( const IsolationContext& context, int child_id, @@ -2443,8 +2461,24 @@ // content_unittests don't always report being on the IO thread. DCHECK(IsRunningOnExpectedThread()); base::AutoLock lock(lock_); - for (auto& it : security_state_) + for (auto& it : security_state_) { it.second->ClearBrowsingInstanceId(browsing_instance_id); + + // TODO(wjmaclean): Remove when https://crbug.com/1148542 is resolved. + if (it.second->browsing_instance_ids().empty() && + it.second->render_frame_host_count() > 0) { + // When there are no more BrowsingInstanceIDs associated with a + // RenderProcess, then there should not be any RenderFrameHosts either. + // Send a crash dump to alert if this happens and collect state for + // debugging. + SCOPED_CRASH_KEY_NUMBER("NoBIIDsButHasRFH", "num_rfhs", + it.second->render_frame_host_count()); + SCOPED_CRASH_KEY_STRING256("NoBIIDsButHasRFH", "process_lock", + it.second->process_lock().ToString()); + NOTREACHED(); + base::debug::DumpWithoutCrashing(); + } + } // Note: if the BrowsingInstanceId set is empty at the end of this function, // we must never remove the ProcessLock in case the associated RenderProcess // is compromised, in which case we wouldn't want to reuse it for another
diff --git a/content/browser/child_process_security_policy_impl.h b/content/browser/child_process_security_policy_impl.h index 4145c7c..e85b83f18 100644 --- a/content/browser/child_process_security_policy_impl.h +++ b/content/browser/child_process_security_policy_impl.h
@@ -547,6 +547,12 @@ void IncludeIsolationContext(int child_id, const IsolationContext& isolation_context); + // Stores the number of RenderFrameHosts currently active on the + // RenderProcessHost corresponding to |child_id| so that it's accessible on + // the IO thread. + // Diagnostic for debugging https://crbug.com/1148542. + void SetRenderFrameHostCount(int child_id, int count); + // Sets the process identified by |child_id| as only permitted to access data // for the origin specified by |site_info|'s process_lock_url(). Most callers // should use RenderProcessHostImpl::SetProcessLock instead of calling this
diff --git a/content/browser/compute_pressure/OWNERS b/content/browser/compute_pressure/OWNERS index 79830e6..8de7804 100644 --- a/content/browser/compute_pressure/OWNERS +++ b/content/browser/compute_pressure/OWNERS
@@ -1,7 +1,6 @@ # Primary -oyiptong@chromium.org +pwnall@chromium.org # Secondary jsbell@chromium.org mek@chromium.org -pwnall@chromium.org
diff --git a/content/browser/compute_pressure/README.md b/content/browser/compute_pressure/README.md index 50fa263..105aa4dd 100644 --- a/content/browser/compute_pressure/README.md +++ b/content/browser/compute_pressure/README.md
@@ -1,7 +1,7 @@ # Compute Pressure API This directory contains the browser-side implementation of the -[Compute Pressure API](https://github.com/oyiptong/compute-pressure/). +[Compute Pressure API](https://github.com/wicg/compute-pressure/). ## Code map
diff --git a/content/browser/compute_pressure/compute_pressure_host.cc b/content/browser/compute_pressure/compute_pressure_host.cc index d594a30..ef1afda 100644 --- a/content/browser/compute_pressure/compute_pressure_host.cc +++ b/content/browser/compute_pressure/compute_pressure_host.cc
@@ -128,8 +128,8 @@ blink::mojom::ComputePressureState quantized_state = quantizer_.Quantize(sample); - // TODO(oyiptong): Rate-limit observers in non-visible frames instead of - // cutting off their updates completely. + // TODO(pwnall): Rate-limit observers in non-visible frames instead of + // cutting off their updates completely. if (sample_time - last_report_time_ < visible_observer_rate_limit_) { return; } @@ -144,14 +144,14 @@ RenderFrameHost* rfh = content::RenderFrameHost::FromID(frame_id); if (!rfh || !rfh->IsActive()) { - // TODO(oyiptong): Is it safe to disconnect observers in this state? + // TODO(pwnall): Is it safe to disconnect observers in this state? continue; } if (rfh->GetVisibilityState() != blink::mojom::PageVisibilityState::kVisible) { - // TODO(oyiptong): Rate-limit observers in non-visible frames instead of - // cutting off their updates completely. + // TODO(pwnall): Rate-limit observers in non-visible frames instead of + // cutting off their updates completely. continue; }
diff --git a/content/browser/font_access/OWNERS b/content/browser/font_access/OWNERS index 7f6dc97..8d602dc 100644 --- a/content/browser/font_access/OWNERS +++ b/content/browser/font_access/OWNERS
@@ -1,6 +1,5 @@ # Primary -oyiptong@chromium.org +pwnall@chromium.org # Secondary jsbell@chromium.org -pwnall@chromium.org
diff --git a/content/browser/navigation_browsertest.cc b/content/browser/navigation_browsertest.cc index 7b745e5..a63d301 100644 --- a/content/browser/navigation_browsertest.cc +++ b/content/browser/navigation_browsertest.cc
@@ -42,6 +42,7 @@ #include "content/public/browser/navigation_controller.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/page_navigator.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_client.h" @@ -89,6 +90,7 @@ #include "services/network/public/mojom/url_loader.mojom.h" #include "third_party/blink/public/common/loader/previews_state.h" #include "third_party/blink/public/common/loader/url_loader_throttle.h" +#include "ui/base/page_transition_types.h" #include "url/gurl.h" #include "url/url_util.h" @@ -6010,4 +6012,59 @@ child_b->current_frame_host()->storage_key().nonce().value()); } +// Ensures that OpenURLParams::FromNavigationHandle translates navigation params +// correctly when used to initiate a navigation in another WebContents. +IN_PROC_BROWSER_TEST_F( + NavigationBrowserTest, + FromNavigationHandleTranslatesNavigationParamsCorrectly) { + // Test that the params are translated correctly for a redirected navigation. + const GURL kRedirectedURL( + embedded_test_server()->GetURL("/server-redirect?/simple_page.html")); + NavigationController::LoadURLParams load_params(kRedirectedURL); + TestNavigationManager first_tab_manager(web_contents(), kRedirectedURL); + web_contents()->GetController().LoadURLWithParams(load_params); + + // Wait for response to allow the navigation to resolve the redirect. + EXPECT_TRUE(first_tab_manager.WaitForResponse()); + + // Create LoadURLParams from the navigation after redirection. + NavigationController::LoadURLParams load_url_params( + OpenURLParams::FromNavigationHandle( + first_tab_manager.GetNavigationHandle())); + Shell* second_tab = CreateBrowser(); + TestNavigationManager second_tab_manager(second_tab->web_contents(), + load_url_params.url); + second_tab->web_contents()->GetController().LoadURLWithParams( + load_url_params); + + EXPECT_TRUE(second_tab_manager.WaitForResponse()); + + // Ensure params from the navigation in the first tab are translated to the + // navigation in the second tab as expected. + auto* first_tab_handle = first_tab_manager.GetNavigationHandle(); + auto* second_tab_handle = second_tab_manager.GetNavigationHandle(); + EXPECT_EQ(embedded_test_server()->GetURL("/simple_page.html"), + second_tab_handle->GetURL()); + EXPECT_EQ(first_tab_handle->GetReferrer(), second_tab_handle->GetReferrer()); + EXPECT_TRUE( + ui::PageTransitionCoreTypeIs(first_tab_handle->GetPageTransition(), + second_tab_handle->GetPageTransition())); + EXPECT_EQ(first_tab_handle->IsRendererInitiated(), + second_tab_handle->IsRendererInitiated()); + EXPECT_EQ(first_tab_handle->GetInitiatorOrigin(), + second_tab_handle->GetInitiatorOrigin()); + EXPECT_EQ(first_tab_handle->GetSourceSiteInstance(), + second_tab_handle->GetSourceSiteInstance()); + EXPECT_EQ(first_tab_handle->HasUserGesture(), + second_tab_handle->HasUserGesture()); + EXPECT_EQ(first_tab_handle->WasStartedFromContextMenu(), + second_tab_handle->WasStartedFromContextMenu()); + EXPECT_EQ(first_tab_handle->GetHrefTranslate(), + second_tab_handle->GetHrefTranslate()); + EXPECT_EQ(first_tab_handle->GetReloadType(), + second_tab_handle->GetReloadType()); + EXPECT_EQ(first_tab_handle->GetRedirectChain(), + second_tab_handle->GetRedirectChain()); +} + } // namespace content
diff --git a/content/browser/renderer_host/render_frame_proxy_host.cc b/content/browser/renderer_host/render_frame_proxy_host.cc index 31f47c3..ecea4ef 100644 --- a/content/browser/renderer_host/render_frame_proxy_host.cc +++ b/content/browser/renderer_host/render_frame_proxy_host.cc
@@ -552,8 +552,9 @@ SiteInstance* target_site_instance = target_rfh->GetSiteInstance(); if (!target_site_instance->IsRelatedSiteInstance(GetSiteInstance()) && !target_rfh->delegate()->ShouldRouteMessageEvent(target_rfh, - GetSiteInstance())) + GetSiteInstance())) { return; + } // If there is a |source_frame_token|, translate it to the frame token of the // equivalent RenderFrameProxyHost in the target process.
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 9e571e4a5..dfdb04a 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -2848,9 +2848,13 @@ void RenderProcessHostImpl::IncrementRfhCount() { render_frame_host_count_++; + ChildProcessSecurityPolicyImpl::GetInstance()->SetRenderFrameHostCount( + GetID(), render_frame_host_count_); } void RenderProcessHostImpl::DecrementRfhCount() { render_frame_host_count_--; + ChildProcessSecurityPolicyImpl::GetInstance()->SetRenderFrameHostCount( + GetID(), render_frame_host_count_); } int RenderProcessHostImpl::GetRfhCount() const { return render_frame_host_count_;
diff --git a/content/browser/text_fragment_browsertest.cc b/content/browser/text_fragment_browsertest.cc index b526e6c..19eb808 100644 --- a/content/browser/text_fragment_browsertest.cc +++ b/content/browser/text_fragment_browsertest.cc
@@ -858,7 +858,14 @@ EXPECT_TRUE(last_metadata.is_scroll_offset_at_top); } -IN_PROC_BROWSER_TEST_F(ForceLoadAtTopBrowserTest, SameDocumentNavigation) { +// TODO(https://crbug.com/1239636) Flaky on Android. +#if defined(OS_ANDROID) +#define MAYBE_SameDocumentNavigation DISABLED_SameDocumentNavigation +#else +#define MAYBE_SameDocumentNavigation SameDocumentNavigation +#endif +IN_PROC_BROWSER_TEST_F(ForceLoadAtTopBrowserTest, + MAYBE_SameDocumentNavigation) { ASSERT_NO_FATAL_FAILURE(LoadScrollablePageWithContent("/index.html")); WebContents* main_contents = shell()->web_contents();
diff --git a/content/public/android/java/src/org/chromium/content_public/browser/ContentFeatureList.java b/content/public/android/java/src/org/chromium/content_public/browser/ContentFeatureList.java index 0836c51..badad72 100644 --- a/content/public/android/java/src/org/chromium/content_public/browser/ContentFeatureList.java +++ b/content/public/android/java/src/org/chromium/content_public/browser/ContentFeatureList.java
@@ -28,9 +28,6 @@ // Alphabetical: public static final String ACCESSIBILITY_PAGE_ZOOM = "AccessibilityPageZoom"; - public static final String ACCESSIBILITY_PAGE_ZOOM_UPDATED_UI = - "AccessibilityPageZoomUpdatedUI"; - public static final String BACKGROUND_MEDIA_RENDERER_HAS_MODERATE_BINDING = "BackgroundMediaRendererHasModerateBinding";
diff --git a/content/public/browser/navigation_handle.h b/content/public/browser/navigation_handle.h index 92f1a855..3650d141 100644 --- a/content/public/browser/navigation_handle.h +++ b/content/public/browser/navigation_handle.h
@@ -151,8 +151,7 @@ // lifetime. // // However, because of prerender activations, the RenderFrameHost that this - // navigation is committed into may later transfer to another FrameTreeNode, - // so this value is not necessarily constant over the lifetime of the frame. + // navigation is committed into may later transfer to another FrameTreeNode. // See documentation for RenderFrameHost::GetFrameTreeNodeId() for more // details. virtual int GetFrameTreeNodeId() = 0;
diff --git a/content/public/browser/page_navigator.cc b/content/public/browser/page_navigator.cc index 9a2beda..d435e43 100644 --- a/content/public/browser/page_navigator.cc +++ b/content/public/browser/page_navigator.cc
@@ -67,12 +67,22 @@ params.initiator_origin = handle->GetInitiatorOrigin(); params.source_site_instance = handle->GetSourceSiteInstance(); - params.redirect_chain = handle->GetRedirectChain(); params.user_gesture = handle->HasUserGesture(); params.started_from_context_menu = handle->WasStartedFromContextMenu(); params.href_translate = handle->GetHrefTranslate(); params.reload_type = handle->GetReloadType(); + // NavigationHandle will include all redirects that happened on the way to the + // the current page in its redirect chain, including the current page itself + // as the last entry. However OpenURLParams's redirect chain should only + // include redirects that occurred before the current page. We need to remove + // the last entry from `handle`'s redirect chain when initializing the + // OpenURLParams. + auto redirect_chain = handle->GetRedirectChain(); + DCHECK(redirect_chain.size()); + redirect_chain.pop_back(); + params.redirect_chain = std::move(redirect_chain); + // TODO(lukasza): Consider also covering |post_data| (and |uses_post|) and // |extra_headers| (this is difficult, because we can't cast |handle| to // NavigationRequest*, because it may be MockNavigationHandle in unit tests).
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc index 937f09c..c1a1971b 100644 --- a/content/public/common/content_features.cc +++ b/content/public/common/content_features.cc
@@ -1042,9 +1042,6 @@ const base::Feature kAccessibilityPageZoom{"AccessibilityPageZoom", base::FEATURE_DISABLED_BY_DEFAULT}; -const base::Feature kAccessibilityPageZoomUpdatedUI{ - "AccessibilityPageZoomUpdatedUI", base::FEATURE_DISABLED_BY_DEFAULT}; - // Sets moderate binding to background renderers playing media, when enabled. // Else the renderer will have strong binding. const base::Feature kBackgroundMediaRendererHasModerateBinding{
diff --git a/content/public/common/content_features.h b/content/public/common/content_features.h index eee5857..fa5abc1 100644 --- a/content/public/common/content_features.h +++ b/content/public/common/content_features.h
@@ -261,7 +261,6 @@ #if defined(OS_ANDROID) CONTENT_EXPORT extern const base::Feature kAccessibilityPageZoom; -CONTENT_EXPORT extern const base::Feature kAccessibilityPageZoomUpdatedUI; CONTENT_EXPORT extern const base::Feature kBackgroundMediaRendererHasModerateBinding; CONTENT_EXPORT extern const base::Feature kBindingManagementWaiveCpu;
diff --git a/content/public/test/mock_navigation_handle.cc b/content/public/test/mock_navigation_handle.cc index 1896dd4..0aa02c37 100644 --- a/content/public/test/mock_navigation_handle.cc +++ b/content/public/test/mock_navigation_handle.cc
@@ -28,6 +28,7 @@ web_contents_(WebContents::FromRenderFrameHost(render_frame_host)), render_frame_host_(render_frame_host), is_in_primary_main_frame_(IsInMainFrame()) { + redirect_chain_.push_back(url); proxy_server_ = net::ProxyServer::Direct(); }
diff --git a/content/test/data/gpu/webcodecs/copyTo.html b/content/test/data/gpu/webcodecs/copyTo.html new file mode 100644 index 0000000..7cb7099de --- /dev/null +++ b/content/test/data/gpu/webcodecs/copyTo.html
@@ -0,0 +1,25 @@ +<!DOCTYPE html> +<!-- +Take frames coming from various sources and read them using copyTo(). +--> +<title>copyTo() test</title> +<script src="webcodecs_common.js"></script> +<script type="text/javascript"> + 'use strict'; + + async function main(arg) { + let source_type = arg.source_type; + let source = await createFrameSource(source_type, 640, 480); + if (!source) { + TEST.log('Skipping unsupported source: ' + source_type); + return; + } + + let frame = await source.getNextFrame(); + let size = frame.allocationSize(); + let buf = new ArrayBuffer(size); + await frame.copyTo(buf); + // TODO(crbug.com/1206000): Compare |buf| to the frame. + frame.close(); + } +</script>
diff --git a/content/test/gpu/gpu_tests/test_expectations/context_lost_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/context_lost_expectations.txt index 7dec6f4f..7d2475f 100644 --- a/content/test/gpu/gpu_tests/test_expectations/context_lost_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/context_lost_expectations.txt
@@ -140,6 +140,9 @@ [ chromeos ] ContextLost_WebGPUUnblockedAfterUserInitiatedReload [ Skip ] [ chromeos ] GpuNormalTermination_WebGPUNotBlocked [ Skip ] +# ChromeOS +crbug.com/1253576 [ chromeos chromeos-board-kevin ] ContextLost_WebGLContextLostFromSelectElement [ Failure ] + # Flakily not getting WebGL blocked on context loss crbug.com/1143774 [ chromeos chromeos-board-kevin ] ContextLost_WebGLUnblockedAfterUserInitiatedReload [ RetryOnFailure ]
diff --git a/content/test/gpu/gpu_tests/test_expectations/gpu_process_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/gpu_process_expectations.txt index a91bcdb..b5fb9789 100644 --- a/content/test/gpu/gpu_tests/test_expectations/gpu_process_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/gpu_process_expectations.txt
@@ -92,6 +92,7 @@ # Flakily hits a DCHECK during shared image creation. crbug.com/1188437 [ linux intel display-server-wayland ] GpuProcess_webgl [ RetryOnFailure ] +crbug.com/1253917 [ linux intel display-server-wayland ] GpuProcess_disable_gpu [ RetryOnFailure ] ####################################################################### # Automated Entries After This Point - Do Not Manually Add Below Here #
diff --git a/content/test/gpu/gpu_tests/test_expectations/webgl2_conformance_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/webgl2_conformance_expectations.txt index 03906d5d..f564ee2f 100644 --- a/content/test/gpu/gpu_tests/test_expectations/webgl2_conformance_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/webgl2_conformance_expectations.txt
@@ -725,6 +725,7 @@ crbug.com/695742 [ android qualcomm angle-disabled ] deqp/functional/gles3/multisample/fbo_max_samples.html [ RetryOnFailure ] # Pixel 4 +crbug.com/1254008 [ android android-pixel-4 angle-opengles passthrough ] deqp/functional/gles3/transformfeedback/basic_types_interleaved_lines.html [ RetryOnFailure ] crbug.com/1175226 [ android android-pixel-4 angle-opengles passthrough ] conformance/rendering/blending.html [ Failure ] crbug.com/1175229 [ android android-pixel-4 angle-opengles passthrough ] conformance2/textures/webgl_canvas/tex-2d-rgb565-rgb-unsigned_byte.html [ Failure ] crbug.com/1175229 [ android android-pixel-4 angle-opengles passthrough ] conformance2/textures/webgl_canvas/tex-2d-rgb565-rgb-unsigned_short_5_6_5.html [ Failure ]
diff --git a/content/test/gpu/gpu_tests/test_expectations/webgl_conformance_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/webgl_conformance_expectations.txt index b772eb19..643f2e2 100644 --- a/content/test/gpu/gpu_tests/test_expectations/webgl_conformance_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/webgl_conformance_expectations.txt
@@ -762,6 +762,8 @@ crbug.com/1209254 [ android android-nexus-5x android-chromium passthrough ] conformance/textures/video/tex-2d-rgb-rgb-unsigned_byte.html [ RetryOnFailure ] crbug.com/1209254 [ android android-nexus-5x android-chromium passthrough ] conformance/textures/misc/texture-corner-case-videos.html [ RetryOnFailure ] +crbug.com/1253962 [ android android-nexus-5x android-chromium passthrough ] conformance/textures/canvas/* [ RetryOnFailure ] + ############ # ChromeOS # ############
diff --git a/content/test/gpu/gpu_tests/webcodecs_integration_test.py b/content/test/gpu/gpu_tests/webcodecs_integration_test.py index 4bcf532e..7f3f591f 100644 --- a/content/test/gpu/gpu_tests/webcodecs_integration_test.py +++ b/content/test/gpu/gpu_tests/webcodecs_integration_test.py
@@ -28,9 +28,11 @@ def GenerateGpuTests(cls, options): for source_type in frame_sources: yield ('WebCodecs_DrawImage_' + source_type, 'draw-image.html', - ('{ source_type : "%s" }' % (source_type))) + ('{ source_type : "%s" }' % (source_type, ))) yield ('WebCodecs_TexImage2d_' + source_type, 'tex-image-2d.html', - ('{ source_type : "%s" }' % (source_type))) + ('{ source_type : "%s" }' % (source_type, ))) + yield ('WebCodecs_copyTo_' + source_type, 'copyTo.html', + ('{ source_type : "%s" }' % (source_type, ))) for codec in codecs: yield ('WebCodecs_EncodeDecode_' + codec, 'encode-decode.html',
diff --git a/docs/speed/metrics_changelog/2021_09_lcp.md b/docs/speed/metrics_changelog/2021_09_lcp.md new file mode 100644 index 0000000..d2690f6 --- /dev/null +++ b/docs/speed/metrics_changelog/2021_09_lcp.md
@@ -0,0 +1,27 @@ +# Largest Contentful Paint Bug Fixes in M96 + +## Bug Fixes in Chrome 96 + +In Chrome 96, a bug fix was made to the Chrome implementation. Previously, a +[change](https://chromium-review.googlesource.com/c/chromium/src/+/2441732) was +made to ignore images occupying the full viewport. However, this change used the +frame's viewport instead of the page's viewport. This meant that images embedded +in an iframe and occupying the full iframe size were ignored. This fixes this +issue by always using the full page viewport instead of frame viewport when +considering which images to ignore. + +## How does this affect a site's metrics? + +We saw two main types of sites affected by this change: + +* Some sites embedding images or videos in smaller iframes could see changes, as +those images or poster images would no longer be ignored and could potentially +become the LCP. + +* Certain sites using ads may also see changes to their LCP scores because the +images embedded in those ads would no longer be ignored despite occupying the +full ad iframe size. + +## When were users affected? + +Chrome 96 is currently scheduled to be released the week of November 16, 2021.
diff --git a/docs/speed/metrics_changelog/lcp.md b/docs/speed/metrics_changelog/lcp.md index 58f7309..1bfd86d8 100644 --- a/docs/speed/metrics_changelog/lcp.md +++ b/docs/speed/metrics_changelog/lcp.md
@@ -2,6 +2,8 @@ This is a list of changes to [Largest Contentful Paint](https://web.dev/lcp). +* Chrome 96 + * Metric bug fix: [Largest Contentful Paint uses the page viewport](2021_09_lcp.md) * Chrome 88 * Metric definition improvement: [Largest Contentful Paint ignores full viewport images](2020_11_lcp.md) * Metric definition improvement: [Largest Contentful Paint stops recording after input in an iframe](2020_11_lcp.md)
diff --git a/extensions/browser/extension_function_histogram_value.h b/extensions/browser/extension_function_histogram_value.h index e39a216..e5fb87b1 100644 --- a/extensions/browser/extension_function_histogram_value.h +++ b/extensions/browser/extension_function_histogram_value.h
@@ -1653,6 +1653,7 @@ SPEECHRECOGNITIONPRIVATE_START = 1590, SPEECHRECOGNITIONPRIVATE_STOP = 1591, FILEMANAGERPRIVATEINTERNAL_STARTIOTASK = 1592, + WALLPAPERPRIVATE_ISSWAENABLED = 1593, // Last entry: Add new entries above, then run: // python tools/metrics/histograms/update_extension_histograms.py ENUM_BOUNDARY
diff --git a/infra/config/generated/luci/cr-buildbucket.cfg b/infra/config/generated/luci/cr-buildbucket.cfg index 86f861f..e4d9c430 100644 --- a/infra/config/generated/luci/cr-buildbucket.cfg +++ b/infra/config/generated/luci/cr-buildbucket.cfg
@@ -72378,7 +72378,7 @@ swarming_host: "chromium-swarm.appspot.com" swarming_tags: "vpython:native-python-wrapper" dimensions: "builder:linux-rel" - dimensions: "cores:2" + dimensions: "cores:2|4" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-18.04" dimensions: "pool:luci.chromium.try"
diff --git a/infra/config/subprojects/chromium/try.star b/infra/config/subprojects/chromium/try.star index d452eda..258a087 100644 --- a/infra/config/subprojects/chromium/try.star +++ b/infra/config/subprojects/chromium/try.star
@@ -1311,7 +1311,7 @@ name = "linux-rel", branch_selector = branches.STANDARD_MILESTONE, builderless = not settings.is_main, - cores = 2, + cores = "2|4", executable = "recipe:chromium/orchestrator", main_list_view = "try", use_clang_coverage = True,
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 c6f2fe4..3d9b872 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 @@ -9e995606fb76abb33818848920af49495c392be5 \ No newline at end of file +9a5e81ab00a91908cc812c5d7c20ab6cfb906251 \ 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 2cfd32f..c478ce4 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 @@ -2c9e2bd4676a691f05253485b2cd74c512ecbdf7 \ No newline at end of file +fbcd34c886f37f97f9fdfc8f69d1fe9cc03ae971 \ 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 c40ef446..b40c2f1 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 @@ -610096f9bdfaba0dbfbd0c7530e6cb86ec8a856f \ No newline at end of file +f169bf276ed6762c93a1e943554335fac8aa69a7 \ 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 76494c5..1ba45ca4 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 @@ -cf8afe2097c8c2639f69f7701405011b1cfe6e71 \ No newline at end of file +c71bd3782766fe770a364850a8abafead1444f33 \ 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 1ea6887..b5b0460 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 @@ -4d089675a12a105e8a0af62e77f0db70d708d792 \ No newline at end of file +ea22975ffdd26a297d7d0ff9c9c1e662a5d5d25a \ 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 580675f..aae40de3 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 @@ -3b0b014df6e4fb363690c0d9a092bc44dcf6b9b7 \ No newline at end of file +87054e989923ee59e6af50936c6a7fcf1fd1a95a \ 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 f2e1c852..f1614644 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 @@ -15d343a1700dcf3b318b6f2a9070d10698b59aff \ No newline at end of file +42427681cacfa897c1bae25eede10d64651d79a5 \ 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 f27b8687..51d4ae5 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 @@ -2a9ed0f5eb1a147821087194afdd84c2a12aced2 \ No newline at end of file +e4080d03a3e802b2c0e765b3d08034df15600d4e \ 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 a2b4452..e3b2f2d 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 @@ -dd1610016e54c33ae4cf455858f3f20175383e92 \ No newline at end of file +0dd66718e54993c20f87afa70278bee584de1a89 \ 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 7ec9154..d75baead 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 @@ -0bd1c2a3161dc53fb958072bfebe8819cc5ba47d \ No newline at end of file +0906bf12628410ec0a7fca9fe8172f0677e22057 \ No newline at end of file
diff --git a/ios/net/cookies/cookie_store_ios.h b/ios/net/cookies/cookie_store_ios.h index 8f5a9480..2f97015 100644 --- a/ios/net/cookies/cookie_store_ios.h +++ b/ios/net/cookies/cookie_store_ios.h
@@ -165,9 +165,11 @@ std::unique_ptr<CookieChangeSubscription> AddCallbackForCookie( const GURL& url, const std::string& name, + const absl::optional<net::CookiePartitionKey>& cookie_partition_key, CookieChangeCallback callback) override WARN_UNUSED_RESULT; std::unique_ptr<CookieChangeSubscription> AddCallbackForUrl( const GURL& url, + const absl::optional<net::CookiePartitionKey>& cookie_partition_key, CookieChangeCallback callback) override WARN_UNUSED_RESULT; std::unique_ptr<CookieChangeSubscription> AddCallbackForAllChanges( CookieChangeCallback callback) override WARN_UNUSED_RESULT;
diff --git a/ios/net/cookies/cookie_store_ios.mm b/ios/net/cookies/cookie_store_ios.mm index 8724b5a..3d0c96b 100644 --- a/ios/net/cookies/cookie_store_ios.mm +++ b/ios/net/cookies/cookie_store_ios.mm
@@ -170,14 +170,20 @@ CookieStoreIOS::CookieChangeDispatcherIOS::AddCallbackForCookie( const GURL& gurl, const std::string& name, + const absl::optional<net::CookiePartitionKey>& cookie_partition_key, CookieChangeCallback callback) { + // iOS does not support Partitioned cookies. + DCHECK(!cookie_partition_key); return cookie_store_->AddCallbackForCookie(gurl, name, std::move(callback)); } std::unique_ptr<CookieChangeSubscription> CookieStoreIOS::CookieChangeDispatcherIOS::AddCallbackForUrl( const GURL& gurl, + const absl::optional<net::CookiePartitionKey>& cookie_partition_key, CookieChangeCallback callback) { + // iOS does not support Partitioned cookies. + DCHECK(!cookie_partition_key); // Implement when needed by iOS consumers. NOTIMPLEMENTED(); return nullptr;
diff --git a/ios/net/cookies/cookie_store_ios_unittest.mm b/ios/net/cookies/cookie_store_ios_unittest.mm index 3b679aa..ded5cca 100644 --- a/ios/net/cookies/cookie_store_ios_unittest.mm +++ b/ios/net/cookies/cookie_store_ios_unittest.mm
@@ -70,6 +70,7 @@ static const bool has_exact_change_ordering = false; static const int creation_time_granularity_in_ms = 1000; static const bool supports_cookie_access_semantics = false; + static const bool supports_partitioned_cookies = false; base::test::SingleThreadTaskEnvironment task_environment_; }; @@ -142,6 +143,7 @@ cookie_change_subscription_ = store_->GetChangeDispatcher().AddCallbackForCookie( kTestCookieURLFooBar, "abc", + /*cookie_partition_key=*/absl::nullopt, base::BindRepeating(&RecordCookieChanges, &cookies_changed_, &cookies_removed_)); } @@ -363,6 +365,7 @@ std::unique_ptr<net::CookieChangeSubscription> handle = store_->GetChangeDispatcher().AddCallbackForCookie( kTestCookieURLFooBar, "abc", + /*cookie_partition_key=*/absl::nullopt, base::BindRepeating(&RecordCookieChanges, &cookies, nullptr)); EXPECT_EQ(0U, cookies.size()); } @@ -373,6 +376,7 @@ std::unique_ptr<net::CookieChangeSubscription> handle = store_->GetChangeDispatcher().AddCallbackForCookie( kTestCookieURLFooBar, "abc", + /*cookie_partition_key=*/absl::nullopt, base::BindRepeating(&RecordCookieChanges, &cookies, nullptr)); EXPECT_EQ(0U, cookies.size()); DeleteSystemCookie(kTestCookieURLFooBar, "abc"); @@ -384,6 +388,7 @@ std::unique_ptr<net::CookieChangeSubscription> handle = store_->GetChangeDispatcher().AddCallbackForCookie( kTestCookieURLFooBar, "abc", + /*cookie_partition_key=*/absl::nullopt, base::BindRepeating(&RecordCookieChanges, &cookies, &removes)); EXPECT_EQ(0U, cookies.size()); EXPECT_EQ(0U, removes.size()); @@ -408,6 +413,7 @@ std::unique_ptr<net::CookieChangeSubscription> handle = store_->GetChangeDispatcher().AddCallbackForCookie( kTestCookieURLFooBar, "abc", + /*cookie_partition_key=*/absl::nullopt, base::BindRepeating(&RecordCookieChanges, &cookies, &removes)); EXPECT_EQ(0U, cookies.size()); SetSystemCookie(kTestCookieURLFooBar, "abc", "def"); @@ -432,6 +438,7 @@ std::unique_ptr<net::CookieChangeSubscription> handle = store_->GetChangeDispatcher().AddCallbackForCookie( kTestCookieURLFooBar, "abc", + /*cookie_partition_key=*/absl::nullopt, base::BindRepeating(&RecordCookieChanges, &cookies, &removes)); EXPECT_EQ(0U, cookies.size()); DeleteSystemCookie(kTestCookieURLFooBar, "abc"); @@ -450,6 +457,7 @@ std::unique_ptr<net::CookieChangeSubscription> handle = store_->GetChangeDispatcher().AddCallbackForCookie( kTestCookieURLFooBar, "abc", + /*cookie_partition_key=*/absl::nullopt, base::BindRepeating(&RecordCookieChanges, &cookies, nullptr)); EXPECT_EQ(0U, cookies.size()); SetSystemCookie(kTestCookieURLFooBar, "abc", "def"); @@ -467,18 +475,22 @@ std::unique_ptr<net::CookieChangeSubscription> handle = store_->GetChangeDispatcher().AddCallbackForCookie( kTestCookieURLFooBar, "abc", + /*cookie_partition_key=*/absl::nullopt, base::BindRepeating(&RecordCookieChanges, &cookies, nullptr)); std::unique_ptr<net::CookieChangeSubscription> handle2 = store_->GetChangeDispatcher().AddCallbackForCookie( kTestCookieURLFooBaz, "abc", + /*cookie_partition_key=*/absl::nullopt, base::BindRepeating(&RecordCookieChanges, &cookies2, nullptr)); std::unique_ptr<net::CookieChangeSubscription> handle3 = store_->GetChangeDispatcher().AddCallbackForCookie( kTestCookieURLFoo, "abc", + /*cookie_partition_key=*/absl::nullopt, base::BindRepeating(&RecordCookieChanges, &cookies3, nullptr)); std::unique_ptr<net::CookieChangeSubscription> handle4 = store_->GetChangeDispatcher().AddCallbackForCookie( kTestCookieURLBarBar, "abc", + /*cookie_partition_key=*/absl::nullopt, base::BindRepeating(&RecordCookieChanges, &cookies4, nullptr)); SetSystemCookie(kTestCookieURLFooBar, "abc", "def"); SetSystemCookie(kTestCookieURLFooBaz, "abc", "def"); @@ -500,6 +512,7 @@ std::unique_ptr<net::CookieChangeSubscription> handle = store_->GetChangeDispatcher().AddCallbackForCookie( kTestCookieURLFooBaz, "abc", + /*cookie_partition_key=*/absl::nullopt, base::BindRepeating(&RecordCookieChanges, &cookies, nullptr)); EXPECT_EQ(0U, cookies.size()); SetSystemCookie(kTestCookieURLFoo, "abc", "ghi"); @@ -513,6 +526,7 @@ std::unique_ptr<net::CookieChangeSubscription> handle = store_->GetChangeDispatcher().AddCallbackForCookie( kTestCookieURLFooBaz, "abc", + /*cookie_partition_key=*/absl::nullopt, base::BindRepeating(&RecordCookieChanges, &cookies, nullptr)); EXPECT_EQ(0U, cookies.size()); SetSystemCookie(kTestCookieURLFooBaz, "abc", "ghi"); @@ -526,6 +540,7 @@ std::unique_ptr<net::CookieChangeSubscription> handle = store_->GetChangeDispatcher().AddCallbackForCookie( kTestCookieURLFooBaz, "abc", + /*cookie_partition_key=*/absl::nullopt, base::BindRepeating(&RecordCookieChanges, &cookies, nullptr)); EXPECT_EQ(0U, cookies.size()); SetSystemCookie(kTestCookieURLFooBaz, "abc", "def"); @@ -539,6 +554,7 @@ std::unique_ptr<net::CookieChangeSubscription> handle = store_->GetChangeDispatcher().AddCallbackForCookie( kTestCookieURLFooBar, "abc", + /*cookie_partition_key=*/absl::nullopt, base::BindRepeating(&RecordCookieChanges, &cookies, nullptr)); EXPECT_EQ(0U, cookies.size()); SetSystemCookie(kTestCookieURLFooBar, "abc", "ghi");
diff --git a/media/base/video_util.cc b/media/base/video_util.cc index aa1623d..ebd61ff 100644 --- a/media/base/video_util.cc +++ b/media/base/video_util.cc
@@ -62,202 +62,159 @@ } } -std::pair<SkColorType, GrGLenum> GetSkiaAndGlColorTypesForPlane( - VideoPixelFormat format, - size_t plane) { - // TODO(eugene): There is some strange channel switch during RGB readback. - // When frame's pixel format matches GL and Skia color types we get reversed - // channels. But why? - switch (format) { - case PIXEL_FORMAT_NV12: - if (plane == VideoFrame::kUVPlane) - return {kR8G8_unorm_SkColorType, GL_RG8_EXT}; - if (plane == VideoFrame::kYPlane) - return {kAlpha_8_SkColorType, GL_R8_EXT}; - break; - case PIXEL_FORMAT_XBGR: - if (plane == VideoFrame::kARGBPlane) - return {kRGBA_8888_SkColorType, GL_RGBA8_OES}; - break; - case PIXEL_FORMAT_ABGR: - if (plane == VideoFrame::kARGBPlane) - return {kRGBA_8888_SkColorType, GL_RGBA8_OES}; - break; - case PIXEL_FORMAT_XRGB: - if (plane == VideoFrame::kARGBPlane) - return {kBGRA_8888_SkColorType, GL_BGRA8_EXT}; - break; +VideoPixelFormat ReadbackFormat(const media::VideoFrame& frame) { + switch (frame.format()) { + case PIXEL_FORMAT_I420: + case PIXEL_FORMAT_I420A: + case PIXEL_FORMAT_I422: + case PIXEL_FORMAT_I444: case PIXEL_FORMAT_ARGB: - if (plane == VideoFrame::kARGBPlane) - return {kBGRA_8888_SkColorType, GL_BGRA8_EXT}; - break; + case PIXEL_FORMAT_XRGB: + case PIXEL_FORMAT_ABGR: + case PIXEL_FORMAT_XBGR: + return frame.format(); + case PIXEL_FORMAT_NV12: + // |frame| may be backed by a graphics buffer that is NV12, but sampled as + // a single RGB texture. + return frame.NumTextures() == 1 ? PIXEL_FORMAT_XRGB : PIXEL_FORMAT_NV12; default: - break; + // Currently unsupported. + return PIXEL_FORMAT_UNKNOWN; } - NOTREACHED(); - return {kUnknown_SkColorType, 0}; } -scoped_refptr<VideoFrame> ReadbackTextureBackedFrameToMemorySyncGLES( - const VideoFrame& txt_frame, - gpu::raster::RasterInterface* ri, - GrDirectContext* gr_context, - VideoFramePool* pool) { +// TODO(eugene): There is some strange channel switch during RGB readback. +// When frame's pixel format matches GL and Skia color types we get reversed +// channels. But why? +SkColorType SkColorTypeForPlane(VideoPixelFormat format, size_t plane) { + switch (format) { + case PIXEL_FORMAT_I420: + case PIXEL_FORMAT_I420A: + case PIXEL_FORMAT_I422: + case PIXEL_FORMAT_I444: + // kGray_8_SkColorType would make more sense but doesn't work on Windows. + return kAlpha_8_SkColorType; + case PIXEL_FORMAT_NV12: + return plane == media::VideoFrame::kYPlane ? kAlpha_8_SkColorType + : kR8G8_unorm_SkColorType; + case PIXEL_FORMAT_XBGR: + case PIXEL_FORMAT_ABGR: + return kRGBA_8888_SkColorType; + case PIXEL_FORMAT_XRGB: + case PIXEL_FORMAT_ARGB: + return kBGRA_8888_SkColorType; + default: + NOTREACHED(); + return kUnknown_SkColorType; + } +} + +GrGLenum GLFormatForPlane(VideoPixelFormat format, size_t plane) { + switch (SkColorTypeForPlane(format, plane)) { + case kAlpha_8_SkColorType: + return GL_R8_EXT; + case kR8G8_unorm_SkColorType: + return GL_RG8_EXT; + case kRGBA_8888_SkColorType: + return GL_RGBA8_OES; + case kBGRA_8888_SkColorType: + return GL_BGRA8_EXT; + default: + NOTREACHED(); + return 0; + } +} + +bool ReadbackTexturePlaneToMemorySyncSkImage(const VideoFrame& src_frame, + size_t src_plane, + gfx::Rect& src_rect, + uint8_t* dest_pixels, + size_t dest_stride, + gpu::raster::RasterInterface* ri, + GrDirectContext* gr_context) { DCHECK(gr_context); - if (txt_frame.NumTextures() > 2 || txt_frame.NumTextures() < 1) { - DLOG(ERROR) << "Readback is not possible for this frame: " - << txt_frame.AsHumanReadableString(); - return nullptr; + VideoPixelFormat format = ReadbackFormat(src_frame); + int width = src_frame.columns(src_plane); + int height = src_frame.rows(src_plane); + bool has_alpha = !IsOpaque(format) && src_frame.NumTextures() == 1; + + const gpu::MailboxHolder& holder = src_frame.mailbox_holder(src_plane); + DCHECK(!holder.mailbox.IsZero()); + ri->WaitSyncTokenCHROMIUM(holder.sync_token.GetConstData()); + auto texture_id = ri->CreateAndConsumeForGpuRaster(holder.mailbox); + if (holder.mailbox.IsSharedImage()) { + ri->BeginSharedImageAccessDirectCHROMIUM( + texture_id, GL_SHARED_IMAGE_ACCESS_MODE_READ_CHROMIUM); + } + base::ScopedClosureRunner cleanup(base::BindOnce( + [](GLuint texture_id, bool shared, gpu::raster::RasterInterface* ri) { + if (shared) + ri->EndSharedImageAccessDirectCHROMIUM(texture_id); + ri->DeleteGpuRasterTexture(texture_id); + }, + texture_id, holder.mailbox.IsSharedImage(), ri)); + + GrGLenum texture_format = GLFormatForPlane(format, src_plane); + SkColorType sk_color_type = SkColorTypeForPlane(format, src_plane); + SkAlphaType sk_alpha_type = + has_alpha ? kUnpremul_SkAlphaType : kOpaque_SkAlphaType; + + GrGLTextureInfo gl_texture_info; + gl_texture_info.fID = texture_id; + gl_texture_info.fTarget = holder.texture_target; + gl_texture_info.fFormat = texture_format; + GrBackendTexture texture(width, height, GrMipMapped::kNo, gl_texture_info); + + auto image = + SkImage::MakeFromTexture(gr_context, texture, + src_frame.metadata().texture_origin_is_top_left + ? kTopLeft_GrSurfaceOrigin + : kBottomLeft_GrSurfaceOrigin, + sk_color_type, sk_alpha_type, + /*colorSpace=*/nullptr); + if (!image) { + DLOG(ERROR) << "Can't create SkImage from texture plane " << src_plane; + return false; } - VideoPixelFormat result_format = txt_frame.format(); - if (txt_frame.NumTextures() == 1 && result_format == PIXEL_FORMAT_NV12) { - // Even though |txt_frame| format is NV12 and it is NV12 in GPU memory, - // the texture is a RGB view that is produced by a shader on the fly. - // So we currently we currently can only read it back as RGB. - result_format = PIXEL_FORMAT_ARGB; + auto dest_info = SkImageInfo::Make(src_rect.width(), src_rect.height(), + sk_color_type, sk_alpha_type); + SkPixmap dest_pixmap(dest_info, dest_pixels, dest_stride); + if (!image->readPixels(gr_context, dest_pixmap, src_rect.x(), src_rect.y(), + SkImage::kDisallow_CachingHint)) { + DLOG(ERROR) << "Plane readback failed." + << " plane:" << src_plane << " width: " << width + << " height: " << height; + return false; } - scoped_refptr<VideoFrame> result = - pool - ? pool->CreateFrame(result_format, txt_frame.coded_size(), - txt_frame.visible_rect(), - txt_frame.natural_size(), txt_frame.timestamp()) - : VideoFrame::CreateFrame( - result_format, txt_frame.coded_size(), txt_frame.visible_rect(), - txt_frame.natural_size(), txt_frame.timestamp()); - result->set_color_space(txt_frame.ColorSpace()); - result->metadata().MergeMetadataFrom(txt_frame.metadata()); - result->metadata().texture_origin_is_top_left = true; - - size_t planes = VideoFrame::NumPlanes(result->format()); - for (size_t plane = 0; plane < planes; plane++) { - const gpu::MailboxHolder& holder = txt_frame.mailbox_holder(plane); - if (holder.mailbox.IsZero()) - return nullptr; - ri->WaitSyncTokenCHROMIUM(holder.sync_token.GetConstData()); - - int width = result->columns(plane); - int height = result->rows(plane); - - auto texture_id = ri->CreateAndConsumeForGpuRaster(holder.mailbox); - if (holder.mailbox.IsSharedImage()) { - ri->BeginSharedImageAccessDirectCHROMIUM( - texture_id, GL_SHARED_IMAGE_ACCESS_MODE_READ_CHROMIUM); - } - - auto cleanup_fn = [](GLuint texture_id, bool shared, - gpu::raster::RasterInterface* ri) { - if (shared) - ri->EndSharedImageAccessDirectCHROMIUM(texture_id); - ri->DeleteGpuRasterTexture(texture_id); - }; - base::ScopedClosureRunner cleanup(base::BindOnce( - cleanup_fn, texture_id, holder.mailbox.IsSharedImage(), ri)); - - GrGLenum texture_format; - SkColorType sk_color_type; - std::tie(sk_color_type, texture_format) = - GetSkiaAndGlColorTypesForPlane(result->format(), plane); - GrGLTextureInfo gl_texture_info; - gl_texture_info.fID = texture_id; - gl_texture_info.fTarget = holder.texture_target; - gl_texture_info.fFormat = texture_format; - - GrBackendTexture texture(width, height, GrMipMapped::kNo, gl_texture_info); - auto image = SkImage::MakeFromTexture( - gr_context, texture, - txt_frame.metadata().texture_origin_is_top_left - ? kTopLeft_GrSurfaceOrigin - : kBottomLeft_GrSurfaceOrigin, - sk_color_type, kOpaque_SkAlphaType, /*colorSpace=*/nullptr); - - if (!image) { - DLOG(ERROR) << "Can't create SkImage from texture!" - << " plane:" << plane; - return nullptr; - } - - auto info = - SkImageInfo::Make(width, height, sk_color_type, kOpaque_SkAlphaType); - SkPixmap pixmap(info, result->data(plane), result->row_bytes(plane)); - if (!image->readPixels(gr_context, pixmap, 0, 0, - SkImage::kDisallow_CachingHint)) { - DLOG(ERROR) << "Plane readback failed." - << " plane:" << plane << " width: " << width - << " height: " << height - << " minRowBytes: " << info.minRowBytes(); - return nullptr; - } - } - - return result; + return true; } -scoped_refptr<VideoFrame> ReadbackTextureBackedFrameToMemorySyncOOP( - const VideoFrame& txt_frame, - gpu::raster::RasterInterface* ri, - VideoFramePool* pool) { - if (txt_frame.NumTextures() > 2 || txt_frame.NumTextures() < 1) { - DLOG(ERROR) << "Readback is not possible for this frame: " - << txt_frame.AsHumanReadableString(); - return nullptr; - } +bool ReadbackTexturePlaneToMemorySyncOOP(const VideoFrame& src_frame, + size_t src_plane, + gfx::Rect& src_rect, + uint8_t* dest_pixels, + size_t dest_stride, + gpu::raster::RasterInterface* ri) { + VideoPixelFormat format = ReadbackFormat(src_frame); + bool has_alpha = !IsOpaque(format) && src_frame.NumTextures() == 1; - VideoPixelFormat result_format = txt_frame.format(); - if (txt_frame.NumTextures() == 1 && result_format == PIXEL_FORMAT_NV12) { - // Even though |txt_frame| format is NV12 and it is NV12 in GPU memory, - // the texture is a RGB view that is produced by a shader on the fly. - // So we currently we currently can only read it back as RGB. - result_format = PIXEL_FORMAT_ARGB; - } + const gpu::MailboxHolder& holder = src_frame.mailbox_holder(src_plane); + DCHECK(!holder.mailbox.IsZero()); + ri->WaitSyncTokenCHROMIUM(holder.sync_token.GetConstData()); - scoped_refptr<VideoFrame> result = - pool - ? pool->CreateFrame(result_format, txt_frame.coded_size(), - txt_frame.visible_rect(), - txt_frame.natural_size(), txt_frame.timestamp()) - : VideoFrame::CreateFrame( - result_format, txt_frame.coded_size(), txt_frame.visible_rect(), - txt_frame.natural_size(), txt_frame.timestamp()); - result->set_color_space(txt_frame.ColorSpace()); - result->metadata().MergeMetadataFrom(txt_frame.metadata()); + SkColorType sk_color_type = SkColorTypeForPlane(format, src_plane); + SkAlphaType sk_alpha_type = + has_alpha ? kUnpremul_SkAlphaType : kOpaque_SkAlphaType; - size_t planes = VideoFrame::NumPlanes(result->format()); - for (size_t plane = 0; plane < planes; plane++) { - const gpu::MailboxHolder& holder = txt_frame.mailbox_holder(plane); - if (holder.mailbox.IsZero()) { - DLOG(ERROR) << "Can't readback video frame with Zero texture on plane " - << plane; - return nullptr; - } - ri->WaitSyncTokenCHROMIUM(holder.sync_token.GetConstData()); - - int width = result->columns(plane); - int height = result->rows(plane); - - GrGLenum texture_format; - SkColorType sk_color_type; - std::tie(sk_color_type, texture_format) = - GetSkiaAndGlColorTypesForPlane(result->format(), plane); - - auto info = - SkImageInfo::Make(width, height, sk_color_type, kOpaque_SkAlphaType); - - ri->ReadbackImagePixels(holder.mailbox, info, info.minRowBytes(), 0, 0, - result->data(plane)); - if (ri->GetError() != GL_NO_ERROR) { - DLOG(ERROR) << "Plane readback failed." - << " plane:" << plane << " width: " << width - << " height: " << height - << " minRowBytes: " << info.minRowBytes() - << " error: " << ri->GetError(); - return nullptr; - } - } - - return result; + auto info = SkImageInfo::Make(src_rect.width(), src_rect.height(), + sk_color_type, sk_alpha_type); + ri->ReadbackImagePixels(holder.mailbox, info, dest_stride, src_rect.x(), + src_rect.y(), dest_pixels); + DCHECK_EQ(ri->GetError(), static_cast<GLenum>(GL_NO_ERROR)); + return true; } } // namespace @@ -699,11 +656,53 @@ VideoFramePool* pool) { DCHECK(ri); - if (gr_context) { - return ReadbackTextureBackedFrameToMemorySyncGLES(txt_frame, ri, gr_context, - pool); + VideoPixelFormat format = ReadbackFormat(txt_frame); + if (format == PIXEL_FORMAT_UNKNOWN) { + DLOG(ERROR) << "Readback is not possible for this frame: " + << txt_frame.AsHumanReadableString(); + return nullptr; } - return ReadbackTextureBackedFrameToMemorySyncOOP(txt_frame, ri, pool); + + scoped_refptr<VideoFrame> result = + pool ? pool->CreateFrame(format, txt_frame.coded_size(), + txt_frame.visible_rect(), + txt_frame.natural_size(), txt_frame.timestamp()) + : VideoFrame::CreateFrame( + format, txt_frame.coded_size(), txt_frame.visible_rect(), + txt_frame.natural_size(), txt_frame.timestamp()); + result->set_color_space(txt_frame.ColorSpace()); + result->metadata().MergeMetadataFrom(txt_frame.metadata()); + + size_t planes = VideoFrame::NumPlanes(format); + for (size_t plane = 0; plane < planes; plane++) { + gfx::Rect src_rect(0, 0, txt_frame.columns(plane), txt_frame.rows(plane)); + if (!ReadbackTexturePlaneToMemorySync( + txt_frame, plane, src_rect, result->data(plane), + result->stride(plane), ri, gr_context)) { + return nullptr; + } + } + + return result; +} + +bool ReadbackTexturePlaneToMemorySync(const VideoFrame& src_frame, + size_t src_plane, + gfx::Rect& src_rect, + uint8_t* dest_pixels, + size_t dest_stride, + gpu::raster::RasterInterface* ri, + GrDirectContext* gr_context) { + DCHECK(ri); + + if (gr_context) { + return ReadbackTexturePlaneToMemorySyncSkImage(src_frame, src_plane, + src_rect, dest_pixels, + dest_stride, ri, gr_context); + } + + return ReadbackTexturePlaneToMemorySyncOOP(src_frame, src_plane, src_rect, + dest_pixels, dest_stride, ri); } Status ConvertAndScaleFrame(const VideoFrame& src_frame,
diff --git a/media/base/video_util.h b/media/base/video_util.h index 3df1619..87ecadd 100644 --- a/media/base/video_util.h +++ b/media/base/video_util.h
@@ -153,6 +153,17 @@ GrDirectContext* gr_context, VideoFramePool* pool = nullptr); +// Synchronously reads a single plane. |src_rect| is relative to the plane, +// which may be smaller than |frame| due to subsampling. +MEDIA_EXPORT bool ReadbackTexturePlaneToMemorySync( + const VideoFrame& src_frame, + size_t src_plane, + gfx::Rect& src_rect, + uint8_t* dest_pixels, + size_t dest_stride, + gpu::raster::RasterInterface* ri, + GrDirectContext* gr_context); + // Converts a frame with I420A format into I420 by dropping alpha channel. MEDIA_EXPORT scoped_refptr<VideoFrame> WrapAsI420VideoFrame( scoped_refptr<VideoFrame> frame);
diff --git a/media/filters/frame_buffer_pool.cc b/media/filters/frame_buffer_pool.cc index 7a140f1..3b0ef84 100644 --- a/media/filters/frame_buffer_pool.cc +++ b/media/filters/frame_buffer_pool.cc
@@ -13,6 +13,7 @@ #include "base/memory/free_deleter.h" #include "base/process/memory.h" #include "base/sequenced_task_runner.h" +#include "base/strings/stringprintf.h" #include "base/threading/sequenced_task_runner_handle.h" #include "base/trace_event/memory_allocator_dump.h" #include "base/trace_event/memory_dump_manager.h" @@ -141,9 +142,13 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); base::trace_event::MemoryAllocatorDump* memory_dump = - pmd->CreateAllocatorDump("media/frame_buffers/memory_pool"); + pmd->CreateAllocatorDump( + base::StringPrintf("media/frame_buffers/memory_pool/0x%" PRIXPTR, + reinterpret_cast<uintptr_t>(this))); base::trace_event::MemoryAllocatorDump* used_memory_dump = - pmd->CreateAllocatorDump("media/frame_buffers/memory_pool/used"); + pmd->CreateAllocatorDump( + base::StringPrintf("media/frame_buffers/memory_pool/used/0x%" PRIXPTR, + reinterpret_cast<uintptr_t>(this))); pmd->AddSuballocation(memory_dump->guid(), base::trace_event::MemoryDumpManager::GetInstance()
diff --git a/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc b/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc index f05261e..8ce0965 100644 --- a/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc +++ b/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc
@@ -1478,6 +1478,10 @@ &scaled_d3d11_texture); RETURN_ON_HR_FAILURE(hr, "Failed to create texture", hr); + hr = media::SetDebugName(scaled_d3d11_texture.Get(), + "MFVideoEncodeAccelerator_ScaledTexture"); + RETURN_ON_HR_FAILURE(hr, "Failed to set debug name", hr); + D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC output_desc = {}; output_desc.ViewDimension = D3D11_VPOV_DIMENSION_TEXTURE2D; output_desc.Texture2D.MipSlice = 0;
diff --git a/media/mojo/services/BUILD.gn b/media/mojo/services/BUILD.gn index 84ce634..5e04ab0 100644 --- a/media/mojo/services/BUILD.gn +++ b/media/mojo/services/BUILD.gn
@@ -114,7 +114,7 @@ [ "//chromeos/components/cdm_factory_daemon:cdm_factory_daemon_gpu" ] } } else { - sources += [ "gpu_mojo_media_client_stubs.cc" ] + sources += [ "gpu_mojo_media_client_default.cc" ] } if (is_android) {
diff --git a/media/mojo/services/gpu_mojo_media_client.cc b/media/mojo/services/gpu_mojo_media_client.cc index fa1e4227..c4bcbb2 100644 --- a/media/mojo/services/gpu_mojo_media_client.cc +++ b/media/mojo/services/gpu_mojo_media_client.cc
@@ -63,11 +63,7 @@ std::unique_ptr<MediaLog> media_log, RequestOverlayInfoCB request_overlay_info_cb, const gfx::ColorSpace* target_color_space, - gpu::GpuPreferences gpu_preferences, - gpu::GpuFeatureInfo gpu_feature_info, - const gpu::GpuDriverBugWorkarounds* gpu_workarounds, gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory, - GetConfigCacheCB get_cached_configs_cb, GetCommandBufferStubCB get_command_buffer_stub_cb, AndroidOverlayMojoFactoryCB android_overlay_factory_cb) : task_runner(std::move(task_runner)), @@ -75,11 +71,7 @@ media_log(std::move(media_log)), request_overlay_info_cb(request_overlay_info_cb), target_color_space(target_color_space), - gpu_preferences(gpu_preferences), - gpu_feature_info(gpu_feature_info), - gpu_workarounds(gpu_workarounds), gpu_memory_buffer_factory(gpu_memory_buffer_factory), - get_cached_configs_cb(std::move(get_cached_configs_cb)), get_command_buffer_stub_cb(std::move(get_command_buffer_stub_cb)), android_overlay_factory_cb(std::move(android_overlay_factory_cb)) {} @@ -97,35 +89,79 @@ gpu_task_runner_(std::move(gpu_task_runner)), media_gpu_channel_manager_(std::move(media_gpu_channel_manager)), android_overlay_factory_cb_(std::move(android_overlay_factory_cb)), - gpu_memory_buffer_factory_(gpu_memory_buffer_factory) {} + gpu_memory_buffer_factory_(gpu_memory_buffer_factory), + platform_(PlatformDelegate::Create(this)) {} GpuMojoMediaClient::~GpuMojoMediaClient() = default; +GpuMojoMediaClient::PlatformDelegate::~PlatformDelegate() = default; + +std::unique_ptr<VideoDecoder> +GpuMojoMediaClient::PlatformDelegate::CreateVideoDecoder( + const VideoDecoderTraits&) { + return nullptr; +} + +void GpuMojoMediaClient::PlatformDelegate::GetSupportedVideoDecoderConfigs( + MojoMediaClient::SupportedVideoDecoderConfigsCallback callback) { + std::move(callback).Run({}); +} + +std::unique_ptr<AudioDecoder> +GpuMojoMediaClient::PlatformDelegate::CreateAudioDecoder( + scoped_refptr<base::SingleThreadTaskRunner> task_runner) { + return nullptr; +} + +std::unique_ptr<CdmFactory> +GpuMojoMediaClient::PlatformDelegate::CreateCdmFactory( + mojom::FrameInterfaceFactory* frame_interfaces) { + return nullptr; +} + +VideoDecoderType +GpuMojoMediaClient::PlatformDelegate::GetDecoderImplementationType() { + return VideoDecoderType::kUnknown; +} + std::unique_ptr<AudioDecoder> GpuMojoMediaClient::CreateAudioDecoder( scoped_refptr<base::SingleThreadTaskRunner> task_runner) { - return CreatePlatformAudioDecoder(task_runner); + return platform_->CreateAudioDecoder(task_runner); } VideoDecoderType GpuMojoMediaClient::GetDecoderImplementationType() { - return GetPlatformDecoderImplementationType(gpu_workarounds_, - gpu_preferences_); + return platform_->GetDecoderImplementationType(); } -SupportedVideoDecoderConfigs -GpuMojoMediaClient::GetSupportedVideoDecoderConfigs() { - if (!supported_config_cache_) - supported_config_cache_ = GetPlatformSupportedVideoDecoderConfigs( - gpu_workarounds_, gpu_preferences_, - // GetPlatformSupportedVideoDecoderConfigs runs this callback either - // never or immediately, and will not store it, so |this| will outlive - // the bound function. - base::BindOnce(&GpuMojoMediaClient::GetVDAVideoDecoderConfigs, +void GpuMojoMediaClient::GetSupportedVideoDecoderConfigs( + MojoMediaClient::SupportedVideoDecoderConfigsCallback callback) { + if (supported_config_cache_) { + DCHECK(pending_supported_config_callbacks_.empty()); + + std::move(callback).Run(*supported_config_cache_); + return; + } + + const bool should_query = pending_supported_config_callbacks_.empty(); + pending_supported_config_callbacks_.push_back(std::move(callback)); + if (should_query) { + // Only get configurations if there is no query already in flight. + platform_->GetSupportedVideoDecoderConfigs( + base::BindOnce(&GpuMojoMediaClient::OnSupportedVideoDecoderConfigs, base::Unretained(this))); + } +} - if (!supported_config_cache_) - return {}; +void GpuMojoMediaClient::OnSupportedVideoDecoderConfigs( + SupportedVideoDecoderConfigs configs) { + DCHECK(!pending_supported_config_callbacks_.empty()); - return *supported_config_cache_; + // Return the result to all pending queries. + supported_config_cache_ = std::move(configs); + for (auto& callback : pending_supported_config_callbacks_) { + std::move(callback).Run(*supported_config_cache_); + } + pending_supported_config_callbacks_.clear(); } SupportedVideoDecoderConfigs GpuMojoMediaClient::GetVDAVideoDecoderConfigs() { @@ -152,23 +188,19 @@ media_log ? media_log->Clone() : std::make_unique<media::NullMediaLog>(); VideoDecoderTraits traits( task_runner, gpu_task_runner_, std::move(log), - std::move(request_overlay_info_cb), &target_color_space, gpu_preferences_, - gpu_feature_info_, &gpu_workarounds_, gpu_memory_buffer_factory_, - // CreatePlatformVideoDecoder does not keep a reference to |traits| - // so this bound method will not outlive |this| - base::BindRepeating(&GpuMojoMediaClient::GetSupportedVideoDecoderConfigs, - base::Unretained(this)), + std::move(request_overlay_info_cb), &target_color_space, + gpu_memory_buffer_factory_, base::BindRepeating( &GetCommandBufferStub, gpu_task_runner_, media_gpu_channel_manager_, command_buffer_id->channel_token, command_buffer_id->route_id), std::move(android_overlay_factory_cb_)); - return CreatePlatformVideoDecoder(traits); + return platform_->CreateVideoDecoder(traits); } std::unique_ptr<CdmFactory> GpuMojoMediaClient::CreateCdmFactory( mojom::FrameInterfaceFactory* frame_interfaces) { - return CreatePlatformCdmFactory(frame_interfaces); + return platform_->CreateCdmFactory(frame_interfaces); } } // namespace media
diff --git a/media/mojo/services/gpu_mojo_media_client.h b/media/mojo/services/gpu_mojo_media_client.h index e99807b..9043105 100644 --- a/media/mojo/services/gpu_mojo_media_client.h +++ b/media/mojo/services/gpu_mojo_media_client.h
@@ -43,14 +43,8 @@ std::unique_ptr<MediaLog> media_log; RequestOverlayInfoCB request_overlay_info_cb; const gfx::ColorSpace* const target_color_space; - gpu::GpuPreferences gpu_preferences; - gpu::GpuFeatureInfo gpu_feature_info; - const gpu::GpuDriverBugWorkarounds* const gpu_workarounds; gpu::GpuMemoryBufferFactory* const gpu_memory_buffer_factory; - // Windows decoders need to ensure that the cache is populated. - GetConfigCacheCB get_cached_configs_cb; - // Android uses this twice. GetCommandBufferStubCB get_command_buffer_stub_cb; @@ -62,48 +56,52 @@ std::unique_ptr<MediaLog> media_log, RequestOverlayInfoCB request_overlay_info_cb, const gfx::ColorSpace* target_color_space, - gpu::GpuPreferences gpu_preferences, - gpu::GpuFeatureInfo gpu_feature_info, - const gpu::GpuDriverBugWorkarounds* gpu_workarounds, gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory, - GetConfigCacheCB get_cached_configs_cb, GetCommandBufferStubCB get_command_buffer_stub_cb, AndroidOverlayMojoFactoryCB android_overlay_factory_cb); ~VideoDecoderTraits(); }; -// Find platform specific implementations of these in -// gpu_mojo_media_client_{platform}.cc -// Creates a platform-specific media::VideoDecoder. -std::unique_ptr<VideoDecoder> CreatePlatformVideoDecoder( - const VideoDecoderTraits&); - -// Queries the platform-specific VideoDecoder implementation for its -// supported profiles. Many platforms fall back to use the VDAVideoDecoder -// so that implementation is shared, and its supported configs can be -// queries using the |get_vda_configs| callback. -absl::optional<SupportedVideoDecoderConfigs> -GetPlatformSupportedVideoDecoderConfigs( - gpu::GpuDriverBugWorkarounds gpu_workarounds, - gpu::GpuPreferences gpu_preferences, - base::OnceCallback<SupportedVideoDecoderConfigs()> get_vda_configs); - -// Creates a platform-specific media::AudioDecoder. Most platforms don't do -// anything here, but android, for example, does. -std::unique_ptr<AudioDecoder> CreatePlatformAudioDecoder( - scoped_refptr<base::SingleThreadTaskRunner> task_runner); - -// Creates a CDM factory, right now only used on android and chromeos. -std::unique_ptr<CdmFactory> CreatePlatformCdmFactory( - mojom::FrameInterfaceFactory* frame_interfaces); - -// Queries the platform decoder type. -VideoDecoderType GetPlatformDecoderImplementationType( - gpu::GpuDriverBugWorkarounds gpu_workarounds, - gpu::GpuPreferences gpu_preferences); - class GpuMojoMediaClient final : public MojoMediaClient { public: + // Implementations of platform specific media functionality can be provided + // by overriding the appropriate methods in this interface. + // Specification of the platform object is done by implementing the static + // Create() method in the gpu_mojo_media_client_<platform>.cc file. + class PlatformDelegate { + public: + virtual ~PlatformDelegate(); + + // Instantiates the PlatformDelegate suitable for the platform. + // Implemented in platform-specific files. + static std::unique_ptr<PlatformDelegate> Create(GpuMojoMediaClient* client); + + // Find platform specific implementations of these in + // gpu_mojo_media_client_{platform}.cc + // Creates a platform-specific media::VideoDecoder. + virtual std::unique_ptr<VideoDecoder> CreateVideoDecoder( + const VideoDecoderTraits& traits); + + // Queries the platform-specific VideoDecoder implementation for its + // supported profiles. Many platforms fall back to use the VDAVideoDecoder + // so that implementation is shared, and its supported configs can be + // queries using the |get_vda_configs| callback. + virtual void GetSupportedVideoDecoderConfigs( + MojoMediaClient::SupportedVideoDecoderConfigsCallback callback); + + // Creates a platform-specific media::AudioDecoder. Most platforms don't do + // anything here, but android, for example, does. + virtual std::unique_ptr<AudioDecoder> CreateAudioDecoder( + scoped_refptr<base::SingleThreadTaskRunner> task_runner); + + // Creates a CDM factory, right now only used on android and chromeos. + virtual std::unique_ptr<CdmFactory> CreateCdmFactory( + mojom::FrameInterfaceFactory* frame_interfaces); + + // Queries the platform decoder type. + virtual VideoDecoderType GetDecoderImplementationType(); + }; + // |media_gpu_channel_manager| must only be used on |gpu_task_runner|, which // is expected to be the GPU main thread task runner. GpuMojoMediaClient( @@ -114,14 +112,28 @@ base::WeakPtr<MediaGpuChannelManager> media_gpu_channel_manager, gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory, AndroidOverlayMojoFactoryCB android_overlay_factory_cb); + ~GpuMojoMediaClient() final; GpuMojoMediaClient(const GpuMojoMediaClient&) = delete; GpuMojoMediaClient& operator=(const GpuMojoMediaClient&) = delete; - ~GpuMojoMediaClient() final; + // Can be used as default fallback values by platform specific + // implementations. + SupportedVideoDecoderConfigs GetVDAVideoDecoderConfigs(); + + const gpu::GpuPreferences& gpu_preferences() { return gpu_preferences_; } + + const gpu::GpuDriverBugWorkarounds& gpu_workarounds() { + return gpu_workarounds_; + } + + const gpu::GpuFeatureInfo& gpu_feature_info() const { + return gpu_feature_info_; + } // MojoMediaClient implementation. - SupportedVideoDecoderConfigs GetSupportedVideoDecoderConfigs() final; + void GetSupportedVideoDecoderConfigs( + MojoMediaClient::SupportedVideoDecoderConfigsCallback callback) final; VideoDecoderType GetDecoderImplementationType() final; std::unique_ptr<AudioDecoder> CreateAudioDecoder( scoped_refptr<base::SingleThreadTaskRunner> task_runner) final; @@ -135,12 +147,12 @@ mojom::FrameInterfaceFactory* interface_provider) final; private: - // These are useful to bind into callbacks for platform specific - // implementations that can use these defaults as fallbacks. - SupportedVideoDecoderConfigs GetVDAVideoDecoderConfigs(); + void OnSupportedVideoDecoderConfigs(SupportedVideoDecoderConfigs configs); // Cross-platform cache supported config cache. absl::optional<SupportedVideoDecoderConfigs> supported_config_cache_; + std::vector<MojoMediaClient::SupportedVideoDecoderConfigsCallback> + pending_supported_config_callbacks_; gpu::GpuPreferences gpu_preferences_; gpu::GpuDriverBugWorkarounds gpu_workarounds_; @@ -149,6 +161,7 @@ base::WeakPtr<MediaGpuChannelManager> media_gpu_channel_manager_; AndroidOverlayMojoFactoryCB android_overlay_factory_cb_; gpu::GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; + std::unique_ptr<PlatformDelegate> platform_; }; } // namespace media
diff --git a/media/mojo/services/gpu_mojo_media_client_android.cc b/media/mojo/services/gpu_mojo_media_client_android.cc index b155d36..52773c9 100644 --- a/media/mojo/services/gpu_mojo_media_client_android.cc +++ b/media/mojo/services/gpu_mojo_media_client_android.cc
@@ -28,82 +28,99 @@ using media::android_mojo_util::CreateProvisionFetcher; namespace media { +namespace { -std::unique_ptr<VideoDecoder> CreatePlatformVideoDecoder( - const VideoDecoderTraits& traits) { - scoped_refptr<gpu::RefCountedLock> ref_counted_lock; +class AndroidPlatformDelegate : public GpuMojoMediaClient::PlatformDelegate { + public: + explicit AndroidPlatformDelegate(GpuMojoMediaClient* client) + : client_(client) {} + ~AndroidPlatformDelegate() override = default; - // When this feature is enabled, CodecImage, CodecBufferWaitCorrdinator and - // other media classes used in MCVD path will be accessed by multiple gpu - // threads. To implement thread safetyness, we are using a global ref - // counted lock here. CodecImage, CodecOutputBufferRenderer, - // CodecBufferWaitCoordinator expects this ref counted lock to be held by the - // classes which are accessing them (SharedImageVideo, MRE, FrameInfoHelper - // etc.) - if (features::NeedThreadSafeAndroidMedia()) { - ref_counted_lock = base::MakeRefCounted<gpu::RefCountedLock>(); - } + AndroidPlatformDelegate(const AndroidPlatformDelegate&) = delete; + void operator=(const AndroidPlatformDelegate&) = delete; - std::unique_ptr<SharedImageVideoProvider> image_provider = - std::make_unique<DirectSharedImageVideoProvider>( + // GpuMojoMediaClient::PlatformDelegate implementation. + std::unique_ptr<VideoDecoder> CreateVideoDecoder( + const VideoDecoderTraits& traits) override { + scoped_refptr<gpu::RefCountedLock> ref_counted_lock; + + // When this feature is enabled, CodecImage, CodecBufferWaitCorrdinator and + // other media classes used in MCVD path will be accessed by multiple gpu + // threads. To implement thread safetyness, we are using a global ref + // counted lock here. CodecImage, CodecOutputBufferRenderer, + // CodecBufferWaitCoordinator expects this ref counted lock to be held by + // the classes which are accessing them (SharedImageVideo, MRE, + // FrameInfoHelper etc.) + if (features::NeedThreadSafeAndroidMedia()) { + ref_counted_lock = base::MakeRefCounted<gpu::RefCountedLock>(); + } + + std::unique_ptr<SharedImageVideoProvider> image_provider = + std::make_unique<DirectSharedImageVideoProvider>( + traits.gpu_task_runner, traits.get_command_buffer_stub_cb, + ref_counted_lock); + + if (base::FeatureList::IsEnabled(kUsePooledSharedImageVideoProvider)) { + // Wrap |image_provider| in a pool. + image_provider = PooledSharedImageVideoProvider::Create( traits.gpu_task_runner, traits.get_command_buffer_stub_cb, - ref_counted_lock); - - if (base::FeatureList::IsEnabled(kUsePooledSharedImageVideoProvider)) { - // Wrap |image_provider| in a pool. - image_provider = PooledSharedImageVideoProvider::Create( + std::move(image_provider), ref_counted_lock); + } + // TODO(liberato): Create this only if we're using Vulkan, else it's + // ignored. If we can tell that here, then VideoFrameFactory can use it + // as a signal about whether it's supposed to get YCbCrInfo rather than + // requiring the provider to set |is_vulkan| in the ImageRecord. + auto frame_info_helper = FrameInfoHelper::Create( traits.gpu_task_runner, traits.get_command_buffer_stub_cb, - std::move(image_provider), ref_counted_lock); + ref_counted_lock); + + return MediaCodecVideoDecoder::Create( + client_->gpu_preferences(), client_->gpu_feature_info(), + traits.media_log->Clone(), DeviceInfo::GetInstance(), + CodecAllocator::GetInstance(traits.gpu_task_runner), + std::make_unique<AndroidVideoSurfaceChooserImpl>( + DeviceInfo::GetInstance()->IsSetOutputSurfaceSupported()), + traits.android_overlay_factory_cb, + std::move(traits.request_overlay_info_cb), + std::make_unique<VideoFrameFactoryImpl>( + traits.gpu_task_runner, client_->gpu_preferences(), + std::move(image_provider), + MaybeRenderEarlyManager::Create(traits.gpu_task_runner, + ref_counted_lock), + std::move(frame_info_helper), ref_counted_lock), + ref_counted_lock); } - // TODO(liberato): Create this only if we're using Vulkan, else it's - // ignored. If we can tell that here, then VideoFrameFactory can use it - // as a signal about whether it's supposed to get YCbCrInfo rather than - // requiring the provider to set |is_vulkan| in the ImageRecord. - auto frame_info_helper = FrameInfoHelper::Create( - traits.gpu_task_runner, traits.get_command_buffer_stub_cb, - ref_counted_lock); - return MediaCodecVideoDecoder::Create( - traits.gpu_preferences, traits.gpu_feature_info, - traits.media_log->Clone(), DeviceInfo::GetInstance(), - CodecAllocator::GetInstance(traits.gpu_task_runner), - std::make_unique<AndroidVideoSurfaceChooserImpl>( - DeviceInfo::GetInstance()->IsSetOutputSurfaceSupported()), - traits.android_overlay_factory_cb, - std::move(traits.request_overlay_info_cb), - std::make_unique<VideoFrameFactoryImpl>( - traits.gpu_task_runner, traits.gpu_preferences, - std::move(image_provider), - MaybeRenderEarlyManager::Create(traits.gpu_task_runner, - ref_counted_lock), - std::move(frame_info_helper), ref_counted_lock), - ref_counted_lock); -} + void GetSupportedVideoDecoderConfigs( + MojoMediaClient::SupportedVideoDecoderConfigsCallback callback) override { + std::move(callback).Run(MediaCodecVideoDecoder::GetSupportedConfigs()); + } -absl::optional<SupportedVideoDecoderConfigs> -GetPlatformSupportedVideoDecoderConfigs( - gpu::GpuDriverBugWorkarounds gpu_workarounds, - gpu::GpuPreferences gpu_preferences, - base::OnceCallback<SupportedVideoDecoderConfigs()> get_vda_configs) { - return MediaCodecVideoDecoder::GetSupportedConfigs(); -} + std::unique_ptr<AudioDecoder> CreateAudioDecoder( + scoped_refptr<base::SingleThreadTaskRunner> task_runner) override { + return std::make_unique<MediaCodecAudioDecoder>(std::move(task_runner)); + } -std::unique_ptr<AudioDecoder> CreatePlatformAudioDecoder( - scoped_refptr<base::SingleThreadTaskRunner> task_runner) { - return std::make_unique<MediaCodecAudioDecoder>(std::move(task_runner)); -} + std::unique_ptr<CdmFactory> CreateCdmFactory( + mojom::FrameInterfaceFactory* frame_interfaces) override { + return std::make_unique<AndroidCdmFactory>( + base::BindRepeating(&CreateProvisionFetcher, frame_interfaces), + base::BindRepeating(&CreateMediaDrmStorage, frame_interfaces)); + } -std::unique_ptr<CdmFactory> CreatePlatformCdmFactory( - mojom::FrameInterfaceFactory* frame_interfaces) { - return std::make_unique<AndroidCdmFactory>( - base::BindRepeating(&CreateProvisionFetcher, frame_interfaces), - base::BindRepeating(&CreateMediaDrmStorage, frame_interfaces)); -} + VideoDecoderType GetDecoderImplementationType() override { + return VideoDecoderType::kMediaCodec; + } -VideoDecoderType GetPlatformDecoderImplementationType( - gpu::GpuDriverBugWorkarounds gpu_workarounds, - gpu::GpuPreferences gpu_preferences) { - return VideoDecoderType::kMediaCodec; + private: + GpuMojoMediaClient* client_; +}; + +} // namespace + +std::unique_ptr<GpuMojoMediaClient::PlatformDelegate> +GpuMojoMediaClient::PlatformDelegate::Create(GpuMojoMediaClient* client) { + return std::make_unique<AndroidPlatformDelegate>(client); } } // namespace media
diff --git a/media/mojo/services/gpu_mojo_media_client_cros.cc b/media/mojo/services/gpu_mojo_media_client_cros.cc index 1ae2a0d..b099865 100644 --- a/media/mojo/services/gpu_mojo_media_client_cros.cc +++ b/media/mojo/services/gpu_mojo_media_client_cros.cc
@@ -5,6 +5,7 @@ #include "media/mojo/services/gpu_mojo_media_client.h" #include "media/base/audio_decoder.h" +#include "media/base/cdm_factory.h" #include "media/gpu/chromeos/mailbox_video_frame_converter.h" #include "media/gpu/chromeos/platform_video_frame_pool.h" #include "media/gpu/chromeos/video_decoder_pipeline.h" @@ -26,64 +27,70 @@ #endif } +class CrosPlatformDelegate : public GpuMojoMediaClient::PlatformDelegate { + public: + explicit CrosPlatformDelegate(GpuMojoMediaClient* client) : client_(client) {} + ~CrosPlatformDelegate() override = default; + + CrosPlatformDelegate(const CrosPlatformDelegate&) = delete; + void operator=(const CrosPlatformDelegate&) = delete; + + // GpuMojoMediaClient::PlatformDelegate implementation. + std::unique_ptr<VideoDecoder> CreateVideoDecoder( + const VideoDecoderTraits& traits) override { + if (ShouldUseChromeOSDirectVideoDecoder(client_->gpu_preferences())) { + auto frame_pool = std::make_unique<PlatformVideoFramePool>( + traits.gpu_memory_buffer_factory); + auto frame_converter = MailboxVideoFrameConverter::Create( + base::BindRepeating(&PlatformVideoFramePool::UnwrapFrame, + base::Unretained(frame_pool.get())), + traits.gpu_task_runner, traits.get_command_buffer_stub_cb); + return VideoDecoderPipeline::Create( + traits.task_runner, std::move(frame_pool), std::move(frame_converter), + traits.media_log->Clone()); + } + return VdaVideoDecoder::Create( + traits.task_runner, traits.gpu_task_runner, traits.media_log->Clone(), + *traits.target_color_space, client_->gpu_preferences(), + client_->gpu_workarounds(), traits.get_command_buffer_stub_cb); + } + + void GetSupportedVideoDecoderConfigs( + MojoMediaClient::SupportedVideoDecoderConfigsCallback callback) override { + SupportedVideoDecoderConfigs supported_configs; + if (ShouldUseChromeOSDirectVideoDecoder(client_->gpu_preferences())) { + std::move(callback).Run(*VideoDecoderPipeline::GetSupportedConfigs( + client_->gpu_workarounds())); + return; + } + std::move(callback).Run(client_->GetVDAVideoDecoderConfigs()); + } + + std::unique_ptr<CdmFactory> CreateCdmFactory( + mojom::FrameInterfaceFactory* frame_interfaces) override { +#if defined(OS_CHROMEOS) + return std::make_unique<chromeos::ChromeOsCdmFactory>(frame_interfaces); +#else // defined(OS_CHROMEOS) + return nullptr; +#endif // else defined(OS_CHROMEOS) + } + + VideoDecoderType GetDecoderImplementationType() override { + if (ShouldUseChromeOSDirectVideoDecoder(client_->gpu_preferences())) { + return VideoDecoderType::kVaapi; + } + return VideoDecoderType::kVda; + } + + private: + GpuMojoMediaClient* client_; +}; + } // namespace -std::unique_ptr<VideoDecoder> CreatePlatformVideoDecoder( - const VideoDecoderTraits& traits) { - if (ShouldUseChromeOSDirectVideoDecoder(traits.gpu_preferences)) { - auto frame_pool = std::make_unique<PlatformVideoFramePool>( - traits.gpu_memory_buffer_factory); - auto frame_converter = MailboxVideoFrameConverter::Create( - base::BindRepeating(&PlatformVideoFramePool::UnwrapFrame, - base::Unretained(frame_pool.get())), - traits.gpu_task_runner, traits.get_command_buffer_stub_cb); - return VideoDecoderPipeline::Create( - traits.task_runner, std::move(frame_pool), std::move(frame_converter), - traits.media_log->Clone()); - } - return VdaVideoDecoder::Create( - traits.task_runner, traits.gpu_task_runner, traits.media_log->Clone(), - *traits.target_color_space, traits.gpu_preferences, - *traits.gpu_workarounds, traits.get_command_buffer_stub_cb); -} - -absl::optional<SupportedVideoDecoderConfigs> -GetPlatformSupportedVideoDecoderConfigs( - gpu::GpuDriverBugWorkarounds gpu_workarounds, - gpu::GpuPreferences gpu_preferences, - base::OnceCallback<SupportedVideoDecoderConfigs()> get_vda_configs) { - SupportedVideoDecoderConfigs supported_configs; - if (ShouldUseChromeOSDirectVideoDecoder(gpu_preferences)) { - return VideoDecoderPipeline::GetSupportedConfigs(gpu_workarounds); - } - return std::move(get_vda_configs).Run(); -} - -VideoDecoderType GetPlatformDecoderImplementationType( - gpu::GpuDriverBugWorkarounds gpu_workarounds, - gpu::GpuPreferences gpu_preferences) { - if (ShouldUseChromeOSDirectVideoDecoder(gpu_preferences)) { - return VideoDecoderType::kVaapi; - } - return VideoDecoderType::kVda; -} - -std::unique_ptr<AudioDecoder> CreatePlatformAudioDecoder( - scoped_refptr<base::SingleThreadTaskRunner> task_runner) { - return nullptr; -} - -#if !defined(OS_CHROMEOS) -class CdmFactory {}; -#endif // !defined(OS_CHROMEOS) - -std::unique_ptr<CdmFactory> CreatePlatformCdmFactory( - mojom::FrameInterfaceFactory* frame_interfaces) { -#if defined(OS_CHROMEOS) - return std::make_unique<chromeos::ChromeOsCdmFactory>(frame_interfaces); -#else // defined(OS_CHROMEOS) - return nullptr; -#endif // else defined(OS_CHROMEOS) +std::unique_ptr<GpuMojoMediaClient::PlatformDelegate> +GpuMojoMediaClient::PlatformDelegate::Create(GpuMojoMediaClient* client) { + return std::make_unique<CrosPlatformDelegate>(client); } } // namespace media
diff --git a/media/mojo/services/gpu_mojo_media_client_default.cc b/media/mojo/services/gpu_mojo_media_client_default.cc new file mode 100644 index 0000000..24c6d5f5 --- /dev/null +++ b/media/mojo/services/gpu_mojo_media_client_default.cc
@@ -0,0 +1,14 @@ +// 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 "media/mojo/services/gpu_mojo_media_client.h" + +namespace media { + +std::unique_ptr<GpuMojoMediaClient::PlatformDelegate> +GpuMojoMediaClient::PlatformDelegate::Create(GpuMojoMediaClient* client) { + return std::make_unique<GpuMojoMediaClient::PlatformDelegate>(); +} + +} // namespace media
diff --git a/media/mojo/services/gpu_mojo_media_client_mac.cc b/media/mojo/services/gpu_mojo_media_client_mac.cc index fad1ca3..a1bcb33d 100644 --- a/media/mojo/services/gpu_mojo_media_client_mac.cc +++ b/media/mojo/services/gpu_mojo_media_client_mac.cc
@@ -7,40 +7,43 @@ #include "media/mojo/services/gpu_mojo_media_client.h" namespace media { +namespace { -std::unique_ptr<VideoDecoder> CreatePlatformVideoDecoder( - const VideoDecoderTraits& traits) { - return VdaVideoDecoder::Create( - traits.task_runner, traits.gpu_task_runner, traits.media_log->Clone(), - *traits.target_color_space, traits.gpu_preferences, - *traits.gpu_workarounds, traits.get_command_buffer_stub_cb); -} +class MacPlatformDelegate : public GpuMojoMediaClient::PlatformDelegate { + public: + explicit MacPlatformDelegate(GpuMojoMediaClient* client) : client_(client) {} + ~MacPlatformDelegate() override = default; -absl::optional<SupportedVideoDecoderConfigs> -GetPlatformSupportedVideoDecoderConfigs( - gpu::GpuDriverBugWorkarounds gpu_workarounds, - gpu::GpuPreferences gpu_preferences, - base::OnceCallback<SupportedVideoDecoderConfigs()> get_vda_configs) { - return std::move(get_vda_configs).Run(); -} + MacPlatformDelegate(const MacPlatformDelegate&) = delete; + void operator=(const MacPlatformDelegate&) = delete; -std::unique_ptr<AudioDecoder> CreatePlatformAudioDecoder( - scoped_refptr<base::SingleThreadTaskRunner> task_runner) { - return nullptr; -} + // GpuMojoMediaClient::PlatformDelegate implementation. + std::unique_ptr<VideoDecoder> CreateVideoDecoder( + const VideoDecoderTraits& traits) override { + return VdaVideoDecoder::Create( + traits.task_runner, traits.gpu_task_runner, traits.media_log->Clone(), + *traits.target_color_space, client_->gpu_preferences(), + client_->gpu_workarounds(), traits.get_command_buffer_stub_cb); + } -// This class doesn't exist on mac, so we need a stub for unique_ptr. -class CdmFactory {}; + void GetSupportedVideoDecoderConfigs( + MojoMediaClient::SupportedVideoDecoderConfigsCallback callback) override { + std::move(callback).Run(client_->GetVDAVideoDecoderConfigs()); + } -std::unique_ptr<CdmFactory> CreatePlatformCdmFactory( - mojom::FrameInterfaceFactory* frame_interfaces) { - return nullptr; -} + VideoDecoderType GetDecoderImplementationType() override { + return VideoDecoderType::kVda; + } -VideoDecoderType GetPlatformDecoderImplementationType( - gpu::GpuDriverBugWorkarounds gpu_workarounds, - gpu::GpuPreferences gpu_preferences) { - return VideoDecoderType::kVda; + private: + GpuMojoMediaClient* client_; +}; + +} // namespace + +std::unique_ptr<GpuMojoMediaClient::PlatformDelegate> +GpuMojoMediaClient::PlatformDelegate::Create(GpuMojoMediaClient* client) { + return std::make_unique<MacPlatformDelegate>(client); } } // namespace media
diff --git a/media/mojo/services/gpu_mojo_media_client_stubs.cc b/media/mojo/services/gpu_mojo_media_client_stubs.cc deleted file mode 100644 index 135bd87a..0000000 --- a/media/mojo/services/gpu_mojo_media_client_stubs.cc +++ /dev/null
@@ -1,43 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "media/base/audio_decoder.h" -#include "media/base/video_decoder.h" -#include "media/mojo/services/gpu_mojo_media_client.h" - -namespace media { - -std::unique_ptr<VideoDecoder> CreatePlatformVideoDecoder( - const VideoDecoderTraits& traits) { - return nullptr; -} - -absl::optional<SupportedVideoDecoderConfigs> -GetPlatformSupportedVideoDecoderConfigs( - gpu::GpuDriverBugWorkarounds gpu_workarounds, - gpu::GpuPreferences gpu_preferences, - base::OnceCallback<SupportedVideoDecoderConfigs()> get_vda_configs) { - return {}; -} - -std::unique_ptr<AudioDecoder> CreatePlatformAudioDecoder( - scoped_refptr<base::SingleThreadTaskRunner> task_runner) { - return nullptr; -} - -// This class doesn't exist on any of the platforms that use the stubs. -class CdmFactory {}; - -std::unique_ptr<CdmFactory> CreatePlatformCdmFactory( - mojom::FrameInterfaceFactory* frame_interfaces) { - return nullptr; -} - -VideoDecoderType GetPlatformDecoderImplementationType( - gpu::GpuDriverBugWorkarounds gpu_workarounds, - gpu::GpuPreferences gpu_preferences) { - return VideoDecoderType::kUnknown; -} - -} // namespace media
diff --git a/media/mojo/services/gpu_mojo_media_client_win.cc b/media/mojo/services/gpu_mojo_media_client_win.cc index 730f5698..94b63c0 100644 --- a/media/mojo/services/gpu_mojo_media_client_win.cc +++ b/media/mojo/services/gpu_mojo_media_client_win.cc
@@ -32,59 +32,68 @@ return true; } +class WinPlatformDelegate : public GpuMojoMediaClient::PlatformDelegate { + public: + explicit WinPlatformDelegate(GpuMojoMediaClient* client) : client_(client) {} + ~WinPlatformDelegate() override = default; + + WinPlatformDelegate(const WinPlatformDelegate&) = delete; + void operator=(const WinPlatformDelegate&) = delete; + + // GpuMojoMediaClient::PlatformDelegate implementation. + SupportedVideoDecoderConfigs GetSupportedVideoDecoderConfigsSync() { + SupportedVideoDecoderConfigs supported_configs; + if (ShouldUseD3D11VideoDecoder(client_->gpu_workarounds())) { + return D3D11VideoDecoder::GetSupportedVideoDecoderConfigs( + client_->gpu_preferences(), client_->gpu_workarounds(), + GetD3D11DeviceCallback()); + } else if (!client_->gpu_workarounds().disable_dxva_video_decoder) { + return client_->GetVDAVideoDecoderConfigs(); + } else { + return {}; + } + } + + // GpuMojoMediaClient::PlatformDelegate implementation. + std::unique_ptr<VideoDecoder> CreateVideoDecoder( + const VideoDecoderTraits& traits) override { + if (!ShouldUseD3D11VideoDecoder(client_->gpu_workarounds())) { + if (client_->gpu_workarounds().disable_dxva_video_decoder) + return nullptr; + return VdaVideoDecoder::Create( + traits.task_runner, traits.gpu_task_runner, traits.media_log->Clone(), + *traits.target_color_space, client_->gpu_preferences(), + client_->gpu_workarounds(), traits.get_command_buffer_stub_cb); + } + DCHECK(base::FeatureList::IsEnabled(kD3D11VideoDecoder)); + return D3D11VideoDecoder::Create( + traits.gpu_task_runner, traits.media_log->Clone(), + client_->gpu_preferences(), client_->gpu_workarounds(), + traits.get_command_buffer_stub_cb, GetD3D11DeviceCallback(), + GetSupportedVideoDecoderConfigsSync(), + gl::DirectCompositionSurfaceWin::IsHDRSupported()); + } + + void GetSupportedVideoDecoderConfigs( + MojoMediaClient::SupportedVideoDecoderConfigsCallback callback) override { + std::move(callback).Run(GetSupportedVideoDecoderConfigsSync()); + } + + VideoDecoderType GetDecoderImplementationType() override { + if (!ShouldUseD3D11VideoDecoder(client_->gpu_workarounds())) + return VideoDecoderType::kVda; + return VideoDecoderType::kD3D11; + } + + private: + GpuMojoMediaClient* client_; +}; + } // namespace -std::unique_ptr<VideoDecoder> CreatePlatformVideoDecoder( - const VideoDecoderTraits& traits) { - if (!ShouldUseD3D11VideoDecoder(*traits.gpu_workarounds)) { - if (traits.gpu_workarounds->disable_dxva_video_decoder) - return nullptr; - return VdaVideoDecoder::Create( - traits.task_runner, traits.gpu_task_runner, traits.media_log->Clone(), - *traits.target_color_space, traits.gpu_preferences, - *traits.gpu_workarounds, traits.get_command_buffer_stub_cb); - } - DCHECK(base::FeatureList::IsEnabled(kD3D11VideoDecoder)); - return D3D11VideoDecoder::Create( - traits.gpu_task_runner, traits.media_log->Clone(), traits.gpu_preferences, - *traits.gpu_workarounds, traits.get_command_buffer_stub_cb, - GetD3D11DeviceCallback(), traits.get_cached_configs_cb.Run(), - gl::DirectCompositionSurfaceWin::IsHDRSupported()); -} - -absl::optional<SupportedVideoDecoderConfigs> -GetPlatformSupportedVideoDecoderConfigs( - gpu::GpuDriverBugWorkarounds gpu_workarounds, - gpu::GpuPreferences gpu_preferences, - base::OnceCallback<SupportedVideoDecoderConfigs()> get_vda_configs) { - SupportedVideoDecoderConfigs supported_configs; - if (ShouldUseD3D11VideoDecoder(gpu_workarounds)) { - supported_configs = D3D11VideoDecoder::GetSupportedVideoDecoderConfigs( - gpu_preferences, gpu_workarounds, GetD3D11DeviceCallback()); - } else if (!gpu_workarounds.disable_dxva_video_decoder) { - supported_configs = std::move(get_vda_configs).Run(); - } - return supported_configs; -} - -std::unique_ptr<AudioDecoder> CreatePlatformAudioDecoder( - scoped_refptr<base::SingleThreadTaskRunner> task_runner) { - return nullptr; -} - -VideoDecoderType GetPlatformDecoderImplementationType( - gpu::GpuDriverBugWorkarounds gpu_workarounds, - gpu::GpuPreferences gpu_preferences) { - if (!ShouldUseD3D11VideoDecoder(gpu_workarounds)) - return VideoDecoderType::kVda; - return VideoDecoderType::kD3D11; -} - -// There is no CdmFactory on windows, so just stub it out. -class CdmFactory {}; -std::unique_ptr<CdmFactory> CreatePlatformCdmFactory( - mojom::FrameInterfaceFactory* frame_interfaces) { - return nullptr; +std::unique_ptr<GpuMojoMediaClient::PlatformDelegate> +GpuMojoMediaClient::PlatformDelegate::Create(GpuMojoMediaClient* client) { + return std::make_unique<WinPlatformDelegate>(client); } } // namespace media
diff --git a/media/mojo/services/mojo_media_client.cc b/media/mojo/services/mojo_media_client.cc index b559e45..d4a9194 100644 --- a/media/mojo/services/mojo_media_client.cc +++ b/media/mojo/services/mojo_media_client.cc
@@ -24,9 +24,9 @@ return nullptr; } -SupportedVideoDecoderConfigs -MojoMediaClient::GetSupportedVideoDecoderConfigs() { - return {}; +void MojoMediaClient::GetSupportedVideoDecoderConfigs( + MojoMediaClient::SupportedVideoDecoderConfigsCallback callback) { + std::move(callback).Run({}); } VideoDecoderType MojoMediaClient::GetDecoderImplementationType() {
diff --git a/media/mojo/services/mojo_media_client.h b/media/mojo/services/mojo_media_client.h index 70e42240..8557f62 100644 --- a/media/mojo/services/mojo_media_client.h +++ b/media/mojo/services/mojo_media_client.h
@@ -43,6 +43,9 @@ // the media components. class MEDIA_MOJO_EXPORT MojoMediaClient { public: + using SupportedVideoDecoderConfigsCallback = + base::OnceCallback<void(SupportedVideoDecoderConfigs)>; + // Called before the host application is scheduled to quit. // The application message loop is still valid at this point, so all clean // up tasks requiring the message loop must be completed before returning. @@ -54,8 +57,8 @@ virtual std::unique_ptr<AudioDecoder> CreateAudioDecoder( scoped_refptr<base::SingleThreadTaskRunner> task_runner); - virtual std::vector<SupportedVideoDecoderConfig> - GetSupportedVideoDecoderConfigs(); + virtual void GetSupportedVideoDecoderConfigs( + SupportedVideoDecoderConfigsCallback callback); virtual VideoDecoderType GetDecoderImplementationType();
diff --git a/media/mojo/services/mojo_video_decoder_service.cc b/media/mojo/services/mojo_video_decoder_service.cc index 1d694555..a3a2a23 100644 --- a/media/mojo/services/mojo_video_decoder_service.cc +++ b/media/mojo/services/mojo_video_decoder_service.cc
@@ -137,9 +137,16 @@ void MojoVideoDecoderService::GetSupportedConfigs( GetSupportedConfigsCallback callback) { DVLOG(3) << __func__; - TRACE_EVENT0("media", "MojoVideoDecoderService::GetSupportedConfigs"); - std::move(callback).Run(mojo_media_client_->GetSupportedVideoDecoderConfigs(), + mojo_media_client_->GetSupportedVideoDecoderConfigs( + base::BindOnce(&MojoVideoDecoderService::OnSupportedVideoDecoderConfigs, + weak_factory_.GetWeakPtr(), std::move(callback))); +} + +void MojoVideoDecoderService::OnSupportedVideoDecoderConfigs( + GetSupportedConfigsCallback callback, + SupportedVideoDecoderConfigs configs) { + std::move(callback).Run(std::move(configs), mojo_media_client_->GetDecoderImplementationType()); }
diff --git a/media/mojo/services/mojo_video_decoder_service.h b/media/mojo/services/mojo_video_decoder_service.h index ea1255a..cc8897c 100644 --- a/media/mojo/services/mojo_video_decoder_service.h +++ b/media/mojo/services/mojo_video_decoder_service.h
@@ -90,6 +90,9 @@ bool restart_for_transitions, ProvideOverlayInfoCB provide_overlay_info_cb); + void OnSupportedVideoDecoderConfigs(GetSupportedConfigsCallback callback, + SupportedVideoDecoderConfigs configs); + // Whether this instance is active (Decode() was called at least once). bool is_active_instance_ = false;
diff --git a/net/cookies/cookie_change_dispatcher.h b/net/cookies/cookie_change_dispatcher.h index 21d2d94..0f6fc31 100644 --- a/net/cookies/cookie_change_dispatcher.h +++ b/net/cookies/cookie_change_dispatcher.h
@@ -129,22 +129,37 @@ virtual ~CookieChangeDispatcher() = default; - // Observe changes to all cookies named |name| that would be sent in a - // request to |url|. + // Observe changes to all cookies named `name` that would be sent in a + // request to `url`. + // + // If `cookie_partition_key` is nullopt, then we ignore all change events for + // partitioned cookies. Otherwise it only subscribes to change events for + // partitioned cookies with the same provided key. + // Unpartitioned cookies are not affected by the `cookie_partition_key` + // parameter. virtual std::unique_ptr<CookieChangeSubscription> AddCallbackForCookie( const GURL& url, const std::string& name, + const absl::optional<CookiePartitionKey>& cookie_partition_key, CookieChangeCallback callback) WARN_UNUSED_RESULT = 0; - // Observe changes to the cookies that would be sent for a request to |url|. + // Observe changes to the cookies that would be sent for a request to `url`. + // + // If `cookie_partition_key` is nullopt, then we ignore all change events for + // partitioned cookies. Otherwise it only subscribes to change events for + // partitioned cookies with the same provided key. + // Unpartitioned cookies are not affected by the `cookie_partition_key` + // parameter. virtual std::unique_ptr<CookieChangeSubscription> AddCallbackForUrl( const GURL& url, + const absl::optional<CookiePartitionKey>& cookie_partition_key, CookieChangeCallback callback) WARN_UNUSED_RESULT = 0; // Observe all the CookieStore's changes. // // The callback will not observe a few bookkeeping changes. // See kChangeCauseMapping in cookie_monster.cc for details. + // TODO(crbug.com/1225444): Add support for Partitioned cookies. virtual std::unique_ptr<CookieChangeSubscription> AddCallbackForAllChanges( CookieChangeCallback callback) WARN_UNUSED_RESULT = 0; };
diff --git a/net/cookies/cookie_monster_change_dispatcher.cc b/net/cookies/cookie_monster_change_dispatcher.cc index 43dffc1..6cac1881 100644 --- a/net/cookies/cookie_monster_change_dispatcher.cc +++ b/net/cookies/cookie_monster_change_dispatcher.cc
@@ -33,11 +33,13 @@ std::string domain_key, std::string name_key, GURL url, + absl::optional<CookiePartitionKey> cookie_partition_key, net::CookieChangeCallback callback) : change_dispatcher_(std::move(change_dispatcher)), domain_key_(std::move(domain_key)), name_key_(std::move(name_key)), url_(std::move(url)), + cookie_partition_key_(std::move(cookie_partition_key)), callback_(std::move(callback)), task_runner_(base::ThreadTaskRunnerHandle::Get()) { DCHECK(url_.is_valid() || url_.is_empty()); @@ -80,6 +82,11 @@ } } + if (change.cookie.IsPartitioned() && + change.cookie.PartitionKey() != cookie_partition_key_) { + return; + } + // TODO(mmenke, pwnall): Run callbacks synchronously? task_runner_->PostTask( FROM_HERE, base::BindOnce(&Subscription::DoDispatchChange, @@ -130,12 +137,13 @@ CookieMonsterChangeDispatcher::AddCallbackForCookie( const GURL& url, const std::string& name, + const absl::optional<CookiePartitionKey>& cookie_partition_key, CookieChangeCallback callback) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); std::unique_ptr<Subscription> subscription = std::make_unique<Subscription>( weak_ptr_factory_.GetWeakPtr(), DomainKey(url), NameKey(name), url, - std::move(callback)); + cookie_partition_key, std::move(callback)); LinkSubscription(subscription.get()); return subscription; @@ -144,12 +152,14 @@ std::unique_ptr<CookieChangeSubscription> CookieMonsterChangeDispatcher::AddCallbackForUrl( const GURL& url, + const absl::optional<CookiePartitionKey>& cookie_partition_key, CookieChangeCallback callback) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); std::unique_ptr<Subscription> subscription = std::make_unique<Subscription>( weak_ptr_factory_.GetWeakPtr(), DomainKey(url), - std::string(kGlobalNameKey), url, std::move(callback)); + std::string(kGlobalNameKey), url, cookie_partition_key, + std::move(callback)); LinkSubscription(subscription.get()); return subscription; @@ -162,7 +172,8 @@ std::unique_ptr<Subscription> subscription = std::make_unique<Subscription>( weak_ptr_factory_.GetWeakPtr(), std::string(kGlobalDomainKey), - std::string(kGlobalNameKey), GURL(""), std::move(callback)); + std::string(kGlobalNameKey), GURL(""), CookiePartitionKey::Todo(), + std::move(callback)); LinkSubscription(subscription.get()); return subscription;
diff --git a/net/cookies/cookie_monster_change_dispatcher.h b/net/cookies/cookie_monster_change_dispatcher.h index c147120d..bf25388 100644 --- a/net/cookies/cookie_monster_change_dispatcher.h +++ b/net/cookies/cookie_monster_change_dispatcher.h
@@ -53,9 +53,11 @@ std::unique_ptr<CookieChangeSubscription> AddCallbackForCookie( const GURL& url, const std::string& name, + const absl::optional<CookiePartitionKey>& cookie_partition_key, CookieChangeCallback callback) override WARN_UNUSED_RESULT; std::unique_ptr<CookieChangeSubscription> AddCallbackForUrl( const GURL& url, + const absl::optional<CookiePartitionKey>& cookie_partition_key, CookieChangeCallback callback) override WARN_UNUSED_RESULT; std::unique_ptr<CookieChangeSubscription> AddCallbackForAllChanges( CookieChangeCallback callback) override WARN_UNUSED_RESULT; @@ -74,6 +76,7 @@ std::string domain_key, std::string name_key, GURL url, + absl::optional<CookiePartitionKey> cookie_partition_key, net::CookieChangeCallback callback); Subscription(const Subscription&) = delete; @@ -99,6 +102,8 @@ const std::string domain_key_; // kGlobalDomainKey means no filtering. const std::string name_key_; // kGlobalNameKey means no filtering. const GURL url_; // empty() means no URL-based filtering. + // nullopt means all Partitioned cookies will be ignored. + const absl::optional<CookiePartitionKey> cookie_partition_key_; const net::CookieChangeCallback callback_; void DoDispatchChange(const CookieChangeInfo& change) const;
diff --git a/net/cookies/cookie_monster_unittest.cc b/net/cookies/cookie_monster_unittest.cc index 434e737..27bdff6 100644 --- a/net/cookies/cookie_monster_unittest.cc +++ b/net/cookies/cookie_monster_unittest.cc
@@ -109,6 +109,7 @@ static const bool has_exact_change_ordering = true; static const int creation_time_granularity_in_ms = 0; static const bool supports_cookie_access_semantics = true; + static const bool supports_partitioned_cookies = true; }; INSTANTIATE_TYPED_TEST_SUITE_P(CookieMonster,
diff --git a/net/cookies/cookie_partition_key.cc b/net/cookies/cookie_partition_key.cc index f97421f8..e0542e20 100644 --- a/net/cookies/cookie_partition_key.cc +++ b/net/cookies/cookie_partition_key.cc
@@ -35,6 +35,10 @@ return site_ == other.site_; } +bool CookiePartitionKey::operator!=(const CookiePartitionKey& other) const { + return site_ != other.site_; +} + bool CookiePartitionKey::operator<(const CookiePartitionKey& other) const { return site_ < other.site_; }
diff --git a/net/cookies/cookie_partition_key.h b/net/cookies/cookie_partition_key.h index f13aff4..5ce04f2 100644 --- a/net/cookies/cookie_partition_key.h +++ b/net/cookies/cookie_partition_key.h
@@ -25,6 +25,7 @@ ~CookiePartitionKey(); bool operator==(const CookiePartitionKey& other) const; + bool operator!=(const CookiePartitionKey& other) const; bool operator<(const CookiePartitionKey& other) const; // Methods for serializing and deserializing a partition key to/from a string.
diff --git a/net/cookies/cookie_store_change_unittest.h b/net/cookies/cookie_store_change_unittest.h index 5c742e77..47e5fb2 100644 --- a/net/cookies/cookie_store_change_unittest.h +++ b/net/cookies/cookie_store_change_unittest.h
@@ -715,7 +715,7 @@ std::vector<CookieChangeInfo> cookie_changes; std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForUrl( - this->http_www_foo_.url(), + this->http_www_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -733,7 +733,7 @@ this->DeliverChangeNotifications(); std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForUrl( - this->http_www_foo_.url(), + this->http_www_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -749,7 +749,7 @@ std::vector<CookieChangeInfo> cookie_changes; std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForUrl( - this->http_www_foo_.url(), + this->http_www_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -776,7 +776,7 @@ std::vector<CookieChangeInfo> cookie_changes; std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForUrl( - this->http_www_foo_.url(), + this->http_www_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -820,7 +820,7 @@ std::vector<CookieChangeInfo> cookie_changes; std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForUrl( - this->www_foo_foo_.url(), + this->www_foo_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -874,7 +874,7 @@ std::vector<CookieChangeInfo> cookie_changes; std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForUrl( - this->http_www_foo_.url(), + this->http_www_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -904,7 +904,7 @@ std::vector<CookieChangeInfo> cookie_changes; std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForUrl( - this->http_www_foo_.url(), + this->http_www_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -953,7 +953,7 @@ std::vector<CookieChangeInfo> cookie_changes; std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForUrl( - this->www_foo_foo_.url(), + this->www_foo_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -1019,7 +1019,7 @@ std::vector<CookieChangeInfo> cookie_changes; std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForUrl( - this->http_www_foo_.url(), + this->http_www_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -1063,7 +1063,7 @@ std::vector<CookieChangeInfo> cookie_changes; std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForUrl( - this->www_foo_foo_.url(), + this->www_foo_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -1159,7 +1159,7 @@ std::vector<CookieChangeInfo> cookie_changes; std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForUrl( - this->www_foo_foo_.url(), + this->www_foo_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -1220,7 +1220,7 @@ std::vector<CookieChangeInfo> cookie_changes; std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForUrl( - this->http_www_foo_.url(), + this->http_www_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -1256,13 +1256,13 @@ std::vector<CookieChangeInfo> cookie_changes_1, cookie_changes_2; std::unique_ptr<CookieChangeSubscription> subscription1 = cs->GetChangeDispatcher().AddCallbackForUrl( - this->http_www_foo_.url(), + this->http_www_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_1))); std::unique_ptr<CookieChangeSubscription> subscription2 = cs->GetChangeDispatcher().AddCallbackForUrl( - this->http_www_foo_.url(), + this->http_www_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_2))); @@ -1313,7 +1313,7 @@ std::vector<CookieChangeInfo> cookie_changes; std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForUrl( - this->http_www_foo_.url(), + this->http_www_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -1340,7 +1340,7 @@ std::vector<CookieChangeInfo> cookie_changes; std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForUrl( - this->http_www_foo_.url(), + this->http_www_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -1385,13 +1385,13 @@ std::vector<CookieChangeInfo> cookie_changes_1, cookie_changes_2; std::unique_ptr<CookieChangeSubscription> subscription1 = cs->GetChangeDispatcher().AddCallbackForUrl( - this->http_www_foo_.url(), + this->http_www_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_1))); std::unique_ptr<CookieChangeSubscription> subscription2 = cs->GetChangeDispatcher().AddCallbackForUrl( - this->http_www_foo_.url(), + this->http_www_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_2))); @@ -1446,13 +1446,13 @@ std::vector<CookieChangeInfo> cookie_changes_1, cookie_changes_2; std::unique_ptr<CookieChangeSubscription> subscription1 = cs->GetChangeDispatcher().AddCallbackForUrl( - this->http_www_foo_.url(), + this->http_www_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_1))); std::unique_ptr<CookieChangeSubscription> subscription2 = cs->GetChangeDispatcher().AddCallbackForUrl( - this->http_bar_com_.url(), + this->http_bar_com_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_2))); @@ -1490,13 +1490,13 @@ std::vector<CookieChangeInfo> cookie_changes_1, cookie_changes_2; std::unique_ptr<CookieChangeSubscription> subscription1 = cs->GetChangeDispatcher().AddCallbackForUrl( - this->http_www_foo_.url(), + this->http_www_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_1))); std::unique_ptr<CookieChangeSubscription> subscription2 = cs->GetChangeDispatcher().AddCallbackForUrl( - this->http_bar_com_.url(), + this->http_bar_com_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_2))); @@ -1534,13 +1534,13 @@ std::vector<CookieChangeInfo> cookie_changes_1, cookie_changes_2; std::unique_ptr<CookieChangeSubscription> subscription1 = cs->GetChangeDispatcher().AddCallbackForUrl( - this->http_www_foo_.url(), + this->http_www_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_1))); std::unique_ptr<CookieChangeSubscription> subscription2 = cs->GetChangeDispatcher().AddCallbackForUrl( - this->www_foo_foo_.url(), + this->www_foo_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_2))); @@ -1590,19 +1590,19 @@ std::vector<CookieChangeInfo> cookie_changes_3; std::unique_ptr<CookieChangeSubscription> subscription1 = cs->GetChangeDispatcher().AddCallbackForUrl( - this->http_www_foo_.url(), + this->http_www_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_1))); std::unique_ptr<CookieChangeSubscription> subscription2 = cs->GetChangeDispatcher().AddCallbackForUrl( - this->http_bar_com_.url(), + this->http_bar_com_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_2))); std::unique_ptr<CookieChangeSubscription> subscription3 = cs->GetChangeDispatcher().AddCallbackForUrl( - this->www_foo_foo_.url(), + this->www_foo_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_3))); @@ -1667,13 +1667,13 @@ std::vector<CookieChangeInfo> cookie_changes_1, cookie_changes_2; std::unique_ptr<CookieChangeSubscription> subscription1 = cs->GetChangeDispatcher().AddCallbackForUrl( - this->http_www_foo_.url(), + this->http_www_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_1))); std::unique_ptr<CookieChangeSubscription> subscription2 = cs->GetChangeDispatcher().AddCallbackForUrl( - this->http_www_foo_.url(), + this->http_www_foo_.url(), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_2))); @@ -1706,7 +1706,7 @@ std::vector<CookieChangeInfo> cookie_changes; std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForUrl( - GURL("http://domain1.test"), + GURL("http://domain1.test"), absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -1723,6 +1723,77 @@ cookie_changes[0].access_result.access_semantics)); } +TYPED_TEST_P(CookieStoreChangeUrlTest, PartitionedCookies) { + if (!TypeParam::supports_url_cookie_tracking || + !TypeParam::supports_partitioned_cookies) + return; + + CookieStore* cs = this->GetCookieStore(); + std::vector<CookieChangeInfo> cookie_changes; + std::unique_ptr<CookieChangeSubscription> subscription = + cs->GetChangeDispatcher().AddCallbackForUrl( + GURL("https://www.example.com/"), + absl::make_optional(CookiePartitionKey::FromURLForTesting( + GURL("https://www.foo.com"))), + base::BindRepeating( + &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, + base::Unretained(&cookie_changes))); + + // Unpartitioned cookie + this->CreateAndSetCookie(cs, GURL("https://www.example.com/"), + "__Host-a=1; Secure; Path=/", + CookieOptions::MakeAllInclusive()); + // Partitioned cookie with the same partition key + this->CreateAndSetCookie( + cs, GURL("https://www.example.com/"), + "__Host-b=2; Secure; Path=/; Partitioned", + CookieOptions::MakeAllInclusive(), absl::nullopt /* server_time */, + absl::nullopt /* system_time */, + absl::make_optional( + CookiePartitionKey::FromURLForTesting(GURL("https://sub.foo.com")))); + // Partitioned cookie with a different partition key + this->CreateAndSetCookie( + cs, GURL("https://www.example.com"), + "__Host-c=3; Secure; Path=/; Partitioned", + CookieOptions::MakeAllInclusive(), absl::nullopt /* server_time */, + absl::nullopt /* system_time */, + absl::make_optional( + CookiePartitionKey::FromURLForTesting(GURL("https://www.bar.com")))); + this->DeliverChangeNotifications(); + + ASSERT_EQ(2u, cookie_changes.size()); + EXPECT_FALSE(cookie_changes[0].cookie.IsPartitioned()); + EXPECT_EQ("__Host-a", cookie_changes[0].cookie.Name()); + EXPECT_TRUE(cookie_changes[1].cookie.IsPartitioned()); + EXPECT_EQ(CookiePartitionKey::FromURLForTesting(GURL("https://www.foo.com")), + cookie_changes[1].cookie.PartitionKey().value()); + EXPECT_EQ("__Host-b", cookie_changes[1].cookie.Name()); + + // Test that when the partition key parameter is nullopt that all Partitioned + // cookies do not emit events. + + std::vector<CookieChangeInfo> other_cookie_changes; + std::unique_ptr<CookieChangeSubscription> other_subscription = + cs->GetChangeDispatcher().AddCallbackForUrl( + GURL("https://www.example.com/"), + absl::nullopt /* cookie_partition_key */, + base::BindRepeating( + &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, + base::Unretained(&other_cookie_changes))); + // Update Max-Age: None -> 7200 + this->CreateAndSetCookie( + cs, GURL("https://www.example.com"), + "__Host-b=2; Secure; Path=/; Partitioned; Max-Age=7200", + CookieOptions::MakeAllInclusive(), absl::nullopt /* server_time */, + absl::nullopt /* system_time */, + absl::make_optional( + CookiePartitionKey::FromURLForTesting(GURL("https://www.foo.com")))); + this->DeliverChangeNotifications(); + ASSERT_EQ(0u, other_cookie_changes.size()); + // Check that the other listener was invoked. + ASSERT_LT(2u, cookie_changes.size()); +} + TYPED_TEST_P(CookieStoreChangeNamedTest, NoCookie) { if (!TypeParam::supports_named_cookie_tracking) return; @@ -1732,6 +1803,7 @@ std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForCookie( this->http_www_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -1750,6 +1822,7 @@ std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForCookie( this->http_www_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -1766,6 +1839,7 @@ std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForCookie( this->http_www_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -1793,6 +1867,7 @@ std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForCookie( this->www_foo_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -1834,6 +1909,7 @@ std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForCookie( this->www_foo_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -1893,6 +1969,7 @@ std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForCookie( this->http_www_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -1923,6 +2000,7 @@ std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForCookie( this->www_foo_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -1967,6 +2045,7 @@ std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForCookie( this->www_foo_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -2037,6 +2116,7 @@ std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForCookie( this->http_www_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -2081,6 +2161,7 @@ std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForCookie( this->www_foo_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -2184,6 +2265,7 @@ std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForCookie( this->www_foo_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -2246,6 +2328,7 @@ std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForCookie( this->www_foo_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -2285,12 +2368,14 @@ std::unique_ptr<CookieChangeSubscription> subscription1 = cs->GetChangeDispatcher().AddCallbackForCookie( this->www_foo_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_1))); std::unique_ptr<CookieChangeSubscription> subscription2 = cs->GetChangeDispatcher().AddCallbackForCookie( this->www_foo_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_2))); @@ -2348,6 +2433,7 @@ std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForCookie( this->www_foo_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -2377,6 +2463,7 @@ std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForCookie( this->www_foo_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -2424,12 +2511,14 @@ std::unique_ptr<CookieChangeSubscription> subscription1 = cs->GetChangeDispatcher().AddCallbackForCookie( this->www_foo_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_1))); std::unique_ptr<CookieChangeSubscription> subscription2 = cs->GetChangeDispatcher().AddCallbackForCookie( this->www_foo_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_2))); @@ -2490,12 +2579,14 @@ std::unique_ptr<CookieChangeSubscription> subscription1 = cs->GetChangeDispatcher().AddCallbackForCookie( this->http_www_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_1))); std::unique_ptr<CookieChangeSubscription> subscription2 = cs->GetChangeDispatcher().AddCallbackForCookie( this->http_bar_com_.url(), "ghi", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_2))); @@ -2534,12 +2625,14 @@ std::unique_ptr<CookieChangeSubscription> subscription1 = cs->GetChangeDispatcher().AddCallbackForCookie( this->http_www_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_1))); std::unique_ptr<CookieChangeSubscription> subscription2 = cs->GetChangeDispatcher().AddCallbackForCookie( this->http_bar_com_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_2))); @@ -2578,12 +2671,14 @@ std::unique_ptr<CookieChangeSubscription> subscription1 = cs->GetChangeDispatcher().AddCallbackForCookie( this->http_www_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_1))); std::unique_ptr<CookieChangeSubscription> subscription2 = cs->GetChangeDispatcher().AddCallbackForCookie( this->http_www_foo_.url(), "ghi", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_2))); @@ -2622,12 +2717,14 @@ std::unique_ptr<CookieChangeSubscription> subscription1 = cs->GetChangeDispatcher().AddCallbackForCookie( this->http_www_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_1))); std::unique_ptr<CookieChangeSubscription> subscription2 = cs->GetChangeDispatcher().AddCallbackForCookie( this->www_foo_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_2))); @@ -2679,24 +2776,28 @@ std::unique_ptr<CookieChangeSubscription> subscription1 = cs->GetChangeDispatcher().AddCallbackForCookie( this->http_www_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_1))); std::unique_ptr<CookieChangeSubscription> subscription2 = cs->GetChangeDispatcher().AddCallbackForCookie( this->http_www_foo_.url(), "hij", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_2))); std::unique_ptr<CookieChangeSubscription> subscription3 = cs->GetChangeDispatcher().AddCallbackForCookie( this->http_bar_com_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_3))); std::unique_ptr<CookieChangeSubscription> subscription4 = cs->GetChangeDispatcher().AddCallbackForCookie( this->www_foo_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_4))); @@ -2783,12 +2884,14 @@ std::unique_ptr<CookieChangeSubscription> subscription1 = cs->GetChangeDispatcher().AddCallbackForCookie( this->http_www_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_1))); std::unique_ptr<CookieChangeSubscription> subscription2 = cs->GetChangeDispatcher().AddCallbackForCookie( this->http_www_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes_2))); @@ -2817,6 +2920,7 @@ std::unique_ptr<CookieChangeSubscription> subscription = this->GetCookieStore()->GetChangeDispatcher().AddCallbackForCookie( this->http_www_foo_.url(), "abc", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -2842,6 +2946,7 @@ std::unique_ptr<CookieChangeSubscription> subscription = cs->GetChangeDispatcher().AddCallbackForCookie( GURL("http://domain1.test"), "cookie", + absl::nullopt /* cookie_partition_key */, base::BindRepeating( &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, base::Unretained(&cookie_changes))); @@ -2858,6 +2963,76 @@ cookie_changes[0].access_result.access_semantics)); } +TYPED_TEST_P(CookieStoreChangeNamedTest, PartitionedCookies) { + if (!TypeParam::supports_named_cookie_tracking || + !TypeParam::supports_partitioned_cookies) + return; + + CookieStore* cs = this->GetCookieStore(); + std::vector<CookieChangeInfo> cookie_changes; + std::unique_ptr<CookieChangeSubscription> subscription = + cs->GetChangeDispatcher().AddCallbackForCookie( + GURL("https://www.example.com"), "__Host-a", + absl::make_optional(CookiePartitionKey::FromURLForTesting( + GURL("https://www.foo.com"))), + base::BindRepeating( + &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, + base::Unretained(&cookie_changes))); + + // Unpartitioned cookie + this->CreateAndSetCookie(cs, GURL("https://www.example.com"), + "__Host-a=1; Secure; Path=/", + CookieOptions::MakeAllInclusive()); + // Partitioned cookie with the same partition key + this->CreateAndSetCookie( + cs, GURL("https://www.example.com"), + "__Host-a=2; Secure; Path=/; Partitioned", + CookieOptions::MakeAllInclusive(), absl::nullopt /* server_time */, + absl::nullopt /* system_time */, + absl::make_optional( + CookiePartitionKey::FromURLForTesting(GURL("https://sub.foo.com")))); + // Partitioned cookie with a different partition key + this->CreateAndSetCookie( + cs, GURL("https://www.example.com"), + "__Host-a=3; Secure; Path=/; Partitioned", + CookieOptions::MakeAllInclusive(), absl::nullopt /* server_time */, + absl::nullopt /* system_time */, + absl::make_optional( + CookiePartitionKey::FromURLForTesting(GURL("https://www.bar.com")))); + this->DeliverChangeNotifications(); + + ASSERT_EQ(2u, cookie_changes.size()); + EXPECT_FALSE(cookie_changes[0].cookie.IsPartitioned()); + EXPECT_EQ("1", cookie_changes[0].cookie.Value()); + EXPECT_TRUE(cookie_changes[1].cookie.IsPartitioned()); + EXPECT_EQ(CookiePartitionKey::FromURLForTesting(GURL("https://www.foo.com")), + cookie_changes[1].cookie.PartitionKey().value()); + EXPECT_EQ("2", cookie_changes[1].cookie.Value()); + + // Test that when the partition key parameter is nullopt that all Partitioned + // cookies do not emit events. + std::vector<CookieChangeInfo> other_cookie_changes; + std::unique_ptr<CookieChangeSubscription> other_subscription = + cs->GetChangeDispatcher().AddCallbackForCookie( + GURL("https://www.example.com"), "__Host-a", + absl::nullopt /* cookie_partition_key */, + base::BindRepeating( + &CookieStoreChangeTestBase<TypeParam>::OnCookieChange, + base::Unretained(&other_cookie_changes))); + // Update Max-Age: None -> 7200 + this->CreateAndSetCookie( + cs, GURL("https://www.example.com"), + "__Host-a=2; Secure; Path=/; Partitioned; Max-Age=7200", + CookieOptions::MakeAllInclusive(), absl::nullopt /* server_time */, + absl::nullopt /* system_time */, + absl::make_optional( + CookiePartitionKey::FromURLForTesting(GURL("https://www.foo.com")))); + this->DeliverChangeNotifications(); + ASSERT_EQ(0u, other_cookie_changes.size()); + // Check that the other listener was invoked. + ASSERT_LT(2u, cookie_changes.size()); +} + REGISTER_TYPED_TEST_SUITE_P(CookieStoreChangeGlobalTest, NoCookie, InitialCookie, @@ -2897,7 +3072,8 @@ DifferentSubscriptionsPaths, DifferentSubscriptionsFiltering, MultipleSubscriptions, - ChangeIncludesCookieAccessSemantics); + ChangeIncludesCookieAccessSemantics, + PartitionedCookies); REGISTER_TYPED_TEST_SUITE_P(CookieStoreChangeNamedTest, NoCookie, @@ -2923,7 +3099,8 @@ DifferentSubscriptionsFiltering, MultipleSubscriptions, SubscriptionOutlivesStore, - ChangeIncludesCookieAccessSemantics); + ChangeIncludesCookieAccessSemantics, + PartitionedCookies); } // namespace net
diff --git a/net/cookies/cookie_store_test_helpers.cc b/net/cookies/cookie_store_test_helpers.cc index 4d69bcd..d9cfa9c 100644 --- a/net/cookies/cookie_store_test_helpers.cc +++ b/net/cookies/cookie_store_test_helpers.cc
@@ -46,6 +46,7 @@ DelayedCookieMonsterChangeDispatcher::AddCallbackForCookie( const GURL& url, const std::string& name, + const absl::optional<CookiePartitionKey>& cookie_partition_key, CookieChangeCallback callback) { ADD_FAILURE(); return nullptr; @@ -53,6 +54,7 @@ std::unique_ptr<CookieChangeSubscription> DelayedCookieMonsterChangeDispatcher::AddCallbackForUrl( const GURL& url, + const absl::optional<CookiePartitionKey>& cookie_partition_key, CookieChangeCallback callback) { ADD_FAILURE(); return nullptr;
diff --git a/net/cookies/cookie_store_test_helpers.h b/net/cookies/cookie_store_test_helpers.h index 424f28ee..55cf1512 100644 --- a/net/cookies/cookie_store_test_helpers.h +++ b/net/cookies/cookie_store_test_helpers.h
@@ -36,9 +36,11 @@ std::unique_ptr<CookieChangeSubscription> AddCallbackForCookie( const GURL& url, const std::string& name, + const absl::optional<CookiePartitionKey>& cookie_partition_key, CookieChangeCallback callback) override WARN_UNUSED_RESULT; std::unique_ptr<CookieChangeSubscription> AddCallbackForUrl( const GURL& url, + const absl::optional<CookiePartitionKey>& cookie_partition_key, CookieChangeCallback callback) override WARN_UNUSED_RESULT; std::unique_ptr<CookieChangeSubscription> AddCallbackForAllChanges( CookieChangeCallback callback) override WARN_UNUSED_RESULT;
diff --git a/net/dns/host_cache.cc b/net/dns/host_cache.cc index 05ecec3..ca349f7f 100644 --- a/net/dns/host_cache.cc +++ b/net/dns/host_cache.cc
@@ -279,7 +279,7 @@ hostnames_(entry.hostnames()), experimental_results_(entry.experimental_results()), source_(entry.source()), - pinned_(entry.pinned()), + pinning_(entry.pinning()), ttl_(entry.ttl()), expires_(now + ttl), network_changes_(network_changes) {} @@ -405,7 +405,8 @@ entry_dict.SetIntKey(kNetworkChangesKey, network_changes()); // The "pinned" status is meaningful only if "network_changes" is also // preserved. - entry_dict.SetBoolKey(kPinnedKey, pinned()); + if (pinning()) + entry_dict.SetBoolKey(kPinnedKey, *pinning()); } else { // Convert expiration time in TimeTicks to Time for serialization, using a // string because base::Value doesn't handle 64-bit integers. @@ -579,11 +580,11 @@ if (caching_is_disabled()) return; - bool preserve_pin = false; + bool has_active_pin = false; bool result_changed = false; auto it = entries_.find(key); if (it != entries_.end()) { - preserve_pin = HasActivePin(it->second); + has_active_pin = HasActivePin(it->second); absl::optional<AddressListDeltaType> addresses_delta; if (entry.addresses() || it->second.addresses()) { @@ -651,9 +652,7 @@ } Entry entry_for_cache(entry, now, ttl, network_changes_); - if (preserve_pin) - entry_for_cache.set_pinned(true); - + entry_for_cache.set_pinning(entry.pinning().value_or(has_active_pin)); entry_for_cache.PrepareForCacheInsertion(); AddEntry(key, std::move(entry_for_cache)); @@ -682,6 +681,7 @@ void HostCache::AddEntry(const Key& key, Entry&& entry) { DCHECK_EQ(0u, entries_.count(key)); + DCHECK(entry.pinning().has_value()); entries_.emplace(key, std::move(entry)); } @@ -854,6 +854,7 @@ const base::Value* hostname_records_value = nullptr; const base::Value* host_ports_value = nullptr; absl::optional<int> maybe_error = entry_dict.FindIntKey(kNetErrorKey); + absl::optional<bool> maybe_pinned = entry_dict.FindBoolKey(kPinnedKey); if (maybe_error.has_value()) { error = maybe_error.value(); } else { @@ -932,11 +933,11 @@ // replace the entry. auto found = entries_.find(key); if (found == entries_.end()) { - AddEntry( - key, - Entry(error, address_list, std::move(text_records), - std::move(hostname_records), std::move(experimental_results), - Entry::SOURCE_UNKNOWN, expiration_time, network_changes_ - 1)); + Entry entry(error, address_list, std::move(text_records), + std::move(hostname_records), std::move(experimental_results), + Entry::SOURCE_UNKNOWN, expiration_time, network_changes_ - 1); + entry.set_pinning(maybe_pinned.value_or(false)); + AddEntry(key, std::move(entry)); restore_size_++; } } @@ -994,7 +995,8 @@ } bool HostCache::HasActivePin(const Entry& entry) { - return entry.pinned() && entry.network_changes() == network_changes(); + return entry.pinning().value_or(false) && + entry.network_changes() == network_changes(); } } // namespace net
diff --git a/net/dns/host_cache.h b/net/dns/host_cache.h index 410b23a..0b6e432 100644 --- a/net/dns/host_cache.h +++ b/net/dns/host_cache.h
@@ -178,8 +178,8 @@ absl::optional<std::vector<bool>> experimental_results) { experimental_results_ = std::move(experimental_results); } - bool pinned() const { return pinned_; } - void set_pinned(bool pinned) { pinned_ = pinned; } + absl::optional<bool> pinning() const { return pinning_; } + void set_pinning(absl::optional<bool> pinning) { pinning_ = pinning; } Source source() const { return source_; } bool has_ttl() const { return ttl_ >= base::TimeDelta(); } @@ -276,9 +276,10 @@ // Where results were obtained (e.g. DNS lookup, hosts file, etc). Source source_ = SOURCE_UNKNOWN; // If true, this entry cannot be evicted from the cache until after the next - // network change. When a pinned Entry is replaced, HostCache will copy - // this flag to the replacement. - bool pinned_ = false; + // network change. When an Entry is replaced by one whose pinning flag + // is not set, HostCache will copy this flag to the replacement. + // If this flag is null, HostCache will set it to false for simplicity. + absl::optional<bool> pinning_; // TTL obtained from the nameserver. Negative if unknown. base::TimeDelta ttl_ = base::TimeDelta::FromSeconds(-1);
diff --git a/net/dns/host_cache_unittest.cc b/net/dns/host_cache_unittest.cc index 141a56e1..45a4b62 100644 --- a/net/dns/host_cache_unittest.cc +++ b/net/dns/host_cache_unittest.cc
@@ -821,7 +821,7 @@ HostCache::Key key3 = Key("foobar3.com"); HostCache::Entry entry = HostCache::Entry(OK, AddressList(), HostCache::Entry::SOURCE_UNKNOWN); - entry.set_pinned(true); + entry.set_pinning(true); cache.Set(key1, entry, now, base::TimeDelta::FromSeconds(5)); now += base::TimeDelta::FromSeconds(10); @@ -848,7 +848,7 @@ HostCache::Key key4 = Key("foobar4.com"); HostCache::Entry entry = HostCache::Entry(OK, AddressList(), HostCache::Entry::SOURCE_UNKNOWN); - entry.set_pinned(true); + entry.set_pinning(true); // |key2| should be preserved, since it expires later. cache.Set(key1, entry, now, base::TimeDelta::FromSeconds(5)); @@ -887,18 +887,18 @@ HostCache::Entry::SOURCE_UNKNOWN); HostCache::Entry entry2 = HostCache::Entry(OK, AddressList(endpoint2), HostCache::Entry::SOURCE_UNKNOWN); - entry1.set_pinned(true); + entry1.set_pinning(true); HostCache::Key key = Key("foobar.com"); // Insert entry1, and verify that it can be retrieved with the - // correct IP and |pinned()| == true. + // correct IP and |pinning()| == true. cache.Set(key, entry1, now, base::TimeDelta::FromSeconds(10)); const auto* pair1 = cache.Lookup(key, now); ASSERT_TRUE(pair1); const HostCache::Entry& result1 = pair1->second; EXPECT_EQ(endpoint1, result1.addresses()->front()); - EXPECT_TRUE(result1.pinned()); + EXPECT_THAT(result1.pinning(), Optional(true)); // Insert |entry2|, and verify that it when it is retrieved, it // has the new IP, and the "pinned" flag copied from |entry1|. @@ -907,7 +907,7 @@ ASSERT_TRUE(pair2); const HostCache::Entry& result2 = pair2->second; EXPECT_EQ(endpoint2, result2.addresses()->front()); - EXPECT_TRUE(result2.pinned()); + EXPECT_THAT(result2.pinning(), Optional(true)); } // An obsolete cache pin is not preserved if the record is replaced. @@ -925,18 +925,18 @@ HostCache::Entry::SOURCE_UNKNOWN); HostCache::Entry entry2 = HostCache::Entry(OK, AddressList(endpoint2), HostCache::Entry::SOURCE_UNKNOWN); - entry1.set_pinned(true); + entry1.set_pinning(true); HostCache::Key key = Key("foobar.com"); // Insert entry1, and verify that it can be retrieved with the - // correct IP and |pinned()| == true. + // correct IP and |pinning()| == true. cache.Set(key, entry1, now, base::TimeDelta::FromSeconds(10)); const auto* pair1 = cache.Lookup(key, now); ASSERT_TRUE(pair1); const HostCache::Entry& result1 = pair1->second; EXPECT_EQ(endpoint1, result1.addresses()->front()); - EXPECT_TRUE(result1.pinned()); + EXPECT_THAT(result1.pinning(), Optional(true)); // Make entry1 obsolete. cache.Invalidate(); @@ -948,7 +948,47 @@ ASSERT_TRUE(pair2); const HostCache::Entry& result2 = pair2->second; EXPECT_EQ(endpoint2, result2.addresses()->front()); - EXPECT_FALSE(result2.pinned()); + EXPECT_THAT(result2.pinning(), Optional(false)); +} + +// An active pin is removed if the record is replaced by a Set() call +// with the pin flag set to false. +TEST(HostCacheTest, Unpin) { + HostCache cache(2); + + base::TimeTicks now; + + // Make entry1 and entry2, identical except for IP and pinned flag. + IPAddress address1(192, 0, 2, 1); + IPAddress address2(192, 0, 2, 2); + IPEndPoint endpoint1(address1, 0); + IPEndPoint endpoint2(address2, 0); + HostCache::Entry entry1 = HostCache::Entry(OK, AddressList(endpoint1), + HostCache::Entry::SOURCE_UNKNOWN); + HostCache::Entry entry2 = HostCache::Entry(OK, AddressList(endpoint2), + HostCache::Entry::SOURCE_UNKNOWN); + entry1.set_pinning(true); + entry2.set_pinning(false); + + HostCache::Key key = Key("foobar.com"); + + // Insert entry1, and verify that it can be retrieved with the + // correct IP and |pinning()| == true. + cache.Set(key, entry1, now, base::TimeDelta::FromSeconds(10)); + const auto* pair1 = cache.Lookup(key, now); + ASSERT_TRUE(pair1); + const HostCache::Entry& result1 = pair1->second; + EXPECT_EQ(endpoint1, result1.addresses()->front()); + EXPECT_THAT(result1.pinning(), Optional(true)); + + // Insert |entry2|, and verify that it when it is retrieved, it + // has the new IP, and the "pinned" flag is now false. + cache.Set(key, entry2, now, base::TimeDelta::FromSeconds(10)); + const auto* pair2 = cache.Lookup(key, now); + ASSERT_TRUE(pair2); + const HostCache::Entry& result2 = pair2->second; + EXPECT_EQ(endpoint2, result2.addresses()->front()); + EXPECT_THAT(result2.pinning(), Optional(false)); } // Tests the less than and equal operators for HostCache::Key work.
diff --git a/pdf/pdf_view_web_plugin.cc b/pdf/pdf_view_web_plugin.cc index 0fb0ec3..73202cfd 100644 --- a/pdf/pdf_view_web_plugin.cc +++ b/pdf/pdf_view_web_plugin.cc
@@ -13,6 +13,7 @@ #include <vector> #include "base/check_op.h" +#include "base/i18n/char_iterator.h" #include "base/i18n/string_search.h" #include "base/no_destructor.h" #include "base/notreached.h" @@ -69,6 +70,7 @@ #include "ui/base/cursor/cursor.h" #include "ui/base/cursor/mojom/cursor_type.mojom-shared.h" #include "ui/display/screen_info.h" +#include "ui/events/base_event_utils.h" #include "ui/events/blink/blink_event_util.h" #include "ui/events/keycodes/keyboard_codes.h" #include "ui/gfx/geometry/point.h" @@ -595,10 +597,40 @@ } } +bool PdfViewWebPlugin::ShouldDispatchImeEventsToPlugin() { + return true; +} + blink::WebTextInputType PdfViewWebPlugin::GetPluginTextInputType() { return text_input_type_; } +gfx::Rect PdfViewWebPlugin::GetPluginCaretBounds() { + return caret_rect_; +} + +void PdfViewWebPlugin::ImeSetCompositionForPlugin( + const blink::WebString& text, + const std::vector<ui::ImeTextSpan>& /*ime_text_spans*/, + const gfx::Range& /*replacement_range*/, + int /*selection_start*/, + int /*selection_end*/) { + composition_text_ = text; +} + +void PdfViewWebPlugin::ImeCommitTextForPlugin( + const blink::WebString& text, + const std::vector<ui::ImeTextSpan>& /*ime_text_spans*/, + const gfx::Range& /*replacement_range*/, + int /*relative_cursor_pos*/) { + HandleImeCommit(text); +} + +void PdfViewWebPlugin::ImeFinishComposingTextForPlugin( + bool /*keep_selection*/) { + HandleImeCommit(composition_text_); +} + void PdfViewWebPlugin::UpdateCursor(ui::mojom::CursorType new_cursor_type) { set_cursor_type(new_cursor_type); } @@ -612,6 +644,11 @@ current_find_index + 1); } +void PdfViewWebPlugin::CaretChanged(const gfx::Rect& caret_rect) { + caret_rect_ = gfx::ScaleToEnclosingRectSafe( + caret_rect + available_area().OffsetFromOrigin(), device_to_css_scale_); +} + void PdfViewWebPlugin::Alert(const std::string& message) { container_wrapper_->Alert(blink::WebString::FromUTF8(message)); } @@ -957,6 +994,32 @@ return true; } +void PdfViewWebPlugin::HandleImeCommit(const blink::WebString& text) { + if (text.IsEmpty()) + return; + + std::u16string text16 = text.Utf16(); + composition_text_.Reset(); + + size_t i = 0; + for (base::i18n::UTF16CharIterator iterator(text16); iterator.Advance();) { + blink::WebKeyboardEvent char_event(blink::WebInputEvent::Type::kChar, + blink::WebInputEvent::kNoModifiers, + ui::EventTimeForNow()); + char_event.windows_key_code = text16[i]; + char_event.native_key_code = text16[i]; + + for (const size_t char_start = i; i < iterator.array_pos(); ++i) { + char_event.text[i - char_start] = text16[i]; + char_event.unmodified_text[i - char_start] = text16[i]; + } + + blink::WebCoalescedInputEvent input_event(char_event, ui::LatencyInfo()); + ui::Cursor dummy_cursor_info; + HandleInputEvent(input_event, &dummy_cursor_info); + } +} + void PdfViewWebPlugin::OnInvokePrintDialog(int32_t /*result*/) { client_->Print(Container()->GetElement()); }
diff --git a/pdf/pdf_view_web_plugin.h b/pdf/pdf_view_web_plugin.h index f8546523..08573035 100644 --- a/pdf/pdf_view_web_plugin.h +++ b/pdf/pdf_view_web_plugin.h
@@ -198,11 +198,27 @@ void StopFind() override; bool CanRotateView() override; void RotateView(blink::WebPlugin::RotationType type) override; + + bool ShouldDispatchImeEventsToPlugin() override; blink::WebTextInputType GetPluginTextInputType() override; + gfx::Rect GetPluginCaretBounds() override; + void ImeSetCompositionForPlugin( + const blink::WebString& text, + const std::vector<ui::ImeTextSpan>& ime_text_spans, + const gfx::Range& replacement_range, + int selection_start, + int selection_end) override; + void ImeCommitTextForPlugin( + const blink::WebString& text, + const std::vector<ui::ImeTextSpan>& ime_text_spans, + const gfx::Range& replacement_range, + int relative_cursor_pos) override; + void ImeFinishComposingTextForPlugin(bool keep_selection) override; // PdfViewPluginBase: void UpdateCursor(ui::mojom::CursorType new_cursor_type) override; void NotifySelectedFindResultChanged(int current_find_index) override; + void CaretChanged(const gfx::Rect& caret_rect) override; void Alert(const std::string& message) override; bool Confirm(const std::string& message) override; std::string Prompt(const std::string& question, @@ -302,6 +318,10 @@ bool Undo(); bool Redo(); + // Helper method for converting IME text to input events. + // TODO(crbug.com/1253665): Consider handling composition events. + void HandleImeCommit(const blink::WebString& text); + // Callback to print without re-entrancy issues. The callback prevents the // invocation of printing in the middle of an event handler, which is risky; // see crbug.com/66334. @@ -331,6 +351,10 @@ blink::WebTextInputType text_input_type_ = blink::WebTextInputType::kWebTextInputTypeNone; + gfx::Rect caret_rect_; + + blink::WebString composition_text_; + // Whether the plugin element currently has focus. bool has_focus_ = false;
diff --git a/pdf/pdf_view_web_plugin_unittest.cc b/pdf/pdf_view_web_plugin_unittest.cc index 08c4bb2..eb186261 100644 --- a/pdf/pdf_view_web_plugin_unittest.cc +++ b/pdf/pdf_view_web_plugin_unittest.cc
@@ -5,8 +5,10 @@ #include "pdf/pdf_view_web_plugin.h" #include <memory> +#include <string> #include <utility> +#include "base/strings/string_piece.h" #include "cc/paint/paint_canvas.h" #include "cc/test/pixel_comparator.h" #include "cc/test/pixel_test_utils.h" @@ -18,6 +20,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/input/web_coalesced_input_event.h" #include "third_party/blink/public/common/input/web_input_event.h" +#include "third_party/blink/public/common/input/web_keyboard_event.h" +#include "third_party/blink/public/common/input/web_mouse_event.h" #include "third_party/blink/public/common/input/web_pointer_properties.h" #include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/public/platform/web_text_input_type.h" @@ -29,6 +33,8 @@ #include "third_party/skia/include/core/SkColor.h" #include "ui/base/cursor/cursor.h" #include "ui/events/blink/blink_event_util.h" +#include "ui/events/keycodes/dom/dom_code.h" +#include "ui/events/keycodes/dom/dom_key.h" #include "ui/gfx/canvas.h" #include "ui/gfx/geometry/point_f.h" #include "ui/gfx/geometry/rect.h" @@ -82,6 +88,20 @@ return l.start_index == r.start_index && l.length == r.length; } +MATCHER_P(IsExpectedImeKeyEvent, expected_text, "") { + if (arg.GetType() != blink::WebInputEvent::Type::kChar) + return false; + + const auto& event = static_cast<const blink::WebKeyboardEvent&>(arg); + return event.GetModifiers() == blink::WebInputEvent::kNoModifiers && + event.windows_key_code == expected_text[0] && + event.native_key_code == expected_text[0] && + event.dom_code == static_cast<int>(ui::DomCode::NONE) && + event.dom_key == ui::DomKey::NONE && !event.is_system_key && + !event.is_browser_shortcut && event.text == expected_text && + event.unmodified_text == expected_text; +} + // Generates the expected `SkBitmap` with `paint_color` filled in the expected // clipped area and `kDefaultColor` as the background color. SkBitmap GenerateExpectedBitmapForPaint(const gfx::Rect& expected_clipped_rect, @@ -253,7 +273,7 @@ auto wrapper = std::make_unique<NiceMock<FakeContainerWrapper>>(plugin_.get()); wrapper_ptr_ = wrapper.get(); - auto engine = std::make_unique<TestPDFiumEngine>(plugin_.get()); + auto engine = CreateEngine(); engine_ptr_ = engine.get(); EXPECT_TRUE( plugin_->InitializeForTesting(std::move(wrapper), std::move(engine))); @@ -265,6 +285,11 @@ PdfViewWebPluginWithoutInitializeTest::TearDown(); } + // Allow derived test classes to create their own custom TestPDFiumEngine. + virtual std::unique_ptr<TestPDFiumEngine> CreateEngine() { + return std::make_unique<TestPDFiumEngine>(plugin_.get()); + } + void UpdatePluginGeometry(float device_scale, const gfx::Rect& window_rect) { // The plugin container's device scale must be set before calling // UpdateGeometry(). @@ -479,7 +504,45 @@ PdfViewWebPluginTestUseZoomForDSF, testing::Bool()); -TEST_F(PdfViewWebPluginTest, HandleInputEventWithUseZoomForDSFEnabled) { +class PdfViewWebPluginMouseEventsTest : public PdfViewWebPluginTest { + public: + class TestPDFiumEngineForMouseEvents : public TestPDFiumEngine { + public: + explicit TestPDFiumEngineForMouseEvents(PDFEngine::Client* client) + : TestPDFiumEngine(client) {} + + // TestPDFiumEngine: + bool HandleInputEvent(const blink::WebInputEvent& event) override { + // Since blink::WebInputEvent is an abstract class, we cannot use equal + // matcher to verify its value. Here we test with blink::WebMouseEvent + // specifically. + if (!blink::WebInputEvent::IsMouseEventType(event.GetType())) + return false; + + scaled_mouse_event_ = std::make_unique<blink::WebMouseEvent>(); + *scaled_mouse_event_ = static_cast<const blink::WebMouseEvent&>(event); + return true; + } + + const blink::WebMouseEvent* GetScaledMouseEvent() const { + return scaled_mouse_event_.get(); + } + + private: + std::unique_ptr<blink::WebMouseEvent> scaled_mouse_event_; + }; + + std::unique_ptr<TestPDFiumEngine> CreateEngine() override { + return std::make_unique<TestPDFiumEngineForMouseEvents>(plugin_.get()); + } + + TestPDFiumEngineForMouseEvents* engine() { + return static_cast<TestPDFiumEngineForMouseEvents*>(engine_ptr_); + } +}; + +TEST_F(PdfViewWebPluginMouseEventsTest, + HandleInputEventWithUseZoomForDSFEnabled) { // Test when using zoom for DSF is enabled. EXPECT_CALL(*client_ptr_, IsUseZoomForDSFEnabled) .WillRepeatedly(Return(true)); @@ -492,12 +555,13 @@ ui::LatencyInfo()), &dummy_cursor); - ASSERT_TRUE(engine_ptr_->GetScaledMouseEvent()); - EXPECT_EQ(gfx::PointF(-10.0f, 0.0f), - engine_ptr_->GetScaledMouseEvent()->PositionInWidget()); + const blink::WebMouseEvent* event = engine()->GetScaledMouseEvent(); + ASSERT_TRUE(event); + EXPECT_EQ(gfx::PointF(-10.0f, 0.0f), event->PositionInWidget()); } -TEST_F(PdfViewWebPluginTest, HandleInputEventWithUseZoomForDSFDisabled) { +TEST_F(PdfViewWebPluginMouseEventsTest, + HandleInputEventWithUseZoomForDSFDisabled) { // Test when using zoom for DSF is disabled. EXPECT_CALL(*client_ptr_, IsUseZoomForDSFEnabled) .WillRepeatedly(Return(false)); @@ -510,9 +574,109 @@ ui::LatencyInfo()), &dummy_cursor); - ASSERT_TRUE(engine_ptr_->GetScaledMouseEvent()); - EXPECT_EQ(gfx::PointF(-20.0f, 0.0f), - engine_ptr_->GetScaledMouseEvent()->PositionInWidget()); + const blink::WebMouseEvent* event = engine()->GetScaledMouseEvent(); + ASSERT_TRUE(event); + EXPECT_EQ(gfx::PointF(-20.0f, 0.0f), event->PositionInWidget()); +} + +class PdfViewWebPluginImeTest : public PdfViewWebPluginTest { + public: + class TestPDFiumEngineForIme : public TestPDFiumEngine { + public: + explicit TestPDFiumEngineForIme(PDFEngine::Client* client) + : TestPDFiumEngine(client) {} + + // TestPDFiumEngine: + MOCK_METHOD(bool, + HandleInputEvent, + (const blink::WebInputEvent&), + (override)); + }; + + std::unique_ptr<TestPDFiumEngine> CreateEngine() override { + return std::make_unique<TestPDFiumEngineForIme>(plugin_.get()); + } + + TestPDFiumEngineForIme* engine() { + return static_cast<TestPDFiumEngineForIme*>(engine_ptr_); + } + + void TestImeSetCompositionForPlugin(const blink::WebString& text) { + EXPECT_CALL(*engine(), HandleInputEvent).Times(0); + plugin_->ImeSetCompositionForPlugin(text, std::vector<ui::ImeTextSpan>(), + gfx::Range(), + /*selection_start=*/0, + /*selection_end=*/0); + } + + void TestImeFinishComposingTextForPlugin( + const blink::WebString& expected_text) { + InSequence sequence; + std::u16string expected_text16 = expected_text.Utf16(); + if (expected_text16.size()) { + for (const auto& c : expected_text16) { + base::StringPiece16 expected_key(&c, 1); + EXPECT_CALL(*engine(), + HandleInputEvent(IsExpectedImeKeyEvent(expected_key))) + .WillOnce(Return(true)); + } + } else { + EXPECT_CALL(*engine(), HandleInputEvent).Times(0); + } + plugin_->ImeFinishComposingTextForPlugin(false); + } + + void TestImeCommitTextForPlugin(const blink::WebString& text) { + InSequence sequence; + std::u16string expected_text16 = text.Utf16(); + if (expected_text16.size()) { + for (const auto& c : expected_text16) { + base::StringPiece16 event(&c, 1); + EXPECT_CALL(*engine(), HandleInputEvent(IsExpectedImeKeyEvent(event))) + .WillOnce(Return(true)); + } + } else { + EXPECT_CALL(*engine(), HandleInputEvent).Times(0); + } + plugin_->ImeCommitTextForPlugin(text, std::vector<ui::ImeTextSpan>(), + gfx::Range(), + /*relative_cursor_pos=*/0); + } +}; + +TEST_F(PdfViewWebPluginImeTest, ImeSetCompositionAndFinishAscii) { + const blink::WebString text = blink::WebString::FromASCII("input"); + TestImeSetCompositionForPlugin(text); + TestImeFinishComposingTextForPlugin(text); +} + +TEST_F(PdfViewWebPluginImeTest, ImeSetCompositionAndFinishUnicode) { + const blink::WebString text = blink::WebString::FromUTF16(u"你好"); + TestImeSetCompositionForPlugin(text); + TestImeFinishComposingTextForPlugin(text); + // Calling ImeFinishComposingTextForPlugin() again is a no-op. + TestImeFinishComposingTextForPlugin(""); +} + +TEST_F(PdfViewWebPluginImeTest, ImeSetCompositionAndFinishEmpty) { + const blink::WebString text; + TestImeSetCompositionForPlugin(text); + TestImeFinishComposingTextForPlugin(text); +} + +TEST_F(PdfViewWebPluginImeTest, ImeCommitTextForPluginAscii) { + const blink::WebString text = blink::WebString::FromASCII("a b"); + TestImeCommitTextForPlugin(text); +} + +TEST_F(PdfViewWebPluginImeTest, ImeCommitTextForPluginUnicode) { + const blink::WebString text = blink::WebString::FromUTF16(u"さようなら"); + TestImeCommitTextForPlugin(text); +} + +TEST_F(PdfViewWebPluginImeTest, ImeCommitTextForPluginEmpty) { + const blink::WebString text; + TestImeCommitTextForPlugin(text); } TEST_F(PdfViewWebPluginTest, ChangeTextSelection) { @@ -625,4 +789,28 @@ plugin_->UpdateFocus(/*focused=*/true, blink::mojom::FocusType::kNone); } +TEST_F(PdfViewWebPluginTest, ShouldDispatchImeEventsToPlugin) { + ASSERT_TRUE(plugin_->ShouldDispatchImeEventsToPlugin()); +} + +TEST_F(PdfViewWebPluginTest, CaretChangeUseZoomForDSFEnabled) { + EXPECT_CALL(*client_ptr_, IsUseZoomForDSFEnabled) + .WillRepeatedly(Return(true)); + EXPECT_CALL(*engine_ptr_, ZoomUpdated(2.0f)); + UpdatePluginGeometry( + /*device_scale=*/2.0f, /*window_rect=*/gfx::Rect(12, 24, 36, 48)); + plugin_->CaretChanged(gfx::Rect(10, 20, 30, 40)); + EXPECT_EQ(gfx::Rect(28, 20, 30, 40), plugin_->GetPluginCaretBounds()); +} + +TEST_F(PdfViewWebPluginTest, CaretChangeUseZoomForDSFDisabled) { + EXPECT_CALL(*client_ptr_, IsUseZoomForDSFEnabled) + .WillRepeatedly(Return(false)); + EXPECT_CALL(*engine_ptr_, ZoomUpdated(2.0f)); + UpdatePluginGeometry( + /*device_scale=*/2.0f, /*window_rect=*/gfx::Rect(12, 24, 36, 48)); + plugin_->CaretChanged(gfx::Rect(10, 20, 30, 40)); + EXPECT_EQ(gfx::Rect(23, 10, 15, 20), plugin_->GetPluginCaretBounds()); +} + } // namespace chrome_pdf
diff --git a/pdf/test/test_pdfium_engine.cc b/pdf/test/test_pdfium_engine.cc index d87b28d..e219f72b 100644 --- a/pdf/test/test_pdfium_engine.cc +++ b/pdf/test/test_pdfium_engine.cc
@@ -6,7 +6,7 @@ #include <string.h> -#include <memory> +#include <iterator> #include <vector> #include "base/check_op.h" @@ -18,8 +18,6 @@ #include "pdf/pdf_engine.h" #include "pdf/pdfium/pdfium_engine.h" #include "pdf/pdfium/pdfium_form_filler.h" -#include "third_party/blink/public/common/input/web_input_event.h" -#include "third_party/blink/public/common/input/web_mouse_event.h" namespace chrome_pdf { @@ -34,20 +32,6 @@ TestPDFiumEngine::~TestPDFiumEngine() = default; -bool TestPDFiumEngine::HandleInputEvent( - const blink::WebInputEvent& scaled_event) { - // Since blink::WebInputEvent is an abstract class, we cannot use equal - // matcher to verify its value. Here we test with blink::WebMouseEvent - // specifically. - if (!blink::WebInputEvent::IsMouseEventType(scaled_event.GetType())) - return false; - - blink::WebMouseEvent* mouse_event = new blink::WebMouseEvent; - scaled_mouse_event_.reset(mouse_event); - *mouse_event = static_cast<const blink::WebMouseEvent&>(scaled_event); - return true; -} - bool TestPDFiumEngine::HasPermission(DocumentPermission permission) const { return base::Contains(permissions_, permission); } @@ -83,10 +67,6 @@ return std::vector<uint8_t>(std::begin(kSaveData), std::end(kSaveData)); } -const blink::WebMouseEvent* TestPDFiumEngine::GetScaledMouseEvent() const { - return scaled_mouse_event_ ? scaled_mouse_event_.get() : nullptr; -} - void TestPDFiumEngine::SetPermissions( const std::vector<DocumentPermission>& permissions) { permissions_.clear();
diff --git a/pdf/test/test_pdfium_engine.h b/pdf/test/test_pdfium_engine.h index fc64a50a..73d1896 100644 --- a/pdf/test/test_pdfium_engine.h +++ b/pdf/test/test_pdfium_engine.h
@@ -7,7 +7,6 @@ #include <stdint.h> -#include <memory> #include <vector> #include "base/containers/flat_set.h" @@ -17,11 +16,6 @@ #include "pdf/pdf_engine.h" #include "pdf/pdfium/pdfium_engine.h" #include "testing/gmock/include/gmock/gmock.h" -#include "third_party/blink/public/common/input/web_mouse_event.h" - -namespace blink { -class WebInputEvent; -} // namespace blink namespace chrome_pdf { @@ -48,9 +42,6 @@ (const DocumentLayout::Options&), (override)); - // Sets a scaled mouse event for testing. - bool HandleInputEvent(const blink::WebInputEvent& scaled_event) override; - bool HasPermission(DocumentPermission permission) const override; const std::vector<DocumentAttachmentInfo>& GetDocumentAttachmentInfoList() @@ -69,8 +60,6 @@ std::vector<uint8_t> GetSaveData() override; - const blink::WebMouseEvent* GetScaledMouseEvent() const; - void SetPermissions(const std::vector<DocumentPermission>& permissions); protected: @@ -85,8 +74,6 @@ DocumentMetadata metadata_; - std::unique_ptr<blink::WebMouseEvent> scaled_mouse_event_; - base::flat_set<DocumentPermission> permissions_; };
diff --git a/remoting/host/mojo_ipc/BUILD.gn b/remoting/host/mojo_ipc/BUILD.gn index e4731584..4d5a905 100644 --- a/remoting/host/mojo_ipc/BUILD.gn +++ b/remoting/host/mojo_ipc/BUILD.gn
@@ -7,6 +7,8 @@ "ipc_server.h", "mojo_ipc_server.cc", "mojo_ipc_server.h", + "mojo_ipc_util.cc", + "mojo_ipc_util.h", ] deps = [ "//base",
diff --git a/remoting/host/mojo_ipc/mojo_ipc_util.cc b/remoting/host/mojo_ipc/mojo_ipc_util.cc new file mode 100644 index 0000000..7dff0a0 --- /dev/null +++ b/remoting/host/mojo_ipc/mojo_ipc_util.cc
@@ -0,0 +1,38 @@ +// 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 "remoting/host/mojo_ipc/mojo_ipc_util.h" + +#include <string> + +#include "build/build_config.h" + +#if defined(OS_POSIX) && !defined(OS_MAC) +#include "base/files/file_path.h" +#include "base/files/file_util.h" +#include "base/logging.h" +#endif + +namespace remoting { + +mojo::NamedPlatformChannel::ServerName +WorkingDirectoryIndependentServerNameFromUTF8(base::StringPiece name) { +#if defined(OS_POSIX) && !defined(OS_MAC) + // The channel name on non-mac POSIX (basically Linux) is the path to a unix + // domain socket, so it needs to be an absolute path to allow the IPC binary + // to be executed from any working directory. + base::FilePath temp_dir_path; + if (base::GetTempDir(&temp_dir_path)) { + return mojo::NamedPlatformChannel::ServerNameFromUTF8( + temp_dir_path.Append(name).value()); + } + LOG(ERROR) << "Failed to retrieve temporary directory."; + // Fallback to just using |name|. +#endif + + // ServerName on other platforms (i.e. Windows and Mac) is globally unique. + return mojo::NamedPlatformChannel::ServerNameFromUTF8(name); +} + +} // namespace remoting
diff --git a/remoting/host/mojo_ipc/mojo_ipc_util.h b/remoting/host/mojo_ipc/mojo_ipc_util.h new file mode 100644 index 0000000..f6486d2 --- /dev/null +++ b/remoting/host/mojo_ipc/mojo_ipc_util.h
@@ -0,0 +1,21 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef REMOTING_HOST_MOJO_IPC_MOJO_IPC_UTIL_H_ +#define REMOTING_HOST_MOJO_IPC_MOJO_IPC_UTIL_H_ + +#include "base/strings/string_piece_forward.h" +#include "mojo/public/cpp/platform/named_platform_channel.h" + +namespace remoting { + +// Creates a server name that is independent to the working directory, i.e. +// it resolves to the same channel no matter which working directory you are +// running the binary from. +mojo::NamedPlatformChannel::ServerName +WorkingDirectoryIndependentServerNameFromUTF8(base::StringPiece name); + +} // namespace remoting + +#endif // REMOTING_HOST_MOJO_IPC_MOJO_IPC_UTIL_H_
diff --git a/remoting/host/mojom/BUILD.gn b/remoting/host/mojom/BUILD.gn index 5eb4f6f..6f22703 100644 --- a/remoting/host/mojom/BUILD.gn +++ b/remoting/host/mojom/BUILD.gn
@@ -10,6 +10,7 @@ "remote_support.mojom", "remote_url_opener.mojom", "testing.mojom", + "webauthn_proxy.mojom", ] deps = [
diff --git a/remoting/host/mojom/webauthn_proxy.mojom b/remoting/host/mojom/webauthn_proxy.mojom new file mode 100644 index 0000000..8edb3f1 --- /dev/null +++ b/remoting/host/mojom/webauthn_proxy.mojom
@@ -0,0 +1,21 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module remoting.mojom; + +// An interface for the host-side chromoting extension to pass intercepted Web +// Authentication API requests to the client side chromoting security extension +// through a chromoting host process. +// The remote of this interface is always owned by a low-trust native messaging +// host process; on Windows, the receiver is bound in a low-trust chromoting +// network process, while on Linux, the receiver is bound in a high-trust +// chromoting host process. +// Note that both processes are chromoting-only and they don't make IPCs with +// Chrome processes. +interface WebAuthnProxy { + // Handles a + // PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable() call + // remotely. + IsUserVerifyingPlatformAuthenticatorAvailable() => (bool is_available); +};
diff --git a/remoting/host/remote_open_url/remote_open_url_constants.cc b/remoting/host/remote_open_url/remote_open_url_constants.cc index 62bb62f0..55aa788d 100644 --- a/remoting/host/remote_open_url/remote_open_url_constants.cc +++ b/remoting/host/remote_open_url/remote_open_url_constants.cc
@@ -6,33 +6,20 @@ #include "base/no_destructor.h" #include "build/build_config.h" +#include "remoting/host/mojo_ipc/mojo_ipc_util.h" namespace remoting { namespace { - -#if defined(OS_LINUX) - -// The channel name on Linux is the path to a unix domain socket, so it needs -// to be an absolute path to allow the IPC client binary to be executed from -// any working directory. -constexpr char kRemoteOpenUrlChannelName[] = "/tmp/crd_remote_open_url_ipc"; - -#else - -// TODO(yuweih): Check if this IPC name works on other platforms. -constexpr char kRemoteOpenUrlChannelName[] = "crd_remote_open_url_ipc"; - -#endif - +constexpr char kRemoteOpenUrlIpcChannelName[] = "crd_remote_open_url_ipc"; } // namespace const char kRemoteOpenUrlDataChannelName[] = "remote-open-url"; const mojo::NamedPlatformChannel::ServerName& GetRemoteOpenUrlIpcChannelName() { static const base::NoDestructor<mojo::NamedPlatformChannel::ServerName> - server_name(mojo::NamedPlatformChannel::ServerNameFromUTF8( - kRemoteOpenUrlChannelName)); + server_name(WorkingDirectoryIndependentServerNameFromUTF8( + kRemoteOpenUrlIpcChannelName)); return *server_name; }
diff --git a/remoting/host/webauthn/BUILD.gn b/remoting/host/webauthn/BUILD.gn index 3b5e81e..e30314c 100644 --- a/remoting/host/webauthn/BUILD.gn +++ b/remoting/host/webauthn/BUILD.gn
@@ -17,6 +17,8 @@ deps = [ "//base", "//extensions/browser/api/messaging:native_messaging", + "//remoting/host/mojo_ipc", + "//remoting/host/mojom", "//remoting/host/native_messaging", "//remoting/proto", "//remoting/protocol",
diff --git a/remoting/host/webauthn/remote_webauthn_constants.cc b/remoting/host/webauthn/remote_webauthn_constants.cc index 0a7a720..85213db 100644 --- a/remoting/host/webauthn/remote_webauthn_constants.cc +++ b/remoting/host/webauthn/remote_webauthn_constants.cc
@@ -4,8 +4,25 @@ #include "remoting/host/webauthn/remote_webauthn_constants.h" +#include "base/no_destructor.h" +#include "build/build_config.h" +#include "remoting/host/mojo_ipc/mojo_ipc_util.h" + namespace remoting { +namespace { +constexpr char kRemoteWebAuthnIpcChannelName[] = "crd_remote_webauthn_ipc"; +} // namespace + const char kRemoteWebAuthnDataChannelName[] = "remote-webauthn"; +const char kIsUvpaaMessageType[] = "isUvpaa"; +const char kIsUvpaaResponseIsAvailableKey[] = "isAvailable"; + +const mojo::NamedPlatformChannel::ServerName& GetRemoteWebAuthnChannelName() { + static const base::NoDestructor<mojo::NamedPlatformChannel::ServerName> + server_name(WorkingDirectoryIndependentServerNameFromUTF8( + kRemoteWebAuthnIpcChannelName)); + return *server_name; +} } // namespace remoting
diff --git a/remoting/host/webauthn/remote_webauthn_constants.h b/remoting/host/webauthn/remote_webauthn_constants.h index e79e328..f34266d 100644 --- a/remoting/host/webauthn/remote_webauthn_constants.h +++ b/remoting/host/webauthn/remote_webauthn_constants.h
@@ -5,10 +5,20 @@ #ifndef REMOTING_HOST_WEBAUTHN_REMOTE_WEBAUTHN_CONSTANTS_H_ #define REMOTING_HOST_WEBAUTHN_REMOTE_WEBAUTHN_CONSTANTS_H_ +#include "mojo/public/cpp/platform/named_platform_channel.h" + namespace remoting { extern const char kRemoteWebAuthnDataChannelName[]; +// NMH message types. +extern const char kIsUvpaaMessageType[]; + +// NMH message keys. +extern const char kIsUvpaaResponseIsAvailableKey[]; + +const mojo::NamedPlatformChannel::ServerName& GetRemoteWebAuthnChannelName(); + } // namespace remoting #endif // REMOTING_HOST_WEBAUTHN_REMOTE_WEBAUTHN_CONSTANTS_H_
diff --git a/remoting/host/webauthn/remote_webauthn_message_handler.cc b/remoting/host/webauthn/remote_webauthn_message_handler.cc index e6b4d59..8c3adbdb 100644 --- a/remoting/host/webauthn/remote_webauthn_message_handler.cc +++ b/remoting/host/webauthn/remote_webauthn_message_handler.cc
@@ -4,7 +4,10 @@ #include "remoting/host/webauthn/remote_webauthn_message_handler.h" +#include "base/callback_helpers.h" #include "base/notreached.h" +#include "remoting/host/mojo_ipc/mojo_ipc_server.h" +#include "remoting/host/webauthn/remote_webauthn_constants.h" #include "remoting/proto/remote_webauthn.pb.h" #include "remoting/protocol/message_serialization.h" @@ -13,23 +16,88 @@ RemoteWebAuthnMessageHandler::RemoteWebAuthnMessageHandler( const std::string& name, std::unique_ptr<protocol::MessagePipe> pipe) - : protocol::NamedMessagePipeHandler(name, std::move(pipe)) {} + : protocol::NamedMessagePipeHandler(name, std::move(pipe)) { + ipc_server_ = std::make_unique<MojoIpcServer<mojom::WebAuthnProxy>>( + GetRemoteWebAuthnChannelName(), this); +} -RemoteWebAuthnMessageHandler::~RemoteWebAuthnMessageHandler() = default; +RemoteWebAuthnMessageHandler::~RemoteWebAuthnMessageHandler() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + OnDisconnecting(); +} void RemoteWebAuthnMessageHandler::OnConnected() { - NOTIMPLEMENTED(); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + ipc_server_->StartServer(); } void RemoteWebAuthnMessageHandler::OnIncomingMessage( std::unique_ptr<CompoundBuffer> message) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + auto remote_webauthn = protocol::ParseMessage<protocol::RemoteWebAuthn>(message.get()); - NOTIMPLEMENTED(); + if (!remote_webauthn->has_id()) { + LOG(ERROR) << "Response doesn't have a message ID."; + return; + } + switch (remote_webauthn->message_case()) { + case protocol::RemoteWebAuthn::kIsUvpaaResponse: + OnIsUvpaaResponse(remote_webauthn->id(), + remote_webauthn->is_uvpaa_response()); + break; + default: + LOG(ERROR) << "Unknown message case: " << remote_webauthn->message_case(); + } } void RemoteWebAuthnMessageHandler::OnDisconnecting() { - NOTIMPLEMENTED(); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + // Run mojo callbacks with error/default response then clean them up. + for (auto& entry : is_uvpaa_callbacks_) { + std::move(entry.second).Run(false); + } + is_uvpaa_callbacks_.clear(); + + ipc_server_->StopServer(); +} + +void RemoteWebAuthnMessageHandler:: + IsUserVerifyingPlatformAuthenticatorAvailable( + IsUserVerifyingPlatformAuthenticatorAvailableCallback callback) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + uint64_t id = AssignNextMessageId(); + is_uvpaa_callbacks_[id] = std::move(callback); + + protocol::RemoteWebAuthn remote_webauthn; + remote_webauthn.set_id(id); + // This simply creates the is_uvpaa_request. + remote_webauthn.mutable_is_uvpaa_request(); + Send(remote_webauthn, base::DoNothing()); +} + +void RemoteWebAuthnMessageHandler::OnIsUvpaaResponse( + uint64_t id, + const protocol::RemoteWebAuthn_IsUvpaaResponse& response) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + auto it = is_uvpaa_callbacks_.find(id); + if (it == is_uvpaa_callbacks_.end()) { + LOG(WARNING) << "No IsUvpaa IPC callback associated with ID: " << id; + return; + } + std::move(it->second).Run(response.is_available()); + is_uvpaa_callbacks_.erase(it); +} + +uint64_t RemoteWebAuthnMessageHandler::AssignNextMessageId() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + return current_message_id_++; } } // namespace remoting
diff --git a/remoting/host/webauthn/remote_webauthn_message_handler.h b/remoting/host/webauthn/remote_webauthn_message_handler.h index c1f1266..d87ab82 100644 --- a/remoting/host/webauthn/remote_webauthn_message_handler.h +++ b/remoting/host/webauthn/remote_webauthn_message_handler.h
@@ -5,27 +5,63 @@ #ifndef REMOTING_HOST_WEBAUTHN_REMOTE_WEBAUTHN_MESSAGE_HANDLER_H_ #define REMOTING_HOST_WEBAUTHN_REMOTE_WEBAUTHN_MESSAGE_HANDLER_H_ +#include <stdint.h> + +#include <memory> + +#include "base/containers/flat_map.h" +#include "base/sequence_checker.h" +#include "base/thread_annotations.h" +#include "remoting/host/mojom/webauthn_proxy.mojom.h" #include "remoting/protocol/named_message_pipe_handler.h" namespace remoting { +namespace protocol { +class RemoteWebAuthn_IsUvpaaResponse; +} // namespace protocol + +class IpcServer; + class RemoteWebAuthnMessageHandler final - : public protocol::NamedMessagePipeHandler { + : public mojom::WebAuthnProxy, + public protocol::NamedMessagePipeHandler { public: RemoteWebAuthnMessageHandler(const std::string& name, std::unique_ptr<protocol::MessagePipe> pipe); - ~RemoteWebAuthnMessageHandler() override; - RemoteWebAuthnMessageHandler(const RemoteWebAuthnMessageHandler&) = delete; RemoteWebAuthnMessageHandler& operator=(const RemoteWebAuthnMessageHandler&) = delete; + ~RemoteWebAuthnMessageHandler() override; // protocol::NamedMessagePipeHandler implementation. void OnConnected() override; void OnIncomingMessage(std::unique_ptr<CompoundBuffer> message) override; void OnDisconnecting() override; + + // mojom::WebAuthnProxy implementation. + void IsUserVerifyingPlatformAuthenticatorAvailable( + IsUserVerifyingPlatformAuthenticatorAvailableCallback callback) override; + + private: + void OnIsUvpaaResponse( + uint64_t id, + const protocol::RemoteWebAuthn_IsUvpaaResponse& response); + + uint64_t AssignNextMessageId(); + + SEQUENCE_CHECKER(sequence_checker_); + + std::unique_ptr<IpcServer> ipc_server_; + + // message ID => mojo callback mappings. + base::flat_map<uint64_t, + IsUserVerifyingPlatformAuthenticatorAvailableCallback> + is_uvpaa_callbacks_ GUARDED_BY_CONTEXT(sequence_checker_); + + uint64_t current_message_id_ GUARDED_BY_CONTEXT(sequence_checker_) = 0u; }; } // namespace remoting -#endif // REMOTING_HOST_WEBAUTHN_REMOTE_WEBAUTHN_MESSAGE_HANDLER_H_ \ No newline at end of file +#endif // REMOTING_HOST_WEBAUTHN_REMOTE_WEBAUTHN_MESSAGE_HANDLER_H_
diff --git a/remoting/host/webauthn/remote_webauthn_native_messaging_host.cc b/remoting/host/webauthn/remote_webauthn_native_messaging_host.cc index 5a377f7..cea851f 100644 --- a/remoting/host/webauthn/remote_webauthn_native_messaging_host.cc +++ b/remoting/host/webauthn/remote_webauthn_native_messaging_host.cc
@@ -4,10 +4,17 @@ #include "remoting/host/webauthn/remote_webauthn_native_messaging_host.h" +#include <memory> + +#include "base/bind.h" #include "base/json/json_writer.h" #include "base/logging.h" +#include "mojo/public/cpp/bindings/pending_remote.h" +#include "mojo/public/cpp/platform/named_platform_channel.h" +#include "mojo/public/cpp/system/isolated_connection.h" #include "remoting/host/native_messaging/native_messaging_constants.h" #include "remoting/host/native_messaging/native_messaging_helpers.h" +#include "remoting/host/webauthn/remote_webauthn_constants.h" namespace remoting { @@ -35,6 +42,8 @@ if (type == kHelloMessage) { ProcessHello(std::move(response)); + } else if (type == kIsUvpaaMessageType) { + ProcessIsUvpaa(request, std::move(response)); } else { LOG(ERROR) << "Unsupported request type: " << type; } @@ -61,6 +70,72 @@ SendMessageToClient(std::move(response)); } +void RemoteWebAuthnNativeMessagingHost::ProcessIsUvpaa( + const base::Value& request, + base::Value response) { + // IsUvpaa request: {id: string, type: 'isUvpaa'} + // IsUvpaa response: + // {id: string, type: 'isUvpaaResponse', isAvailable: boolean} + + DCHECK(task_runner_->BelongsToCurrentThread()); + + if (!EnsureIpcConnection()) { + response.SetBoolKey(kIsUvpaaResponseIsAvailableKey, false); + SendMessageToClient(std::move(response)); + return; + } + + remote_->IsUserVerifyingPlatformAuthenticatorAvailable( + base::BindOnce(&RemoteWebAuthnNativeMessagingHost::OnIsUvpaaResponse, + base::Unretained(this), std::move(response))); +} + +void RemoteWebAuthnNativeMessagingHost::OnIpcDisconnected() { + DCHECK(task_runner_->BelongsToCurrentThread()); + + // Unbinds the remote so that EnsureIpcConnection() knows that the connection + // has been disconnected. + remote_.reset(); +} + +void RemoteWebAuthnNativeMessagingHost::OnIsUvpaaResponse(base::Value response, + bool is_available) { + response.SetBoolKey(kIsUvpaaResponseIsAvailableKey, is_available); + SendMessageToClient(std::move(response)); +} + +bool RemoteWebAuthnNativeMessagingHost::EnsureIpcConnection() { + DCHECK(task_runner_->BelongsToCurrentThread()); + + if (remote_.is_bound()) { + return true; + } + + auto endpoint = mojo::NamedPlatformChannel::ConnectToServer( + GetRemoteWebAuthnChannelName()); + if (!endpoint.is_valid()) { + // TODO(yuweih): The NMH lasts longer than individual remote sessions. + // Detect remote session state and maintain the IPC connection by + // periodically attempting to connect to the IPC server. + LOG(WARNING) << "Can't make IPC connection. The desktop session is " + << "probably not remoted."; + return false; + } + connection_ = std::make_unique<mojo::IsolatedConnection>(); + mojo::PendingRemote<mojom::WebAuthnProxy> pending_remote( + connection_->Connect(std::move(endpoint)), /* version= */ 0); + if (!pending_remote.is_valid()) { + LOG(WARNING) << "Invalid message pipe."; + connection_.reset(); + return false; + } + remote_.Bind(std::move(pending_remote)); + remote_.set_disconnect_handler( + base::BindOnce(&RemoteWebAuthnNativeMessagingHost::OnIpcDisconnected, + base::Unretained(this))); + return true; +} + void RemoteWebAuthnNativeMessagingHost::SendMessageToClient( base::Value message) { DCHECK(task_runner_->BelongsToCurrentThread());
diff --git a/remoting/host/webauthn/remote_webauthn_native_messaging_host.h b/remoting/host/webauthn/remote_webauthn_native_messaging_host.h index aea82d73..6c896cae 100644 --- a/remoting/host/webauthn/remote_webauthn_native_messaging_host.h +++ b/remoting/host/webauthn/remote_webauthn_native_messaging_host.h
@@ -5,8 +5,16 @@ #ifndef REMOTING_HOST_WEBAUTHN_REMOTE_WEBAUTHN_NATIVE_MESSAGING_HOST_H_ #define REMOTING_HOST_WEBAUTHN_REMOTE_WEBAUTHN_NATIVE_MESSAGING_HOST_H_ +#include <memory> + #include "base/values.h" #include "extensions/browser/api/messaging/native_message_host.h" +#include "mojo/public/cpp/bindings/remote.h" +#include "remoting/host/mojom/webauthn_proxy.mojom.h" + +namespace mojo { +class IsolatedConnection; +} // namespace mojo namespace remoting { @@ -17,24 +25,33 @@ public: explicit RemoteWebAuthnNativeMessagingHost( scoped_refptr<base::SingleThreadTaskRunner> task_runner); + RemoteWebAuthnNativeMessagingHost(const RemoteWebAuthnNativeMessagingHost&) = + delete; + RemoteWebAuthnNativeMessagingHost& operator=( + const RemoteWebAuthnNativeMessagingHost&) = delete; ~RemoteWebAuthnNativeMessagingHost() override; void OnMessage(const std::string& message) override; void Start(extensions::NativeMessageHost::Client* client) override; scoped_refptr<base::SingleThreadTaskRunner> task_runner() const override; - RemoteWebAuthnNativeMessagingHost(const RemoteWebAuthnNativeMessagingHost&) = - delete; - RemoteWebAuthnNativeMessagingHost& operator=( - const RemoteWebAuthnNativeMessagingHost&) = delete; - private: void ProcessHello(base::Value response); + void ProcessIsUvpaa(const base::Value& request, base::Value response); + void OnIpcDisconnected(); + void OnIsUvpaaResponse(base::Value response, bool is_available); + + // Attempts to connect to the IPC server if the connection has not been + // established. Returns a boolean indicating whether there is a valid IPC + // connection to the crd host + bool EnsureIpcConnection(); void SendMessageToClient(base::Value message); scoped_refptr<base::SingleThreadTaskRunner> task_runner_; extensions::NativeMessageHost::Client* client_ = nullptr; + std::unique_ptr<mojo::IsolatedConnection> connection_; + mojo::Remote<mojom::WebAuthnProxy> remote_; }; } // namespace remoting
diff --git a/remoting/proto/remote_webauthn.proto b/remoting/proto/remote_webauthn.proto index 7dfcade..ca5884d 100644 --- a/remoting/proto/remote_webauthn.proto +++ b/remoting/proto/remote_webauthn.proto
@@ -10,4 +10,22 @@ // Composite message type for messages sent over the remote-webauthn data // channel. -message RemoteWebAuthn {} +// Next ID: 4 +message RemoteWebAuthn { + // Requests the client to handle a call to + // PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable(). + message IsUvpaaRequest {} + + // Response for IsUvpaaRequest. + // Next ID: 2 + message IsUvpaaResponse { optional bool is_available = 1; } + + // Unique ID to pair a response with the request. + // Required for all message types. + optional uint64 id = 1; + + oneof message { + IsUvpaaRequest is_uvpaa_request = 2; + IsUvpaaResponse is_uvpaa_response = 3; + } +}
diff --git a/services/device/generic_sensor/platform_sensor_linux.cc b/services/device/generic_sensor/platform_sensor_linux.cc index ff0d1ff..b629761b 100644 --- a/services/device/generic_sensor/platform_sensor_linux.cc +++ b/services/device/generic_sensor/platform_sensor_linux.cc
@@ -5,24 +5,12 @@ #include "services/device/generic_sensor/platform_sensor_linux.h" #include "base/bind.h" +#include "base/ranges/algorithm.h" #include "services/device/generic_sensor/linux/sensor_data_linux.h" #include "services/device/generic_sensor/platform_sensor_reader_linux.h" namespace device { -namespace { - -// Checks if at least one value has been changed. -bool HaveValuesChanged(const SensorReading& lhs, const SensorReading& rhs) { - for (size_t i = 0; i < SensorReadingRaw::kValuesCount; ++i) { - if (lhs.raw.values[i] != rhs.raw.values[i]) - return true; - } - return false; -} - -} // namespace - PlatformSensorLinux::PlatformSensorLinux( mojom::SensorType type, SensorReadingSharedBuffer* reading_buffer, @@ -48,7 +36,7 @@ void PlatformSensorLinux::UpdatePlatformSensorReading(SensorReading reading) { DCHECK(main_task_runner()->RunsTasksInCurrentSequence()); if (GetReportingMode() == mojom::ReportingMode::ON_CHANGE && - !HaveValuesChanged(reading, old_values_)) { + base::ranges::equal(reading.raw.values, old_values_.raw.values)) { return; } old_values_ = reading;
diff --git a/services/network/cookie_manager.cc b/services/network/cookie_manager.cc index 3d570fe..9f82fb3 100644 --- a/services/network/cookie_manager.cc +++ b/services/network/cookie_manager.cc
@@ -170,11 +170,13 @@ if (name) { listener_registration->subscription = cookie_store_->GetChangeDispatcher().AddCallbackForCookie( - url, *name, std::move(cookie_change_callback)); + url, *name, net::CookiePartitionKey::Todo(), + std::move(cookie_change_callback)); } else { listener_registration->subscription = cookie_store_->GetChangeDispatcher().AddCallbackForUrl( - url, std::move(cookie_change_callback)); + url, net::CookiePartitionKey::Todo(), + std::move(cookie_change_callback)); } listener_registration->listener.set_disconnect_handler(
diff --git a/services/network/restricted_cookie_manager.cc b/services/network/restricted_cookie_manager.cc index 6b4e47c1..e02892a9 100644 --- a/services/network/restricted_cookie_manager.cc +++ b/services/network/restricted_cookie_manager.cc
@@ -10,9 +10,6 @@ #include "base/bind.h" #include "base/compiler_specific.h" // for FALLTHROUGH; -#include "base/debug/alias.h" -#include "base/debug/crash_logging.h" -#include "base/debug/dump_without_crashing.h" #include "base/memory/weak_ptr.h" #include "base/metrics/histogram_macros.h" #include "base/sequenced_task_runner.h" @@ -150,6 +147,7 @@ const GURL& url, const net::SiteForCookies& site_for_cookies, const url::Origin& top_frame_origin, + const absl::optional<net::CookiePartitionKey>& cookie_partition_key, net::CookieOptions options, mojo::PendingRemote<mojom::CookieChangeListener> mojo_listener) : cookie_store_(cookie_store), @@ -162,13 +160,14 @@ // TODO(pwnall): add a constructor w/options to net::CookieChangeDispatcher. cookie_store_subscription_ = cookie_store->GetChangeDispatcher().AddCallbackForUrl( - url, base::BindRepeating( - &Listener::OnCookieChange, - // Safe because net::CookieChangeDispatcher guarantees that - // the callback will stop being called immediately after we - // remove the subscription, and the cookie store lives on - // the same thread as we do. - base::Unretained(this))); + url, cookie_partition_key, + base::BindRepeating( + &Listener::OnCookieChange, + // Safe because net::CookieChangeDispatcher guarantees that + // the callback will stop being called immediately after we + // remove the subscription, and the cookie store lives on + // the same thread as we do. + base::Unretained(this))); } Listener(const Listener&) = delete; @@ -299,9 +298,7 @@ net_options.set_return_excluded_cookies(); cookie_store_->GetCookieListWithOptionsAsync( - url, net_options, - net::CookiePartitionKey::FromNetworkIsolationKey( - isolation_info_.network_isolation_key()), + url, net_options, CookiePartitionKey(), base::BindOnce(&RestrictedCookieManager::CookieListToGetAllForUrlCallback, weak_ptr_factory_.GetWeakPtr(), url, site_for_cookies, top_frame_origin, net_options, std::move(options), @@ -501,8 +498,8 @@ role_, url, site_for_cookies, isolation_info_, cookie_settings(), cookie_store_->cookie_access_delegate()); auto listener = std::make_unique<Listener>( - cookie_store_, this, url, site_for_cookies, top_frame_origin, net_options, - std::move(mojo_listener)); + cookie_store_, this, url, site_for_cookies, top_frame_origin, + CookiePartitionKey(), net_options, std::move(mojo_listener)); listener->mojo_listener().set_disconnect_handler( base::BindOnce(&RestrictedCookieManager::RemoveChangeListener, @@ -626,31 +623,6 @@ UMA_HISTOGRAM_BOOLEAN("Net.RestrictedCookieManager.TopFrameOriginOK", top_frame_origin_ok); - if (!top_frame_origin_ok || !site_for_cookies_ok) { - base::debug::Alias(&top_frame_origin_ok); - base::debug::Alias(&site_for_cookies_ok); - static bool reported = false; - if (!reported) { - reported = true; - SCOPED_CRASH_KEY_STRING256("RCM", "rcm-site_for_cookies", - BoundSiteForCookies().ToDebugString()); - SCOPED_CRASH_KEY_STRING256("RCM", "render-site_for_cookies", - site_for_cookies.ToDebugString()); - - SCOPED_CRASH_KEY_STRING256("RCM", "rcm-top_frame_origin", - BoundTopFrameOrigin().GetDebugString()); - SCOPED_CRASH_KEY_STRING256("RCM", "render-top_frame_origin", - top_frame_origin.GetDebugString()); - - SCOPED_CRASH_KEY_STRING256("RCM", "rcm-origin", origin_.GetDebugString()); - // Only origin here, since url is probably way too sensitive. - SCOPED_CRASH_KEY_STRING256("RCM", "render-origin", - url::Origin::Create(url).GetDebugString()); - base::debug::DumpWithoutCrashing(); - } - return false; - } - // Don't allow setting cookies on other domains. See crbug.com/996786. if (cookie_being_set && !cookie_being_set->IsDomainMatch(url.host())) { mojo::ReportBadMessage("Setting cookies on other domains is disallowed.");
diff --git a/services/network/restricted_cookie_manager.h b/services/network/restricted_cookie_manager.h index 66708028..d88f46c 100644 --- a/services/network/restricted_cookie_manager.h +++ b/services/network/restricted_cookie_manager.h
@@ -160,6 +160,11 @@ return isolation_info_.top_frame_origin().value(); } + const absl::optional<net::CookiePartitionKey> CookiePartitionKey() const { + return net::CookiePartitionKey::FromNetworkIsolationKey( + isolation_info_.network_isolation_key()); + } + const mojom::RestrictedCookieManagerRole role_; net::CookieStore* const cookie_store_; const CookieSettings& cookie_settings_;
diff --git a/services/network/restricted_cookie_manager_unittest.cc b/services/network/restricted_cookie_manager_unittest.cc index 962f1e1..668e511 100644 --- a/services/network/restricted_cookie_manager_unittest.cc +++ b/services/network/restricted_cookie_manager_unittest.cc
@@ -188,6 +188,47 @@ mojom::RestrictedCookieManager* cookie_service_; }; +namespace { + +// Stashes the cookie changes it receives, for testing. +class TestCookieChangeListener : public network::mojom::CookieChangeListener { + public: + explicit TestCookieChangeListener( + mojo::PendingReceiver<network::mojom::CookieChangeListener> receiver) + : receiver_(this, std::move(receiver)) {} + ~TestCookieChangeListener() override = default; + + // Spin in a run loop until a change is received. + void WaitForChange() { + base::RunLoop loop; + run_loop_ = &loop; + loop.Run(); + run_loop_ = nullptr; + } + + // Changes received by this listener. + const std::vector<net::CookieChangeInfo>& observed_changes() const { + return observed_changes_; + } + + // network::mojom::CookieChangeListener + void OnCookieChange(const net::CookieChangeInfo& change) override { + observed_changes_.emplace_back(change); + + if (run_loop_) // Set in WaitForChange(). + run_loop_->Quit(); + } + + private: + std::vector<net::CookieChangeInfo> observed_changes_; + mojo::Receiver<network::mojom::CookieChangeListener> receiver_; + + // If not null, will be stopped when a cookie change notification is received. + base::RunLoop* run_loop_ = nullptr; +}; + +} // namespace + class RestrictedCookieManagerTest : public testing::TestWithParam<mojom::RestrictedCookieManagerRole> { public: @@ -278,6 +319,18 @@ "https", /* can_modify_httponly = */ true)); } + std::unique_ptr<TestCookieChangeListener> CreateCookieChangeListener( + const GURL& url, + const net::SiteForCookies& site_for_cookies, + const url::Origin& top_frame_origin) { + mojo::PendingRemote<network::mojom::CookieChangeListener> listener_remote; + mojo::PendingReceiver<network::mojom::CookieChangeListener> receiver = + listener_remote.InitWithNewPipeAndPassReceiver(); + sync_service_->AddChangeListener(url, site_for_cookies, top_frame_origin, + std::move(listener_remote)); + return std::make_unique<TestCookieChangeListener>(std::move(receiver)); + } + void ExpectBadMessage() { expecting_bad_message_ = true; } bool received_bad_message() { return received_bad_message_; } @@ -1161,82 +1214,33 @@ IsEmpty()); } -namespace { - -// Stashes the cookie changes it receives, for testing. -class TestCookieChangeListener : public network::mojom::CookieChangeListener { - public: - explicit TestCookieChangeListener( - mojo::PendingReceiver<network::mojom::CookieChangeListener> receiver) - : receiver_(this, std::move(receiver)) {} - ~TestCookieChangeListener() override = default; - - // Spin in a run loop until a change is received. - void WaitForChange() { - base::RunLoop loop; - run_loop_ = &loop; - loop.Run(); - run_loop_ = nullptr; - } - - // Changes received by this listener. - const std::vector<net::CookieChangeInfo>& observed_changes() const { - return observed_changes_; - } - - // network::mojom::CookieChangeListener - void OnCookieChange(const net::CookieChangeInfo& change) override { - observed_changes_.emplace_back(change); - - if (run_loop_) // Set in WaitForChange(). - run_loop_->Quit(); - } - - private: - std::vector<net::CookieChangeInfo> observed_changes_; - mojo::Receiver<network::mojom::CookieChangeListener> receiver_; - - // If not null, will be stopped when a cookie change notification is received. - base::RunLoop* run_loop_ = nullptr; -}; - -} // anonymous namespace - TEST_P(RestrictedCookieManagerTest, ChangeDispatch) { - mojo::PendingRemote<network::mojom::CookieChangeListener> listener_remote; - mojo::PendingReceiver<network::mojom::CookieChangeListener> receiver = - listener_remote.InitWithNewPipeAndPassReceiver(); - sync_service_->AddChangeListener(kDefaultUrlWithPath, kDefaultSiteForCookies, - kDefaultOrigin, std::move(listener_remote)); - TestCookieChangeListener listener(std::move(receiver)); + auto listener = CreateCookieChangeListener( + kDefaultUrlWithPath, kDefaultSiteForCookies, kDefaultOrigin); - ASSERT_THAT(listener.observed_changes(), testing::SizeIs(0)); + ASSERT_THAT(listener->observed_changes(), testing::SizeIs(0)); SetSessionCookie("cookie-name", "cookie-value", "example.com", "/"); - listener.WaitForChange(); + listener->WaitForChange(); - ASSERT_THAT(listener.observed_changes(), testing::SizeIs(1)); + ASSERT_THAT(listener->observed_changes(), testing::SizeIs(1)); EXPECT_EQ(net::CookieChangeCause::INSERTED, - listener.observed_changes()[0].cause); - EXPECT_THAT(listener.observed_changes()[0].cookie, + listener->observed_changes()[0].cause); + EXPECT_THAT(listener->observed_changes()[0].cookie, net::MatchesCookieNameValue("cookie-name", "cookie-value")); } TEST_P(RestrictedCookieManagerTest, ChangeSettings) { service_->OverrideIsolationInfoForTesting(kOtherIsolationInfo); - mojo::PendingRemote<network::mojom::CookieChangeListener> listener_remote; - mojo::PendingReceiver<network::mojom::CookieChangeListener> receiver = - listener_remote.InitWithNewPipeAndPassReceiver(); - sync_service_->AddChangeListener(kDefaultUrlWithPath, net::SiteForCookies(), - kDefaultOrigin, std::move(listener_remote)); - TestCookieChangeListener listener(std::move(receiver)); + auto listener = CreateCookieChangeListener( + kDefaultUrlWithPath, net::SiteForCookies(), kDefaultOrigin); - EXPECT_THAT(listener.observed_changes(), IsEmpty()); + EXPECT_THAT(listener->observed_changes(), IsEmpty()); cookie_settings_.set_block_third_party_cookies(true); SetSessionCookie("cookie-name", "cookie-value", "example.com", "/"); base::RunLoop().RunUntilIdle(); - EXPECT_THAT(listener.observed_changes(), IsEmpty()); + EXPECT_THAT(listener->observed_changes(), IsEmpty()); } TEST_P(RestrictedCookieManagerTest, AddChangeListenerFromWrongOrigin) { @@ -1304,23 +1308,18 @@ std::set<net::SchemefulSite>{ net::SchemefulSite(GURL("https://member1.com"))})); - mojo::PendingRemote<network::mojom::CookieChangeListener> listener_remote; - mojo::PendingReceiver<network::mojom::CookieChangeListener> receiver = - listener_remote.InitWithNewPipeAndPassReceiver(); - sync_service_->AddChangeListener(kDefaultUrlWithPath, net::SiteForCookies(), - kDefaultOrigin, - std::move(listener_remote)); - TestCookieChangeListener listener(std::move(receiver)); + auto listener = CreateCookieChangeListener( + kDefaultUrlWithPath, net::SiteForCookies(), kDefaultOrigin); - ASSERT_THAT(listener.observed_changes(), IsEmpty()); + ASSERT_THAT(listener->observed_changes(), IsEmpty()); SetSamePartyCookie("cookie-name", "cookie-value", "example.com", "/"); - listener.WaitForChange(); + listener->WaitForChange(); - ASSERT_THAT(listener.observed_changes(), testing::SizeIs(1)); + ASSERT_THAT(listener->observed_changes(), testing::SizeIs(1)); EXPECT_EQ(net::CookieChangeCause::INSERTED, - listener.observed_changes()[0].cause); - EXPECT_THAT(listener.observed_changes()[0].cookie, + listener->observed_changes()[0].cause); + EXPECT_THAT(listener->observed_changes()[0].cookie, net::MatchesCookieNameValue("cookie-name", "cookie-value")); } // Cross Party. @@ -1331,17 +1330,12 @@ std::set<net::SchemefulSite>{ net::SchemefulSite(GURL("https://not-example.com"))})); - mojo::PendingRemote<network::mojom::CookieChangeListener> listener_remote; - mojo::PendingReceiver<network::mojom::CookieChangeListener> receiver = - listener_remote.InitWithNewPipeAndPassReceiver(); - sync_service_->AddChangeListener(kDefaultUrlWithPath, net::SiteForCookies(), - kDefaultOrigin, - std::move(listener_remote)); - TestCookieChangeListener listener(std::move(receiver)); + auto listener = CreateCookieChangeListener( + kDefaultUrlWithPath, net::SiteForCookies(), kDefaultOrigin); - EXPECT_THAT(listener.observed_changes(), IsEmpty()); + EXPECT_THAT(listener->observed_changes(), IsEmpty()); SetSamePartyCookie("cookie-name", "cookie-value", "example.com", "/"); - EXPECT_THAT(listener.observed_changes(), IsEmpty()); + EXPECT_THAT(listener->observed_changes(), IsEmpty()); } } @@ -1354,17 +1348,12 @@ "example.com", net::CookieAccessSemantics::LEGACY); cookie_monster_.SetCookieAccessDelegate(std::move(cookie_access_delegate)); - mojo::PendingRemote<network::mojom::CookieChangeListener> listener_remote; - mojo::PendingReceiver<network::mojom::CookieChangeListener> receiver = - listener_remote.InitWithNewPipeAndPassReceiver(); - // Use a cross-site site_for_cookies. service_->OverrideIsolationInfoForTesting(kOtherIsolationInfo); - sync_service_->AddChangeListener(kDefaultUrlWithPath, net::SiteForCookies(), - kDefaultOrigin, std::move(listener_remote)); - TestCookieChangeListener listener(std::move(receiver)); + auto listener = CreateCookieChangeListener( + kDefaultUrlWithPath, net::SiteForCookies(), kDefaultOrigin); - ASSERT_THAT(listener.observed_changes(), IsEmpty()); + ASSERT_THAT(listener->observed_changes(), IsEmpty()); auto cookie = net::CanonicalCookie::Create( kDefaultUrl, "cookie_with_no_samesite=unspecified", base::Time::Now(), @@ -1379,11 +1368,11 @@ ASSERT_TRUE(callback.result().status.IsInclude()); // The listener only receives the change because the cookie is legacy. - listener.WaitForChange(); + listener->WaitForChange(); - ASSERT_THAT(listener.observed_changes(), testing::SizeIs(1)); + ASSERT_THAT(listener->observed_changes(), testing::SizeIs(1)); EXPECT_EQ(net::CookieAccessSemantics::LEGACY, - listener.observed_changes()[0].access_result.access_semantics); + listener->observed_changes()[0].access_result.access_semantics); } TEST_P(RestrictedCookieManagerTest, NoChangeNotificationForNonlegacyCookie) { @@ -1393,17 +1382,12 @@ "example.com", net::CookieAccessSemantics::NONLEGACY); cookie_monster_.SetCookieAccessDelegate(std::move(cookie_access_delegate)); - mojo::PendingRemote<network::mojom::CookieChangeListener> listener_remote; - mojo::PendingReceiver<network::mojom::CookieChangeListener> receiver = - listener_remote.InitWithNewPipeAndPassReceiver(); - // Use a cross-site site_for_cookies. service_->OverrideIsolationInfoForTesting(kOtherIsolationInfo); - sync_service_->AddChangeListener(kDefaultUrlWithPath, net::SiteForCookies(), - kDefaultOrigin, std::move(listener_remote)); - TestCookieChangeListener listener(std::move(receiver)); + auto listener = CreateCookieChangeListener( + kDefaultUrlWithPath, net::SiteForCookies(), kDefaultOrigin); - ASSERT_THAT(listener.observed_changes(), testing::SizeIs(0)); + ASSERT_THAT(listener->observed_changes(), testing::SizeIs(0)); auto unspecified_cookie = net::CanonicalCookie::Create( kDefaultUrl, "cookie_with_no_samesite=unspecified", base::Time::Now(), @@ -1425,7 +1409,7 @@ // Listener doesn't receive notification because cookie is not included for // request URL for being unspecified and treated as lax. base::RunLoop().RunUntilIdle(); - ASSERT_THAT(listener.observed_changes(), testing::SizeIs(0)); + ASSERT_THAT(listener->observed_changes(), testing::SizeIs(0)); net::ResultSavingCookieCallback<net::CookieAccessResult> callback2; cookie_monster_.SetCanonicalCookieAsync( @@ -1435,13 +1419,13 @@ ASSERT_TRUE(callback2.result().status.IsInclude()); // Listener only receives notification about the SameSite=None cookie. - listener.WaitForChange(); - ASSERT_THAT(listener.observed_changes(), testing::SizeIs(1)); + listener->WaitForChange(); + ASSERT_THAT(listener->observed_changes(), testing::SizeIs(1)); EXPECT_EQ("samesite_none_cookie", - listener.observed_changes()[0].cookie.Name()); + listener->observed_changes()[0].cookie.Name()); EXPECT_EQ(net::CookieAccessSemantics::NONLEGACY, - listener.observed_changes()[0].access_result.access_semantics); + listener->observed_changes()[0].access_result.access_semantics); } INSTANTIATE_TEST_SUITE_P( @@ -1487,6 +1471,25 @@ ASSERT_EQ(1u, cookies.size()); EXPECT_FALSE(cookies[0].IsPartitioned()); EXPECT_EQ("__Host-foo", cookies[0].Name()); + + auto listener = CreateCookieChangeListener(kCookieURL, kSiteForCookies, + kTopFrameOrigin); + + // Update partitioned cookie Max-Age: None -> 7200. + EXPECT_TRUE(SetCanonicalCookie( + *net::CanonicalCookie::Create( + kCookieURL, + "__Host-foo=bar; Secure; SameSite=None; Path=/; Partitioned; " + "Max-Age=7200", + base::Time::Now(), absl::nullopt /* server_time */, + net::CookiePartitionKey::FromNetworkIsolationKey( + kIsolationInfo.network_isolation_key())), + "https", false /* can_modify_httponly */)); + + // If Partitioned cookies are disabled, the change listener should see the + // change to the cookie on this top-level site. + listener->WaitForChange(); + ASSERT_THAT(listener->observed_changes(), testing::SizeIs(1)); } { // Test request from another top-level site. @@ -1510,6 +1513,25 @@ ASSERT_EQ(1u, cookies.size()); EXPECT_FALSE(cookies[0].IsPartitioned()); EXPECT_EQ("__Host-foo", cookies[0].Name()); + + auto listener = CreateCookieChangeListener(kCookieURL, kOtherSiteForCookies, + kOtherTopFrameOrigin); + + // Update partitioned cookie Max-Age: 7200 -> 3600. + EXPECT_TRUE(SetCanonicalCookie( + *net::CanonicalCookie::Create( + kCookieURL, + "__Host-foo=bar; Secure; SameSite=None; Path=/; Partitioned; " + "Max-Age=3600", + base::Time::Now(), absl::nullopt /* server_time */, + net::CookiePartitionKey::FromNetworkIsolationKey( + kIsolationInfo.network_isolation_key())), + "https", false /* can_modify_httponly */)); + + // If Partitioned cookies are disabled, the change listener should see the + // change to the cookie on the other top-level site as well. + listener->WaitForChange(); + ASSERT_THAT(listener->observed_changes(), testing::SizeIs(1)); } } @@ -1542,6 +1564,25 @@ net::CookiePartitionKey::FromURLForTesting(GURL("https://foo.com")), cookies[0].PartitionKey()); EXPECT_EQ("__Host-foo", cookies[0].Name()); + + auto listener = CreateCookieChangeListener(kCookieURL, kSiteForCookies, + kTopFrameOrigin); + + // Update partitioned cookie Max-Age: None -> 7200. + EXPECT_TRUE(SetCanonicalCookie( + *net::CanonicalCookie::Create( + kCookieURL, + "__Host-foo=bar; Secure; SameSite=None; Path=/; Partitioned; " + "Max-Age=7200", + base::Time::Now(), absl::nullopt /* server_time */, + net::CookiePartitionKey::FromNetworkIsolationKey( + kIsolationInfo.network_isolation_key())), + "https", false /* can_modify_httponly */)); + + // If Partitioned cookies are enabled, the change listener should see the + // change to the cookie on this top-level site. + listener->WaitForChange(); + ASSERT_THAT(listener->observed_changes(), testing::SizeIs(1)); } { // Test request from another top-level site. @@ -1563,6 +1604,32 @@ sync_service_->GetAllForUrl(kCookieURL, kOtherSiteForCookies, kOtherTopFrameOrigin, std::move(options)); ASSERT_EQ(0u, cookies.size()); + + auto listener = CreateCookieChangeListener(kCookieURL, kOtherSiteForCookies, + kOtherTopFrameOrigin); + + // Set a new listener with the original IsolationInfo, we wait for this + // listener to receive an event to verify that the second listener was + // either called or skipped. + service_->OverrideIsolationInfoForTesting(kIsolationInfo); + auto second_listener = CreateCookieChangeListener( + kCookieURL, kSiteForCookies, kTopFrameOrigin); + + // Update partitioned cookie Max-Age: 7200 -> 3600. + EXPECT_TRUE(SetCanonicalCookie( + *net::CanonicalCookie::Create( + kCookieURL, + "__Host-foo=bar; Secure; SameSite=None; Path=/; Partitioned; " + "Max-Age=3600", + base::Time::Now(), absl::nullopt /* server_time */, + net::CookiePartitionKey::FromNetworkIsolationKey( + kIsolationInfo.network_isolation_key())), + "https", false /* can_modify_httponly */)); + + // If Partitioned cookies are enabled, the listener should not see cookie + // change events on this top-level site. + second_listener->WaitForChange(); + ASSERT_THAT(listener->observed_changes(), testing::SizeIs(0)); } }
diff --git a/skia/config/SkUserConfig.h b/skia/config/SkUserConfig.h index 39478f04..a2dfafe 100644 --- a/skia/config/SkUserConfig.h +++ b/skia/config/SkUserConfig.h
@@ -215,6 +215,8 @@ #define SK_LEGACY_INNER_JOINS +#define SK_SUPPORT_LEGACY_BILERP_HIGHP + ///////////////////////// Imported from BUILD.gn and skia_common.gypi /* In some places Skia can use static initializers for global initialization,
diff --git a/testing/buildbot/chromium.mac.json b/testing/buildbot/chromium.mac.json index b6132b5..dc842de 100644 --- a/testing/buildbot/chromium.mac.json +++ b/testing/buildbot/chromium.mac.json
@@ -23913,6 +23913,37 @@ }, { "args": [ + "--num-retries=3" + ], + "ci_only": true, + "experiment_percentage": 100, + "isolate_name": "blink_web_tests", + "merge": { + "args": [ + "--verbose" + ], + "script": "//third_party/blink/tools/merge_web_test_results.py" + }, + "name": "blink_web_tests", + "resultdb": { + "enable": true + }, + "results_handler": "layout tests", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "arm64", + "os": "Mac-11" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", + "shards": 12 + }, + "test_id_prefix": "ninja://:blink_web_tests/" + }, + { + "args": [ "--test-type=integration" ], "ci_only": true,
diff --git a/testing/buildbot/gn_isolate_map.pyl b/testing/buildbot/gn_isolate_map.pyl index a223cfd..829bca6 100644 --- a/testing/buildbot/gn_isolate_map.pyl +++ b/testing/buildbot/gn_isolate_map.pyl
@@ -1858,7 +1858,7 @@ }, "updater_tests_win_uac": { "label": "//chrome/updater:updater_tests_win_uac", - "script": "//chrome/updater/chrome/updater/test/service/run_command_as_standard_user.py", + "script": "//chrome/updater/test/service/win/run_command_as_standard_user.py", "type": "script", }, "upload_trace_processor": {
diff --git a/testing/buildbot/test_suite_exceptions.pyl b/testing/buildbot/test_suite_exceptions.pyl index 7d520044..34e552d 100644 --- a/testing/buildbot/test_suite_exceptions.pyl +++ b/testing/buildbot/test_suite_exceptions.pyl
@@ -218,7 +218,6 @@ }, 'blink_web_tests': { 'remove_from': [ - 'mac11-arm64-rel-tests', # TODO(https://crbug.com/1169240): Enable 'Mac10.11 Tests', 'Win 7 Tests x64 (1)', # 64-bit win is unsupported by the layout tests. 'Win10 Tests x64 (dbg)', @@ -507,6 +506,9 @@ 'shards': 20, }, }, + 'mac11-arm64-rel-tests': { + 'experiment_percentage': 100, + }, 'mac11.0-blink-rel-dummy': { 'swarming': { 'shards': 12,
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 251ae2b..e9f513b4 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -4802,6 +4802,43 @@ ] } ], + "MyChromeEverywhere": [ + { + "platforms": [ + "linux", + "mac", + "windows" + ], + "experiments": [ + { + "name": "Enabled", + "enable_features": [ + "AutofillCreditCardUploadFeedback", + "AutofillEnableToolbarStatusChip" + ] + } + ] + } + ], + "NavigationPredictor": [ + { + "platforms": [ + "android", + "android_weblayer" + ], + "experiments": [ + { + "name": "Enabled_Logistic_Precision_15_M79_20191029", + "params": { + "random_anchor_sampling_period": "100" + }, + "enable_features": [ + "NavigationPredictor" + ] + } + ] + } + ], "NavigationThreadingOptimizations": [ { "platforms": [ @@ -7202,25 +7239,6 @@ ] } ], - "SmoothnessModeForAnimatedScrolls": [ - { - "platforms": [ - "chromeos", - "chromeos_lacros", - "linux", - "mac", - "windows" - ], - "experiments": [ - { - "name": "Enabled", - "enable_features": [ - "SmoothnessModeForAnimatedScrolls" - ] - } - ] - } - ], "SplitCacheByNetworkIsolationKey": [ { "platforms": [
diff --git a/third_party/blink/renderer/core/css/view-source.css b/third_party/blink/renderer/core/css/view-source.css index a54f79a9..ade8b71 100644 --- a/third_party/blink/renderer/core/css/view-source.css +++ b/third_party/blink/renderer/core/css/view-source.css
@@ -49,7 +49,7 @@ font-size: initial; font-family: monospace; user-select: none; - background-color: rgb(240, 240, 240); + background-color: -internal-light-dark(rgb(240, 240, 240), rgb(60, 60, 60)); border-bottom: 1px solid rgb(187, 187, 187); display: flex; justify-content: flex-start; @@ -70,7 +70,7 @@ box-sizing: border-box; padding: 0 4px !important; width: 31px; - background-color: rgb(240, 240, 240); + background-color: -internal-light-dark(rgb(240, 240, 240), rgb(60, 60, 60)); border-right: 1px solid rgb(187, 187, 187) !important; -webkit-user-select: none; } @@ -86,7 +86,7 @@ .line-number { text-align: right; - color: rgb(128, 128, 128); + color: -internal-light-dark(rgb(148, 132, 132), rgb(128, 128, 128)); word-break: normal; white-space: nowrap; font-size: 9px; @@ -107,23 +107,23 @@ } .html-tag { - /* Keep this in sync with inspector.css (.webkit-html-tag) */ - color: rgb(136, 18, 128); + /* Keep this in sync with inspectorSyntaxHighlight.css (.webkit-html-tag) */ + color: -internal-light-dark(rgb(136, 18, 128), rgb(93, 176, 215)); } .html-attribute-name { - /* Keep this in sync with inspector.css (.webkit-html-attribute-name) */ - color: rgb(153, 69, 0); + /* Keep this in sync with inspectorSyntaxHighlight.css (.webkit-html-attribute-name) */ + color: -internal-light-dark(rgb(153, 69, 0), rgb(155 187 220)); } .html-attribute-value { - /* Keep this in sync with inspector.css (.webkit-html-attribute-value) */ - color: rgb(26, 26, 166); + /* Keep this in sync with inspectorSyntaxHighlight.css (.webkit-html-attribute-value) */ + color: -internal-light-dark(rgb(26, 26, 166), rgb(242, 151, 102)); } .html-external-link, .html-resource-link { /* Keep this in sync with inspectorSyntaxHighlight.css (.webkit-html-external-link, .webkit-html-resource-link) */ - color: #00e; + color: -internal-light-dark(#00e, rgb(159, 180, 214)); } .html-external-link {
diff --git a/third_party/blink/renderer/core/display_lock/display_lock_utilities.cc b/third_party/blink/renderer/core/display_lock/display_lock_utilities.cc index 98f68eef..825bd1ae 100644 --- a/third_party/blink/renderer/core/display_lock/display_lock_utilities.cc +++ b/third_party/blink/renderer/core/display_lock/display_lock_utilities.cc
@@ -92,6 +92,19 @@ } template <typename Lambda> +const Element* LockedInclusiveAncestorPreventingUpdate( + const Node& node, + Lambda update_is_prevented) { + if (const Element* element = DynamicTo<Element>(node)) { + if (auto* context = element->GetDisplayLockContext()) { + if (update_is_prevented(context)) + return element; + } + } + return LockedAncestorPreventingUpdate(node, update_is_prevented); +} + +template <typename Lambda> Element* LockedAncestorPreventingUpdate(const LayoutObject& object, Lambda update_is_prevented) { if (auto* ancestor = NearestLockedExclusiveAncestor(object)) { @@ -625,6 +638,14 @@ }); } +const Element* DisplayLockUtilities::LockedInclusiveAncestorPreventingLayout( + const Node& node) { + return LockedInclusiveAncestorPreventingUpdate( + node, [](DisplayLockContext* context) { + return !context->ShouldLayoutChildren(); + }); +} + Element* DisplayLockUtilities::LockedAncestorPreventingStyle(const Node& node) { return LockedAncestorPreventingUpdate(node, [](DisplayLockContext* context) { return !context->ShouldStyleChildren();
diff --git a/third_party/blink/renderer/core/display_lock/display_lock_utilities.h b/third_party/blink/renderer/core/display_lock/display_lock_utilities.h index a589f3b..0b64be9 100644 --- a/third_party/blink/renderer/core/display_lock/display_lock_utilities.h +++ b/third_party/blink/renderer/core/display_lock/display_lock_utilities.h
@@ -154,6 +154,8 @@ // the layout update can be forced. static Element* LockedAncestorPreventingLayout(const LayoutObject& object); static Element* LockedAncestorPreventingLayout(const Node& node); + static const Element* LockedInclusiveAncestorPreventingLayout( + const Node& node); // Returns the nearest ancestor element which has a lock that prevents // style. Note that this is different from a nearest locked ancestor since
diff --git a/third_party/blink/renderer/core/editing/caret_display_item_client.cc b/third_party/blink/renderer/core/editing/caret_display_item_client.cc index 379ad29..030afda 100644 --- a/third_party/blink/renderer/core/editing/caret_display_item_client.cc +++ b/third_party/blink/renderer/core/editing/caret_display_item_client.cc
@@ -35,6 +35,7 @@ #include "third_party/blink/renderer/core/layout/layout_view.h" #include "third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h" #include "third_party/blink/renderer/core/paint/object_paint_invalidator.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/paint_invalidator.h" #include "third_party/blink/renderer/core/paint/paint_layer.h" @@ -264,8 +265,10 @@ } IntRect paint_rect = PixelSnappedIntRect(drawing_rect); - context.FillRect(paint_rect, is_visible_if_active_ ? color_ : Color(), - DarkModeFilter::ElementRole::kText); + context.FillRect( + paint_rect, is_visible_if_active_ ? color_ : Color(), + PaintAutoDarkMode(layout_block_->StyleRef(), layout_block_->GetDocument(), + DarkModeFilter::ElementRole::kText)); } void CaretDisplayItemClient::RecordSelection(
diff --git a/third_party/blink/renderer/core/editing/iterators/text_iterator.cc b/third_party/blink/renderer/core/editing/iterators/text_iterator.cc index 4e1f37f8..3f97e693 100644 --- a/third_party/blink/renderer/core/editing/iterators/text_iterator.cc +++ b/third_party/blink/renderer/core/editing/iterators/text_iterator.cc
@@ -327,7 +327,7 @@ // lock. const bool locked = !behavior_.IgnoresDisplayLock() && - DisplayLockUtilities::NearestLockedInclusiveAncestor(*node_); + DisplayLockUtilities::LockedInclusiveAncestorPreventingLayout(*node_); LayoutObject* layout_object = node_->GetLayoutObject(); if (!layout_object || locked) {
diff --git a/third_party/blink/renderer/core/frame/frame_overlay_test.cc b/third_party/blink/renderer/core/frame/frame_overlay_test.cc index dd9d575..09cb9164 100644 --- a/third_party/blink/renderer/core/frame/frame_overlay_test.cc +++ b/third_party/blink/renderer/core/frame/frame_overlay_test.cc
@@ -49,7 +49,7 @@ DrawingRecorder recorder(graphics_context, frame_overlay, DisplayItem::kFrameOverlay, IntRect(IntPoint(), size)); - graphics_context.FillRect(rect, color_); + graphics_context.FillRect(rect, color_, AutoDarkMode::Disabled()); } private:
diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc index cde4f0c..49d1a33d 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
@@ -60,6 +60,7 @@ #include "third_party/blink/renderer/core/css/media_query_matcher.h" #include "third_party/blink/renderer/core/css/resolver/style_resolver.h" #include "third_party/blink/renderer/core/css/style_media.h" +#include "third_party/blink/renderer/core/display_lock/display_lock_document_state.h" #include "third_party/blink/renderer/core/dom/document_init.h" #include "third_party/blink/renderer/core/dom/events/add_event_listener_options_resolved.h" #include "third_party/blink/renderer/core/dom/events/event_dispatch_forbidden_scope.h" @@ -1334,6 +1335,10 @@ bool whole_word, bool /*searchInFrames*/, bool /*showDialog*/) const { + auto forced_activatable_locks = document() + ->GetDisplayLockDocumentState() + .GetScopedForceActivatableLocks(); + if (!IsCurrentlyDisplayedInFrame()) return false;
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc index 12158fd..b19c1d9 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc
@@ -166,6 +166,7 @@ #include "third_party/blink/renderer/core/page/scrolling/text_fragment_handler.h" #include "third_party/blink/renderer/core/paint/compositing/paint_layer_compositor.h" #include "third_party/blink/renderer/core/paint/object_painter.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" #include "third_party/blink/renderer/core/probe/core_probes.h" #include "third_party/blink/renderer/core/script/classic_script.h" @@ -2359,7 +2360,11 @@ DisplayItem::kFrameOverlay, IntRect(IntPoint(), view->Size())); FloatRect rect(0, 0, view->Width(), view->Height()); - graphics_context.FillRect(rect, color_); + graphics_context.FillRect( + rect, color_, + PaintAutoDarkMode(view->GetLayoutView()->StyleRef(), + view->GetLayoutView()->GetDocument(), + DarkModeFilter::ElementRole::kBackground)); } SkColor color_;
diff --git a/third_party/blink/renderer/core/frame/local_frame_view.cc b/third_party/blink/renderer/core/frame/local_frame_view.cc index 3211181..25d2f3c 100644 --- a/third_party/blink/renderer/core/frame/local_frame_view.cc +++ b/third_party/blink/renderer/core/frame/local_frame_view.cc
@@ -2967,12 +2967,6 @@ visual_viewport_or_overlay_needs_repaint_) { GraphicsContext graphics_context(*paint_controller_); - if (Settings* settings = frame_->GetSettings()) { - graphics_context.SetDarkModeEnabled( - settings->GetForceDarkModeEnabled() && - !GetLayoutView()->StyleRef().DarkColorScheme()); - } - bool painted_full_screen_overlay = false; if (frame_->IsMainFrame()) { PaintLayer* full_screen_layer = GetFullScreenOverlayLayer();
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 63a1187..ab27312a 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
@@ -346,7 +346,7 @@ context.BeginRecording(all_pages_rect); // Fill the whole background by white. - context.FillRect(all_pages_rect, Color::kWhite); + context.FillRect(all_pages_rect, Color::kWhite, AutoDarkMode::Disabled()); wtf_size_t num_pages = PageRects().size(); int current_height = 0; @@ -358,7 +358,8 @@ context.SetStrokeColor(Color(0, 0, 255)); context.DrawLine( IntPoint(0, current_height - 1), - IntPoint(spool_size_in_pixels.Width(), current_height - 1)); + IntPoint(spool_size_in_pixels.Width(), current_height - 1), + AutoDarkMode::Disabled()); context.Restore(); }
diff --git a/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc b/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc index 8feea66..fa1fb4d9 100644 --- a/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc +++ b/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc
@@ -88,6 +88,7 @@ #include "third_party/blink/renderer/core/layout/layout_view.h" #include "third_party/blink/renderer/core/page/chrome_client.h" #include "third_party/blink/renderer/core/page/page.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/probe/core_probes.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" @@ -756,14 +757,21 @@ BrokenCanvas(device_scale_factor); Image* broken_canvas = broken_canvas_and_image_scale_factor.first; context.Save(); - context.FillRect(FloatRect(r), Color(), SkBlendMode::kClear); + context.FillRect( + FloatRect(r), Color(), + PaintAutoDarkMode(ComputedStyleRef(), GetDocument(), + DarkModeFilter::ElementRole::kBackground), + SkBlendMode::kClear); // Place the icon near the upper left, like the missing image icon // for image elements. Offset it a bit from the upper corner. FloatSize icon_size(broken_canvas->Size()); FloatPoint upper_left = FloatPoint(r.PixelSnappedOffset()) + icon_size.ScaledBy(0.5f); - context.DrawImage(broken_canvas, Image::kSyncDecode, - FloatRect(upper_left, icon_size)); + context.DrawImage( + broken_canvas, Image::kSyncDecode, + PaintAutoDarkMode(ComputedStyleRef(), GetDocument(), + DarkModeFilter::ElementRole::kBackground), + FloatRect(upper_left, icon_size)); context.Restore(); return; } @@ -784,8 +792,11 @@ DCHECK(GetDocument().Printing()); scoped_refptr<StaticBitmapImage> image_for_printing = OffscreenCanvasFrame()->Bitmap()->MakeUnaccelerated(); - context.DrawImage(image_for_printing.get(), Image::kSyncDecode, - FloatRect(PixelSnappedIntRect(r))); + context.DrawImage( + image_for_printing.get(), Image::kSyncDecode, + PaintAutoDarkMode(ComputedStyleRef(), GetDocument(), + DarkModeFilter::ElementRole::kBackground), + FloatRect(PixelSnappedIntRect(r))); return; } @@ -836,15 +847,20 @@ // GraphicsContext cannot handle gpu resource serialization. snapshot = snapshot->MakeUnaccelerated(); DCHECK(!snapshot->IsTextureBacked()); - const ComputedStyle* style = GetComputedStyle(); - context.DrawImage(snapshot.get(), Image::kSyncDecode, - FloatRect(PixelSnappedIntRect(r)), &src_rect, - style && style->DisableForceDark(), composite_operator); + context.DrawImage( + snapshot.get(), Image::kSyncDecode, + PaintAutoDarkMode(ComputedStyleRef(), GetDocument(), + DarkModeFilter::ElementRole::kBackground), + FloatRect(PixelSnappedIntRect(r)), &src_rect, composite_operator); } } else { // When alpha is false, we should draw to opaque black. - if (!context_->CreationAttributes().alpha) - context.FillRect(FloatRect(r), Color(0, 0, 0)); + if (!context_->CreationAttributes().alpha) { + context.FillRect( + FloatRect(r), Color(0, 0, 0), + PaintAutoDarkMode(ComputedStyleRef(), GetDocument(), + DarkModeFilter::ElementRole::kBackground)); + } } if (IsWebGL() && PaintsIntoCanvasBuffer())
diff --git a/third_party/blink/renderer/core/html/html_view_source_document.cc b/third_party/blink/renderer/core/html/html_view_source_document.cc index 1575b5c..6516bfdd 100644 --- a/third_party/blink/renderer/core/html/html_view_source_document.cc +++ b/third_party/blink/renderer/core/html/html_view_source_document.cc
@@ -40,6 +40,7 @@ #include "third_party/blink/renderer/core/html/html_div_element.h" #include "third_party/blink/renderer/core/html/html_head_element.h" #include "third_party/blink/renderer/core/html/html_html_element.h" +#include "third_party/blink/renderer/core/html/html_meta_element.h" #include "third_party/blink/renderer/core/html/html_span_element.h" #include "third_party/blink/renderer/core/html/html_table_cell_element.h" #include "third_party/blink/renderer/core/html/html_table_element.h" @@ -89,6 +90,10 @@ auto* html = MakeGarbageCollected<HTMLHtmlElement>(*this); ParserAppendChild(html); auto* head = MakeGarbageCollected<HTMLHeadElement>(*this); + auto* meta = MakeGarbageCollected<HTMLMetaElement>(*this); + meta->setAttribute(html_names::kNameAttr, "color-scheme"); + meta->setAttribute(html_names::kContentAttr, "light dark"); + head->ParserAppendChild(meta); html->ParserAppendChild(head); auto* body = MakeGarbageCollected<HTMLBodyElement>(*this); html->ParserAppendChild(body);
diff --git a/third_party/blink/renderer/core/html/html_view_source_document_test.cc b/third_party/blink/renderer/core/html/html_view_source_document_test.cc index a3e728cbe..e210fc7 100644 --- a/third_party/blink/renderer/core/html/html_view_source_document_test.cc +++ b/third_party/blink/renderer/core/html/html_view_source_document_test.cc
@@ -37,7 +37,8 @@ )HTML"); EXPECT_EQ( GetDocument().documentElement()->outerHTML(), - "<html><head></head><body><div class=\"line-gutter-backdrop\"></div><form " + "<html><head><meta name=\"color-scheme\" content=\"light " + "dark\"></head><body><div class=\"line-gutter-backdrop\"></div><form " "autocomplete=\"off\"><label class=\"line-wrap-control\">" "<input type=\"checkbox\"></label>" "</form><table><tbody><tr><td class=\"line-number\" value=\"1\"></td><td " @@ -91,7 +92,8 @@ )HTML"); EXPECT_EQ( GetDocument().documentElement()->outerHTML(), - "<html><head></head><body><div class=\"line-gutter-backdrop\"></div><form " + "<html><head><meta name=\"color-scheme\" content=\"light " + "dark\"></head><body><div class=\"line-gutter-backdrop\"></div><form " "autocomplete=\"off\"><label class=\"line-wrap-control\">" "<input type=\"checkbox\"></label>" "</form><table><tbody><tr><td class=\"line-number\" value=\"1\"></td><td " @@ -144,7 +146,8 @@ )HTML"); EXPECT_EQ( GetDocument().documentElement()->outerHTML(), - "<html><head></head><body><div class=\"line-gutter-backdrop\"></div><form " + "<html><head><meta name=\"color-scheme\" content=\"light " + "dark\"></head><body><div class=\"line-gutter-backdrop\"></div><form " "autocomplete=\"off\"><label class=\"line-wrap-control\">" "<input type=\"checkbox\"></label>" "</form><table><tbody><tr><td class=\"line-number\" value=\"1\"></td><td " @@ -210,7 +213,8 @@ )HTML"); EXPECT_EQ( GetDocument().documentElement()->outerHTML(), - "<html><head></head><body><div class=\"line-gutter-backdrop\"></div><form " + "<html><head><meta name=\"color-scheme\" content=\"light " + "dark\"></head><body><div class=\"line-gutter-backdrop\"></div><form " "autocomplete=\"off\"><label class=\"line-wrap-control\">" "<input type=\"checkbox\"></label>" "</form><table><tbody><tr><td class=\"line-number\" value=\"1\"></td><td " @@ -279,7 +283,8 @@ )HTML"); EXPECT_EQ( GetDocument().documentElement()->outerHTML(), - "<html><head></head><body><div class=\"line-gutter-backdrop\"></div><form " + "<html><head><meta name=\"color-scheme\" content=\"light " + "dark\"></head><body><div class=\"line-gutter-backdrop\"></div><form " "autocomplete=\"off\"><label class=\"line-wrap-control\">" "<input type=\"checkbox\"></label>" "</form><table><tbody><tr><td class=\"line-number\" value=\"1\"></td><td " @@ -312,7 +317,8 @@ std::string many_spaces(32760, ' '); LoadMainResource((many_spaces + std::string(" <b>A</b> ")).c_str()); std::string expected_beginning( - "<html><head></head><body><div class=\"line-gutter-backdrop\"></div><form " + "<html><head><meta name=\"color-scheme\" content=\"light " + "dark\"></head><body><div class=\"line-gutter-backdrop\"></div><form " "autocomplete=\"off\"><label class=\"line-wrap-control\">" "<input type=\"checkbox\"></label>" "</form><table><tbody><tr><td class=\"line-number\" value=\"1\">" @@ -328,8 +334,10 @@ TEST_F(HTMLViewSourceDocumentTest, ViewSource7) { LoadMainResource("1234567"); - EXPECT_EQ(GetDocument().documentElement()->outerHTML(), - "<html><head></head><body><div class=\"line-gutter-backdrop\"></div><form " + EXPECT_EQ( + GetDocument().documentElement()->outerHTML(), + "<html><head><meta name=\"color-scheme\" content=\"light " + "dark\"></head><body><div class=\"line-gutter-backdrop\"></div><form " "autocomplete=\"off\"><label class=\"line-wrap-control\">" "<input type=\"checkbox\"></label>" "</form><table><tbody><tr><td class=\"line-number\" value=\"1\">" @@ -352,7 +360,8 @@ )HTML"); EXPECT_EQ( GetDocument().documentElement()->outerHTML(), - "<html><head></head><body><div class=\"line-gutter-backdrop\"></div><form " + "<html><head><meta name=\"color-scheme\" content=\"light " + "dark\"></head><body><div class=\"line-gutter-backdrop\"></div><form " "autocomplete=\"off\"><label class=\"line-wrap-control\">" "<input type=\"checkbox\"></label>" "</form><table><tbody><tr><td class=\"line-number\" value=\"1\"></td><td " @@ -420,7 +429,8 @@ )HTML"); EXPECT_EQ( GetDocument().documentElement()->outerHTML(), - "<html><head></head><body><div class=\"line-gutter-backdrop\"></div><form " + "<html><head><meta name=\"color-scheme\" content=\"light " + "dark\"></head><body><div class=\"line-gutter-backdrop\"></div><form " "autocomplete=\"off\"><label class=\"line-wrap-control\">" "<input type=\"checkbox\"></label>" "</form><table><tbody><tr><td class=\"line-number\" value=\"1\"></td><td " @@ -452,7 +462,8 @@ )HTML"); EXPECT_EQ( GetDocument().documentElement()->outerHTML(), - "<html><head></head><body><div class=\"line-gutter-backdrop\"></div><form " + "<html><head><meta name=\"color-scheme\" content=\"light " + "dark\"></head><body><div class=\"line-gutter-backdrop\"></div><form " "autocomplete=\"off\"><label class=\"line-wrap-control\">" "<input type=\"checkbox\"></label>" "</form><table><tbody><tr><td class=\"line-number\" value=\"1\"></td><td " @@ -475,7 +486,8 @@ )HTML"); EXPECT_EQ( GetDocument().documentElement()->outerHTML(), - "<html><head></head><body><div class=\"line-gutter-backdrop\"></div><form " + "<html><head><meta name=\"color-scheme\" content=\"light " + "dark\"></head><body><div class=\"line-gutter-backdrop\"></div><form " "autocomplete=\"off\"><label class=\"line-wrap-control\">" "<input type=\"checkbox\"></label>" "</form><table><tbody><tr><td class=\"line-number\" value=\"1\"></td>" @@ -492,7 +504,8 @@ )HTML"); EXPECT_EQ( GetDocument().documentElement()->outerHTML(), - "<html><head></head><body><div class=\"line-gutter-backdrop\"></div><form " + "<html><head><meta name=\"color-scheme\" content=\"light " + "dark\"></head><body><div class=\"line-gutter-backdrop\"></div><form " "autocomplete=\"off\"><label class=\"line-wrap-control\">" "<input type=\"checkbox\"></label>" "</form><table><tbody><tr><td class=\"line-number\" value=\"1\"></td>"
diff --git a/third_party/blink/renderer/core/page/scrolling/text_fragment_anchor.cc b/third_party/blink/renderer/core/page/scrolling/text_fragment_anchor.cc index 984f9e61..5d6b8ec2 100644 --- a/third_party/blink/renderer/core/page/scrolling/text_fragment_anchor.cc +++ b/third_party/blink/renderer/core/page/scrolling/text_fragment_anchor.cc
@@ -6,6 +6,7 @@ #include "components/shared_highlighting/core/common/shared_highlighting_features.h" #include "components/shared_highlighting/core/common/text_fragments_utils.h" +#include "third_party/blink/renderer/core/display_lock/display_lock_document_state.h" #include "third_party/blink/renderer/core/display_lock/display_lock_utilities.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/element.h" @@ -16,6 +17,7 @@ #include "third_party/blink/renderer/core/editing/visible_units.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h" +#include "third_party/blink/renderer/core/html/html_details_element.h" #include "third_party/blink/renderer/core/layout/layout_object.h" #include "third_party/blink/renderer/core/loader/document_loader.h" #include "third_party/blink/renderer/core/loader/frame_load_request.h" @@ -327,7 +329,7 @@ } void TextFragmentAnchor::DidFindMatch( - const EphemeralRangeInFlatTree& range, + const RangeInFlatTree& range, const TextFragmentAnchorMetrics::Match match_metrics, bool is_unique) { if (search_finished_) @@ -343,7 +345,8 @@ if (!frame_->GetDocument() ->Markers() .MarkersIntersectingRange( - range, DocumentMarker::MarkerTypes::TextFragment()) + range.ToEphemeralRange(), + DocumentMarker::MarkerTypes::TextFragment()) .IsEmpty()) { return; } @@ -368,13 +371,19 @@ // Apply :target to the first match if (!did_find_match_) { - ApplyTargetToCommonAncestor(range); + ApplyTargetToCommonAncestor(range.ToEphemeralRange()); needs_style_and_layout = true; } + // TODO(crbug.com/1252872): Only |first_node| is considered for the below + // ancestor expanding code, but we should be considering the entire |range| + // for ancestor unlocking as well. + Node& first_node = *range.ToEphemeralRange().Nodes().begin(); + // Activate any find-in-page activatable display-locks in the ancestor // chain. - if (DisplayLockUtilities::ActivateFindInPageMatchRangeIfNeeded(range)) { + if (DisplayLockUtilities::ActivateFindInPageMatchRangeIfNeeded( + range.ToEphemeralRange())) { // Since activating a lock dirties layout, we need to make sure it's clean // before computing the text rect below. needs_style_and_layout = true; @@ -384,6 +393,19 @@ // to run. } + // If the active match is hidden inside a <details> element, then we should + // expand it so we can scroll to it. + needs_style_and_layout |= + RuntimeEnabledFeatures::AutoExpandDetailsElementEnabled() && + HTMLDetailsElement::ExpandDetailsAncestors(first_node); + + // If the active match is hidden inside a hidden=until-found element, then we + // should reveal it so we can scroll to it. + needs_style_and_layout |= + RuntimeEnabledFeatures::BeforeMatchEventEnabled( + first_node.GetExecutionContext()) && + DisplayLockUtilities::RevealHiddenUntilFoundAncestors(first_node); + if (needs_style_and_layout) { frame_->GetDocument()->UpdateStyleAndLayout( DocumentUpdateReason::kFindInPage); @@ -395,20 +417,19 @@ if (first_match_needs_scroll_) { first_match_needs_scroll_ = false; - PhysicalRect bounding_box(ComputeTextRect(range)); + PhysicalRect bounding_box(ComputeTextRect(range.ToEphemeralRange())); // Set the bounding box height to zero because we want to center the top of // the text range. bounding_box.SetHeight(LayoutUnit()); - DCHECK(range.Nodes().begin() != range.Nodes().end()); + DCHECK(range.ToEphemeralRange().Nodes().begin() != + range.ToEphemeralRange().Nodes().end()); - Node& node = *range.Nodes().begin(); - - DCHECK(node.GetLayoutObject()); + DCHECK(first_node.GetLayoutObject()); PhysicalRect scrolled_bounding_box = - node.GetLayoutObject()->ScrollRectToVisible( + first_node.GetLayoutObject()->ScrollRectToVisible( bounding_box, ScrollAlignment::CreateScrollIntoViewParams( ScrollAlignment::CenterAlways(), ScrollAlignment::CenterAlways(), @@ -416,7 +437,7 @@ did_scroll_into_view_ = true; if (AXObjectCache* cache = frame_->GetDocument()->ExistingAXObjectCache()) - cache->HandleScrolledToAnchor(&node); + cache->HandleScrolledToAnchor(&first_node); metrics_->DidScroll();
diff --git a/third_party/blink/renderer/core/page/scrolling/text_fragment_anchor.h b/third_party/blink/renderer/core/page/scrolling/text_fragment_anchor.h index 3d47e7b..e103c2d 100644 --- a/third_party/blink/renderer/core/page/scrolling/text_fragment_anchor.h +++ b/third_party/blink/renderer/core/page/scrolling/text_fragment_anchor.h
@@ -81,7 +81,7 @@ void Trace(Visitor*) const override; // TextFragmentFinder::Client interface - void DidFindMatch(const EphemeralRangeInFlatTree& range, + void DidFindMatch(const RangeInFlatTree& range, const TextFragmentAnchorMetrics::Match match_metrics, bool is_unique) override;
diff --git a/third_party/blink/renderer/core/page/scrolling/text_fragment_finder.cc b/third_party/blink/renderer/core/page/scrolling/text_fragment_finder.cc index 91dee7e..dede7ce4 100644 --- a/third_party/blink/renderer/core/page/scrolling/text_fragment_finder.cc +++ b/third_party/blink/renderer/core/page/scrolling/text_fragment_finder.cc
@@ -452,7 +452,7 @@ match_metrics.spans_multiple_blocks = !IsInSameUninterruptedBlock( potential_match.StartPosition(), potential_match.EndPosition()); } - client_.DidFindMatch(potential_match, match_metrics, !potential_match_); + client_.DidFindMatch(*first_match_, match_metrics, !potential_match_); } }
diff --git a/third_party/blink/renderer/core/page/scrolling/text_fragment_finder.h b/third_party/blink/renderer/core/page/scrolling/text_fragment_finder.h index 6c090a4..3acdc79 100644 --- a/third_party/blink/renderer/core/page/scrolling/text_fragment_finder.h +++ b/third_party/blink/renderer/core/page/scrolling/text_fragment_finder.h
@@ -31,7 +31,7 @@ class Client { public: virtual void DidFindMatch( - const EphemeralRangeInFlatTree& range, + const RangeInFlatTree& range, const TextFragmentAnchorMetrics::Match match_metrics, bool is_unique) = 0; virtual void NoMatchFound() = 0;
diff --git a/third_party/blink/renderer/core/page/scrolling/text_fragment_finder_test.cc b/third_party/blink/renderer/core/page/scrolling/text_fragment_finder_test.cc index 7694fa4..d38aef4 100644 --- a/third_party/blink/renderer/core/page/scrolling/text_fragment_finder_test.cc +++ b/third_party/blink/renderer/core/page/scrolling/text_fragment_finder_test.cc
@@ -30,7 +30,7 @@ void NoMatchFound() override { no_match_called_ = true; } - void DidFindMatch(const EphemeralRangeInFlatTree& match, + void DidFindMatch(const RangeInFlatTree& match, const TextFragmentAnchorMetrics::Match match_metrics, bool is_unique) override {} bool IsNoMatchFoundCalled() { return no_match_called_; }
diff --git a/third_party/blink/renderer/core/page/scrolling/text_fragment_selector_generator.cc b/third_party/blink/renderer/core/page/scrolling/text_fragment_selector_generator.cc index cabfb03..4e8b7b06 100644 --- a/third_party/blink/renderer/core/page/scrolling/text_fragment_selector_generator.cc +++ b/third_party/blink/renderer/core/page/scrolling/text_fragment_selector_generator.cc
@@ -256,11 +256,11 @@ } void TextFragmentSelectorGenerator::DidFindMatch( - const EphemeralRangeInFlatTree& match, + const RangeInFlatTree& match, const TextFragmentAnchorMetrics::Match match_metrics, bool is_unique) { if (is_unique && - PlainText(match).StripWhiteSpace().length() == + PlainText(match.ToEphemeralRange()).StripWhiteSpace().length() == PlainText(range_->ToEphemeralRange()).StripWhiteSpace().length()) { state_ = kSuccess; ResolveSelectorState();
diff --git a/third_party/blink/renderer/core/page/scrolling/text_fragment_selector_generator.h b/third_party/blink/renderer/core/page/scrolling/text_fragment_selector_generator.h index 2d54bc5..9a5f124 100644 --- a/third_party/blink/renderer/core/page/scrolling/text_fragment_selector_generator.h +++ b/third_party/blink/renderer/core/page/scrolling/text_fragment_selector_generator.h
@@ -102,7 +102,7 @@ }; // TextFragmentFinder::Client interface - void DidFindMatch(const EphemeralRangeInFlatTree& match, + void DidFindMatch(const RangeInFlatTree& match, const TextFragmentAnchorMetrics::Match match_metrics, bool is_unique) override; void NoMatchFound() override;
diff --git a/third_party/blink/renderer/core/paint/applied_decoration_painter.cc b/third_party/blink/renderer/core/paint/applied_decoration_painter.cc index 6e96152..47e1d05 100644 --- a/third_party/blink/renderer/core/paint/applied_decoration_painter.cc +++ b/third_party/blink/renderer/core/paint/applied_decoration_painter.cc
@@ -4,6 +4,7 @@ #include "third_party/blink/renderer/core/paint/applied_decoration_painter.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/platform/graphics/graphics_context.h" namespace blink { @@ -12,6 +13,8 @@ context_.SetStrokeStyle(decoration_info_.StrokeStyle()); context_.SetStrokeColor(decoration_info_.LineColor()); + AutoDarkMode auto_dark_mode(PaintAutoDarkMode( + decoration_info_.Style(), DarkModeFilter::ElementRole::kText)); switch (decoration_info_.DecorationStyle()) { case ETextDecorationStyle::kWavy: StrokeWavyTextDecoration(flags); @@ -22,13 +25,13 @@ FALLTHROUGH; default: context_.DrawLineForText(decoration_info_.StartPoint(line_), - decoration_info_.Width(), flags); + decoration_info_.Width(), auto_dark_mode, flags); if (decoration_info_.DecorationStyle() == ETextDecorationStyle::kDouble) { context_.DrawLineForText( decoration_info_.StartPoint(line_) + FloatPoint(0, decoration_info_.DoubleOffset(line_)), - decoration_info_.Width(), flags); + decoration_info_.Width(), auto_dark_mode, flags); } } } @@ -37,10 +40,12 @@ const PaintFlags* flags) { context_.SetShouldAntialias(true); absl::optional<Path> path = decoration_info_.PrepareWavyStrokePath(line_); + AutoDarkMode auto_dark_mode(PaintAutoDarkMode( + decoration_info_.Style(), DarkModeFilter::ElementRole::kText)); if (flags) - context_.DrawPath(path->GetSkPath(), *flags); + context_.DrawPath(path->GetSkPath(), *flags, auto_dark_mode); else - context_.StrokePath(path.value()); + context_.StrokePath(path.value(), auto_dark_mode); } } // namespace blink
diff --git a/third_party/blink/renderer/core/paint/box_border_painter.cc b/third_party/blink/renderer/core/paint/box_border_painter.cc index 7c1f062a..fb9c964 100644 --- a/third_party/blink/renderer/core/paint/box_border_painter.cc +++ b/third_party/blink/renderer/core/paint/box_border_painter.cc
@@ -9,6 +9,7 @@ #include "base/cxx17_backports.h" #include "third_party/blink/renderer/core/paint/box_painter.h" #include "third_party/blink/renderer/core/paint/object_painter.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/rounded_border_geometry.h" #include "third_party/blink/renderer/core/style/border_edge.h" #include "third_party/blink/renderer/core/style/computed_style.h" @@ -232,7 +233,8 @@ void DrawSolidBorderRect(GraphicsContext& context, const FloatRect& border_rect, float border_width, - const Color& color) { + const Color& color, + const AutoDarkMode& auto_dark_mode) { FloatRect stroke_rect(border_rect); border_width = floorf(border_width); stroke_rect.Inflate(-border_width / 2); @@ -243,7 +245,7 @@ context.SetStrokeStyle(kSolidStroke); context.SetStrokeColor(color); - context.StrokeRect(stroke_rect, border_width); + context.StrokeRect(stroke_rect, border_width, auto_dark_mode); if (!was_antialias) context.SetShouldAntialias(false); @@ -253,7 +255,8 @@ BackgroundBleedAvoidance bleed_avoidance, const FloatRoundedRect& outer, const FloatRoundedRect& inner, - Color color) { + Color color, + const AutoDarkMode& auto_dark_mode) { switch (bleed_avoidance) { case kBackgroundBleedClipLayer: { // BackgroundBleedClipLayer clips the outer rrect for the whole layer. @@ -268,7 +271,7 @@ flags.setColor(color.Rgb()); flags.setStyle(PaintFlags::kFill_Style); flags.setAntiAlias(true); - context.DrawPath(path, flags); + context.DrawPath(path, flags, auto_dark_mode); break; } @@ -277,12 +280,12 @@ // BackgroundBleedClipOnly clips the outer rrect corners for us. FloatRoundedRect adjusted_outer = outer; adjusted_outer.SetRadii(FloatRoundedRect::Radii()); - context.FillDRRect(adjusted_outer, inner, color); + context.FillDRRect(adjusted_outer, inner, color, auto_dark_mode); break; } FALLTHROUGH; default: - context.FillDRRect(outer, inner, color); + context.FillDRRect(outer, inner, color, auto_dark_mode); break; } } @@ -374,7 +377,8 @@ Color color, int thickness, EBorderStyle style, - bool antialias) { + bool antialias, + const AutoDarkMode& auto_dark_mode) { DCHECK_GT(thickness, 0); GraphicsContextStateSaver state_saver(context); @@ -388,13 +392,15 @@ case BoxSide::kBottom: case BoxSide::kTop: { int mid_y = y1 + thickness / 2; - context.DrawLine(IntPoint(x1, mid_y), IntPoint(x2, mid_y)); + context.DrawLine(IntPoint(x1, mid_y), IntPoint(x2, mid_y), + auto_dark_mode); break; } case BoxSide::kRight: case BoxSide::kLeft: { int mid_x = x1 + thickness / 2; - context.DrawLine(IntPoint(mid_x, y1), IntPoint(mid_x, y2)); + context.DrawLine(IntPoint(mid_x, y1), IntPoint(mid_x, y2), + auto_dark_mode); break; } } @@ -411,7 +417,8 @@ float thickness, int adjacent_width1, int adjacent_width2, - bool antialias) { + bool antialias, + const AutoDarkMode& auto_dark_mode) { int third_of_thickness = (thickness + 1) / 3; DCHECK_GT(third_of_thickness, 0); @@ -426,15 +433,19 @@ switch (side) { case BoxSide::kTop: case BoxSide::kBottom: - context.DrawRect(IntRect(x1, y1, length, third_of_thickness)); + context.DrawRect(IntRect(x1, y1, length, third_of_thickness), + auto_dark_mode); context.DrawRect( - IntRect(x1, y2 - third_of_thickness, length, third_of_thickness)); + IntRect(x1, y2 - third_of_thickness, length, third_of_thickness), + auto_dark_mode); break; case BoxSide::kLeft: case BoxSide::kRight: - context.DrawRect(IntRect(x1, y1, third_of_thickness, length)); + context.DrawRect(IntRect(x1, y1, third_of_thickness, length), + auto_dark_mode); context.DrawRect( - IntRect(x2 - third_of_thickness, y1, third_of_thickness, length)); + IntRect(x2 - third_of_thickness, y1, third_of_thickness, length), + auto_dark_mode); break; } @@ -454,13 +465,13 @@ context, x1 + std::max((-adjacent_width1 * 2 + 1) / 3, 0), y1, x2 - std::max((-adjacent_width2 * 2 + 1) / 3, 0), y1 + third_of_thickness, side, color, EBorderStyle::kSolid, - adjacent1_big_third, adjacent2_big_third, antialias); + adjacent1_big_third, adjacent2_big_third, antialias, auto_dark_mode); BoxBorderPainter::DrawLineForBoxSide( context, x1 + std::max((adjacent_width1 * 2 + 1) / 3, 0), y2 - third_of_thickness, x2 - std::max((adjacent_width2 * 2 + 1) / 3, 0), y2, side, color, EBorderStyle::kSolid, adjacent1_big_third, adjacent2_big_third, - antialias); + antialias, auto_dark_mode); break; case BoxSide::kLeft: BoxBorderPainter::DrawLineForBoxSide( @@ -468,26 +479,26 @@ x1 + third_of_thickness, y2 - std::max((-adjacent_width2 * 2 + 1) / 3, 0), side, color, EBorderStyle::kSolid, adjacent1_big_third, adjacent2_big_third, - antialias); + antialias, auto_dark_mode); BoxBorderPainter::DrawLineForBoxSide( context, x2 - third_of_thickness, y1 + std::max((adjacent_width1 * 2 + 1) / 3, 0), x2, y2 - std::max((adjacent_width2 * 2 + 1) / 3, 0), side, color, EBorderStyle::kSolid, adjacent1_big_third, adjacent2_big_third, - antialias); + antialias, auto_dark_mode); break; case BoxSide::kBottom: BoxBorderPainter::DrawLineForBoxSide( context, x1 + std::max((adjacent_width1 * 2 + 1) / 3, 0), y1, x2 - std::max((adjacent_width2 * 2 + 1) / 3, 0), y1 + third_of_thickness, side, color, EBorderStyle::kSolid, - adjacent1_big_third, adjacent2_big_third, antialias); + adjacent1_big_third, adjacent2_big_third, antialias, auto_dark_mode); BoxBorderPainter::DrawLineForBoxSide( context, x1 + std::max((-adjacent_width1 * 2 + 1) / 3, 0), y2 - third_of_thickness, x2 - std::max((-adjacent_width2 * 2 + 1) / 3, 0), y2, side, color, EBorderStyle::kSolid, adjacent1_big_third, adjacent2_big_third, - antialias); + antialias, auto_dark_mode); break; case BoxSide::kRight: BoxBorderPainter::DrawLineForBoxSide( @@ -495,13 +506,13 @@ x1 + third_of_thickness, y2 - std::max((adjacent_width2 * 2 + 1) / 3, 0), side, color, EBorderStyle::kSolid, adjacent1_big_third, adjacent2_big_third, - antialias); + antialias, auto_dark_mode); BoxBorderPainter::DrawLineForBoxSide( context, x2 - third_of_thickness, y1 + std::max((-adjacent_width1 * 2 + 1) / 3, 0), x2, y2 - std::max((-adjacent_width2 * 2 + 1) / 3, 0), side, color, EBorderStyle::kSolid, adjacent1_big_third, adjacent2_big_third, - antialias); + antialias, auto_dark_mode); break; default: break; @@ -518,7 +529,8 @@ EBorderStyle style, int adjacent_width1, int adjacent_width2, - bool antialias) { + bool antialias, + const AutoDarkMode& auto_dark_mode) { EBorderStyle s1; EBorderStyle s2; if (style == EBorderStyle::kGroove) { @@ -539,42 +551,46 @@ BoxBorderPainter::DrawLineForBoxSide( context, x1 + std::max(-adjacent_width1, 0) / 2, y1, x2 - std::max(-adjacent_width2, 0) / 2, (y1 + y2 + 1) / 2, side, - color, s1, adjacent1_big_half, adjacent2_big_half, antialias); + color, s1, adjacent1_big_half, adjacent2_big_half, antialias, + auto_dark_mode); BoxBorderPainter::DrawLineForBoxSide( context, x1 + std::max(adjacent_width1 + 1, 0) / 2, (y1 + y2 + 1) / 2, x2 - std::max(adjacent_width2 + 1, 0) / 2, y2, side, color, s2, - adjacent_width1 / 2, adjacent_width2 / 2, antialias); + adjacent_width1 / 2, adjacent_width2 / 2, antialias, auto_dark_mode); break; case BoxSide::kLeft: BoxBorderPainter::DrawLineForBoxSide( context, x1, y1 + std::max(-adjacent_width1, 0) / 2, (x1 + x2 + 1) / 2, y2 - std::max(-adjacent_width2, 0) / 2, side, - color, s1, adjacent1_big_half, adjacent2_big_half, antialias); + color, s1, adjacent1_big_half, adjacent2_big_half, antialias, + auto_dark_mode); BoxBorderPainter::DrawLineForBoxSide( context, (x1 + x2 + 1) / 2, y1 + std::max(adjacent_width1 + 1, 0) / 2, x2, y2 - std::max(adjacent_width2 + 1, 0) / 2, side, color, s2, - adjacent_width1 / 2, adjacent_width2 / 2, antialias); + adjacent_width1 / 2, adjacent_width2 / 2, antialias, auto_dark_mode); break; case BoxSide::kBottom: BoxBorderPainter::DrawLineForBoxSide( context, x1 + std::max(adjacent_width1, 0) / 2, y1, x2 - std::max(adjacent_width2, 0) / 2, (y1 + y2 + 1) / 2, side, color, - s2, adjacent1_big_half, adjacent2_big_half, antialias); + s2, adjacent1_big_half, adjacent2_big_half, antialias, + auto_dark_mode); BoxBorderPainter::DrawLineForBoxSide( context, x1 + std::max(-adjacent_width1 + 1, 0) / 2, (y1 + y2 + 1) / 2, x2 - std::max(-adjacent_width2 + 1, 0) / 2, y2, - side, color, s1, adjacent_width1 / 2, adjacent_width2 / 2, antialias); + side, color, s1, adjacent_width1 / 2, adjacent_width2 / 2, antialias, + auto_dark_mode); break; case BoxSide::kRight: BoxBorderPainter::DrawLineForBoxSide( context, x1, y1 + std::max(adjacent_width1, 0) / 2, (x1 + x2 + 1) / 2, y2 - std::max(adjacent_width2, 0) / 2, side, color, s2, - adjacent1_big_half, adjacent2_big_half, antialias); + adjacent1_big_half, adjacent2_big_half, antialias, auto_dark_mode); BoxBorderPainter::DrawLineForBoxSide( context, (x1 + x2 + 1) / 2, y1 + std::max(-adjacent_width1 + 1, 0) / 2, x2, y2 - std::max(-adjacent_width2 + 1, 0) / 2, side, color, s1, - adjacent_width1 / 2, adjacent_width2 / 2, antialias); + adjacent_width1 / 2, adjacent_width2 / 2, antialias, auto_dark_mode); break; } } @@ -582,7 +598,8 @@ void FillQuad(GraphicsContext& context, const FloatPoint quad[], const Color& color, - bool antialias) { + bool antialias, + const AutoDarkMode& auto_dark_mode) { SkPathBuilder path; path.moveTo(FloatPointToSkPoint(quad[0])); path.lineTo(FloatPointToSkPoint(quad[1])); @@ -592,7 +609,7 @@ flags.setAntiAlias(antialias); flags.setColor(color.Rgb()); - context.DrawPath(path.detach(), flags); + context.DrawPath(path.detach(), flags, auto_dark_mode); } void DrawSolidBoxSide(GraphicsContext& context, @@ -604,7 +621,8 @@ Color color, int adjacent_width1, int adjacent_width2, - bool antialias) { + bool antialias, + const AutoDarkMode& auto_dark_mode) { DCHECK_GE(x2, x1); DCHECK_GE(y2, y1); @@ -614,7 +632,7 @@ bool was_antialiased = context.ShouldAntialias(); if (antialias != was_antialiased) context.SetShouldAntialias(antialias); - context.FillRect(IntRect(x1, y1, x2 - x1, y2 - y1), color); + context.FillRect(IntRect(x1, y1, x2 - x1, y2 - y1), color, auto_dark_mode); if (antialias != was_antialiased) context.SetShouldAntialias(was_antialiased); return; @@ -648,7 +666,7 @@ break; } - FillQuad(context, quad, color, antialias); + FillQuad(context, quad, color, antialias, auto_dark_mode); } } // anonymous namespace @@ -738,6 +756,9 @@ // When painting outlines, we ignore outer/inner radii. const auto force_rectangular = !outer_.IsRounded() && !inner_.IsRounded(); + AutoDarkMode auto_dark_mode(PaintAutoDarkMode( + style_, document_, DarkModeFilter::ElementRole::kBackground)); + // outer stripe const LayoutRectOutsets outer_third_outsets = DoubleStripeOutsets(BorderEdge::kDoubleBorderStripeOuter); @@ -747,7 +768,7 @@ if (force_rectangular) outer_third_rect.SetRadii(FloatRoundedRect::Radii()); DrawBleedAdjustedDRRect(context_, bleed_avoidance_, outer_, outer_third_rect, - color); + color, auto_dark_mode); // inner stripe const LayoutRectOutsets inner_third_outsets = @@ -757,7 +778,7 @@ style_, border_rect_, inner_third_outsets, sides_to_include_); if (force_rectangular) inner_third_rect.SetRadii(FloatRoundedRect::Radii()); - context_.FillDRRect(inner_third_rect, inner_, color); + context_.FillDRRect(inner_third_rect, inner_, color, auto_dark_mode); } bool BoxBorderPainter::PaintBorderFastPath() const { @@ -772,12 +793,16 @@ if (FirstEdge().BorderStyle() == EBorderStyle::kSolid) { if (is_uniform_width_ && !outer_.IsRounded()) { // 4-side, solid, uniform-width, rectangular border => one drawRect() - DrawSolidBorderRect(context_, outer_.Rect(), FirstEdge().Width(), - FirstEdge().color); + DrawSolidBorderRect( + context_, outer_.Rect(), FirstEdge().Width(), FirstEdge().color, + PaintAutoDarkMode(style_, document_, + DarkModeFilter::ElementRole::kBackground)); } else { // 4-side, solid border => one drawDRRect() - DrawBleedAdjustedDRRect(context_, bleed_avoidance_, outer_, inner_, - FirstEdge().color); + DrawBleedAdjustedDRRect( + context_, bleed_avoidance_, outer_, inner_, FirstEdge().color, + PaintAutoDarkMode(style_, document_, + DarkModeFilter::ElementRole::kBackground)); } } else { // 4-side, double border => 2x drawDRRect() @@ -805,7 +830,9 @@ } context_.SetFillColor(FirstEdge().color); - context_.FillPath(path); + context_.FillPath( + path, PaintAutoDarkMode(style_, document_, + DarkModeFilter::ElementRole::kBackground)); return true; } @@ -815,11 +842,13 @@ BoxBorderPainter::BoxBorderPainter(GraphicsContext& context, const PhysicalRect& border_rect, const ComputedStyle& style, + const Document& document, BackgroundBleedAvoidance bleed_avoidance, PhysicalBoxSides sides_to_include) : context_(context), border_rect_(border_rect), style_(style), + document_(document), bleed_avoidance_(bleed_avoidance), sides_to_include_(sides_to_include), visible_edge_count_(0), @@ -856,6 +885,7 @@ BoxBorderPainter::BoxBorderPainter(GraphicsContext& context, const ComputedStyle& style, + const Document& document, const PhysicalRect& border_rect, int width, int inner_outset_x, @@ -865,6 +895,7 @@ outer_outset_x_(inner_outset_x + width), outer_outset_y_(inner_outset_y + width), style_(style), + document_(document), bleed_avoidance_(kBackgroundBleedNone), sides_to_include_(PhysicalBoxSides()), visible_edge_count_(0), @@ -1218,12 +1249,14 @@ miter1 = miter2 = kNoMiter; } - DrawLineForBoxSide(context_, side_rect.X(), side_rect.Y(), side_rect.MaxX(), - side_rect.MaxY(), side, color, - edge_to_render.BorderStyle(), - miter1 != kNoMiter ? floorf(adjacent_edge1.Width()) : 0, - miter2 != kNoMiter ? floorf(adjacent_edge2.Width()) : 0, - /*antialias*/ true); + DrawLineForBoxSide( + context_, side_rect.X(), side_rect.Y(), side_rect.MaxX(), + side_rect.MaxY(), side, color, edge_to_render.BorderStyle(), + miter1 != kNoMiter ? floorf(adjacent_edge1.Width()) : 0, + miter2 != kNoMiter ? floorf(adjacent_edge2.Width()) : 0, + /*antialias*/ true, + PaintAutoDarkMode(style_, document_, + DarkModeFilter::ElementRole::kBackground)); } } @@ -1275,7 +1308,10 @@ context_.SetStrokeStyle(kNoStroke); context_.SetFillColor(color); - context_.DrawRect(RoundedIntRect(outer_.Rect())); + context_.DrawRect( + RoundedIntRect(outer_.Rect()), + PaintAutoDarkMode(style_, document_, + DarkModeFilter::ElementRole::kBackground)); } void BoxBorderPainter::DrawDashedDottedBoxSideFromPath( @@ -1310,8 +1346,11 @@ // TODO(schenney): stroking the border path causes issues with tight corners: // https://bugs.chromium.org/p/chromium/issues/detail?id=344234 - context_.StrokePath(centerline_path, centerline_path.length(), - border_thickness); + context_.StrokePath( + centerline_path, + PaintAutoDarkMode(style_, document_, + DarkModeFilter::ElementRole::kBackground), + centerline_path.length(), border_thickness); } void BoxBorderPainter::DrawWideDottedBoxSideFromPath( @@ -1323,7 +1362,11 @@ // TODO(schenney): stroking the border path causes issues with tight corners: // https://bugs.webkit.org/show_bug.cgi?id=58711 - context_.StrokePath(border_path, border_path.length(), border_thickness); + context_.StrokePath( + border_path, + PaintAutoDarkMode(style_, document_, + DarkModeFilter::ElementRole::kBackground), + border_path.length(), border_thickness); } void BoxBorderPainter::DrawDoubleBoxSideFromPath( @@ -1736,7 +1779,8 @@ EBorderStyle style, int adjacent_width1, int adjacent_width2, - bool antialias) { + bool antialias, + const AutoDarkMode& auto_dark_mode) { float thickness; float length; if (side == BoxSide::kTop || side == BoxSide::kBottom) { @@ -1763,16 +1807,18 @@ case EBorderStyle::kDotted: case EBorderStyle::kDashed: DrawDashedOrDottedBoxSide(context, x1, y1, x2, y2, side, color, thickness, - style, antialias); + style, antialias, auto_dark_mode); break; case EBorderStyle::kDouble: DrawDoubleBoxSide(context, x1, y1, x2, y2, length, side, color, thickness, - adjacent_width1, adjacent_width2, antialias); + adjacent_width1, adjacent_width2, antialias, + auto_dark_mode); break; case EBorderStyle::kRidge: case EBorderStyle::kGroove: DrawRidgeOrGrooveBoxSide(context, x1, y1, x2, y2, side, color, style, - adjacent_width1, adjacent_width2, antialias); + adjacent_width1, adjacent_width2, antialias, + auto_dark_mode); break; case EBorderStyle::kInset: // FIXME: Maybe we should lighten the colors on one side like Firefox. @@ -1787,7 +1833,7 @@ FALLTHROUGH; case EBorderStyle::kSolid: DrawSolidBoxSide(context, x1, y1, x2, y2, side, color, adjacent_width1, - adjacent_width2, antialias); + adjacent_width2, antialias, auto_dark_mode); break; } }
diff --git a/third_party/blink/renderer/core/paint/box_border_painter.h b/third_party/blink/renderer/core/paint/box_border_painter.h index a3cd1d54..0e284e9 100644 --- a/third_party/blink/renderer/core/paint/box_border_painter.h +++ b/third_party/blink/renderer/core/paint/box_border_painter.h
@@ -10,11 +10,12 @@ #include "third_party/blink/renderer/core/layout/geometry/physical_rect.h" #include "third_party/blink/renderer/core/style/border_edge.h" #include "third_party/blink/renderer/platform/geometry/float_rounded_rect.h" +#include "third_party/blink/renderer/platform/graphics/graphics_context.h" namespace blink { class ComputedStyle; -class GraphicsContext; +class Document; class Path; struct PhysicalRect; @@ -27,21 +28,23 @@ static void PaintBorder(GraphicsContext& context, const PhysicalRect& border_rect, const ComputedStyle& style, + const Document& document, BackgroundBleedAvoidance bleed_avoidance, PhysicalBoxSides sides_to_include) { - BoxBorderPainter(context, border_rect, style, bleed_avoidance, + BoxBorderPainter(context, border_rect, style, document, bleed_avoidance, sides_to_include) .Paint(); } static void PaintSingleRectOutline(GraphicsContext& context, const ComputedStyle& style, + const Document& document, const PhysicalRect& border_rect, int width, int inner_outset_x, int inner_outset_y) { - BoxBorderPainter(context, style, border_rect, width, inner_outset_x, - inner_outset_y) + BoxBorderPainter(context, style, document, border_rect, width, + inner_outset_x, inner_outset_y) .Paint(); } @@ -49,10 +52,11 @@ const IntRect& snapped_edge_rect, BoxSide side, Color color, - EBorderStyle style) { + EBorderStyle style, + const AutoDarkMode& auto_dark_mode) { DrawLineForBoxSide(context, snapped_edge_rect.X(), snapped_edge_rect.Y(), snapped_edge_rect.MaxX(), snapped_edge_rect.MaxY(), side, - color, style, 0, 0, true); + color, style, 0, 0, true, auto_dark_mode); } // TODO(crbug.com/1201762): The float parameters are truncated to int in the @@ -69,18 +73,21 @@ EBorderStyle, int adjacent_edge_width1, int adjacent_edge_width2, - bool antialias); + bool antialias, + const AutoDarkMode& auto_dark_mode); private: // For PaintBorder(). BoxBorderPainter(GraphicsContext&, const PhysicalRect& border_rect, const ComputedStyle&, + const Document&, BackgroundBleedAvoidance, PhysicalBoxSides sides_to_include); // For PaintSingleRectOutline(). BoxBorderPainter(GraphicsContext&, const ComputedStyle&, + const Document&, const PhysicalRect& border_rect, int width, int inner_outset_x, @@ -168,6 +175,9 @@ const LayoutUnit outer_outset_x_; const LayoutUnit outer_outset_y_; const ComputedStyle& style_; + // TODO(crbug.com/1224806): Remove this once ComputedStyle fully controls + // auto dark mode. + const Document& document_; const BackgroundBleedAvoidance bleed_avoidance_; const PhysicalBoxSides sides_to_include_;
diff --git a/third_party/blink/renderer/core/paint/box_painter_base.cc b/third_party/blink/renderer/core/paint/box_painter_base.cc index c8a6847..5c036e8a 100644 --- a/third_party/blink/renderer/core/paint/box_painter_base.cc +++ b/third_party/blink/renderer/core/paint/box_painter_base.cc
@@ -15,6 +15,7 @@ #include "third_party/blink/renderer/core/paint/box_border_painter.h" #include "third_party/blink/renderer/core/paint/image_element_timing.h" #include "third_party/blink/renderer/core/paint/nine_piece_image_painter.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/paint/paint_timing_detector.h" @@ -166,9 +167,13 @@ FloatRoundedRect rounded_fill_rect = border; rounded_fill_rect.Inflate(shadow_spread); ApplySpreadToShadowShape(rounded_fill_rect, shadow_spread); - context.FillRoundedRect(rounded_fill_rect, Color::kBlack); + context.FillRoundedRect( + rounded_fill_rect, Color::kBlack, + PaintAutoDarkMode(style, DarkModeFilter::ElementRole::kBackground)); } else { - context.FillRect(fill_rect, Color::kBlack); + context.FillRect( + fill_rect, Color::kBlack, + PaintAutoDarkMode(style, DarkModeFilter::ElementRole::kBackground)); } } } @@ -254,10 +259,13 @@ style.VisitedDependentColor(GetCSSPropertyColor()), style.UsedColorScheme()); + AutoDarkMode auto_dark_mode( + PaintAutoDarkMode(style, DarkModeFilter::ElementRole::kBackground)); + FloatRect inner_rect(bounds.Rect()); inner_rect.Inflate(-shadow.Spread()); if (inner_rect.IsEmpty()) { - context.FillRoundedRect(bounds, shadow_color); + context.FillRoundedRect(bounds, shadow_color, auto_dark_mode); continue; } AdjustInnerRectForSideClipping(inner_rect, shadow, sides_to_include); @@ -281,7 +289,8 @@ Color fill_color(shadow_color.Red(), shadow_color.Green(), shadow_color.Blue()); FloatRect outer_rect = AreaCastingShadowInHole(bounds.Rect(), shadow); - context.FillRectWithRoundedHole(outer_rect, inner_rounded_rect, fill_color); + context.FillRectWithRoundedHole(outer_rect, inner_rounded_rect, fill_color, + auto_dark_mode); } } @@ -501,7 +510,7 @@ Image* image, const BackgroundImageGeometry& geometry, SkBlendMode op, - bool has_filter_property, + const AutoDarkMode& auto_dark_mode, RespectImageOrientationEnum respect_orientation) { DCHECK(!geometry.TileSize().IsEmpty()); @@ -514,9 +523,9 @@ geometry.UnsnappedDestRect().size); if (absl::optional<FloatRect> single_tile_src = OptimizeToSingleTileDraw( geometry, dest_rect_for_subset, image, respect_orientation)) { - context.DrawImage(image, Image::kSyncDecode, + context.DrawImage(image, Image::kSyncDecode, auto_dark_mode, FloatRect(geometry.SnappedDestRect()), &*single_tile_src, - has_filter_property, op, respect_orientation); + op, respect_orientation); return; } @@ -560,8 +569,7 @@ // it into the snapped_dest_rect using phase from one_tile_rect and the // given repeat spacing. Note the phase is already scaled. context.DrawImageTiled(image, FloatRect(geometry.SnappedDestRect()), - tiling_info, has_filter_property, op, - respect_orientation); + tiling_info, auto_dark_mode, op, respect_orientation); } scoped_refptr<Image> GetBGColorPaintWorkletImage(const Document* document, @@ -589,6 +597,7 @@ bool PaintBGColorWithPaintWorklet(const Document* document, const BoxPainterBase::FillLayerInfo& info, Node* node, + const ComputedStyle& style, const FloatRoundedRect& dest_rect, GraphicsContext& context) { if (!info.should_paint_color_with_paint_worklet_image) @@ -598,9 +607,11 @@ if (!paint_worklet_image) return false; FloatRect src_rect(FloatPoint(), dest_rect.Rect().Size()); - context.DrawImageRRect(paint_worklet_image.get(), Image::kSyncDecode, - dest_rect, src_rect, - node && node->ComputedStyleRef().DisableForceDark()); + context.DrawImageRRect( + paint_worklet_image.get(), Image::kSyncDecode, + PaintAutoDarkMode(style, *document, + DarkModeFilter::ElementRole::kBackground), + dest_rect, src_rect); return true; } @@ -626,6 +637,7 @@ inline bool PaintFastBottomLayer(const Document* document, Node* node, + const ComputedStyle& style, GraphicsContext& context, const BoxPainterBase::FillLayerInfo& info, const PhysicalRect& rect, @@ -706,9 +718,12 @@ if (info.should_paint_color) { // Try to paint the background with a paint worklet first in case it will be // animated. Otherwise, paint it directly into the context. - if (!PaintBGColorWithPaintWorklet(document, info, node, color_border, + if (!PaintBGColorWithPaintWorklet(document, info, node, style, color_border, context)) { - context.FillRoundedRect(color_border, info.color); + context.FillRoundedRect( + color_border, info.color, + PaintAutoDarkMode(style, *document, + DarkModeFilter::ElementRole::kBackground)); } } @@ -723,9 +738,11 @@ // Since there is no way for the developer to specify decode behavior, use // kSync by default. - context.DrawImageRRect(image, Image::kSyncDecode, image_border, src_rect, - node && node->ComputedStyleRef().DisableForceDark(), - composite_op, info.respect_image_orientation); + context.DrawImageRRect( + image, Image::kSyncDecode, + PaintAutoDarkMode(style, *document, + DarkModeFilter::ElementRole::kBackground), + image_border, src_rect, composite_op, info.respect_image_orientation); DidDrawImage(node, *image, *info.image, context.GetPaintController().CurrentPaintChunkProperties(), @@ -822,6 +839,7 @@ GraphicsContext& context, const BoxPainterBase::FillLayerInfo& info, Node* node, + const ComputedStyle& style, Image* image, SkBlendMode composite_op, const BackgroundImageGeometry& geometry, @@ -835,9 +853,13 @@ IntRect background_rect(PixelSnappedIntRect(scrolled_paint_rect)); // Try to paint the background with a paint worklet first in case it will be // animated. Otherwise, paint it directly into the context. - if (!PaintBGColorWithPaintWorklet( - document, info, node, FloatRoundedRect(background_rect), context)) { - context.FillRect(background_rect, info.color); + if (!PaintBGColorWithPaintWorklet(document, info, node, style, + FloatRoundedRect(background_rect), + context)) { + context.FillRect( + background_rect, info.color, + PaintAutoDarkMode(style, *document, + DarkModeFilter::ElementRole::kBackground)); } } @@ -850,9 +872,11 @@ TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", inspector_paint_image_event::Data, node, *info.image, FloatRect(image->Rect()), FloatRect(scrolled_paint_rect)); - DrawTiledBackground(context, image, geometry, composite_op, - node && node->ComputedStyleRef().DisableForceDark(), - info.respect_image_orientation); + DrawTiledBackground( + context, image, geometry, composite_op, + PaintAutoDarkMode(style, *document, + DarkModeFilter::ElementRole::kBackground), + info.respect_image_orientation); DidDrawImage(node, *image, *info.image, context.GetPaintController().CurrentPaintChunkProperties(), FloatRect(geometry.SnappedDestRect())); @@ -956,8 +980,9 @@ (bleed_avoidance == kBackgroundBleedShrinkBackground || did_adjust_paint_rect); if (!disable_fast_path && - PaintFastBottomLayer(document_, node_, context, fill_layer_info, rect, - border_rect, geometry, image.get(), composite_op)) { + PaintFastBottomLayer(document_, node_, style_, context, fill_layer_info, + rect, border_rect, geometry, image.get(), + composite_op)) { return; } @@ -999,7 +1024,7 @@ break; } - PaintFillLayerBackground(document_, context, fill_layer_info, node_, + PaintFillLayerBackground(document_, context, fill_layer_info, node_, style_, image.get(), composite_op, geometry, scrolled_paint_rect); } @@ -1027,7 +1052,7 @@ context.Clip(mask_rect); context.BeginLayer(1, composite_op); - PaintFillLayerBackground(document_, context, info, node_, image, + PaintFillLayerBackground(document_, context, info, node_, style_, image, SkBlendMode::kSrcOver, geometry, scrolled_paint_rect); @@ -1057,8 +1082,8 @@ return; } - BoxBorderPainter::PaintBorder(info.context, rect, style, bleed_avoidance, - sides_to_include); + BoxBorderPainter::PaintBorder(info.context, rect, style, document, + bleed_avoidance, sides_to_include); } void BoxPainterBase::PaintMaskImages(const PaintInfo& paint_info,
diff --git a/third_party/blink/renderer/core/paint/build.gni b/third_party/blink/renderer/core/paint/build.gni index 0bde2b6b6..d4717857 100644 --- a/third_party/blink/renderer/core/paint/build.gni +++ b/third_party/blink/renderer/core/paint/build.gni
@@ -156,6 +156,7 @@ "object_painter.h", "outline_painter.cc", "outline_painter.h", + "paint_auto_dark_mode.h", "paint_event.h", "paint_info.h", "paint_invalidator.cc",
diff --git a/third_party/blink/renderer/core/paint/clip_path_clipper.cc b/third_party/blink/renderer/core/paint/clip_path_clipper.cc index 3dc0492..fb96244 100644 --- a/third_party/blink/renderer/core/paint/clip_path_clipper.cc +++ b/third_party/blink/renderer/core/paint/clip_path_clipper.cc
@@ -11,6 +11,7 @@ #include "third_party/blink/renderer/core/layout/layout_inline.h" #include "third_party/blink/renderer/core/layout/svg/layout_svg_resource_clipper.h" #include "third_party/blink/renderer/core/layout/svg/svg_resources.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/style/clip_path_operation.h" @@ -102,9 +103,12 @@ ClipPathClipper::LocalClipPathBoundingBox(clip_path_owner); DCHECK(bounding_box); FloatRect src_rect(bounding_box.value()); - context.DrawImage(paint_worklet_image.get(), Image::kSyncDecode, src_rect, - &src_rect, clip_path_owner.StyleRef().DisableForceDark(), - SkBlendMode::kSrcOver, kRespectImageOrientation); + context.DrawImage(paint_worklet_image.get(), Image::kSyncDecode, + PaintAutoDarkMode(clip_path_owner.StyleRef(), + clip_path_owner.GetDocument(), + DarkModeFilter::ElementRole::kBackground), + src_rect, &src_rect, SkBlendMode::kSrcOver, + kRespectImageOrientation); } FloatRect ClipPathClipper::LocalReferenceBox(const LayoutObject& object) {
diff --git a/third_party/blink/renderer/core/paint/collapsed_border_painter.cc b/third_party/blink/renderer/core/paint/collapsed_border_painter.cc index 5d84c77..92472e0 100644 --- a/third_party/blink/renderer/core/paint/collapsed_border_painter.cc +++ b/third_party/blink/renderer/core/paint/collapsed_border_painter.cc
@@ -6,6 +6,7 @@ #include "third_party/blink/renderer/core/paint/block_painter.h" #include "third_party/blink/renderer/core/paint/box_border_painter.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/scoped_paint_state.h" #include "third_party/blink/renderer/core/paint/table_cell_painter.h" @@ -355,6 +356,10 @@ TableCellPainter(cell_).PaintRectNotIncludingVisualOverflow( paint_state.PaintOffset())); + AutoDarkMode auto_dark_mode( + PaintAutoDarkMode(cell_.StyleRef(), cell_.GetDocument(), + DarkModeFilter::ElementRole::kBackground)); + // We never paint diagonals at the joins. We simply let the border with the // highest precedence paint on top of borders with lower precedence. if (before_.value) { @@ -362,36 +367,36 @@ rect.Y() - before_.outer_width, rect.Width() + before_.begin_outset + before_.end_outset, before_.outer_width + before_.inner_width); - BoxBorderPainter::DrawBoxSide(context, edge_rect, BoxSide::kTop, - before_.value->GetColor(), - CollapsedBorderStyle(before_.value->Style())); + BoxBorderPainter::DrawBoxSide( + context, edge_rect, BoxSide::kTop, before_.value->GetColor(), + CollapsedBorderStyle(before_.value->Style()), auto_dark_mode); } if (after_.value) { IntRect edge_rect(rect.X() - after_.begin_outset, rect.MaxY() - after_.inner_width, rect.Width() + after_.begin_outset + after_.end_outset, after_.inner_width + after_.outer_width); - BoxBorderPainter::DrawBoxSide(context, edge_rect, BoxSide::kBottom, - after_.value->GetColor(), - CollapsedBorderStyle(after_.value->Style())); + BoxBorderPainter::DrawBoxSide( + context, edge_rect, BoxSide::kBottom, after_.value->GetColor(), + CollapsedBorderStyle(after_.value->Style()), auto_dark_mode); } if (start_.value) { IntRect edge_rect(rect.X() - start_.outer_width, rect.Y() - start_.begin_outset, start_.outer_width + start_.inner_width, rect.Height() + start_.begin_outset + start_.end_outset); - BoxBorderPainter::DrawBoxSide(context, edge_rect, BoxSide::kLeft, - start_.value->GetColor(), - CollapsedBorderStyle(start_.value->Style())); + BoxBorderPainter::DrawBoxSide( + context, edge_rect, BoxSide::kLeft, start_.value->GetColor(), + CollapsedBorderStyle(start_.value->Style()), auto_dark_mode); } if (end_.value) { IntRect edge_rect(rect.MaxX() - end_.inner_width, rect.Y() - end_.begin_outset, end_.inner_width + end_.outer_width, rect.Height() + end_.begin_outset + end_.end_outset); - BoxBorderPainter::DrawBoxSide(context, edge_rect, BoxSide::kRight, - end_.value->GetColor(), - CollapsedBorderStyle(end_.value->Style())); + BoxBorderPainter::DrawBoxSide( + context, edge_rect, BoxSide::kRight, end_.value->GetColor(), + CollapsedBorderStyle(end_.value->Style()), auto_dark_mode); } }
diff --git a/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.cc b/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.cc index d4127ef..ece787bc 100644 --- a/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.cc +++ b/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.cc
@@ -1515,10 +1515,6 @@ float device_scale_factor = blink::DeviceScaleFactorDeprecated( paint_info.paint_layer->GetLayoutObject().GetFrame()); context.SetDeviceScaleFactor(device_scale_factor); - Settings* settings = GetLayoutObject().GetFrame()->GetSettings(); - context.SetDarkModeEnabled( - settings->GetForceDarkModeEnabled() && - !GetLayoutObject().View()->StyleRef().DarkColorScheme()); // As a composited layer may be painted directly, we need to traverse the // effect tree starting from the current node all the way up through the
diff --git a/third_party/blink/renderer/core/paint/custom_scrollbar_theme.cc b/third_party/blink/renderer/core/paint/custom_scrollbar_theme.cc index d015d3d..a6d2d72 100644 --- a/third_party/blink/renderer/core/paint/custom_scrollbar_theme.cc +++ b/third_party/blink/renderer/core/paint/custom_scrollbar_theme.cc
@@ -28,6 +28,7 @@ #include "third_party/blink/renderer/core/layout/custom_scrollbar.h" #include "third_party/blink/renderer/core/layout/layout_custom_scrollbar_part.h" #include "third_party/blink/renderer/core/paint/object_painter.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/scroll/scrollbar.h" #include "third_party/blink/renderer/platform/graphics/graphics_context.h" @@ -143,7 +144,7 @@ DrawingRecorder recorder(context, display_item_client, DisplayItem::kScrollCorner, corner_rect); // FIXME: Implement. - context.FillRect(corner_rect, Color::kWhite); + context.FillRect(corner_rect, Color::kWhite, AutoDarkMode::Disabled()); } void CustomScrollbarTheme::PaintTrackAndButtons(GraphicsContext& context,
diff --git a/third_party/blink/renderer/core/paint/document_marker_painter.cc b/third_party/blink/renderer/core/paint/document_marker_painter.cc index 8e4e1e1..d61ce5c6 100644 --- a/third_party/blink/renderer/core/paint/document_marker_painter.cc +++ b/third_party/blink/renderer/core/paint/document_marker_painter.cc
@@ -10,6 +10,7 @@ #include "third_party/blink/renderer/core/layout/geometry/physical_rect.h" #include "third_party/blink/renderer/core/layout/layout_theme.h" #include "third_party/blink/renderer/core/paint/highlight_painting_utils.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/text_paint_style.h" #include "third_party/blink/renderer/core/style/computed_style.h" @@ -116,7 +117,7 @@ // cached tile for all markers at a given zoom level. GraphicsContextStateSaver saver(context); context.Translate(origin_x, origin_y); - context.DrawRect(rect, flags); + context.DrawRect(rect, flags, AutoDarkMode::Disabled()); } } // namespace @@ -137,6 +138,7 @@ const PhysicalOffset& box_origin, const StyleableMarker& marker, const ComputedStyle& style, + const Document& document, const FloatRect& marker_rect, LayoutUnit logical_height, bool in_dark_mode) { @@ -198,7 +200,8 @@ FloatPoint(box_origin.left + start, (box_origin.top + logical_height.ToInt() - line_thickness) .ToFloat()), - width); + width, + PaintAutoDarkMode(style, document, DarkModeFilter::ElementRole::kText)); } else { // For wavy underline format we use this logic that is very similar to // spelling/grammar squiggles format. Only applicable for composition
diff --git a/third_party/blink/renderer/core/paint/document_marker_painter.h b/third_party/blink/renderer/core/paint/document_marker_painter.h index 32bf083d..8530108e 100644 --- a/third_party/blink/renderer/core/paint/document_marker_painter.h +++ b/third_party/blink/renderer/core/paint/document_marker_painter.h
@@ -35,6 +35,7 @@ const PhysicalOffset& box_origin, const StyleableMarker& marker, const ComputedStyle& style, + const Document& document, const FloatRect& marker_rect, LayoutUnit logical_height, bool in_dark_mode);
diff --git a/third_party/blink/renderer/core/paint/ellipsis_box_painter.cc b/third_party/blink/renderer/core/paint/ellipsis_box_painter.cc index 5f26ca31..0625886 100644 --- a/third_party/blink/renderer/core/paint/ellipsis_box_painter.cc +++ b/third_party/blink/renderer/core/paint/ellipsis_box_painter.cc
@@ -9,6 +9,7 @@ #include "third_party/blink/renderer/core/layout/line/ellipsis_box.h" #include "third_party/blink/renderer/core/layout/line/root_inline_box.h" #include "third_party/blink/renderer/core/layout/text_run_constructor.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/paint_timing_detector.h" #include "third_party/blink/renderer/core/paint/text_painter.h" @@ -64,17 +65,22 @@ if (!font_data) return; - TextPaintStyle text_style = TextPainter::TextPaintingStyle( - ellipsis_box_.GetLineLayoutItem().GetDocument(), style, paint_info); + const Document& document = ellipsis_box_.GetLineLayoutItem().GetDocument(); + TextPaintStyle text_style = + TextPainter::TextPaintingStyle(document, style, paint_info); TextRun text_run = ConstructTextRun(font, ellipsis_box_.EllipsisStr(), style, TextRun::kAllowTrailingExpansion); PhysicalOffset text_origin( box_origin.left, box_origin.top + font_data->GetFontMetrics().Ascent()); TextPainter text_painter(context, font, text_run, text_origin, box_rect, ellipsis_box_.IsHorizontal()); + + AutoDarkMode auto_dark_mode( + PaintAutoDarkMode(style, document, DarkModeFilter::ElementRole::kText)); + text_painter.Paint(0, ellipsis_box_.EllipsisStr().length(), ellipsis_box_.EllipsisStr().length(), text_style, - kInvalidDOMNodeId); + kInvalidDOMNodeId, auto_dark_mode); // TODO(npm): Check that there are non-whitespace characters. See // crbug.com/788444. context.GetPaintController().SetTextPainted();
diff --git a/third_party/blink/renderer/core/paint/embedded_object_painter.cc b/third_party/blink/renderer/core/paint/embedded_object_painter.cc index c88a78dd..d60c9eb 100644 --- a/third_party/blink/renderer/core/paint/embedded_object_painter.cc +++ b/third_party/blink/renderer/core/paint/embedded_object_painter.cc
@@ -9,6 +9,7 @@ #include "third_party/blink/renderer/core/layout/layout_theme.h" #include "third_party/blink/renderer/core/paint/box_painter.h" #include "third_party/blink/renderer/core/paint/embedded_content_painter.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/platform/fonts/font.h" #include "third_party/blink/renderer/platform/fonts/font_selector.h" @@ -80,15 +81,19 @@ kReplacementTextRoundedRectRadius)); context.SetFillColor( ScaleAlpha(Color::kWhite, kReplacementTextRoundedRectOpacity)); - context.FillPath(rounded_background_rect); + AutoDarkMode auto_dark_mode(PaintAutoDarkMode( + layout_embedded_object_.StyleRef(), layout_embedded_object_.GetDocument(), + DarkModeFilter::ElementRole::kBackground)); + context.FillPath(rounded_background_rect, auto_dark_mode); FloatRect text_rect(FloatPoint(), text_geometry); text_rect.Move(FloatPoint(content_rect.Center()) - text_rect.Center()); TextRunPaintInfo run_info(text_run); context.SetFillColor(ScaleAlpha(Color::kBlack, kReplacementTextTextOpacity)); - context.DrawBidiText(font, run_info, - text_rect.Location() + - FloatSize(0, font_data->GetFontMetrics().Ascent())); + context.DrawBidiText( + font, run_info, + text_rect.Location() + FloatSize(0, font_data->GetFontMetrics().Ascent()), + auto_dark_mode); } } // namespace blink
diff --git a/third_party/blink/renderer/core/paint/file_upload_control_painter.cc b/third_party/blink/renderer/core/paint/file_upload_control_painter.cc index 31e7b722..e1620ca 100644 --- a/third_party/blink/renderer/core/paint/file_upload_control_painter.cc +++ b/third_party/blink/renderer/core/paint/file_upload_control_painter.cc
@@ -9,6 +9,7 @@ #include "third_party/blink/renderer/core/layout/layout_file_upload_control.h" #include "third_party/blink/renderer/core/layout/text_run_constructor.h" #include "third_party/blink/renderer/core/paint/box_painter.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/paint_timing_detector.h" #include "third_party/blink/renderer/platform/fonts/text_run_paint_info.h" @@ -78,7 +79,10 @@ layout_file_upload_control_.ResolveColor(GetCSSPropertyColor())); paint_info.context.DrawBidiText( font, text_run_paint_info, - FloatPoint(RoundToInt(text_x), RoundToInt(text_y))); + FloatPoint(RoundToInt(text_x), RoundToInt(text_y)), + PaintAutoDarkMode(layout_file_upload_control_.StyleRef(), + layout_file_upload_control_.GetDocument(), + DarkModeFilter::ElementRole::kText)); if (!font.ShouldSkipDrawing()) { ScopedPaintTimingDetectorBlockPaintHook scoped_paint_timing_detector_block_paint_hook;
diff --git a/third_party/blink/renderer/core/paint/frame_set_painter.cc b/third_party/blink/renderer/core/paint/frame_set_painter.cc index ef120b4..2ed8991 100644 --- a/third_party/blink/renderer/core/paint/frame_set_painter.cc +++ b/third_party/blink/renderer/core/paint/frame_set_painter.cc
@@ -8,6 +8,7 @@ #include "third_party/blink/renderer/core/html/html_frame_set_element.h" #include "third_party/blink/renderer/core/layout/layout_frame_set.h" #include "third_party/blink/renderer/core/paint/box_painter.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/scoped_paint_state.h" #include "third_party/blink/renderer/platform/graphics/paint/drawing_recorder.h" @@ -34,22 +35,28 @@ // FIXME: We should do something clever when borders from distinct framesets // meet at a join. + AutoDarkMode auto_dark_mode(PaintAutoDarkMode( + layout_frame_set_.StyleRef(), layout_frame_set_.GetDocument(), + DarkModeFilter::ElementRole::kBackground)); + // Fill first. GraphicsContext& context = paint_info.context; - context.FillRect(border_rect, layout_frame_set_.FrameSet()->HasBorderColor() - ? layout_frame_set_.ResolveColor( - GetCSSPropertyBorderLeftColor()) - : BorderFillColor()); + context.FillRect( + border_rect, + layout_frame_set_.FrameSet()->HasBorderColor() + ? layout_frame_set_.ResolveColor(GetCSSPropertyBorderLeftColor()) + : BorderFillColor(), + auto_dark_mode); // Now stroke the edges but only if we have enough room to paint both edges // with a little bit of the fill color showing through. if (border_rect.Width() >= 3) { context.FillRect( IntRect(border_rect.Location(), IntSize(1, border_rect.Height())), - BorderStartEdgeColor()); + BorderStartEdgeColor(), auto_dark_mode); context.FillRect(IntRect(IntPoint(border_rect.MaxX() - 1, border_rect.Y()), IntSize(1, border_rect.Height())), - BorderEndEdgeColor()); + BorderEndEdgeColor(), auto_dark_mode); } } @@ -58,22 +65,28 @@ // FIXME: We should do something clever when borders from distinct framesets // meet at a join. + AutoDarkMode auto_dark_mode(PaintAutoDarkMode( + layout_frame_set_.StyleRef(), layout_frame_set_.GetDocument(), + DarkModeFilter::ElementRole::kBackground)); + // Fill first. GraphicsContext& context = paint_info.context; - context.FillRect(border_rect, layout_frame_set_.FrameSet()->HasBorderColor() - ? layout_frame_set_.ResolveColor( - GetCSSPropertyBorderLeftColor()) - : BorderFillColor()); + context.FillRect( + border_rect, + layout_frame_set_.FrameSet()->HasBorderColor() + ? layout_frame_set_.ResolveColor(GetCSSPropertyBorderLeftColor()) + : BorderFillColor(), + auto_dark_mode); // Now stroke the edges but only if we have enough room to paint both edges // with a little bit of the fill color showing through. if (border_rect.Height() >= 3) { context.FillRect( IntRect(border_rect.Location(), IntSize(border_rect.Width(), 1)), - BorderStartEdgeColor()); + BorderStartEdgeColor(), auto_dark_mode); context.FillRect(IntRect(IntPoint(border_rect.X(), border_rect.MaxY() - 1), IntSize(border_rect.Width(), 1)), - BorderEndEdgeColor()); + BorderEndEdgeColor(), auto_dark_mode); } }
diff --git a/third_party/blink/renderer/core/paint/image_painter.cc b/third_party/blink/renderer/core/paint/image_painter.cc index 674a680..8386304f 100644 --- a/third_party/blink/renderer/core/paint/image_painter.cc +++ b/third_party/blink/renderer/core/paint/image_painter.cc
@@ -23,6 +23,7 @@ #include "third_party/blink/renderer/core/paint/box_painter.h" #include "third_party/blink/renderer/core/paint/image_element_timing.h" #include "third_party/blink/renderer/core/paint/outline_painter.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/paint_timing_detector.h" #include "third_party/blink/renderer/core/paint/scoped_paint_state.h" @@ -174,7 +175,10 @@ context.SetStrokeStyle(kSolidStroke); context.SetStrokeColor(Color::kLightGray); context.SetFillColor(Color::kTransparent); - context.DrawRect(paint_rect); + context.DrawRect( + paint_rect, + PaintAutoDarkMode(layout_image_.StyleRef(), layout_image_.GetDocument(), + DarkModeFilter::ElementRole::kBackground)); return; } @@ -260,10 +264,12 @@ } } - context.DrawImage(image.get(), decode_mode, - FloatRect(pixel_snapped_dest_rect), &src_rect, - layout_image_.StyleRef().DisableForceDark(), - SkBlendMode::kSrcOver, respect_orientation); + context.DrawImage( + image.get(), decode_mode, + PaintAutoDarkMode(layout_image_.StyleRef(), layout_image_.GetDocument(), + DarkModeFilter::ElementRole::kBackground), + FloatRect(pixel_snapped_dest_rect), &src_rect, SkBlendMode::kSrcOver, + respect_orientation); if (ImageResourceContent* image_content = image_resource.CachedImage()) { if ((IsA<HTMLImageElement>(node) || IsA<HTMLVideoElement>(node)) &&
diff --git a/third_party/blink/renderer/core/paint/inline_text_box_painter.cc b/third_party/blink/renderer/core/paint/inline_text_box_painter.cc index ae4569b..9eae1db 100644 --- a/third_party/blink/renderer/core/paint/inline_text_box_painter.cc +++ b/third_party/blink/renderer/core/paint/inline_text_box_painter.cc
@@ -20,6 +20,7 @@ #include "third_party/blink/renderer/core/paint/applied_decoration_painter.h" #include "third_party/blink/renderer/core/paint/document_marker_painter.h" #include "third_party/blink/renderer/core/paint/highlight_painting_utils.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/paint_timing_detector.h" #include "third_party/blink/renderer/core/paint/selection_bounds_recorder.h" @@ -401,6 +402,9 @@ DOMNodeId node_id = GetNodeHolder( LineLayoutAPIShim::LayoutObjectFrom(inline_text_box_.GetLineLayoutItem()) ->GetNode()); + AutoDarkMode auto_dark_mode(PaintAutoDarkMode( + style_to_use, inline_text_box_.GetLineLayoutItem().GetDocument(), + DarkModeFilter::ElementRole::kText)); if (!paint_selected_text_only) { // Paint text decorations except line-through. @@ -446,7 +450,8 @@ start_offset = selection_end; end_offset = selection_start; } - text_painter.Paint(start_offset, end_offset, length, text_style, node_id); + text_painter.Paint(start_offset, end_offset, length, text_style, node_id, + auto_dark_mode); // Paint line-through decoration if needed. if (has_line_through_decoration) { @@ -471,7 +476,7 @@ GraphicsContextStateSaver inner_state_saver(context); context.ClipOut(FloatRect(selection_rect)); text_painter.Paint(selection_start, selection_end, length, text_style, - node_id); + node_id, auto_dark_mode); } // the second time, we draw the glyphs inside the selection area, with // the selection style. @@ -479,7 +484,7 @@ GraphicsContextStateSaver inner_state_saver(context); context.Clip(FloatRect(selection_rect)); text_painter.Paint(selection_start, selection_end, length, - selection_style, node_id); + selection_style, node_id, auto_dark_mode); } } @@ -579,9 +584,13 @@ int sel_height = inline_text_box_.Root().SelectionHeight().ToInt(); FloatPoint local_origin(box_origin.left.ToFloat(), box_origin.top.ToFloat() - delta_y); - context.DrawHighlightForText(font, inline_text_box_.ConstructTextRun(style), - local_origin, sel_height, background_color, - start_pos, end_pos); + context.DrawHighlightForText( + font, inline_text_box_.ConstructTextRun(style), local_origin, sel_height, + background_color, + PaintAutoDarkMode(style, + inline_text_box_.GetLineLayoutItem().GetDocument(), + DarkModeFilter::ElementRole::kText), + start_pos, end_pos); } DocumentMarkerVector InlineTextBoxPainter::ComputeMarkersToPaint() const { @@ -855,7 +864,9 @@ GraphicsContextStateSaver state_saver(context); - context.FillRect(FloatRect(selection_rect), c); + context.FillRect(FloatRect(selection_rect), c, + PaintAutoDarkMode(style, layout_item.GetDocument(), + DarkModeFilter::ElementRole::kText)); return selection_rect; } @@ -885,7 +896,8 @@ const FloatRect& marker_rect = font.SelectionRectForText( run, FloatPoint(), 0, marker_offsets.start, marker_offsets.end); DocumentMarkerPainter::PaintStyleableMarkerUnderline( - context, box_origin, marker, style, marker_rect, + context, box_origin, marker, style, + inline_text_box_.GetLineLayoutItem().GetDocument(), marker_rect, inline_text_box_.LogicalHeight(), inline_text_box_.GetLineLayoutItem().GetDocument().InDarkMode()); } @@ -930,8 +942,13 @@ TextPainter text_painter(paint_info.context, font, run, text_origin, box_rect, inline_text_box_.IsHorizontal()); + AutoDarkMode auto_dark_mode(PaintAutoDarkMode( + style, inline_text_box_.GetLineLayoutItem().GetDocument(), + DarkModeFilter::ElementRole::kText)); + text_painter.Paint(paint_offsets.first, paint_offsets.second, - inline_text_box_.Len(), text_style, kInvalidDOMNodeId); + inline_text_box_.Len(), text_style, kInvalidDOMNodeId, + auto_dark_mode); } void InlineTextBoxPainter::PaintTextMarkerBackground( @@ -962,9 +979,12 @@ PhysicalSize(inline_text_box_.LogicalWidth(), inline_text_box_.LogicalHeight())); context.Clip(FloatRect(box_rect)); - context.DrawHighlightForText(font, run, FloatPoint(box_origin), - box_rect.Height().ToInt(), color, - paint_offsets.first, paint_offsets.second); + context.DrawHighlightForText( + font, run, FloatPoint(box_origin), box_rect.Height().ToInt(), color, + PaintAutoDarkMode(style, + inline_text_box_.GetLineLayoutItem().GetDocument(), + DarkModeFilter::ElementRole::kText), + paint_offsets.first, paint_offsets.second); } } // namespace blink
diff --git a/third_party/blink/renderer/core/paint/line_box_list_painter.cc b/third_party/blink/renderer/core/paint/line_box_list_painter.cc index 355247b..85c232e 100644 --- a/third_party/blink/renderer/core/paint/line_box_list_painter.cc +++ b/third_party/blink/renderer/core/paint/line_box_list_painter.cc
@@ -13,6 +13,7 @@ #include "third_party/blink/renderer/core/layout/line/line_box_list.h" #include "third_party/blink/renderer/core/layout/line/root_inline_box.h" #include "third_party/blink/renderer/core/paint/object_painter.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/paint_timing_detector.h" #include "third_party/blink/renderer/core/paint/url_metadata_utils.h" @@ -170,8 +171,12 @@ visual_rect); Color backplate_color = layout_object.GetDocument().GetStyleEngine().ForcedBackgroundColor(); - for (const auto backplate : backplates) - paint_info.context.FillRect(FloatRect(backplate), backplate_color); + for (const auto backplate : backplates) { + paint_info.context.FillRect( + FloatRect(backplate), backplate_color, + PaintAutoDarkMode(style, layout_object.GetDocument(), + DarkModeFilter::ElementRole::kBackground)); + } } Vector<PhysicalRect> LineBoxListPainter::GetBackplates(
diff --git a/third_party/blink/renderer/core/paint/list_marker_painter.cc b/third_party/blink/renderer/core/paint/list_marker_painter.cc index f8695af..6d7a7fb9 100644 --- a/third_party/blink/renderer/core/paint/list_marker_painter.cc +++ b/third_party/blink/renderer/core/paint/list_marker_painter.cc
@@ -11,6 +11,7 @@ #include "third_party/blink/renderer/core/paint/box_model_object_painter.h" #include "third_party/blink/renderer/core/paint/box_painter.h" #include "third_party/blink/renderer/core/paint/highlight_painting_utils.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/scoped_paint_state.h" #include "third_party/blink/renderer/core/paint/text_painter.h" @@ -88,8 +89,6 @@ DCHECK(style.ListStyleType()); DCHECK(style.ListStyleType()->IsCounterStyle()); GraphicsContext& context = paint_info.context; - ScopedDarkModeElementRoleOverride list_symbol( - &context, DarkModeFilter::ElementRole::kListSymbol); Color color(object->ResolveColor(GetCSSPropertyColor())); if (BoxModelObjectPainter::ShouldForceWhiteBackgroundForPrintEconomy( object->GetDocument(), style)) @@ -101,17 +100,19 @@ context.SetStrokeThickness(1.0f); IntRect snapped_rect = PixelSnappedIntRect(marker); const AtomicString& type = style.ListStyleType()->GetCounterStyleName(); + AutoDarkMode auto_dark_mode(PaintAutoDarkMode( + style, object->GetDocument(), DarkModeFilter::ElementRole::kListSymbol)); if (type == "disc") { - context.FillEllipse(FloatRect(snapped_rect)); + context.FillEllipse(FloatRect(snapped_rect), auto_dark_mode); } else if (type == "circle") { - context.StrokeEllipse(FloatRect(snapped_rect)); + context.StrokeEllipse(FloatRect(snapped_rect), auto_dark_mode); } else if (type == "square") { - context.FillRect(snapped_rect); + context.FillRect(snapped_rect, color, auto_dark_mode); } else if (type == "disclosure-open" || type == "disclosure-closed") { Path path = GetCanonicalDisclosurePath(style, type == "disclosure-open"); path.Transform(AffineTransform().Scale(marker.Width(), marker.Height())); path.Translate(FloatSize(marker.X(), marker.Y())); - context.FillPath(path); + context.FillPath(path, auto_dark_mode); } else { NOTREACHED(); } @@ -147,6 +148,10 @@ GraphicsContext& context = local_paint_info.context; + AutoDarkMode auto_dark_mode(PaintAutoDarkMode( + layout_list_marker_.StyleRef(), layout_list_marker_.GetDocument(), + DarkModeFilter::ElementRole::kListSymbol)); + if (layout_list_marker_.IsImage()) { // Since there is no way for the developer to specify decode behavior, use // kSync by default. @@ -155,7 +160,7 @@ ->GetImage(layout_list_marker_, layout_list_marker_.GetDocument(), layout_list_marker_.StyleRef(), FloatSize(marker.Size())) .get(), - Image::kSyncDecode, FloatRect(marker)); + Image::kSyncDecode, auto_dark_mode, FloatRect(marker)); return; } @@ -224,7 +229,8 @@ if (style_category == ListMarker::ListStyleCategory::kStaticString) { // Don't add a suffix. - context.DrawText(font, text_run_paint_info, text_origin, kInvalidDOMNodeId); + context.DrawText(font, text_run_paint_info, text_origin, kInvalidDOMNodeId, + auto_dark_mode); context.GetPaintController().SetTextPainted(); return; } @@ -244,18 +250,24 @@ TextRunPaintInfo suffix_run_info(suffix_run); if (layout_list_marker_.StyleRef().IsLeftToRightDirection()) { - context.DrawText(font, prefix_run_info, text_origin, kInvalidDOMNodeId); + context.DrawText(font, prefix_run_info, text_origin, kInvalidDOMNodeId, + auto_dark_mode); text_origin += FloatSize(IntSize(font.Width(prefix_run), 0)); - context.DrawText(font, text_run_paint_info, text_origin, kInvalidDOMNodeId); + context.DrawText(font, text_run_paint_info, text_origin, kInvalidDOMNodeId, + auto_dark_mode); text_origin += FloatSize(IntSize(font.Width(text_run), 0)); - context.DrawText(font, suffix_run_info, text_origin, kInvalidDOMNodeId); + context.DrawText(font, suffix_run_info, text_origin, kInvalidDOMNodeId, + auto_dark_mode); } else { // Is the truncation to IntSize below meaningful or a bug? - context.DrawText(font, suffix_run_info, text_origin, kInvalidDOMNodeId); + context.DrawText(font, suffix_run_info, text_origin, kInvalidDOMNodeId, + auto_dark_mode); text_origin += FloatSize(IntSize(font.Width(suffix_run), 0)); - context.DrawText(font, text_run_paint_info, text_origin, kInvalidDOMNodeId); + context.DrawText(font, text_run_paint_info, text_origin, kInvalidDOMNodeId, + auto_dark_mode); text_origin += FloatSize(IntSize(font.Width(text_run), 0)); - context.DrawText(font, prefix_run_info, text_origin, kInvalidDOMNodeId); + context.DrawText(font, prefix_run_info, text_origin, kInvalidDOMNodeId, + auto_dark_mode); } // TODO(npm): Check that there are non-whitespace characters. See // crbug.com/788444.
diff --git a/third_party/blink/renderer/core/paint/multi_column_set_painter.cc b/third_party/blink/renderer/core/paint/multi_column_set_painter.cc index 043e55ae..59e1657 100644 --- a/third_party/blink/renderer/core/paint/multi_column_set_painter.cc +++ b/third_party/blink/renderer/core/paint/multi_column_set_painter.cc
@@ -7,6 +7,7 @@ #include "third_party/blink/renderer/core/layout/layout_multi_column_set.h" #include "third_party/blink/renderer/core/paint/block_painter.h" #include "third_party/blink/renderer/core/paint/box_border_painter.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/platform/geometry/layout_point.h" #include "third_party/blink/renderer/platform/graphics/paint/drawing_recorder.h" @@ -64,8 +65,11 @@ for (auto& bound : column_rule_bounds) { IntRect pixel_snapped_rule_rect = PixelSnappedIntRect(bound); - BoxBorderPainter::DrawBoxSide(paint_info.context, pixel_snapped_rule_rect, - box_side, rule_color, rule_style); + BoxBorderPainter::DrawBoxSide( + paint_info.context, pixel_snapped_rule_rect, box_side, rule_color, + rule_style, + PaintAutoDarkMode(block_style, layout_multi_column_set_.GetDocument(), + DarkModeFilter::ElementRole::kBackground)); } }
diff --git a/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc b/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc index 0928c02..03573da 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc
@@ -38,6 +38,7 @@ #include "third_party/blink/renderer/core/paint/ng/ng_text_combine_painter.h" #include "third_party/blink/renderer/core/paint/ng/ng_text_fragment_painter.h" #include "third_party/blink/renderer/core/paint/object_painter.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" @@ -1284,6 +1285,9 @@ LayoutUnit rule_thickness(style.ColumnRuleWidth()); PhysicalRect previous_column; bool past_first_column_in_row = false; + AutoDarkMode auto_dark_mode( + PaintAutoDarkMode(style, box_fragment_.GetDocument(), + DarkModeFilter::ElementRole::kBackground)); for (const NGLink& child : box_fragment_.Children()) { if (!child->IsColumnBox()) { // Column spanner. Continue in the next row, if there are 2 columns or @@ -1352,7 +1356,7 @@ rule.Move(paint_offset); IntRect snapped_rule = PixelSnappedIntRect(rule); BoxBorderPainter::DrawBoxSide(paint_info.context, snapped_rule, box_side, - rule_color, rule_style); + rule_color, rule_style, auto_dark_mode); recorder.UniteVisualRect(snapped_rule); previous_column = current_column; @@ -1625,8 +1629,12 @@ DrawingRecorder recorder(paint_info.context, GetDisplayItemClient(), DisplayItem::kForcedColorsModeBackplate, EnclosingIntRect(UnionRect(backplates))); - for (const auto backplate : backplates) - paint_info.context.FillRect(FloatRect(backplate), backplate_color); + for (const auto backplate : backplates) { + paint_info.context.FillRect( + FloatRect(backplate), backplate_color, + PaintAutoDarkMode(style, box_fragment_.GetDocument(), + DarkModeFilter::ElementRole::kBackground)); + } } void NGBoxFragmentPainter::PaintTextItem(const NGInlineCursor& cursor,
diff --git a/third_party/blink/renderer/core/paint/ng/ng_fragment_painter.cc b/third_party/blink/renderer/core/paint/ng/ng_fragment_painter.cc index 6a51c27b..ee323eec 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_fragment_painter.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_fragment_painter.cc
@@ -27,7 +27,8 @@ return; OutlinePainter::PaintOutlineRects(paint_info, GetDisplayItemClient(), - outline_rects, style_to_use); + outline_rects, style_to_use, + fragment.GetLayoutObject()->GetDocument()); } void NGFragmentPainter::AddURLRectIfNeeded(const PaintInfo& paint_info,
diff --git a/third_party/blink/renderer/core/paint/ng/ng_highlight_painter.cc b/third_party/blink/renderer/core/paint/ng/ng_highlight_painter.cc index 61ecef72..2d76c20 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_highlight_painter.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_highlight_painter.cc
@@ -20,6 +20,7 @@ #include "third_party/blink/renderer/core/paint/highlight_painting_utils.h" #include "third_party/blink/renderer/core/paint/inline_text_box_painter.h" #include "third_party/blink/renderer/core/paint/ng/ng_text_painter.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/platform/instrumentation/use_counter.h" @@ -86,21 +87,24 @@ void PaintRect(GraphicsContext& context, const PhysicalRect& rect, - const Color color) { + const Color color, + const AutoDarkMode& auto_dark_mode) { if (!color.Alpha()) return; if (rect.size.IsEmpty()) return; const IntRect pixel_snapped_rect = PixelSnappedIntRect(rect); if (!pixel_snapped_rect.IsEmpty()) - context.FillRect(pixel_snapped_rect, color); + context.FillRect(pixel_snapped_rect, color, auto_dark_mode); } void PaintRect(GraphicsContext& context, const PhysicalOffset& location, const PhysicalRect& rect, - const Color color) { - PaintRect(context, PhysicalRect(rect.offset + location, rect.size), color); + const Color color, + const AutoDarkMode& auto_dark_mode) { + PaintRect(context, PhysicalRect(rect.offset + location, rect.size), color, + auto_dark_mode); } Color SelectionBackgroundColor(const Document& document, @@ -199,8 +203,11 @@ const Color color = SelectionBackgroundColor(document, style, node, selection_style_.fill_color); + AutoDarkMode auto_dark_mode( + PaintAutoDarkMode(style, document, DarkModeFilter::ElementRole::kText)); + if (!rotation) { - PaintRect(context, RectInPhysicalSpace(), color); + PaintRect(context, RectInPhysicalSpace(), color, auto_dark_mode); return; } @@ -210,7 +217,7 @@ // fix this, we undo the transformation temporarily, then use the original // physical coordinates (before MapSelectionRectIntoRotatedSpace). context.ConcatCTM(rotation->Inverse()); - PaintRect(context, RectInPhysicalSpace(), color); + PaintRect(context, RectInPhysicalSpace(), color, auto_dark_mode); context.ConcatCTM(*rotation); } @@ -219,36 +226,40 @@ NGTextPainter& text_painter, unsigned length, const TextPaintStyle& text_style, - DOMNodeId node_id) { - text_painter.PaintSelectedText(selection_status_.start, selection_status_.end, - length, text_style, selection_style_, - RectInWritingModeSpace(), node_id); + DOMNodeId node_id, + const AutoDarkMode& auto_dark_mode) { + text_painter.PaintSelectedText( + selection_status_.start, selection_status_.end, length, text_style, + selection_style_, RectInWritingModeSpace(), node_id, auto_dark_mode); } // Paint the given text range in the given style, suppressing the text proper // (painting shadows only) where selected. void NGHighlightPainter::SelectionPaintState:: - PaintSuppressingTextProperWhereSelected(NGTextPainter& text_painter, - unsigned start_offset, - unsigned end_offset, - unsigned length, - const TextPaintStyle& text_style, - DOMNodeId node_id) { + PaintSuppressingTextProperWhereSelected( + NGTextPainter& text_painter, + unsigned start_offset, + unsigned end_offset, + unsigned length, + const TextPaintStyle& text_style, + DOMNodeId node_id, + const AutoDarkMode& auto_dark_mode) { // First paint the shadows for the whole range. if (text_style.shadow) { text_painter.Paint(start_offset, end_offset, length, text_style, node_id, - NGTextPainter::kShadowsOnly); + auto_dark_mode, NGTextPainter::kShadowsOnly); } // Then paint the text proper for any unselected parts in storage order, so // that they’re always on top of the shadows. if (start_offset < selection_status_.start) { text_painter.Paint(start_offset, selection_status_.start, length, - text_style, node_id, NGTextPainter::kTextProperOnly); + text_style, node_id, auto_dark_mode, + NGTextPainter::kTextProperOnly); } if (selection_status_.end < end_offset) { text_painter.Paint(selection_status_.end, end_offset, length, text_style, - node_id, NGTextPainter::kTextProperOnly); + node_id, auto_dark_mode, NGTextPainter::kTextProperOnly); } } @@ -285,6 +296,9 @@ const auto& text_node = To<Text>(*fragment_item_.GetNode()); const StringView text = cursor_.CurrentText(); + AutoDarkMode auto_dark_mode(PaintAutoDarkMode( + style_, node_->GetDocument(), DarkModeFilter::ElementRole::kText)); + for (const DocumentMarker* marker : markers_) { const unsigned marker_start_offset = GetTextContentOffset(text_node, marker->StartOffset()); @@ -335,7 +349,7 @@ PaintRect(paint_info_.context, PhysicalOffset(box_origin_), fragment_item_.LocalRect(text, paint_start_offset, paint_end_offset), - color); + color, auto_dark_mode); break; } @@ -360,7 +374,7 @@ break; text_painter_.Paint(paint_start_offset, paint_end_offset, paint_end_offset - paint_start_offset, text_style, - kInvalidDOMNodeId); + kInvalidDOMNodeId, auto_dark_mode); } break; case DocumentMarker::kComposition: @@ -371,7 +385,7 @@ PaintRect(paint_info_.context, PhysicalOffset(box_origin_), fragment_item_.LocalRect(text, paint_start_offset, paint_end_offset), - styleable_marker.BackgroundColor()); + styleable_marker.BackgroundColor(), auto_dark_mode); break; } if (DocumentMarkerPainter::ShouldPaintMarkerUnderline( @@ -379,6 +393,7 @@ const SimpleFontData* font_data = style_.GetFont().PrimaryFont(); DocumentMarkerPainter::PaintStyleableMarkerUnderline( paint_info_.context, box_origin_, styleable_marker, style_, + node_->GetDocument(), FloatRect(MarkerRectForForeground( fragment_item_, text, paint_start_offset, paint_end_offset)), LayoutUnit(font_data->GetFontMetrics().Height()), @@ -400,7 +415,7 @@ PaintRect(paint_info_.context, PhysicalOffset(box_origin_), fragment_item_.LocalRect(text, paint_start_offset, paint_end_offset), - background_color); + background_color, auto_dark_mode); break; } @@ -425,7 +440,8 @@ text_painter_.Paint(paint_start_offset, paint_end_offset, paint_end_offset - paint_start_offset, - final_text_style, kInvalidDOMNodeId); + final_text_style, kInvalidDOMNodeId, + auto_dark_mode); } break;
diff --git a/third_party/blink/renderer/core/paint/ng/ng_highlight_painter.h b/third_party/blink/renderer/core/paint/ng/ng_highlight_painter.h index f386f18..48d7f7da 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_highlight_painter.h +++ b/third_party/blink/renderer/core/paint/ng/ng_highlight_painter.h
@@ -19,6 +19,7 @@ namespace blink { class ComputedStyle; +struct AutoDarkMode; class FrameSelection; class LayoutObject; class NGFragmentItem; @@ -82,7 +83,8 @@ void PaintSelectedText(NGTextPainter& text_painter, unsigned length, const TextPaintStyle& text_style, - DOMNodeId node_id); + DOMNodeId node_id, + const AutoDarkMode& auto_dark_mode); void PaintSuppressingTextProperWhereSelected( NGTextPainter& text_painter, @@ -90,7 +92,8 @@ unsigned end_offset, unsigned length, const TextPaintStyle& text_style, - DOMNodeId node_id); + DOMNodeId node_id, + const AutoDarkMode& auto_dark_mode); private: struct SelectionRect {
diff --git a/third_party/blink/renderer/core/paint/ng/ng_mathml_painter.cc b/third_party/blink/renderer/core/paint/ng/ng_mathml_painter.cc index fbffad0..43f3768 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_mathml_painter.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_mathml_painter.cc
@@ -7,6 +7,7 @@ #include "third_party/blink/renderer/core/layout/ng/mathml/ng_math_layout_utils.h" #include "third_party/blink/renderer/core/mathml/mathml_radical_element.h" #include "third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/platform/fonts/ng_text_fragment_paint_info.h" #include "third_party/blink/renderer/platform/geometry/layout_unit.h" @@ -25,7 +26,11 @@ info.context.SetStrokeColor( box_fragment_.Style().VisitedDependentColor(GetCSSPropertyColor())); IntPoint line_end_point = {bar.Width(), 0}; - info.context.DrawLine(bar.Location(), bar.Location() + line_end_point); + AutoDarkMode auto_dark_mode( + PaintAutoDarkMode(box_fragment_.Style(), box_fragment_.GetDocument(), + DarkModeFilter::ElementRole::kText)); + info.context.DrawLine(bar.Location(), bar.Location() + line_end_point, + auto_dark_mode); } void NGMathMLPainter::PaintStretchyOrLargeOperator( @@ -39,8 +44,11 @@ parameters.operator_shape_result_view.get()}; GraphicsContextStateSaver state_saver(info.context); info.context.SetFillColor(style.VisitedDependentColor(GetCSSPropertyColor())); + AutoDarkMode auto_dark_mode(PaintAutoDarkMode( + style, box_fragment_.GetDocument(), DarkModeFilter::ElementRole::kText)); info.context.DrawText(style.GetFont(), text_fragment_paint_info, - FloatPoint(paint_offset), kInvalidDOMNodeId); + FloatPoint(paint_offset), kInvalidDOMNodeId, + auto_dark_mode); } void NGMathMLPainter::PaintFractionBar(
diff --git a/third_party/blink/renderer/core/paint/ng/ng_table_painters.cc b/third_party/blink/renderer/core/paint/ng/ng_table_painters.cc index 2d88fb1..f9a6ea3 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_table_painters.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_table_painters.cc
@@ -18,6 +18,7 @@ #include "third_party/blink/renderer/core/paint/box_model_object_painter.h" #include "third_party/blink/renderer/core/paint/box_painter.h" #include "third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/paint/scoped_paint_state.h" @@ -441,6 +442,10 @@ WritingModeConverter grid_converter(fragment_.Style().GetWritingDirection(), grid_paint_rect.size); + AutoDarkMode auto_dark_mode( + PaintAutoDarkMode(fragment_.Style(), fragment_.GetDocument(), + DarkModeFilter::ElementRole::kBackground)); + for (NGTableCollapsedEdge edge = NGTableCollapsedEdge(*collapsed_borders, 0); edge.Exists(); ++edge) { if (!edge.CanPaint()) @@ -526,7 +531,7 @@ } BoxBorderPainter::DrawBoxSide( paint_info.context, PixelSnappedIntRect(physical_border_rect), box_side, - edge.BorderColor(), edge.BorderStyle()); + edge.BorderColor(), edge.BorderStyle(), auto_dark_mode); } }
diff --git a/third_party/blink/renderer/core/paint/ng/ng_text_combine_painter.cc b/third_party/blink/renderer/core/paint/ng/ng_text_combine_painter.cc index 3bcdefd0..f1df87e 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_text_combine_painter.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_text_combine_painter.cc
@@ -6,6 +6,7 @@ #include "third_party/blink/renderer/core/layout/ng/inline/layout_ng_text_combine.h" #include "third_party/blink/renderer/core/layout/ng/ng_text_decoration_offset.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/style/computed_style.h" #include "third_party/blink/renderer/platform/graphics/graphics_context.h" @@ -69,7 +70,8 @@ if (has_emphasis_mark) { text_painter.PaintEmphasisMark(text_style, - text_combine.Parent()->StyleRef().GetFont()); + text_combine.Parent()->StyleRef().GetFont(), + text_combine.GetDocument()); } if (has_text_decoration) @@ -117,11 +119,14 @@ } void NGTextCombinePainter::PaintEmphasisMark(const TextPaintStyle& text_style, - const Font& emphasis_mark_font) { + const Font& emphasis_mark_font, + const Document& document) { DCHECK_NE(style_.GetTextEmphasisMark(), TextEmphasisMark::kNone); SetEmphasisMark(style_.TextEmphasisMarkString(), style_.GetTextEmphasisPosition()); - PaintEmphasisMarkForCombinedText(text_style, emphasis_mark_font); + PaintEmphasisMarkForCombinedText( + text_style, emphasis_mark_font, + PaintAutoDarkMode(style_, document, DarkModeFilter::ElementRole::kText)); } } // namespace blink
diff --git a/third_party/blink/renderer/core/paint/ng/ng_text_combine_painter.h b/third_party/blink/renderer/core/paint/ng/ng_text_combine_painter.h index 479fae9..3444e36 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_text_combine_painter.h +++ b/third_party/blink/renderer/core/paint/ng/ng_text_combine_painter.h
@@ -11,6 +11,7 @@ namespace blink { class ComputedStyle; +class Document; class LayoutNGTextCombine; // The painter for painting text decorations and emphasis marks for @@ -36,7 +37,8 @@ void PaintDecorations(const PaintInfo& paint_info, const TextPaintStyle& text_style); void PaintEmphasisMark(const TextPaintStyle& text_style, - const Font& emphasis_mark_font); + const Font& emphasis_mark_font, + const Document& document); const ComputedStyle& style_; };
diff --git a/third_party/blink/renderer/core/paint/ng/ng_text_fragment_painter.cc b/third_party/blink/renderer/core/paint/ng/ng_text_fragment_painter.cc index c51535a..e51ed86 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_text_fragment_painter.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_text_fragment_painter.cc
@@ -28,6 +28,7 @@ #include "third_party/blink/renderer/core/paint/ng/ng_highlight_painter.h" #include "third_party/blink/renderer/core/paint/ng/ng_text_decoration_painter.h" #include "third_party/blink/renderer/core/paint/ng/ng_text_painter.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/selection_bounds_recorder.h" #include "third_party/blink/renderer/core/paint/text_painter_base.h" @@ -390,6 +391,9 @@ node_id = layout_text->EnsureNodeId(); } + AutoDarkMode auto_dark_mode( + PaintAutoDarkMode(style, document, DarkModeFilter::ElementRole::kText)); + const unsigned length = fragment_paint_info.to - fragment_paint_info.from; const unsigned start_offset = fragment_paint_info.from; const unsigned end_offset = fragment_paint_info.to; @@ -397,13 +401,15 @@ if (LIKELY(!highlight_painter.Selection())) { decoration_painter.Begin(NGTextDecorationPainter::kOriginating); decoration_painter.PaintExceptLineThrough(); - text_painter.Paint(start_offset, end_offset, length, text_style, node_id); + text_painter.Paint(start_offset, end_offset, length, text_style, node_id, + auto_dark_mode); decoration_painter.PaintOnlyLineThrough(); } else if (!highlight_painter.Selection()->ShouldPaintSelectedTextOnly()) { decoration_painter.Begin(NGTextDecorationPainter::kOriginating); decoration_painter.PaintExceptLineThrough(); highlight_painter.Selection()->PaintSuppressingTextProperWhereSelected( - text_painter, start_offset, end_offset, length, text_style, node_id); + text_painter, start_offset, end_offset, length, text_style, node_id, + auto_dark_mode); decoration_painter.PaintOnlyLineThrough(); } @@ -429,8 +435,8 @@ // Paint only the text that is selected. decoration_painter.Begin(NGTextDecorationPainter::kSelection); decoration_painter.PaintExceptLineThrough(); - highlight_painter.Selection()->PaintSelectedText(text_painter, length, - text_style, node_id); + highlight_painter.Selection()->PaintSelectedText( + text_painter, length, text_style, node_id, auto_dark_mode); decoration_painter.PaintOnlyLineThrough(); } }
diff --git a/third_party/blink/renderer/core/paint/ng/ng_text_painter.cc b/third_party/blink/renderer/core/paint/ng/ng_text_painter.cc index 12327aa..6689e77 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_text_painter.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_text_painter.cc
@@ -174,18 +174,20 @@ unsigned length, const TextPaintStyle& text_style, DOMNodeId node_id, + const AutoDarkMode& auto_dark_mode, ShadowMode shadow_mode) { GraphicsContextStateSaver state_saver(graphics_context_, false); UpdateGraphicsContext(graphics_context_, text_style, state_saver, shadow_mode); // TODO(layout-dev): Handle combine text here or elsewhere. - PaintInternal<kPaintText>(start_offset, end_offset, length, node_id); + PaintInternal<kPaintText>(start_offset, end_offset, length, node_id, + auto_dark_mode); if (!emphasis_mark_.IsEmpty()) { if (text_style.emphasis_mark_color != text_style.fill_color) graphics_context_.SetFillColor(text_style.emphasis_mark_color); - PaintInternal<kPaintEmphasisMark>(start_offset, end_offset, length, - node_id); + PaintInternal<kPaintEmphasisMark>(start_offset, end_offset, length, node_id, + auto_dark_mode); } } @@ -199,7 +201,8 @@ const TextPaintStyle& text_style, const TextPaintStyle& selection_style, const PhysicalRect& selection_rect, - DOMNodeId node_id) { + DOMNodeId node_id, + const AutoDarkMode& auto_dark_mode) { if (!fragment_paint_info_.shape_result) return; @@ -215,7 +218,8 @@ absl::optional<base::AutoReset<bool>> is_painting_selection_reset; if (NGTextPainter::SvgTextPaintState* state = GetSvgState()) is_painting_selection_reset.emplace(&state->is_painting_selection_, true); - Paint(start_offset, end_offset, length, selection_style, node_id); + Paint(start_offset, end_offset, length, selection_style, node_id, + auto_dark_mode); return; } @@ -232,7 +236,7 @@ { GraphicsContextStateSaver state_saver(graphics_context_); graphics_context_.ClipOut(float_selection_rect); - Paint(start_offset, end_offset, length, text_style, node_id, + Paint(start_offset, end_offset, length, text_style, node_id, auto_dark_mode, kTextProperOnly); } // Then draw the glyphs inside the selection area, with the selection style. @@ -242,7 +246,8 @@ is_painting_selection_reset.emplace(&state->is_painting_selection_, true); GraphicsContextStateSaver state_saver(graphics_context_); graphics_context_.Clip(float_selection_rect); - Paint(start_offset, end_offset, length, selection_style, node_id); + Paint(start_offset, end_offset, length, selection_style, node_id, + auto_dark_mode); } } @@ -303,10 +308,10 @@ } template <NGTextPainter::PaintInternalStep step> -void NGTextPainter::PaintInternalFragment( - unsigned from, - unsigned to, - DOMNodeId node_id) { +void NGTextPainter::PaintInternalFragment(unsigned from, + unsigned to, + DOMNodeId node_id, + const AutoDarkMode& auto_dark_mode) { DCHECK(from <= fragment_paint_info_.text.length()); DCHECK(to <= fragment_paint_info_.text.length()); @@ -316,14 +321,16 @@ if (step == kPaintEmphasisMark) { graphics_context_.DrawEmphasisMarks( font_, fragment_paint_info_, emphasis_mark_, - FloatPoint(text_origin_) + IntSize(0, emphasis_mark_offset_)); + FloatPoint(text_origin_) + IntSize(0, emphasis_mark_offset_), + auto_dark_mode); } else { DCHECK(step == kPaintText); if (svg_text_paint_state_.has_value()) { - PaintSvgTextFragment(node_id); + PaintSvgTextFragment(node_id, auto_dark_mode); } else { graphics_context_.DrawText(font_, fragment_paint_info_, - FloatPoint(text_origin_), node_id); + FloatPoint(text_origin_), node_id, + auto_dark_mode); } // TODO(npm): Check that there are non-whitespace characters. See // crbug.com/788444. @@ -338,19 +345,23 @@ void NGTextPainter::PaintInternal(unsigned start_offset, unsigned end_offset, unsigned truncation_point, - DOMNodeId node_id) { + DOMNodeId node_id, + const AutoDarkMode& auto_dark_mode) { // TODO(layout-dev): We shouldn't be creating text fragments without text. if (!fragment_paint_info_.shape_result) return; if (start_offset <= end_offset) { - PaintInternalFragment<Step>(start_offset, end_offset, node_id); + PaintInternalFragment<Step>(start_offset, end_offset, node_id, + auto_dark_mode); } else { if (end_offset > 0) { - PaintInternalFragment<Step>(ellipsis_offset_, end_offset, node_id); + PaintInternalFragment<Step>(ellipsis_offset_, end_offset, node_id, + auto_dark_mode); } if (start_offset < truncation_point) { - PaintInternalFragment<Step>(start_offset, truncation_point, node_id); + PaintInternalFragment<Step>(start_offset, truncation_point, node_id, + auto_dark_mode); } } } @@ -371,7 +382,8 @@ DecorationsStripeIntercepts(upper, stripe_width, dilation, text_intercepts); } -void NGTextPainter::PaintSvgTextFragment(DOMNodeId node_id) { +void NGTextPainter::PaintSvgTextFragment(DOMNodeId node_id, + const AutoDarkMode& auto_dark_mode) { const NGTextPainter::SvgTextPaintState& state = svg_text_paint_state_.value(); if (state.IsPaintingTextMatch()) { PaintFlags fill_flags; @@ -388,11 +400,12 @@ stroke_flags.setColor(state.TextMatchColor().Rgb()); } graphics_context_.DrawText(font_, fragment_paint_info_, - FloatPoint(text_origin_), fill_flags, node_id); + FloatPoint(text_origin_), fill_flags, node_id, + auto_dark_mode); if (should_paint_stroke) { graphics_context_.DrawText(font_, fragment_paint_info_, FloatPoint(text_origin_), stroke_flags, - node_id); + node_id, auto_dark_mode); } return; } @@ -429,7 +442,8 @@ if (SetupPaintForSvgText(state, graphics_context_, style_to_paint, SvgPaintMode::kText, *resource_mode, flags)) { graphics_context_.DrawText(font_, fragment_paint_info_, - FloatPoint(text_origin_), flags, node_id); + FloatPoint(text_origin_), flags, node_id, + auto_dark_mode); } } }
diff --git a/third_party/blink/renderer/core/paint/ng/ng_text_painter.h b/third_party/blink/renderer/core/paint/ng/ng_text_painter.h index 3b945571..1b2bc8bd 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_text_painter.h +++ b/third_party/blink/renderer/core/paint/ng/ng_text_painter.h
@@ -13,6 +13,7 @@ namespace blink { +struct AutoDarkMode; class LayoutObject; class LayoutSVGInlineText; class NGFragmentItem; @@ -86,6 +87,7 @@ unsigned length, const TextPaintStyle&, DOMNodeId, + const AutoDarkMode& auto_dark_mode, ShadowMode = kBothShadowsAndTextProper); void PaintSelectedText(unsigned start_offset, @@ -94,7 +96,8 @@ const TextPaintStyle& text_style, const TextPaintStyle& selection_style, const PhysicalRect& selection_rect, - DOMNodeId node_id); + DOMNodeId node_id, + const AutoDarkMode& auto_dark_mode); void PaintDecorationsExceptLineThrough(const NGFragmentItem& text_item, const PaintInfo& paint_info, @@ -122,15 +125,20 @@ private: template <PaintInternalStep step> - void PaintInternalFragment(unsigned from, unsigned to, DOMNodeId node_id); + void PaintInternalFragment(unsigned from, + unsigned to, + DOMNodeId node_id, + const AutoDarkMode& auto_dark_mode); template <PaintInternalStep step> void PaintInternal(unsigned start_offset, unsigned end_offset, unsigned truncation_point, - DOMNodeId node_id); + DOMNodeId node_id, + const AutoDarkMode& auto_dark_mode); - void PaintSvgTextFragment(DOMNodeId node_id); + void PaintSvgTextFragment(DOMNodeId node_id, + const AutoDarkMode& auto_dark_mode); void PaintSvgDecorationsExceptLineThrough( const TextDecorationOffsetBase& decoration_offset, TextDecorationInfo& decoration_info,
diff --git a/third_party/blink/renderer/core/paint/nine_piece_image_painter.cc b/third_party/blink/renderer/core/paint/nine_piece_image_painter.cc index d6637d6..4fbed70 100644 --- a/third_party/blink/renderer/core/paint/nine_piece_image_painter.cc +++ b/third_party/blink/renderer/core/paint/nine_piece_image_painter.cc
@@ -7,6 +7,7 @@ #include "third_party/blink/renderer/core/inspector/inspector_trace_events.h" #include "third_party/blink/renderer/core/layout/geometry/physical_rect.h" #include "third_party/blink/renderer/core/paint/nine_piece_image_grid.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/style/computed_style.h" #include "third_party/blink/renderer/core/style/nine_piece_image.h" #include "third_party/blink/renderer/platform/geometry/int_size.h" @@ -87,6 +88,7 @@ void PaintPieces(GraphicsContext& context, const PhysicalRect& border_image_rect, const ComputedStyle& style, + const Document& document, const NinePieceImage& nine_piece_image, Image* image, const FloatSize& unzoomed_image_size, @@ -109,6 +111,9 @@ nine_piece_image, image_size, slice_scale, style.EffectiveZoom(), PixelSnappedIntRect(border_image_rect), border_widths, sides_to_include); + AutoDarkMode auto_dark_mode(PaintAutoDarkMode( + style, document, DarkModeFilter::ElementRole::kBackground)); + ScopedInterpolationQuality interpolation_quality_scope( context, style.GetInterpolationQuality()); for (NinePiece piece = kMinPiece; piece < kMaxPiece; ++piece) { @@ -120,8 +125,8 @@ if (!ShouldTile(draw_info)) { // Since there is no way for the developer to specify decode behavior, // use kSync by default. - context.DrawImage(image, Image::kSyncDecode, draw_info.destination, - &draw_info.source, style.DisableForceDark()); + context.DrawImage(image, Image::kSyncDecode, auto_dark_mode, + draw_info.destination, &draw_info.source); continue; } @@ -155,7 +160,8 @@ (FloatPoint(h_tile->phase, v_tile->phase) - tile_origin_in_dest_space); tiling_info.spacing = FloatSize(h_tile->spacing, v_tile->spacing); - context.DrawImageTiled(image, draw_info.destination, tiling_info); + context.DrawImageTiled(image, draw_info.destination, tiling_info, + auto_dark_mode); } } @@ -210,8 +216,9 @@ TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", inspector_paint_image_event::Data, node, *style_image, FloatRect(image->Rect()), FloatRect(border_image_rect)); - PaintPieces(graphics_context, border_image_rect, style, nine_piece_image, - image.get(), unzoomed_image_size, sides_to_include); + PaintPieces(graphics_context, border_image_rect, style, document, + nine_piece_image, image.get(), unzoomed_image_size, + sides_to_include); return true; }
diff --git a/third_party/blink/renderer/core/paint/object_painter.cc b/third_party/blink/renderer/core/paint/object_painter.cc index 991f57a..8b84feaa 100644 --- a/third_party/blink/renderer/core/paint/object_painter.cc +++ b/third_party/blink/renderer/core/paint/object_painter.cc
@@ -43,7 +43,7 @@ return; OutlinePainter::PaintOutlineRects(paint_info, layout_object_, outline_rects, - style_to_use); + style_to_use, layout_object_.GetDocument()); } void ObjectPainter::PaintInlineChildrenOutlines(const PaintInfo& paint_info) {
diff --git a/third_party/blink/renderer/core/paint/outline_painter.cc b/third_party/blink/renderer/core/paint/outline_painter.cc index bad143b..b524fcf5 100644 --- a/third_party/blink/renderer/core/paint/outline_painter.cc +++ b/third_party/blink/renderer/core/paint/outline_painter.cc
@@ -8,6 +8,7 @@ #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/renderer/core/layout/geometry/physical_rect.h" #include "third_party/blink/renderer/core/paint/box_border_painter.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/rounded_border_geometry.h" #include "third_party/blink/renderer/core/style/border_edge.h" @@ -477,7 +478,10 @@ switch (outline_style_) { case EBorderStyle::kSolid: - context_.FillRect(outer_path.getBounds()); + context_.FillRect( + outer_path.getBounds(), + PaintAutoDarkMode(style_, + DarkModeFilter::ElementRole::kBackground)); break; case EBorderStyle::kDouble: PaintDoubleOutline(); @@ -518,10 +522,12 @@ AddCornerRadiiToPath(outer_third_path, outer_third_radii, inner_third_radii); } - context_.FillPath(inner_third_path); + AutoDarkMode auto_dark_mode( + PaintAutoDarkMode(style_, DarkModeFilter::ElementRole::kBackground)); + context_.FillPath(inner_third_path, auto_dark_mode); MakeClipOutPath(outer_third_path); context_.ClipPath(outer_third_path, kAntiAliased); - context_.FillRect(right_angle_outer_path_.getBounds()); + context_.FillRect(right_angle_outer_path_.getBounds(), auto_dark_mode); } void PaintDottedOrDashedOutline() { @@ -537,16 +543,19 @@ } SkPath center_path = CenterPath(); + AutoDarkMode auto_dark_mode( + PaintAutoDarkMode(style_, DarkModeFilter::ElementRole::kBackground)); if (is_rounded_) { - context_.StrokePath(center_path, Path(center_path).length() + width_, - width_); + context_.StrokePath(center_path, auto_dark_mode, + Path(center_path).length() + width_, width_); } else { // Draw edges one by one instead of the whole path to let the corners // have starting/ending dots/dashes. - IterateRightAnglePath(center_path, [this](const Vector<Line>& lines) { - for (const auto& line : lines) - PaintStraightEdge(line); - }); + IterateRightAnglePath(center_path, + [this, &auto_dark_mode](const Vector<Line>& lines) { + for (const auto& line : lines) + PaintStraightEdge(line, auto_dark_mode); + }); } } @@ -585,10 +594,12 @@ absl::optional<RoundedEdgePathIterator> rounded_edge_path_iterator; if (is_rounded_) rounded_edge_path_iterator.emplace(center_path, (width_ + 1) / 2); + AutoDarkMode auto_dark_mode( + PaintAutoDarkMode(style_, DarkModeFilter::ElementRole::kBackground)); IterateRightAnglePath( is_rounded_ ? right_angle_outer_path_ : center_path, - [this, top_left_or_bottom_right, - &rounded_edge_path_iterator](const Vector<Line>& lines) { + [this, top_left_or_bottom_right, &rounded_edge_path_iterator, + &auto_dark_mode](const Vector<Line>& lines) { for (wtf_size_t i = 0; i < lines.size(); i++) { const Line& line = lines[i]; absl::optional<SkPath> rounded_edge_path; @@ -605,9 +616,9 @@ MiterClipPath(prev_line.start, line, next_line.end), kNotAntiAliased); if (is_rounded_) { - context_.StrokePath(*rounded_edge_path); + context_.StrokePath(*rounded_edge_path, auto_dark_mode); } else { - PaintStraightEdge(line); + PaintStraightEdge(line, auto_dark_mode); } } }); @@ -684,7 +695,7 @@ return path; } - void PaintStraightEdge(const Line& line) { + void PaintStraightEdge(const Line& line, const AutoDarkMode& auto_dark_mode) { Line adjusted_line = line; // GraphicsContext::DrawLine requires the line to be top-to-down or // left-to-right get correct interval among dots/dashes. @@ -695,7 +706,8 @@ ExtendLineAtEndpoint(adjusted_line.start, adjusted_line.end, joint_offset); ExtendLineAtEndpoint(adjusted_line.end, adjusted_line.start, joint_offset); context_.DrawLine(RoundedIntPoint(FloatPoint(adjusted_line.start)), - RoundedIntPoint(FloatPoint(adjusted_line.end))); + RoundedIntPoint(FloatPoint(adjusted_line.end)), + auto_dark_mode); } GraphicsContext& context_; @@ -771,7 +783,8 @@ float width, int offset, const FloatRoundedRect::Radii& corner_radii, - const Color& color) { + const Color& color, + const AutoDarkMode& auto_dark_mode) { DCHECK(!rects.IsEmpty()); SkPath path; if (!ComputeRightAnglePath(path, rects, offset, 0)) @@ -780,20 +793,21 @@ SkRect rect; if (path.isRect(&rect)) { context.DrawFocusRingRect(FloatRoundedRect(rect, corner_radii), color, - width); + width, auto_dark_mode); return; } absl::optional<float> corner_radius = corner_radii.UniformRadius(); if (corner_radius.has_value()) { - context.DrawFocusRingPath(path, color, width, *corner_radius); + context.DrawFocusRingPath(path, color, width, *corner_radius, + auto_dark_mode); return; } // Bake non-uniform radii into the path, and draw the path with 0 corner // radius as the path already has rounded corners. AddCornerRadiiToPath(path, corner_radii, corner_radii); - context.DrawFocusRingPath(path, color, width, 0); + context.DrawFocusRingPath(path, color, width, 0, auto_dark_mode); } void PaintFocusRing(GraphicsContext& context, @@ -811,15 +825,17 @@ const int offset = FocusRingOffset(style); Color outer_color = style.DarkColorScheme() ? Color(0x10, 0x10, 0x10) : Color::kWhite; + AutoDarkMode auto_dark_mode( + PaintAutoDarkMode(style, DarkModeFilter::ElementRole::kBackground)); PaintSingleFocusRing(context, rects, outer_ring_width, offset + std::ceil(inner_ring_width), corner_radii, - outer_color); + outer_color, auto_dark_mode); // Draw the inner ring using |outer_ring_width| (which should be wider than // the additional offset of the outer ring) over the outer ring to ensure no // gaps or AA artifacts. DCHECK_GE(outer_ring_width, std::ceil(inner_ring_width)); PaintSingleFocusRing(context, rects, outer_ring_width, offset, corner_radii, - inner_color); + inner_color, auto_dark_mode); } } // anonymous namespace @@ -828,7 +844,8 @@ const PaintInfo& paint_info, const DisplayItemClient& client, const Vector<PhysicalRect>& outline_rects, - const ComputedStyle& style) { + const ComputedStyle& style, + const Document& document) { DCHECK(style.HasOutline()); DCHECK(!outline_rects.IsEmpty()); @@ -863,7 +880,7 @@ if (united_outline_rect == pixel_snapped_outline_rects[0]) { int outline_offset = OutlineOffsetForPainting(style); BoxBorderPainter::PaintSingleRectOutline( - paint_info.context, style, outline_rects[0], + paint_info.context, style, document, outline_rects[0], OutlineWidthForPainting(style), AdjustedOutlineOffsetX(united_outline_rect, outline_offset), AdjustedOutlineOffsetY(united_outline_rect, outline_offset)); @@ -884,7 +901,8 @@ context.DrawFocusRingPath( focus_ring_path.GetSkPath(), style.VisitedDependentColor(GetCSSPropertyOutlineColor()), - FocusRingStrokeWidth(style), DefaultFocusRingCornerRadius(style)); + FocusRingStrokeWidth(style), DefaultFocusRingCornerRadius(style), + PaintAutoDarkMode(style, DarkModeFilter::ElementRole::kBackground)); } int OutlinePainter::OutlineOutsetExtent(const ComputedStyle& style) {
diff --git a/third_party/blink/renderer/core/paint/outline_painter.h b/third_party/blink/renderer/core/paint/outline_painter.h index 8511bf7..5e07c3a 100644 --- a/third_party/blink/renderer/core/paint/outline_painter.h +++ b/third_party/blink/renderer/core/paint/outline_painter.h
@@ -16,6 +16,7 @@ namespace blink { class ComputedStyle; +class Document; class DisplayItemClient; class GraphicsContext; class Path; @@ -29,7 +30,8 @@ static void PaintOutlineRects(const PaintInfo&, const DisplayItemClient&, const Vector<PhysicalRect>&, - const ComputedStyle&); + const ComputedStyle&, + const Document&); static void PaintFocusRingPath(GraphicsContext&, const Path&,
diff --git a/third_party/blink/renderer/core/paint/paint_auto_dark_mode.h b/third_party/blink/renderer/core/paint/paint_auto_dark_mode.h new file mode 100644 index 0000000..728174330 --- /dev/null +++ b/third_party/blink/renderer/core/paint/paint_auto_dark_mode.h
@@ -0,0 +1,55 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_PAINT_AUTO_DARK_MODE_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_PAINT_AUTO_DARK_MODE_H_ + +#include "third_party/blink/renderer/core/frame/settings.h" +#include "third_party/blink/renderer/core/layout/layout_view.h" +#include "third_party/blink/renderer/core/style/computed_style.h" +#include "third_party/blink/renderer/platform/graphics/dark_mode_filter.h" +#include "third_party/blink/renderer/platform/graphics/graphics_context.h" + +namespace blink { + +// TODO(crbug.com/1224806): Remove this and only rely on the ComputedStyle of +// each object. +inline bool AutoDarkModeEnabled(const Document& document) { + if (!document.GetSettings()->GetForceDarkModeEnabled()) + return false; + if (document.GetLayoutView() && + document.GetLayoutView()->StyleRef().DarkColorScheme()) { + return false; + } + return true; +} + +// TODO(crbug.com/1224806): Remove this and only rely on the |ComputedStyle| +// version of this function, rather than relying on |Document|. +inline AutoDarkMode PaintAutoDarkMode(const ComputedStyle& style, + const Document& document, + DarkModeFilter::ElementRole role) { + // TODO(crbug.com/1224806): Use |style.ForceDark()| here. + return AutoDarkMode( + role, AutoDarkModeEnabled(document) && !style.DisableForceDark()); +} + +inline AutoDarkMode PaintAutoDarkMode(const ComputedStyle& style, + DarkModeFilter::ElementRole role) { + // TODO(crbug.com/1224806): Use |style.ForceDark()| here. + // TODO(crbug.com/1224806): Without access to the global setting, this will + // incorrectly disable auto dark mode. + bool auto_dark_mode_enabled = false; + return AutoDarkMode(role, + auto_dark_mode_enabled && !style.DisableForceDark()); +} + +inline AutoDarkMode PaintAutoDarkMode(DarkModeFilter::ElementRole role, + bool auto_dark_mode_enabled) { + return AutoDarkMode(role, auto_dark_mode_enabled); +} + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_PAINT_AUTO_DARK_MODE_H_
diff --git a/third_party/blink/renderer/core/paint/replaced_painter.cc b/third_party/blink/renderer/core/paint/replaced_painter.cc index 7bb90de..3404ab9 100644 --- a/third_party/blink/renderer/core/paint/replaced_painter.cc +++ b/third_party/blink/renderer/core/paint/replaced_painter.cc
@@ -12,6 +12,7 @@ #include "third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h" #include "third_party/blink/renderer/core/paint/highlight_painting_utils.h" #include "third_party/blink/renderer/core/paint/object_painter.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" @@ -208,8 +209,11 @@ Color selection_bg = HighlightPaintingUtils::HighlightBackgroundColor( layout_replaced_.GetDocument(), layout_replaced_.StyleRef(), layout_replaced_.GetNode(), kPseudoIdSelection); - local_paint_info.context.FillRect(selection_painting_int_rect, - selection_bg); + local_paint_info.context.FillRect( + selection_painting_int_rect, selection_bg, + PaintAutoDarkMode(layout_replaced_.StyleRef(), + layout_replaced_.GetDocument(), + DarkModeFilter::ElementRole::kBackground)); } }
diff --git a/third_party/blink/renderer/core/paint/scrollable_area_painter.cc b/third_party/blink/renderer/core/paint/scrollable_area_painter.cc index 089a702..d7b70e46 100644 --- a/third_party/blink/renderer/core/paint/scrollable_area_painter.cc +++ b/third_party/blink/renderer/core/paint/scrollable_area_painter.cc
@@ -11,6 +11,7 @@ #include "third_party/blink/renderer/core/page/page.h" #include "third_party/blink/renderer/core/paint/custom_scrollbar_theme.h" #include "third_party/blink/renderer/core/paint/object_paint_properties.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" @@ -65,7 +66,10 @@ context.SetStrokeColor(Color(217, 217, 217)); context.SetStrokeThickness(1.0f); context.SetFillColor(Color::kTransparent); - context.DrawRect(larger_corner); + AutoDarkMode auto_dark_mode( + PaintAutoDarkMode(box->StyleRef(), box->GetDocument(), + DarkModeFilter::ElementRole::kBackground)); + context.DrawRect(larger_corner, auto_dark_mode); } } @@ -118,13 +122,18 @@ SkPathBuilder line_path; + AutoDarkMode auto_dark_mode( + PaintAutoDarkMode(GetScrollableArea().GetLayoutBox()->StyleRef(), + GetScrollableArea().GetLayoutBox()->GetDocument(), + DarkModeFilter::ElementRole::kBackground)); + // Draw a dark line, to ensure contrast against a light background line_path.moveTo(points[0].X(), points[0].Y()); line_path.lineTo(points[1].X(), points[1].Y()); line_path.moveTo(points[2].X(), points[2].Y()); line_path.lineTo(points[3].X(), points[3].Y()); paint_flags.setColor(SkColorSetARGB(153, 0, 0, 0)); - context.DrawPath(line_path.detach(), paint_flags); + context.DrawPath(line_path.detach(), paint_flags, auto_dark_mode); // Draw a light line one pixel below the light line, // to ensure contrast against a dark background @@ -133,7 +142,7 @@ line_path.moveTo(points[2].X(), points[2].Y() + 1); line_path.lineTo(points[3].X() + (on_left ? -1 : 1), points[3].Y()); paint_flags.setColor(SkColorSetARGB(153, 255, 255, 255)); - context.DrawPath(line_path.detach(), paint_flags); + context.DrawPath(line_path.detach(), paint_flags, auto_dark_mode); } void ScrollableAreaPainter::PaintOverflowControls(
diff --git a/third_party/blink/renderer/core/paint/svg_image_painter.cc b/third_party/blink/renderer/core/paint/svg_image_painter.cc index 944feb5..fa19ba0 100644 --- a/third_party/blink/renderer/core/paint/svg_image_painter.cc +++ b/third_party/blink/renderer/core/paint/svg_image_painter.cc
@@ -8,6 +8,7 @@ #include "third_party/blink/renderer/core/layout/layout_image_resource.h" #include "third_party/blink/renderer/core/layout/svg/layout_svg_image.h" #include "third_party/blink/renderer/core/paint/image_element_timing.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/paint_timing.h" #include "third_party/blink/renderer/core/paint/paint_timing_detector.h" @@ -87,9 +88,12 @@ layout_svg_image_.StyleRef().GetInterpolationQuality()); Image::ImageDecodingMode decode_mode = image_element->GetDecodingModeForPainting(image->paint_image_id()); - paint_info.context.DrawImage(image.get(), decode_mode, dest_rect, &src_rect, - layout_svg_image_.StyleRef().DisableForceDark(), - SkBlendMode::kSrcOver, respect_orientation); + paint_info.context.DrawImage( + image.get(), decode_mode, + PaintAutoDarkMode(layout_svg_image_.StyleRef(), + layout_svg_image_.GetDocument(), + DarkModeFilter::ElementRole::kSVG), + dest_rect, &src_rect, SkBlendMode::kSrcOver, respect_orientation); ImageResourceContent* image_content = image_resource.CachedImage(); if (image_content->IsLoaded()) {
diff --git a/third_party/blink/renderer/core/paint/svg_inline_text_box_painter.cc b/third_party/blink/renderer/core/paint/svg_inline_text_box_painter.cc index c1b5372..09e6339 100644 --- a/third_party/blink/renderer/core/paint/svg_inline_text_box_painter.cc +++ b/third_party/blink/renderer/core/paint/svg_inline_text_box_painter.cc
@@ -21,6 +21,7 @@ #include "third_party/blink/renderer/core/layout/svg/svg_resources.h" #include "third_party/blink/renderer/core/paint/highlight_painting_utils.h" #include "third_party/blink/renderer/core/paint/inline_text_box_painter.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/paint_timing.h" #include "third_party/blink/renderer/core/paint/paint_timing_detector.h" @@ -279,7 +280,9 @@ svg_inline_text_box_.SelectionRectForTextFragment( fragment, fragment_with_range.start_position, fragment_with_range.end_position, style), - background_color); + background_color, + PaintAutoDarkMode(style, layout_item.GetDocument(), + DarkModeFilter::ElementRole::kSVG)); } } @@ -374,6 +377,10 @@ FloatRect(decoration_origin, FloatSize(fragment.width, thickness / scaling_factor))); + AutoDarkMode auto_dark_mode(PaintAutoDarkMode( + decoration_style, decoration_layout_object->GetDocument(), + DarkModeFilter::ElementRole::kSVG)); + for (int i = 0; i < 3; i++) { switch (decoration_style.PaintOrderType(i)) { case PT_FILL: @@ -387,7 +394,8 @@ break; } fill_flags.setAntiAlias(true); - paint_info.context.DrawPath(path.GetSkPath(), fill_flags); + paint_info.context.DrawPath(path.GetSkPath(), fill_flags, + auto_dark_mode); } break; case PT_STROKE: @@ -413,7 +421,8 @@ stroke_data.SetThickness(stroke_data.Thickness() * stroke_scale_factor); stroke_data.SetupPaint(&stroke_flags); - paint_info.context.DrawPath(path.GetSkPath(), stroke_flags); + paint_info.context.DrawPath(path.GetSkPath(), stroke_flags, + auto_dark_mode); } break; case PT_MARKERS: @@ -509,7 +518,10 @@ text_run_paint_info.to = end_position; context.DrawText(scaled_font, text_run_paint_info, text_origin, flags, - text_layout_object.EnsureNodeId()); + text_layout_object.EnsureNodeId(), + PaintAutoDarkMode(text_layout_object.StyleRef(), + text_layout_object.GetDocument(), + DarkModeFilter::ElementRole::kSVG)); // TODO(npm): Check that there are non-whitespace characters. See // crbug.com/788444. context.GetPaintController().SetTextPainted(); @@ -744,7 +756,10 @@ fragment, text_match_info.start_position, text_match_info.end_position, style); paint_info.context.SetFillColor(color); - paint_info.context.FillRect(fragment_rect); + paint_info.context.FillRect( + fragment_rect, + PaintAutoDarkMode(style, InlineLayoutObject().GetDocument(), + DarkModeFilter::ElementRole::kSVG)); } }
diff --git a/third_party/blink/renderer/core/paint/svg_shape_painter.cc b/third_party/blink/renderer/core/paint/svg_shape_painter.cc index 96fc730..6669561 100644 --- a/third_party/blink/renderer/core/paint/svg_shape_painter.cc +++ b/third_party/blink/renderer/core/paint/svg_shape_painter.cc
@@ -10,6 +10,7 @@ #include "third_party/blink/renderer/core/layout/svg/svg_layout_support.h" #include "third_party/blink/renderer/core/layout/svg/svg_marker_data.h" #include "third_party/blink/renderer/core/layout/svg/svg_resources.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/paint_timing.h" #include "third_party/blink/renderer/core/paint/scoped_svg_paint_state.h" @@ -152,20 +153,22 @@ void SVGShapePainter::FillShape(GraphicsContext& context, const PaintFlags& flags, SkPathFillType fill_type) { + AutoDarkMode auto_dark_mode(PaintAutoDarkMode( + layout_svg_shape_.StyleRef(), layout_svg_shape_.GetDocument(), + DarkModeFilter::ElementRole::kSVG)); switch (layout_svg_shape_.GeometryCodePath()) { case kRectGeometryFastPath: context.DrawRect(layout_svg_shape_.ObjectBoundingBox(), flags, - DarkModeFilter::ElementRole::kSVG); + auto_dark_mode); break; case kEllipseGeometryFastPath: context.DrawOval(layout_svg_shape_.ObjectBoundingBox(), flags, - DarkModeFilter::ElementRole::kSVG); + auto_dark_mode); break; default: { PathWithTemporaryWindingRule path_with_winding( layout_svg_shape_.GetPath(), fill_type); - context.DrawPath(path_with_winding.GetSkPath(), flags, - DarkModeFilter::ElementRole::kSVG); + context.DrawPath(path_with_winding.GetSkPath(), flags, auto_dark_mode); } } PaintTiming& timing = PaintTiming::From(layout_svg_shape_.GetDocument()); @@ -176,22 +179,25 @@ const PaintFlags& flags) { DCHECK(layout_svg_shape_.StyleRef().HasVisibleStroke()); + AutoDarkMode auto_dark_mode(PaintAutoDarkMode( + layout_svg_shape_.StyleRef(), layout_svg_shape_.GetDocument(), + DarkModeFilter::ElementRole::kSVG)); + switch (layout_svg_shape_.GeometryCodePath()) { case kRectGeometryFastPath: context.DrawRect(layout_svg_shape_.ObjectBoundingBox(), flags, - DarkModeFilter::ElementRole::kSVG); + auto_dark_mode); break; case kEllipseGeometryFastPath: context.DrawOval(layout_svg_shape_.ObjectBoundingBox(), flags, - DarkModeFilter::ElementRole::kSVG); + auto_dark_mode); break; default: DCHECK(layout_svg_shape_.HasPath()); const Path* use_path = &layout_svg_shape_.GetPath(); if (layout_svg_shape_.HasNonScalingStroke()) use_path = &layout_svg_shape_.NonScalingStrokePath(); - context.DrawPath(use_path->GetSkPath(), flags, - DarkModeFilter::ElementRole::kSVG); + context.DrawPath(use_path->GetSkPath(), flags, auto_dark_mode); } PaintTiming& timing = PaintTiming::From(layout_svg_shape_.GetDocument()); timing.MarkFirstContentfulPaint();
diff --git a/third_party/blink/renderer/core/paint/text_painter.cc b/third_party/blink/renderer/core/paint/text_painter.cc index bf3fcd5..e854dc9 100644 --- a/third_party/blink/renderer/core/paint/text_painter.cc +++ b/third_party/blink/renderer/core/paint/text_painter.cc
@@ -30,31 +30,34 @@ unsigned end_offset, unsigned length, const TextPaintStyle& text_style, - DOMNodeId node_id) { + DOMNodeId node_id, + const AutoDarkMode& auto_dark_mode) { GraphicsContextStateSaver state_saver(graphics_context_, false); UpdateGraphicsContext(text_style, state_saver); if (combined_text_) { graphics_context_.Save(); combined_text_->TransformToInlineCoordinates(graphics_context_, text_frame_rect_); - PaintInternal<kPaintText>(start_offset, end_offset, length, node_id); + PaintInternal<kPaintText>(start_offset, end_offset, length, node_id, + auto_dark_mode); graphics_context_.Restore(); } else { - PaintInternal<kPaintText>(start_offset, end_offset, length, node_id); + PaintInternal<kPaintText>(start_offset, end_offset, length, node_id, + auto_dark_mode); } if (!emphasis_mark_.IsEmpty()) { if (combined_text_) { graphics_context_.ConcatCTM(Rotation(text_frame_rect_, kClockwise)); - PaintEmphasisMarkForCombinedText(text_style, - combined_text_->OriginalFont()); + PaintEmphasisMarkForCombinedText( + text_style, combined_text_->OriginalFont(), auto_dark_mode); graphics_context_.ConcatCTM( Rotation(text_frame_rect_, kCounterclockwise)); } else { if (text_style.emphasis_mark_color != text_style.fill_color) graphics_context_.SetFillColor(text_style.emphasis_mark_color); PaintInternal<kPaintEmphasisMark>(start_offset, end_offset, length, - node_id); + node_id, auto_dark_mode); } } } @@ -200,7 +203,8 @@ void TextPainter::PaintInternalRun(TextRunPaintInfo& text_run_paint_info, unsigned from, unsigned to, - DOMNodeId node_id) { + DOMNodeId node_id, + const AutoDarkMode& auto_dark_mode) { DCHECK(from <= text_run_paint_info.run.length()); DCHECK(to <= text_run_paint_info.run.length()); @@ -210,11 +214,13 @@ if (step == kPaintEmphasisMark) { graphics_context_.DrawEmphasisMarks( font_, text_run_paint_info, emphasis_mark_, - FloatPoint(text_origin_) + IntSize(0, emphasis_mark_offset_)); + FloatPoint(text_origin_) + IntSize(0, emphasis_mark_offset_), + auto_dark_mode); } else { DCHECK(step == kPaintText); graphics_context_.DrawText(font_, text_run_paint_info, - FloatPoint(text_origin_), node_id); + FloatPoint(text_origin_), node_id, + auto_dark_mode); } } @@ -222,19 +228,20 @@ void TextPainter::PaintInternal(unsigned start_offset, unsigned end_offset, unsigned truncation_point, - DOMNodeId node_id) { + DOMNodeId node_id, + const AutoDarkMode& auto_dark_mode) { TextRunPaintInfo text_run_paint_info(run_); if (start_offset <= end_offset) { PaintInternalRun<Step>(text_run_paint_info, start_offset, end_offset, - node_id); + node_id, auto_dark_mode); } else { if (end_offset > 0) { PaintInternalRun<Step>(text_run_paint_info, ellipsis_offset_, end_offset, - node_id); + node_id, auto_dark_mode); } if (start_offset < truncation_point) { PaintInternalRun<Step>(text_run_paint_info, start_offset, - truncation_point, node_id); + truncation_point, node_id, auto_dark_mode); } } }
diff --git a/third_party/blink/renderer/core/paint/text_painter.h b/third_party/blink/renderer/core/paint/text_painter.h index 232c67d..09730d36 100644 --- a/third_party/blink/renderer/core/paint/text_painter.h +++ b/third_party/blink/renderer/core/paint/text_painter.h
@@ -46,7 +46,8 @@ unsigned end_offset, unsigned length, const TextPaintStyle&, - DOMNodeId node_id); + DOMNodeId node_id, + const AutoDarkMode& auto_dark_mode); void PaintDecorationsExceptLineThrough(const TextDecorationOffsetBase&, TextDecorationInfo&, @@ -64,13 +65,15 @@ void PaintInternalRun(TextRunPaintInfo&, unsigned from, unsigned to, - DOMNodeId node_id); + DOMNodeId node_id, + const AutoDarkMode& auto_dark_mode); template <PaintInternalStep step> void PaintInternal(unsigned start_offset, unsigned end_offset, unsigned truncation_point, - DOMNodeId node_id); + DOMNodeId node_id, + const AutoDarkMode& auto_dark_mode); const TextRun& run_; LayoutTextCombine* combined_text_ = nullptr;
diff --git a/third_party/blink/renderer/core/paint/text_painter_base.cc b/third_party/blink/renderer/core/paint/text_painter_base.cc index eae7188..e4e05b2 100644 --- a/third_party/blink/renderer/core/paint/text_painter_base.cc +++ b/third_party/blink/renderer/core/paint/text_painter_base.cc
@@ -370,7 +370,8 @@ void TextPainterBase::PaintEmphasisMarkForCombinedText( const TextPaintStyle& text_style, - const Font& emphasis_mark_font) { + const Font& emphasis_mark_font, + const AutoDarkMode& auto_dark_mode) { DCHECK(emphasis_mark_font.GetFontDescription().IsVerticalBaseline()); DCHECK(emphasis_mark_); const SimpleFontData* const font_data = font_.PrimaryFont(); @@ -390,8 +391,8 @@ text_frame_rect_.Y().ToFloat() + font_ascent + emphasis_mark_offset_); const TextRunPaintInfo text_run_paint_info(placeholder_text_run); graphics_context_.DrawEmphasisMarks(emphasis_mark_font, text_run_paint_info, - emphasis_mark_, - emphasis_mark_text_origin); + emphasis_mark_, emphasis_mark_text_origin, + auto_dark_mode); } } // namespace blink
diff --git a/third_party/blink/renderer/core/paint/text_painter_base.h b/third_party/blink/renderer/core/paint/text_painter_base.h index d1a599b..6524cdb 100644 --- a/third_party/blink/renderer/core/paint/text_painter_base.h +++ b/third_party/blink/renderer/core/paint/text_painter_base.h
@@ -21,6 +21,7 @@ namespace blink { +struct AutoDarkMode; class ComputedStyle; class Document; class GraphicsContext; @@ -120,7 +121,8 @@ // TODO(yosin): Once legacy inline layout gone, we should move this function // to |NGTextCombinePainter|. void PaintEmphasisMarkForCombinedText(const TextPaintStyle& text_style, - const Font& emphasis_mark_font); + const Font& emphasis_mark_font, + const AutoDarkMode& auto_dark_mode); enum PaintInternalStep { kPaintText, kPaintEmphasisMark };
diff --git a/third_party/blink/renderer/core/paint/theme_painter.cc b/third_party/blink/renderer/core/paint/theme_painter.cc index 9ef1c2346e..8a4ea773 100644 --- a/third_party/blink/renderer/core/paint/theme_painter.cc +++ b/third_party/blink/renderer/core/paint/theme_painter.cc
@@ -35,6 +35,7 @@ #include "third_party/blink/renderer/core/input_type_names.h" #include "third_party/blink/renderer/core/layout/layout_theme.h" #include "third_party/blink/renderer/core/layout/layout_view.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/style/computed_style.h" #include "third_party/blink/renderer/platform/graphics/graphics_context_state_saver.h" @@ -364,8 +365,10 @@ tick_rect.SetX(tick_position); else tick_rect.SetY(tick_position); - paint_info.context.FillRect(tick_rect, - o.ResolveColor(GetCSSPropertyColor())); + paint_info.context.FillRect( + tick_rect, o.ResolveColor(GetCSSPropertyColor()), + PaintAutoDarkMode(o.StyleRef(), o.GetDocument(), + DarkModeFilter::ElementRole::kBackground)); } }
diff --git a/third_party/blink/renderer/core/paint/theme_painter_default.cc b/third_party/blink/renderer/core/paint/theme_painter_default.cc index 8749386..257a330 100644 --- a/third_party/blink/renderer/core/paint/theme_painter_default.cc +++ b/third_party/blink/renderer/core/paint/theme_painter_default.cc
@@ -36,6 +36,7 @@ #include "third_party/blink/renderer/core/layout/layout_object.h" #include "third_party/blink/renderer/core/layout/layout_progress.h" #include "third_party/blink/renderer/core/layout/layout_theme_default.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/platform/graphics/color.h" #include "third_party/blink/renderer/platform/graphics/graphics_context.h" @@ -150,13 +151,16 @@ return PixelSnappedIntRect(part_rect); } +// TODO(crbug.com/1224806): Remove |element| and just check the computed style +// for whether auto dark mode is enabled. mojom::blink::ColorScheme GetColorScheme(const PaintInfo& paint_info, - const ComputedStyle& style) { - bool enable_force_dark = - paint_info.context.IsDarkModeEnabled() && !style.DisableForceDark(); + const ComputedStyle& style, + const Element& element) { mojom::blink::ColorScheme color_scheme = style.UsedColorScheme(); - if (color_scheme == mojom::blink::ColorScheme::kLight && enable_force_dark) + if (color_scheme == mojom::blink::ColorScheme::kLight && + AutoDarkModeEnabled(element.GetDocument())) { return mojom::blink::ColorScheme::kDark; + } return color_scheme; } @@ -201,7 +205,7 @@ Platform::Current()->ThemeEngine()->Paint( paint_info.context.Canvas(), WebThemeEngine::kPartCheckbox, GetWebThemeState(element), unzoomed_rect, &extra_params, - GetColorScheme(paint_info, style), GetAccentColor(style)); + GetColorScheme(paint_info, style, element), GetAccentColor(style)); return false; } @@ -223,7 +227,7 @@ Platform::Current()->ThemeEngine()->Paint( paint_info.context.Canvas(), WebThemeEngine::kPartRadio, GetWebThemeState(element), unzoomed_rect, &extra_params, - GetColorScheme(paint_info, style), GetAccentColor(style)); + GetColorScheme(paint_info, style, element), GetAccentColor(style)); return false; } @@ -245,7 +249,7 @@ Platform::Current()->ThemeEngine()->Paint( paint_info.context.Canvas(), WebThemeEngine::kPartButton, GetWebThemeState(element), rect, &extra_params, - GetColorScheme(paint_info, style), GetAccentColor(style)); + GetColorScheme(paint_info, style, element), GetAccentColor(style)); return false; } @@ -275,7 +279,7 @@ Platform::Current()->ThemeEngine()->Paint( paint_info.context.Canvas(), WebThemeEngine::kPartTextField, GetWebThemeState(element), rect, &extra_params, - GetColorScheme(paint_info, style), GetAccentColor(style)); + GetColorScheme(paint_info, style, element), GetAccentColor(style)); return false; } @@ -310,7 +314,7 @@ Platform::Current()->ThemeEngine()->Paint( paint_info.context.Canvas(), WebThemeEngine::kPartMenuList, GetWebThemeState(element), rect, &extra_params, - GetColorScheme(paint_info, style), GetAccentColor(style)); + GetColorScheme(paint_info, style, element), GetAccentColor(style)); return false; } @@ -329,7 +333,7 @@ Platform::Current()->ThemeEngine()->Paint( paint_info.context.Canvas(), WebThemeEngine::kPartMenuList, GetWebThemeState(element), rect, &extra_params, - GetColorScheme(paint_info, style), GetAccentColor(style)); + GetColorScheme(paint_info, style, element), GetAccentColor(style)); return false; } @@ -398,7 +402,7 @@ Platform::Current()->ThemeEngine()->Paint( paint_info.context.Canvas(), WebThemeEngine::kPartSliderTrack, GetWebThemeState(element), rect, &extra_params, - GetColorScheme(paint_info, style), GetAccentColor(style)); + GetColorScheme(paint_info, style, element), GetAccentColor(style)); return false; } @@ -425,7 +429,7 @@ Platform::Current()->ThemeEngine()->Paint( paint_info.context.Canvas(), WebThemeEngine::kPartSliderThumb, GetWebThemeState(element), rect, &extra_params, - GetColorScheme(paint_info, style), accent_color); + GetColorScheme(paint_info, style, element), accent_color); return false; } @@ -451,7 +455,7 @@ Platform::Current()->ThemeEngine()->Paint( paint_info.context.Canvas(), WebThemeEngine::kPartInnerSpinButton, GetWebThemeState(element), rect, &extra_params, - GetColorScheme(paint_info, style), GetAccentColor(style)); + GetColorScheme(paint_info, style, element), GetAccentColor(style)); return false; } @@ -478,7 +482,7 @@ Platform::Current()->ThemeEngine()->Paint( paint_info.context.Canvas(), WebThemeEngine::kPartProgressBar, GetWebThemeState(element), rect, &extra_params, - GetColorScheme(paint_info, style), GetAccentColor(style)); + GetColorScheme(paint_info, style, element), GetAccentColor(style)); return false; } @@ -574,7 +578,11 @@ To<Element>(cancel_button_object.GetNode())->IsActive() ? color_scheme_adjusted_cancel_pressed_image : color_scheme_adjusted_cancel_image, - Image::kSyncDecode, FloatRect(painting_rect)); + Image::kSyncDecode, + PaintAutoDarkMode(cancel_button_object.StyleRef(), + cancel_button_object.GetDocument(), + DarkModeFilter::ElementRole::kBackground), + FloatRect(painting_rect)); return false; }
diff --git a/third_party/blink/renderer/core/paint/view_painter.cc b/third_party/blink/renderer/core/paint/view_painter.cc index f6d9a6e9..6530879 100644 --- a/third_party/blink/renderer/core/paint/view_painter.cc +++ b/third_party/blink/renderer/core/paint/view_painter.cc
@@ -16,6 +16,7 @@ #include "third_party/blink/renderer/core/paint/box_model_object_painter.h" #include "third_party/blink/renderer/core/paint/box_painter.h" #include "third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" @@ -64,6 +65,8 @@ pixel_snapped_background_rect); context.FillRect( pixel_snapped_background_rect, base_background_color, + PaintAutoDarkMode(layout_view_.StyleRef(), document, + DarkModeFilter::ElementRole::kBackground), should_clear_canvas ? SkBlendMode::kSrc : SkBlendMode::kSrcOver); } } @@ -265,11 +268,15 @@ if (paints_base_background || root_element_background_color.Alpha() || layout_view_.StyleRef().BackgroundLayers().AnyLayerHasImage()) { context.FillRect(pixel_snapped_background_rect, Color::kWhite, - SkBlendMode::kSrc); + AutoDarkMode::Disabled(), SkBlendMode::kSrc); } return; } + AutoDarkMode auto_dark_mode( + PaintAutoDarkMode(layout_view_.StyleRef(), document, + DarkModeFilter::ElementRole::kBackground)); + // Compute the enclosing rect of the view, in root element space. // // For background colors we can simply paint the document rect in the default @@ -312,9 +319,10 @@ if (base_background_color.Alpha()) { context.FillRect( pixel_snapped_background_rect, base_background_color, + auto_dark_mode, should_clear_canvas ? SkBlendMode::kSrc : SkBlendMode::kSrcOver); } else if (should_clear_canvas) { - context.FillRect(pixel_snapped_background_rect, Color(), + context.FillRect(pixel_snapped_background_rect, Color(), auto_dark_mode, SkBlendMode::kClear); } } @@ -353,7 +361,7 @@ if (should_draw_background_in_separate_buffer && !painted_separate_effect) { if (base_background_color.Alpha()) { context.FillRect( - paint_rect, base_background_color, + paint_rect, base_background_color, auto_dark_mode, should_clear_canvas ? SkBlendMode::kSrc : SkBlendMode::kSrcOver); } context.BeginLayer(); @@ -369,13 +377,13 @@ if (combined_background_color.Alpha()) { context.FillRect( - paint_rect, combined_background_color, + paint_rect, combined_background_color, auto_dark_mode, (should_draw_background_in_separate_buffer || should_clear_canvas) ? SkBlendMode::kSrc : SkBlendMode::kSrcOver); } else if (should_clear_canvas && !should_draw_background_in_separate_buffer) { - context.FillRect(paint_rect, Color(), SkBlendMode::kClear); + context.FillRect(paint_rect, Color(), auto_dark_mode, SkBlendMode::kClear); } BackgroundImageGeometry geometry(layout_view_, background_image_offset);
diff --git a/third_party/blink/renderer/core/scroll/scrollbar_theme.cc b/third_party/blink/renderer/core/scroll/scrollbar_theme.cc index e27d2cd..370beb4 100644 --- a/third_party/blink/renderer/core/scroll/scrollbar_theme.cc +++ b/third_party/blink/renderer/core/scroll/scrollbar_theme.cc
@@ -118,7 +118,7 @@ DrawingRecorder recorder(context, display_item_client, DisplayItem::kScrollCorner, corner_rect); #if defined(OS_MAC) - context.FillRect(corner_rect, Color::kWhite); + context.FillRect(corner_rect, Color::kWhite, AutoDarkMode::Disabled()); #else Platform::Current()->ThemeEngine()->Paint( context.Canvas(), WebThemeEngine::kPartScrollbarCorner, @@ -160,11 +160,13 @@ const int y_pos = rect.Y() + (rect.Height() * percent); FloatRect tick_rect(rect.X(), y_pos, rect.Width(), 3); - context.FillRect(tick_rect, Color(0xB0, 0x60, 0x00, 0xFF)); + context.FillRect(tick_rect, Color(0xB0, 0x60, 0x00, 0xFF), + AutoDarkMode::Disabled()); FloatRect tick_stroke(rect.X() + TickmarkBorderWidth(), y_pos + 1, rect.Width() - 2 * TickmarkBorderWidth(), 1); - context.FillRect(tick_stroke, Color(0xFF, 0xDD, 0x00, 0xFF)); + context.FillRect(tick_stroke, Color(0xFF, 0xDD, 0x00, 0xFF), + AutoDarkMode::Disabled()); } #endif }
diff --git a/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay_mobile.cc b/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay_mobile.cc index 7532efef..373852f 100644 --- a/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay_mobile.cc +++ b/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay_mobile.cc
@@ -6,6 +6,9 @@ #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/web_theme_engine.h" +#include "third_party/blink/renderer/core/layout/layout_box.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" +#include "third_party/blink/renderer/core/scroll/scrollable_area.h" #include "third_party/blink/renderer/core/scroll/scrollbar.h" #include "third_party/blink/renderer/core/scroll/scrollbar_theme_overlay_mock.h" #include "third_party/blink/renderer/platform/graphics/graphics_context.h" @@ -68,7 +71,12 @@ DrawingRecorder recorder(context, scrollbar, DisplayItem::kScrollbarThumb, rect); - context.FillRect(rect, color_); + + const auto* box = scrollbar.GetScrollableArea()->GetLayoutBox(); + AutoDarkMode auto_dark_mode( + PaintAutoDarkMode(box->StyleRef(), box->GetDocument(), + DarkModeFilter::ElementRole::kBackground)); + context.FillRect(rect, color_, auto_dark_mode); } } // namespace blink
diff --git a/third_party/blink/renderer/core/svg/graphics/svg_image.cc b/third_party/blink/renderer/core/svg/graphics/svg_image.cc index fb19d56..36bd2429 100644 --- a/third_party/blink/renderer/core/svg/graphics/svg_image.cc +++ b/third_party/blink/renderer/core/svg/graphics/svg_image.cc
@@ -53,6 +53,7 @@ #include "third_party/blink/renderer/core/layout/layout_view.h" #include "third_party/blink/renderer/core/layout/svg/layout_svg_root.h" #include "third_party/blink/renderer/core/loader/frame_load_request.h" +#include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" #include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/style/computed_style.h" #include "third_party/blink/renderer/core/svg/animation/smil_time_container.h" @@ -447,7 +448,9 @@ // Reset filter quality. flags.setFilterQuality(cc::PaintFlags::FilterQuality::kNone); - context.DrawRect(dst_rect, flags); + context.DrawRect(dst_rect, flags, + PaintAutoDarkMode(DarkModeFilter::ElementRole::kSVG, + draw_info.IsDarkModeEnabled())); StartAnimation(); } @@ -543,8 +546,9 @@ // avoid setting timers from the latter. FlushPendingTimelineRewind(); + page_->GetSettings().SetForceDarkModeEnabled(draw_info.IsDarkModeEnabled()); + if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled()) { - page_->GetSettings().SetForceDarkModeEnabled(draw_info.IsDarkModeEnabled()); view->UpdateAllLifecyclePhases(DocumentUpdateReason::kSVGImage); return view->GetPaintRecord(); } @@ -557,8 +561,8 @@ view->UpdateAllLifecyclePhasesExceptPaint(DocumentUpdateReason::kSVGImage); PaintController::CycleScope cycle_scope(*paint_controller_, view->PaintDebugInfoEnabled()); + auto* builder = MakeGarbageCollected<PaintRecordBuilder>(*paint_controller_); - builder->Context().SetDarkModeEnabled(draw_info.IsDarkModeEnabled()); view->PaintOutsideOfLifecycle(builder->Context(), kGlobalPaintNormalPhase); return builder->EndRecording(); }
diff --git a/third_party/blink/renderer/modules/compute_pressure/compute_pressure_observer.idl b/third_party/blink/renderer/modules/compute_pressure/compute_pressure_observer.idl index cd3cda57..3f3c345c 100644 --- a/third_party/blink/renderer/modules/compute_pressure/compute_pressure_observer.idl +++ b/third_party/blink/renderer/modules/compute_pressure/compute_pressure_observer.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://github.com/oyiptong/compute-pressure/ +// https://github.com/wicg/compute-pressure/ [ Exposed=Window, RuntimeEnabled=ComputePressure,
diff --git a/third_party/blink/renderer/modules/compute_pressure/compute_pressure_observer_options.idl b/third_party/blink/renderer/modules/compute_pressure/compute_pressure_observer_options.idl index 42e1bf5c4..5c95bc54 100644 --- a/third_party/blink/renderer/modules/compute_pressure/compute_pressure_observer_options.idl +++ b/third_party/blink/renderer/modules/compute_pressure/compute_pressure_observer_options.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://github.com/oyiptong/compute-pressure/ +// https://github.com/wicg/compute-pressure/ [ Exposed=Window, SecureContext
diff --git a/third_party/blink/renderer/modules/compute_pressure/compute_pressure_observer_update.idl b/third_party/blink/renderer/modules/compute_pressure/compute_pressure_observer_update.idl index 61071f3..dfe95bfa3 100644 --- a/third_party/blink/renderer/modules/compute_pressure/compute_pressure_observer_update.idl +++ b/third_party/blink/renderer/modules/compute_pressure/compute_pressure_observer_update.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://github.com/oyiptong/compute-pressure/ +// https://github.com/wicg/compute-pressure/ [ Exposed=Window,
diff --git a/third_party/blink/renderer/modules/compute_pressure/compute_pressure_update_callback.idl b/third_party/blink/renderer/modules/compute_pressure/compute_pressure_update_callback.idl index e2473fc..2cd27ccb 100644 --- a/third_party/blink/renderer/modules/compute_pressure/compute_pressure_update_callback.idl +++ b/third_party/blink/renderer/modules/compute_pressure/compute_pressure_update_callback.idl
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://github.com/oyiptong/compute-pressure/ +// https://github.com/wicg/compute-pressure/ [ Exposed=Window, RuntimeEnabled=ComputePressure,
diff --git a/third_party/blink/renderer/modules/sensor/sensor_proxy.cc b/third_party/blink/renderer/modules/sensor/sensor_proxy.cc index 2a15354..286c56d 100644 --- a/third_party/blink/renderer/modules/sensor/sensor_proxy.cc +++ b/third_party/blink/renderer/modules/sensor/sensor_proxy.cc
@@ -27,10 +27,9 @@ : PageVisibilityObserver(page), FocusChangedObserver(page), type_(sensor_type), - state_(SensorProxy::kUninitialized), provider_(provider) {} -SensorProxy::~SensorProxy() {} +SensorProxy::~SensorProxy() = default; void SensorProxy::Trace(Visitor* visitor) const { visitor->Trace(observers_);
diff --git a/third_party/blink/renderer/modules/webcodecs/parsed_copy_to_options.cc b/third_party/blink/renderer/modules/webcodecs/parsed_copy_to_options.cc index 1775062..6667087 100644 --- a/third_party/blink/renderer/modules/webcodecs/parsed_copy_to_options.cc +++ b/third_party/blink/renderer/modules/webcodecs/parsed_copy_to_options.cc
@@ -76,10 +76,12 @@ gfx::Size sample_size = media::VideoFrame::SampleSize(format, i); uint32_t sample_bytes = media::VideoFrame::BytesPerElement(format, i); + planes[i].left = rect.x() / sample_size.width(); planes[i].top = rect.y() / sample_size.height(); + planes[i].width = rect.width() / sample_size.width(); planes[i].height = rect.height() / sample_size.height(); - planes[i].left_bytes = rect.x() / sample_size.width() * sample_bytes; - planes[i].width_bytes = rect.width() / sample_size.width() * sample_bytes; + planes[i].left_bytes = planes[i].left * sample_bytes; + planes[i].width_bytes = planes[i].width * sample_bytes; // If an explicit layout was not provided, planes and rows are tightly // packed.
diff --git a/third_party/blink/renderer/modules/webcodecs/parsed_copy_to_options.h b/third_party/blink/renderer/modules/webcodecs/parsed_copy_to_options.h index 2e4d1f5..b93ba33 100644 --- a/third_party/blink/renderer/modules/webcodecs/parsed_copy_to_options.h +++ b/third_party/blink/renderer/modules/webcodecs/parsed_copy_to_options.h
@@ -24,18 +24,18 @@ ExceptionState&); struct Plane { - // Offset in destination buffer. + // Offset and stride in destination buffer. uint32_t offset = 0; - // Stride in destination buffer. uint32_t stride = 0; - // Crop top, in samples. + // Crop, in samples. + uint32_t left = 0; uint32_t top = 0; - // Crop height, in samples. uint32_t height = 0; - // Crop left, in bytes. + uint32_t width = 0; + + // Crop, in bytes. uint32_t left_bytes = 0; - // Crop width, in bytes (aka row_bytes). uint32_t width_bytes = 0; };
diff --git a/third_party/blink/renderer/modules/webcodecs/video_frame.cc b/third_party/blink/renderer/modules/webcodecs/video_frame.cc index a1beebf..005dd038 100644 --- a/third_party/blink/renderer/modules/webcodecs/video_frame.cc +++ b/third_party/blink/renderer/modules/webcodecs/video_frame.cc
@@ -170,28 +170,89 @@ const base::TimeDelta CachedVideoFramePool::kIdleTimeout = base::TimeDelta::FromSeconds(10); -bool IsSupportedPlanarFormat(const media::VideoFrame& frame) { - if (!frame.IsMappable() && !frame.HasGpuMemoryBuffer()) - return false; +absl::optional<media::VideoPixelFormat> CopyToFormat( + const media::VideoFrame& frame) { + const bool mappable = frame.IsMappable() || frame.HasGpuMemoryBuffer(); + const bool texturable = frame.HasTextures(); + if (!(mappable || texturable)) + return absl::nullopt; - const size_t num_planes = frame.layout().num_planes(); + const size_t num_planes = + mappable ? frame.layout().num_planes() : frame.NumTextures(); + switch (frame.format()) { case media::PIXEL_FORMAT_I420: + case media::PIXEL_FORMAT_I420A: case media::PIXEL_FORMAT_I422: case media::PIXEL_FORMAT_I444: - return num_planes == 3; - case media::PIXEL_FORMAT_I420A: - return num_planes == 4; - case media::PIXEL_FORMAT_NV12: - return num_planes == 2; case media::PIXEL_FORMAT_XBGR: - case media::PIXEL_FORMAT_XRGB: case media::PIXEL_FORMAT_ABGR: + case media::PIXEL_FORMAT_XRGB: case media::PIXEL_FORMAT_ARGB: - return num_planes == 1; + break; + case media::PIXEL_FORMAT_NV12: + // Single-texture NV12 is sampled as RGBA even though the underlying + // graphics buffer is NV12. + if (!mappable && num_planes == 1) + return media::PIXEL_FORMAT_XRGB; + break; default: - return false; + return absl::nullopt; } + + // Make sure layout() is as expected before committing to being able to read + // back pixels. + if (num_planes != media::VideoFrame::NumPlanes(frame.format())) + return absl::nullopt; + + return frame.format(); +} + +void CopyMappablePlanes(const media::VideoFrame& src_frame, + const ParsedCopyToOptions& layout, + base::span<uint8_t> dest_buffer) { + for (wtf_size_t i = 0; i < layout.num_planes; i++) { + const uint8_t* src = src_frame.data(i) + + layout.planes[i].top * src_frame.stride(i) + + layout.planes[i].left_bytes; + libyuv::CopyPlane(src, static_cast<int>(src_frame.stride(i)), + dest_buffer.data() + layout.planes[i].offset, + static_cast<int>(layout.planes[i].stride), + static_cast<int>(layout.planes[i].width_bytes), + static_cast<int>(layout.planes[i].height)); + } +} + +bool CopyTexturablePlanes(const media::VideoFrame& src_frame, + const ParsedCopyToOptions& layout, + base::span<uint8_t> dest_buffer) { + auto wrapper = SharedGpuContext::ContextProviderWrapper(); + if (!wrapper) + return false; + + auto* provider = wrapper->ContextProvider(); + if (!provider) + return false; + + auto* ri = provider->RasterInterface(); + auto* gr_context = provider->GetGrContext(); + if (!ri) + return false; + + for (wtf_size_t i = 0; i < layout.num_planes; i++) { + gfx::Rect src_rect(layout.planes[i].left, layout.planes[i].top, + layout.planes[i].width, layout.planes[i].height); + uint8_t* dest_pixels = dest_buffer.data() + layout.planes[i].offset; + if (!media::ReadbackTexturePlaneToMemorySync( + src_frame, i, src_rect, dest_pixels, layout.planes[i].stride, ri, + gr_context)) { + // It's possible to fail after copying some but not all planes, leaving + // the output buffer in a corrupt state D: + return false; + } + } + + return true; } } // namespace @@ -569,10 +630,14 @@ absl::optional<V8VideoPixelFormat> VideoFrame::format() const { auto local_frame = handle_->frame(); - if (!local_frame || !IsSupportedPlanarFormat(*local_frame)) + if (!local_frame) return absl::nullopt; - switch (local_frame->format()) { + auto copy_to_format = CopyToFormat(*local_frame); + if (!copy_to_format) + return absl::nullopt; + + switch (*copy_to_format) { case media::PIXEL_FORMAT_I420: return V8VideoPixelFormat(V8VideoPixelFormat::Enum::kI420); case media::PIXEL_FORMAT_I420A: @@ -707,16 +772,15 @@ return 0; } - // TODO(crbug.com/1176464): Determine the format readback will occur in, use - // that to compute the layout. - if (!IsSupportedPlanarFormat(*local_frame)) { + auto copy_to_format = CopyToFormat(*local_frame); + if (!copy_to_format) { exception_state.ThrowDOMException( DOMExceptionCode::kNotSupportedError, "allocationSize() is not yet implemented when format is null."); return 0; } - ParsedCopyToOptions layout(options, local_frame->format(), + ParsedCopyToOptions layout(options, *copy_to_format, local_frame->coded_size(), local_frame->visible_rect(), exception_state); if (exception_state.HadException()) @@ -737,7 +801,8 @@ } // TODO(crbug.com/1176464): Use async texture readback. - if (!IsSupportedPlanarFormat(*local_frame)) { + auto copy_to_format = CopyToFormat(*local_frame); + if (!copy_to_format) { exception_state.ThrowDOMException( DOMExceptionCode::kNotSupportedError, "copyTo() is not yet implemented when format is null."); @@ -745,7 +810,7 @@ } // Compute layout. - ParsedCopyToOptions layout(options, local_frame->format(), + ParsedCopyToOptions layout(options, *copy_to_format, local_frame->coded_size(), local_frame->visible_rect(), exception_state); if (exception_state.HadException()) @@ -762,27 +827,24 @@ return ScriptPromise(); } - // Map buffers if necessary. - if (!local_frame->IsMappable()) { - DCHECK(local_frame->HasGpuMemoryBuffer()); - local_frame = media::ConvertToMemoryMappedFrame(local_frame); - if (!local_frame) { + // Copy planes. + if (local_frame->IsMappable()) { + CopyMappablePlanes(*local_frame, layout, buffer); + } else if (local_frame->HasGpuMemoryBuffer()) { + auto mapped_frame = media::ConvertToMemoryMappedFrame(local_frame); + if (!mapped_frame) { exception_state.ThrowDOMException(DOMExceptionCode::kInvalidStateError, "Failed to read VideoFrame data."); return ScriptPromise(); } - } - - // Copy data. - for (wtf_size_t i = 0; i < layout.num_planes; i++) { - uint8_t* src = local_frame->data(i) + - layout.planes[i].top * local_frame->stride(i) + - layout.planes[i].left_bytes; - libyuv::CopyPlane(src, static_cast<int>(local_frame->stride(i)), - buffer.data() + layout.planes[i].offset, - static_cast<int>(layout.planes[i].stride), - static_cast<int>(layout.planes[i].width_bytes), - static_cast<int>(layout.planes[i].height)); + CopyMappablePlanes(*mapped_frame, layout, buffer); + } else { + DCHECK(local_frame->HasTextures()); + if (!CopyTexturablePlanes(*local_frame, layout, buffer)) { + exception_state.ThrowDOMException(DOMExceptionCode::kInvalidStateError, + "Failed to read VideoFrame data."); + return ScriptPromise(); + } } // Convert and return |layout|.
diff --git a/third_party/blink/renderer/platform/exported/web_font.cc b/third_party/blink/renderer/platform/exported/web_font.cc index a3b3e3be..2fb9fcd8 100644 --- a/third_party/blink/renderer/platform/exported/web_font.cc +++ b/third_party/blink/renderer/platform/exported/web_font.cc
@@ -92,7 +92,7 @@ context.Save(); context.SetFillColor(color); context.DrawText(private_->GetFont(), run_info, FloatPoint(left_baseline), - kInvalidDOMNodeId); + kInvalidDOMNodeId, AutoDarkMode::Disabled()); context.Restore(); }
diff --git a/third_party/blink/renderer/platform/fonts/shaping/shaping_line_breaker.cc b/third_party/blink/renderer/platform/fonts/shaping/shaping_line_breaker.cc index b2744e73..5946b95 100644 --- a/third_party/blink/renderer/platform/fonts/shaping/shaping_line_breaker.cc +++ b/third_party/blink/renderer/platform/fonts/shaping/shaping_line_breaker.cc
@@ -378,12 +378,12 @@ // available space adjusted to take the reshaping into account. scoped_refptr<const ShapeResult> line_start_result; if (first_safe != start) { + if (!is_break_after_any_space && break_opportunity.non_hangable_run_end) { + break_opportunity.offset = + std::max(start + 1, *break_opportunity.non_hangable_run_end); + } if (first_safe >= break_opportunity.offset) { // There is no safe-to-break, reshape the whole range. - if (!is_break_after_any_space && break_opportunity.non_hangable_run_end) { - break_opportunity.offset = - std::max(start + 1, *break_opportunity.non_hangable_run_end); - } SetBreakOffset(break_opportunity, text, result_out); CheckBreakOffset(result_out->break_offset, start, range_end); return ShapeResultView::Create(
diff --git a/third_party/blink/renderer/platform/graphics/dark_mode_filter.cc b/third_party/blink/renderer/platform/graphics/dark_mode_filter.cc index 5ac11fb..d2ab7331 100644 --- a/third_party/blink/renderer/platform/graphics/dark_mode_filter.cc +++ b/third_party/blink/renderer/platform/graphics/dark_mode_filter.cc
@@ -95,9 +95,6 @@ if (!immutable_.color_filter) return color; - if (role_override_.has_value()) - role = role_override_.value(); - if (ShouldApplyToColor(color, role)) { return inverted_color_cache_->GetInvertedColor( immutable_.color_filter.get(), color); @@ -152,9 +149,6 @@ if (!immutable_.color_filter) return absl::nullopt; - if (role_override_.has_value()) - role = role_override_.value(); - cc::PaintFlags dark_mode_flags = flags; if (flags.HasShader()) { PaintShader::Type shader_type = flags.getShader()->shader_type(); @@ -199,22 +193,4 @@ return inverted_color_cache_->size(); } -ScopedDarkModeElementRoleOverride::ScopedDarkModeElementRoleOverride( - GraphicsContext* graphics_context, - DarkModeFilter::ElementRole role) - : graphics_context_(graphics_context) { - if (!graphics_context_->IsDarkModeEnabled()) - return; - DarkModeFilter* filter = graphics_context_->GetDarkModeFilter(); - previous_role_override_ = filter->role_override_; - filter->role_override_ = role; -} - -ScopedDarkModeElementRoleOverride::~ScopedDarkModeElementRoleOverride() { - if (!graphics_context_->IsDarkModeEnabled()) - return; - graphics_context_->GetDarkModeFilter()->role_override_ = - previous_role_override_; -} - } // namespace blink
diff --git a/third_party/blink/renderer/platform/graphics/dark_mode_filter.h b/third_party/blink/renderer/platform/graphics/dark_mode_filter.h index 4e2c51f..aef91c2 100644 --- a/third_party/blink/renderer/platform/graphics/dark_mode_filter.h +++ b/third_party/blink/renderer/platform/graphics/dark_mode_filter.h
@@ -18,11 +18,9 @@ namespace blink { -class GraphicsContext; class DarkModeColorClassifier; class DarkModeImageClassifier; class DarkModeColorFilter; -class ScopedDarkModeElementRoleOverride; class DarkModeInvertedColorCache; class PLATFORM_EXPORT DarkModeFilter { @@ -71,8 +69,6 @@ sk_sp<SkColorFilter> GetImageFilter() const; private: - friend class ScopedDarkModeElementRoleOverride; - struct ImmutableData { explicit ImmutableData(const DarkModeSettings& settings); @@ -89,26 +85,11 @@ // This is read-only data and is thread-safe. const ImmutableData immutable_; - // Following two members used for color classifications are not thread-safe. - // TODO(prashant.n): Remove element override concept. - absl::optional<ElementRole> role_override_; + // Following member is used for color classifications and is not thread-safe. // TODO(prashant.n): Move cache out of dark mode filter. std::unique_ptr<DarkModeInvertedColorCache> inverted_color_cache_; }; -// Temporarily override the element role for the scope of this object's -// lifetime - for example when drawing symbols that play the role of text. -class PLATFORM_EXPORT ScopedDarkModeElementRoleOverride { - public: - ScopedDarkModeElementRoleOverride(GraphicsContext* graphics_context, - DarkModeFilter::ElementRole role); - ~ScopedDarkModeElementRoleOverride(); - - private: - GraphicsContext* graphics_context_; - absl::optional<DarkModeFilter::ElementRole> previous_role_override_; -}; - } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_DARK_MODE_FILTER_H_
diff --git a/third_party/blink/renderer/platform/graphics/generated_image.cc b/third_party/blink/renderer/platform/graphics/generated_image.cc index 50caa27..5b91457 100644 --- a/third_party/blink/renderer/platform/graphics/generated_image.cc +++ b/third_party/blink/renderer/platform/graphics/generated_image.cc
@@ -60,7 +60,7 @@ fill_flags.setShader(std::move(tile_shader)); fill_flags.setColor(SK_ColorBLACK); - dest_context.DrawRect(dest_rect, fill_flags); + dest_context.DrawRect(dest_rect, fill_flags, AutoDarkMode(draw_options)); } sk_sp<PaintShader> GeneratedImage::CreateShader(
diff --git a/third_party/blink/renderer/platform/graphics/gradient_generated_image.cc b/third_party/blink/renderer/platform/graphics/gradient_generated_image.cc index f85620d..31109f1 100644 --- a/third_party/blink/renderer/platform/graphics/gradient_generated_image.cc +++ b/third_party/blink/renderer/platform/graphics/gradient_generated_image.cc
@@ -58,7 +58,7 @@ PaintFlags gradient_flags(context.FillFlags()); gradient_->ApplyToFlags(gradient_flags, SkMatrix::I()); - context.DrawRect(src_rect, gradient_flags); + context.DrawRect(src_rect, gradient_flags, AutoDarkMode::Disabled()); } bool GradientGeneratedImage::ApplyShader(PaintFlags& flags,
diff --git a/third_party/blink/renderer/platform/graphics/graphics_context.cc b/third_party/blink/renderer/platform/graphics/graphics_context.cc index f6f727c2..b78c8c9 100644 --- a/third_party/blink/renderer/platform/graphics/graphics_context.cc +++ b/third_party/blink/renderer/platform/graphics/graphics_context.cc
@@ -90,9 +90,11 @@ Color DarkModeColor(GraphicsContext& context, const Color& color, - DarkModeFilter::ElementRole role) { - if (context.IsDarkModeEnabled()) - return context.GetDarkModeFilter()->InvertColorIfNeeded(color.Rgb(), role); + const AutoDarkMode& auto_dark_mode) { + if (auto_dark_mode.enabled) { + return context.GetDarkModeFilter()->InvertColorIfNeeded( + color.Rgb(), auto_dark_mode.role); + } return color; } @@ -108,11 +110,11 @@ public: // This helper's lifetime should never exceed |flags|'. DarkModeFlags(GraphicsContext* context, - const PaintFlags& flags, - DarkModeFilter::ElementRole role) { - if (context->IsDarkModeEnabled()) { - dark_mode_flags_ = - context->GetDarkModeFilter()->ApplyToFlagsIfNeeded(flags, role); + const AutoDarkMode& auto_dark_mode, + const PaintFlags& flags) { + if (auto_dark_mode.enabled) { + dark_mode_flags_ = context->GetDarkModeFilter()->ApplyToFlagsIfNeeded( + flags, auto_dark_mode.role); if (dark_mode_flags_) { flags_ = &dark_mode_flags_.value(); return; @@ -152,13 +154,11 @@ void GraphicsContext::CopyConfigFrom(GraphicsContext& other) { SetPrintingMetafile(other.printing_metafile_); SetPaintPreviewTracker(other.paint_preview_tracker_); - SetDarkModeEnabled(other.is_dark_mode_enabled_); SetDeviceScaleFactor(other.device_scale_factor_); SetPrinting(other.printing_); } DarkModeFilter* GraphicsContext::GetDarkModeFilter() { - DCHECK(IsDarkModeEnabled()); if (!dark_mode_filter_) { dark_mode_filter_ = std::make_unique<DarkModeFilter>(GetCurrentDarkModeSettings()); @@ -343,22 +343,19 @@ void GraphicsContext::DrawFocusRingPath(const SkPath& path, const Color& color, float width, - float corner_radius) { - DrawPlatformFocusRing( - path, canvas_, - DarkModeColor(*this, color, DarkModeFilter::ElementRole::kBackground) - .Rgb(), - width, corner_radius); + float corner_radius, + const AutoDarkMode& auto_dark_mode) { + DrawPlatformFocusRing(path, canvas_, + DarkModeColor(*this, color, auto_dark_mode).Rgb(), + width, corner_radius); } void GraphicsContext::DrawFocusRingRect(const SkRRect& rrect, const Color& color, - float width) { + float width, + const AutoDarkMode& auto_dark_mode) { DrawPlatformFocusRing( - rrect, canvas_, - DarkModeColor(*this, color, DarkModeFilter::ElementRole::kBackground) - .Rgb(), - width); + rrect, canvas_, DarkModeColor(*this, color, auto_dark_mode).Rgb(), width); } static void EnforceDotsAtEndpoints(GraphicsContext& context, @@ -367,7 +364,8 @@ const int path_length, const int width, const PaintFlags& flags, - const bool is_vertical_line) { + const bool is_vertical_line, + const AutoDarkMode& auto_dark_mode) { // For narrow lines, we always want integral dot and dash sizes, and start // and end points, to prevent anti-aliasing from erasing the dot effect. // For 1-pixel wide lines, we must make one end a dash. Otherwise we have @@ -439,7 +437,7 @@ p1.Y() + width - width / 2); p1.SetX(p1.X() + (2 * width + start_line_offset)); } - context.DrawRect(start_dot, fill_flags); + context.DrawRect(start_dot, fill_flags, auto_dark_mode); } if (use_end_dot) { SkRect end_dot; @@ -454,14 +452,14 @@ // Be sure to stop drawing before we get to the last dot p2.SetX(p2.X() - (width + end_dot_growth + 1)); } - context.DrawRect(end_dot, fill_flags); + context.DrawRect(end_dot, fill_flags, auto_dark_mode); } } } void GraphicsContext::DrawLine(const IntPoint& point1, const IntPoint& point2, - const DarkModeFilter::ElementRole role, + const AutoDarkMode& auto_dark_mode, bool is_text_line, const PaintFlags* paint_flags) { DCHECK(canvas_); @@ -480,10 +478,10 @@ // probably worth the speed up of no square root, which also won't be exact. FloatSize disp = p2 - p1; int length = SkScalarRoundToInt(disp.Width() + disp.Height()); - const DarkModeFlags flags( - this, - paint_flags ? *paint_flags : ImmutableState()->StrokeFlags(length, width), - role); + const DarkModeFlags flags(this, auto_dark_mode, + paint_flags + ? *paint_flags + : ImmutableState()->StrokeFlags(length, width)); if (pen_style == kDottedStroke) { if (StrokeData::StrokeIsDashed(width, pen_style)) { @@ -495,7 +493,7 @@ // is to improve border line quality. if (!is_text_line) { EnforceDotsAtEndpoints(*this, p1, p2, length, width, flags, - is_vertical_line); + is_vertical_line, auto_dark_mode); } } else { // We draw thick dotted lines with 0 length dash strokes and round @@ -517,6 +515,7 @@ void GraphicsContext::DrawLineForText(const FloatPoint& pt, float width, + const AutoDarkMode& auto_dark_mode, const PaintFlags* paint_flags) { if (width <= 0) return; @@ -527,29 +526,30 @@ IntPoint start; IntPoint end; std::tie(start, end) = GetPointsForTextLine(pt, width, StrokeThickness()); - DrawLine(start, end, DarkModeFilter::ElementRole::kText, true, paint_flags); + DrawLine(start, end, auto_dark_mode, true, paint_flags); } else { SkRect r = GetRectForTextLine(pt, width, StrokeThickness()); if (paint_flags) { - DrawRect(r, *paint_flags, DarkModeFilter::ElementRole::kText); + DrawRect(r, *paint_flags, auto_dark_mode); } else { PaintFlags flags; flags = ImmutableState()->FillFlags(); // Text lines are drawn using the stroke color. flags.setColor(StrokeColor().Rgb()); - DrawRect(r, flags, DarkModeFilter::ElementRole::kText); + DrawRect(r, flags, auto_dark_mode); } } } // Draws a filled rectangle with a stroked border. -void GraphicsContext::DrawRect(const IntRect& rect) { +void GraphicsContext::DrawRect(const IntRect& rect, + const AutoDarkMode& auto_dark_mode) { if (rect.IsEmpty()) return; SkRect sk_rect = rect; if (ImmutableState()->FillColor().Alpha()) - DrawRect(sk_rect, ImmutableState()->FillFlags()); + DrawRect(sk_rect, ImmutableState()->FillFlags(), auto_dark_mode); if (ImmutableState()->GetStrokeData().Style() != kNoStroke && ImmutableState()->StrokeColor().Alpha()) { @@ -560,7 +560,7 @@ flags.setStrokeWidth(1); sk_rect.inset(0.5f, 0.5f); - DrawRect(sk_rect, flags); + DrawRect(sk_rect, flags, auto_dark_mode); } } @@ -568,9 +568,10 @@ const TextRunPaintInfo& text_info, const FloatPoint& point, const PaintFlags& flags, - DOMNodeId node_id) { + DOMNodeId node_id, + const AutoDarkMode& auto_dark_mode) { font.DrawText(canvas_, text_info, point, device_scale_factor_, node_id, - DarkModeFlags(this, flags, DarkModeFilter::ElementRole::kText), + DarkModeFlags(this, auto_dark_mode, flags), printing_ ? Font::DrawType::kGlyphsAndClusters : Font::DrawType::kGlyphsOnly); } @@ -579,20 +580,22 @@ const NGTextFragmentPaintInfo& text_info, const FloatPoint& point, const PaintFlags& flags, - DOMNodeId node_id) { + DOMNodeId node_id, + const AutoDarkMode& auto_dark_mode) { font.DrawText(canvas_, text_info, point, device_scale_factor_, node_id, - DarkModeFlags(this, flags, DarkModeFilter::ElementRole::kText), + DarkModeFlags(this, auto_dark_mode, flags), printing_ ? Font::DrawType::kGlyphsAndClusters : Font::DrawType::kGlyphsOnly); } template <typename DrawTextFunc> -void GraphicsContext::DrawTextPasses(const DrawTextFunc& draw_text) { +void GraphicsContext::DrawTextPasses(const AutoDarkMode& auto_dark_mode, + const DrawTextFunc& draw_text) { TextDrawingModeFlags mode_flags = TextDrawingMode(); if (mode_flags & kTextModeFill) { const PaintFlags& flags = ImmutableState()->FillFlags(); - DarkModeFlags dark_flags(this, flags, DarkModeFilter::ElementRole::kText); + DarkModeFlags dark_flags(this, auto_dark_mode, flags); if (UNLIKELY(ShouldDrawDarkModeTextContrastOutline(flags, dark_flags))) { PaintFlags outline_flags(flags); outline_flags.setStyle(PaintFlags::kStroke_Style); @@ -609,7 +612,7 @@ // shadow was already applied during fill pass flags.setLooper(nullptr); } - draw_text(DarkModeFlags(this, flags, DarkModeFilter::ElementRole::kText)); + draw_text(DarkModeFlags(this, auto_dark_mode, flags)); } } @@ -617,8 +620,9 @@ void GraphicsContext::DrawTextInternal(const Font& font, const TextPaintInfo& text_info, const FloatPoint& point, - DOMNodeId node_id) { - DrawTextPasses([&](const PaintFlags& flags) { + DOMNodeId node_id, + const AutoDarkMode& auto_dark_mode) { + DrawTextPasses(auto_dark_mode, [&](const PaintFlags& flags) { font.DrawText(canvas_, text_info, point, device_scale_factor_, node_id, flags, printing_ ? Font::DrawType::kGlyphsAndClusters @@ -647,61 +651,67 @@ void GraphicsContext::DrawText(const Font& font, const TextRunPaintInfo& text_info, const FloatPoint& point, - DOMNodeId node_id) { - DrawTextInternal(font, text_info, point, node_id); + DOMNodeId node_id, + const AutoDarkMode& auto_dark_mode) { + DrawTextInternal(font, text_info, point, node_id, auto_dark_mode); } void GraphicsContext::DrawText(const Font& font, const NGTextFragmentPaintInfo& text_info, const FloatPoint& point, - DOMNodeId node_id) { - DrawTextInternal(font, text_info, point, node_id); + DOMNodeId node_id, + const AutoDarkMode& auto_dark_mode) { + DrawTextInternal(font, text_info, point, node_id, auto_dark_mode); } template <typename TextPaintInfo> -void GraphicsContext::DrawEmphasisMarksInternal(const Font& font, - const TextPaintInfo& text_info, - const AtomicString& mark, - const FloatPoint& point) { - DrawTextPasses( - [&font, &text_info, &mark, &point, this](const PaintFlags& flags) { - font.DrawEmphasisMarks( - canvas_, text_info, mark, point, device_scale_factor_, - DarkModeFlags(this, flags, DarkModeFilter::ElementRole::kText)); - }); +void GraphicsContext::DrawEmphasisMarksInternal( + const Font& font, + const TextPaintInfo& text_info, + const AtomicString& mark, + const FloatPoint& point, + const AutoDarkMode& auto_dark_mode) { + DrawTextPasses(auto_dark_mode, [&font, &text_info, &mark, &point, + this](const PaintFlags& flags) { + font.DrawEmphasisMarks(canvas_, text_info, mark, point, + device_scale_factor_, flags); + }); } void GraphicsContext::DrawEmphasisMarks(const Font& font, const TextRunPaintInfo& text_info, const AtomicString& mark, - const FloatPoint& point) { - DrawEmphasisMarksInternal(font, text_info, mark, point); + const FloatPoint& point, + const AutoDarkMode& auto_dark_mode) { + DrawEmphasisMarksInternal(font, text_info, mark, point, auto_dark_mode); } void GraphicsContext::DrawEmphasisMarks( const Font& font, const NGTextFragmentPaintInfo& text_info, const AtomicString& mark, - const FloatPoint& point) { - DrawEmphasisMarksInternal(font, text_info, mark, point); + const FloatPoint& point, + const AutoDarkMode& auto_dark_mode) { + DrawEmphasisMarksInternal(font, text_info, mark, point, auto_dark_mode); } void GraphicsContext::DrawBidiText( const Font& font, const TextRunPaintInfo& run_info, const FloatPoint& point, + const AutoDarkMode& auto_dark_mode, Font::CustomFontNotReadyAction custom_font_not_ready_action) { - DrawTextPasses([&font, &run_info, &point, custom_font_not_ready_action, - this](const PaintFlags& flags) { - if (font.DrawBidiText( - canvas_, run_info, point, custom_font_not_ready_action, - device_scale_factor_, - DarkModeFlags(this, flags, DarkModeFilter::ElementRole::kText), - printing_ ? Font::DrawType::kGlyphsAndClusters - : Font::DrawType::kGlyphsOnly)) { - paint_controller_.SetTextPainted(); - } - }); + DrawTextPasses( + auto_dark_mode, [&font, &run_info, &point, custom_font_not_ready_action, + this](const PaintFlags& flags) { + if (font.DrawBidiText(canvas_, run_info, point, + custom_font_not_ready_action, + device_scale_factor_, flags, + printing_ ? Font::DrawType::kGlyphsAndClusters + : Font::DrawType::kGlyphsOnly)) { + paint_controller_.SetTextPainted(); + } + }); } void GraphicsContext::DrawHighlightForText(const Font& font, @@ -709,18 +719,19 @@ const FloatPoint& point, int h, const Color& background_color, + const AutoDarkMode& auto_dark_mode, int from, int to) { - FillRect(font.SelectionRectForText(run, point, h, from, to), - background_color); + FillRect(font.SelectionRectForText(run, point, h, from, to), background_color, + auto_dark_mode); } void GraphicsContext::DrawImage( Image* image, Image::ImageDecodingMode decode_mode, + const AutoDarkMode& auto_dark_mode, const FloatRect& dest, const FloatRect* src_ptr, - bool has_disable_dark_mode_style, SkBlendMode op, RespectImageOrientationEnum should_respect_image_orientation) { if (!image) @@ -732,9 +743,7 @@ image_flags.setBlendMode(op); image_flags.setColor(SK_ColorBLACK); - const bool apply_dark_mode = - IsDarkModeEnabled() && !has_disable_dark_mode_style; - if (apply_dark_mode) { + if (auto_dark_mode.enabled) { DarkModeFilterHelper::ApplyToImageIfNeeded(*GetDarkModeFilter(), image, &image_flags, src, dest); } @@ -742,7 +751,7 @@ draw_options.sampling_options = ComputeSamplingOptions(image, dest, src); draw_options.respect_orientation = should_respect_image_orientation; draw_options.decode_mode = decode_mode; - draw_options.apply_dark_mode = apply_dark_mode; + draw_options.apply_dark_mode = auto_dark_mode.enabled; image->Draw(canvas_, image_flags, dest, src, draw_options); paint_controller_.SetImagePainted(); } @@ -750,17 +759,17 @@ void GraphicsContext::DrawImageRRect( Image* image, Image::ImageDecodingMode decode_mode, + const AutoDarkMode& auto_dark_mode, const FloatRoundedRect& dest, const FloatRect& src_rect, - bool has_disable_dark_mode_style, SkBlendMode op, RespectImageOrientationEnum respect_orientation) { if (!image) return; if (!dest.IsRounded()) { - DrawImage(image, decode_mode, dest.Rect(), &src_rect, - has_disable_dark_mode_style, op, respect_orientation); + DrawImage(image, decode_mode, auto_dark_mode, dest.Rect(), &src_rect, op, + respect_orientation); return; } @@ -777,9 +786,7 @@ image_flags.setBlendMode(op); image_flags.setColor(SK_ColorBLACK); - const bool apply_dark_mode = - IsDarkModeEnabled() && !has_disable_dark_mode_style; - if (apply_dark_mode) { + if (auto_dark_mode.enabled) { DarkModeFilterHelper::ApplyToImageIfNeeded( *GetDarkModeFilter(), image, &image_flags, src_rect, dest.Rect()); } @@ -809,7 +816,7 @@ draw_options.sampling_options = sampling; draw_options.respect_orientation = respect_orientation; draw_options.decode_mode = decode_mode; - draw_options.apply_dark_mode = apply_dark_mode; + draw_options.apply_dark_mode = auto_dark_mode.enabled; image->Draw(canvas_, image_flags, dest.Rect(), src_rect, draw_options); } @@ -846,7 +853,7 @@ Image* image, const FloatRect& dest_rect, const ImageTilingInfo& tiling_info, - bool has_disable_dark_mode_style, + const AutoDarkMode& auto_dark_mode, SkBlendMode op, RespectImageOrientationEnum respect_orientation) { if (!image) @@ -855,9 +862,7 @@ PaintFlags image_flags = ImmutableState()->FillFlags(); image_flags.setBlendMode(op); - const bool apply_dark_mode = - IsDarkModeEnabled() && !has_disable_dark_mode_style; - if (apply_dark_mode) { + if (auto_dark_mode.enabled) { DarkModeFilterHelper::ApplyToImageIfNeeded( *GetDarkModeFilter(), image, &image_flags, tiling_info.image_rect, dest_rect); @@ -866,93 +871,93 @@ ImageDrawOptions draw_options; draw_options.sampling_options = ImageSamplingOptions(); draw_options.respect_orientation = respect_orientation; - draw_options.apply_dark_mode = apply_dark_mode; + draw_options.apply_dark_mode = auto_dark_mode.enabled; image->DrawPattern(*this, image_flags, dest_rect, tiling_info, draw_options); paint_controller_.SetImagePainted(); } void GraphicsContext::DrawOval(const SkRect& oval, const PaintFlags& flags, - const DarkModeFilter::ElementRole role) { + const AutoDarkMode& auto_dark_mode) { DCHECK(canvas_); - canvas_->drawOval(oval, DarkModeFlags(this, flags, role)); + canvas_->drawOval(oval, DarkModeFlags(this, auto_dark_mode, flags)); } void GraphicsContext::DrawPath(const SkPath& path, const PaintFlags& flags, - const DarkModeFilter::ElementRole role) { + const AutoDarkMode& auto_dark_mode) { DCHECK(canvas_); - canvas_->drawPath(path, DarkModeFlags(this, flags, role)); + canvas_->drawPath(path, DarkModeFlags(this, auto_dark_mode, flags)); } void GraphicsContext::DrawRect(const SkRect& rect, const PaintFlags& flags, - const DarkModeFilter::ElementRole role) { + const AutoDarkMode& auto_dark_mode) { DCHECK(canvas_); - canvas_->drawRect(rect, DarkModeFlags(this, flags, role)); + canvas_->drawRect(rect, DarkModeFlags(this, auto_dark_mode, flags)); } -void GraphicsContext::DrawRRect(const SkRRect& rrect, const PaintFlags& flags) { +void GraphicsContext::DrawRRect(const SkRRect& rrect, + const PaintFlags& flags, + const AutoDarkMode& auto_dark_mode) { DCHECK(canvas_); - canvas_->drawRRect( - rrect, - DarkModeFlags(this, flags, DarkModeFilter::ElementRole::kBackground)); + canvas_->drawRRect(rrect, DarkModeFlags(this, auto_dark_mode, flags)); } -void GraphicsContext::FillPath(const Path& path_to_fill) { +void GraphicsContext::FillPath(const Path& path_to_fill, + const AutoDarkMode& auto_dark_mode) { if (path_to_fill.IsEmpty()) return; - DrawPath(path_to_fill.GetSkPath(), ImmutableState()->FillFlags()); + DrawPath(path_to_fill.GetSkPath(), ImmutableState()->FillFlags(), + auto_dark_mode); } -void GraphicsContext::FillRect(const IntRect& rect) { - FillRect(FloatRect(rect)); +void GraphicsContext::FillRect(const IntRect& rect, + const AutoDarkMode& auto_dark_mode) { + FillRect(FloatRect(rect), auto_dark_mode); } void GraphicsContext::FillRect(const IntRect& rect, const Color& color, + const AutoDarkMode& auto_dark_mode, SkBlendMode xfer_mode) { - FillRect(FloatRect(rect), color, xfer_mode); + FillRect(FloatRect(rect), color, auto_dark_mode, xfer_mode); } -void GraphicsContext::FillRect(const FloatRect& rect) { - DrawRect(rect, ImmutableState()->FillFlags()); -} - -void GraphicsContext::FillRect(const IntRect& rect, - const Color& color, - DarkModeFilter::ElementRole role) { - FillRect(FloatRect(rect), color, SkBlendMode::kSrcOver, role); +void GraphicsContext::FillRect(const FloatRect& rect, + const AutoDarkMode& auto_dark_mode) { + DrawRect(rect, ImmutableState()->FillFlags(), auto_dark_mode); } void GraphicsContext::FillRect(const FloatRect& rect, const Color& color, - SkBlendMode xfer_mode, - DarkModeFilter::ElementRole role) { + const AutoDarkMode& auto_dark_mode, + SkBlendMode xfer_mode) { PaintFlags flags = ImmutableState()->FillFlags(); flags.setColor(color.Rgb()); flags.setBlendMode(xfer_mode); - DrawRect(rect, flags, role); + DrawRect(rect, flags, auto_dark_mode); } void GraphicsContext::FillRoundedRect(const FloatRoundedRect& rrect, - const Color& color) { + const Color& color, + const AutoDarkMode& auto_dark_mode) { if (!rrect.IsRounded() || !rrect.IsRenderable()) { - FillRect(rrect.Rect(), color); + FillRect(rrect.Rect(), color, auto_dark_mode); return; } if (color == FillColor()) { - DrawRRect(rrect, ImmutableState()->FillFlags()); + DrawRRect(rrect, ImmutableState()->FillFlags(), auto_dark_mode); return; } PaintFlags flags = ImmutableState()->FillFlags(); flags.setColor(color.Rgb()); - DrawRRect(rrect, flags); + DrawRRect(rrect, flags, auto_dark_mode); } namespace { @@ -1000,18 +1005,20 @@ void GraphicsContext::FillDRRect(const FloatRoundedRect& outer, const FloatRoundedRect& inner, - const Color& color) { + const Color& color, + const AutoDarkMode& auto_dark_mode) { DCHECK(canvas_); - const Color& actual_color = - DarkModeColor(*this, color, DarkModeFilter::ElementRole::kBackground); if (!IsSimpleDRRect(outer, inner)) { if (color == FillColor()) { - canvas_->drawDRRect(outer, inner, ImmutableState()->FillFlags()); + canvas_->drawDRRect( + outer, inner, + DarkModeFlags(this, auto_dark_mode, ImmutableState()->FillFlags())); } else { PaintFlags flags(ImmutableState()->FillFlags()); - flags.setColor(actual_color.Rgb()); - canvas_->drawDRRect(outer, inner, flags); + flags.setColor(color.Rgb()); + canvas_->drawDRRect(outer, inner, + DarkModeFlags(this, auto_dark_mode, flags)); } return; @@ -1023,39 +1030,45 @@ stroke_r_rect.inset(stroke_width / 2, stroke_width / 2); PaintFlags stroke_flags(ImmutableState()->FillFlags()); - stroke_flags.setColor(actual_color.Rgb()); + stroke_flags.setColor(color.Rgb()); stroke_flags.setStyle(PaintFlags::kStroke_Style); stroke_flags.setStrokeWidth(stroke_width); - canvas_->drawRRect(stroke_r_rect, stroke_flags); + canvas_->drawRRect(stroke_r_rect, + DarkModeFlags(this, auto_dark_mode, stroke_flags)); } void GraphicsContext::FillRectWithRoundedHole( const FloatRect& rect, const FloatRoundedRect& rounded_hole_rect, - const Color& color) { + const Color& color, + const AutoDarkMode& auto_dark_mode) { PaintFlags flags(ImmutableState()->FillFlags()); - flags.setColor( - DarkModeColor(*this, color, DarkModeFilter::ElementRole::kBackground) - .Rgb()); - canvas_->drawDRRect(SkRRect::MakeRect(rect), rounded_hole_rect, flags); + flags.setColor(color.Rgb()); + canvas_->drawDRRect(SkRRect::MakeRect(rect), rounded_hole_rect, + DarkModeFlags(this, auto_dark_mode, flags)); } -void GraphicsContext::FillEllipse(const FloatRect& ellipse) { - DrawOval(ellipse, ImmutableState()->FillFlags()); +void GraphicsContext::FillEllipse(const FloatRect& ellipse, + const AutoDarkMode& auto_dark_mode) { + DrawOval(ellipse, ImmutableState()->FillFlags(), auto_dark_mode); } void GraphicsContext::StrokePath(const Path& path_to_stroke, + const AutoDarkMode& auto_dark_mode, const int length, const int dash_thickness) { if (path_to_stroke.IsEmpty()) return; DrawPath(path_to_stroke.GetSkPath(), - ImmutableState()->StrokeFlags(length, dash_thickness)); + ImmutableState()->StrokeFlags(length, dash_thickness), + auto_dark_mode); } -void GraphicsContext::StrokeRect(const FloatRect& rect, float line_width) { +void GraphicsContext::StrokeRect(const FloatRect& rect, + float line_width, + const AutoDarkMode& auto_dark_mode) { PaintFlags flags(ImmutableState()->StrokeFlags()); flags.setStrokeWidth(WebCoreFloatToSkScalar(line_width)); // Reset the dash effect to account for the width @@ -1067,7 +1080,7 @@ bool valid_w = r.width() > 0; bool valid_h = r.height() > 0; if (valid_w && valid_h) { - DrawRect(r, flags); + DrawRect(r, flags, auto_dark_mode); } else if (valid_w || valid_h) { // we are expected to respect the lineJoin, so we can't just call // drawLine -- we have to create a path that doubles back on itself. @@ -1075,12 +1088,13 @@ path.moveTo(r.fLeft, r.fTop); path.lineTo(r.fRight, r.fBottom); path.close(); - DrawPath(path.detach(), flags); + DrawPath(path.detach(), flags, auto_dark_mode); } } -void GraphicsContext::StrokeEllipse(const FloatRect& ellipse) { - DrawOval(ellipse, ImmutableState()->StrokeFlags()); +void GraphicsContext::StrokeEllipse(const FloatRect& ellipse, + const AutoDarkMode& auto_dark_mode) { + DrawOval(ellipse, ImmutableState()->StrokeFlags(), auto_dark_mode); } void GraphicsContext::ClipRoundedRect(const FloatRoundedRect& rrect,
diff --git a/third_party/blink/renderer/platform/graphics/graphics_context.h b/third_party/blink/renderer/platform/graphics/graphics_context.h index 754d7fd..57f48f3 100644 --- a/third_party/blink/renderer/platform/graphics/graphics_context.h +++ b/third_party/blink/renderer/platform/graphics/graphics_context.h
@@ -92,6 +92,23 @@ bool apply_dark_mode = false; }; +struct AutoDarkMode { + AutoDarkMode(DarkModeFilter::ElementRole role, bool enabled) + : role(role), enabled(enabled) {} + + explicit AutoDarkMode(const ImageDrawOptions& draw_options) + : role(DarkModeFilter::ElementRole::kBackground), + enabled(draw_options.apply_dark_mode) {} + + static AutoDarkMode Disabled(DarkModeFilter::ElementRole role = + DarkModeFilter::ElementRole::kBackground) { + return AutoDarkMode(role, false); + } + + DarkModeFilter::ElementRole role; + bool enabled; +}; + class PLATFORM_EXPORT GraphicsContext { USING_FAST_MALLOC(GraphicsContext); @@ -121,9 +138,6 @@ return paint_controller_; } - bool IsDarkModeEnabled() const { return is_dark_mode_enabled_; } - void SetDarkModeEnabled(bool enabled) { is_dark_mode_enabled_ = enabled; } - DarkModeFilter* GetDarkModeFilter(); void UpdateDarkModeSettingsForTest(const DarkModeSettings&); @@ -205,19 +219,18 @@ // DrawRect() fills and always strokes using a 1-pixel stroke inset from // the rect borders (of the pre-set stroke color). - void DrawRect(const IntRect&); + void DrawRect(const IntRect&, const AutoDarkMode& auto_dark_mode); // DrawLine() only operates on horizontal or vertical lines and uses the // current stroke settings. For dotted or dashed stroke, the line need to be // top-to-down or left-to-right to get correct interval of dots/dashes. void DrawLine(const IntPoint&, const IntPoint&, - const DarkModeFilter::ElementRole role = - DarkModeFilter::ElementRole::kBackground, + const AutoDarkMode& auto_dark_mode, bool is_text_line = false, const PaintFlags* flags = nullptr); - void FillPath(const Path&); + void FillPath(const Path&, const AutoDarkMode& auto_dark_mode); // The length parameter is only used when the path has a dashed or dotted // stroke style, with the default dash/dot path effect. If a non-zero length @@ -227,34 +240,38 @@ // where the stroke thickness has been set for corner miters but we want the // dash length set from the border width. void StrokePath(const Path&, + const AutoDarkMode& auto_dark_mode, const int length = 0, const int dash_thickness = 0); - void FillEllipse(const FloatRect&); - void StrokeEllipse(const FloatRect&); + void FillEllipse(const FloatRect&, const AutoDarkMode& auto_dark_mode); + void StrokeEllipse(const FloatRect&, const AutoDarkMode& auto_dark_mode); - void FillRect(const IntRect&); + void FillRect(const IntRect&, const AutoDarkMode& auto_dark_mode); void FillRect(const IntRect&, const Color&, + const AutoDarkMode& auto_dark_mode, SkBlendMode = SkBlendMode::kSrcOver); - void FillRect(const IntRect& rect, - const Color& color, - DarkModeFilter::ElementRole role); - void FillRect(const FloatRect&); - void FillRect( - const FloatRect&, - const Color&, - SkBlendMode = SkBlendMode::kSrcOver, - DarkModeFilter::ElementRole = DarkModeFilter::ElementRole::kBackground); - void FillRoundedRect(const FloatRoundedRect&, const Color&); + void FillRect(const FloatRect&, const AutoDarkMode& auto_dark_mode); + void FillRect(const FloatRect&, + const Color&, + const AutoDarkMode& auto_dark_mode, + SkBlendMode = SkBlendMode::kSrcOver); + void FillRoundedRect(const FloatRoundedRect&, + const Color&, + const AutoDarkMode& auto_dark_mode); void FillDRRect(const FloatRoundedRect&, const FloatRoundedRect&, - const Color&); + const Color&, + const AutoDarkMode& auto_dark_mode); void FillRectWithRoundedHole(const FloatRect&, const FloatRoundedRect& rounded_hole_rect, - const Color&); + const Color&, + const AutoDarkMode& auto_dark_mode); - void StrokeRect(const FloatRect&, float line_width); + void StrokeRect(const FloatRect&, + float line_width, + const AutoDarkMode& auto_dark_mode); void DrawRecord(sk_sp<const PaintRecord>); void CompositeRecord(sk_sp<PaintRecord>, @@ -264,22 +281,22 @@ void DrawImage(Image*, Image::ImageDecodingMode, + const AutoDarkMode& auto_dark_mode, const FloatRect& dest_rect, const FloatRect* src_rect = nullptr, - bool has_disable_dark_mode_style = false, SkBlendMode = SkBlendMode::kSrcOver, RespectImageOrientationEnum = kRespectImageOrientation); void DrawImageRRect(Image*, Image::ImageDecodingMode, + const AutoDarkMode& auto_dark_mode, const FloatRoundedRect& dest, const FloatRect& src_rect, - bool has_disable_dark_mode_style = false, SkBlendMode = SkBlendMode::kSrcOver, RespectImageOrientationEnum = kRespectImageOrientation); void DrawImageTiled(Image* image, const FloatRect& dest_rect, const ImageTilingInfo& tiling_info, - bool has_disable_dark_mode_style = false, + const AutoDarkMode& auto_dark_mode, SkBlendMode = SkBlendMode::kSrcOver, RespectImageOrientationEnum = kRespectImageOrientation); @@ -288,17 +305,16 @@ // fillRoundedRect(). void DrawOval(const SkRect&, const PaintFlags&, - const DarkModeFilter::ElementRole role = - DarkModeFilter::ElementRole::kBackground); + const AutoDarkMode& auto_dark_mode); void DrawPath(const SkPath&, const PaintFlags&, - const DarkModeFilter::ElementRole role = - DarkModeFilter::ElementRole::kBackground); + const AutoDarkMode& auto_dark_mode); void DrawRect(const SkRect&, const PaintFlags&, - const DarkModeFilter::ElementRole role = - DarkModeFilter::ElementRole::kBackground); - void DrawRRect(const SkRRect&, const PaintFlags&); + const AutoDarkMode& auto_dark_mode); + void DrawRRect(const SkRRect&, + const PaintFlags&, + const AutoDarkMode& auto_dark_mode); void Clip(const IntRect& rect) { ClipRect(rect); } void Clip(const FloatRect& rect) { ClipRect(rect); } @@ -323,11 +339,13 @@ void DrawText(const Font&, const TextRunPaintInfo&, const FloatPoint&, - DOMNodeId); + DOMNodeId, + const AutoDarkMode& auto_dark_mode); void DrawText(const Font&, const NGTextFragmentPaintInfo&, const FloatPoint&, - DOMNodeId); + DOMNodeId, + const AutoDarkMode& auto_dark_mode); // TODO(layout-dev): This method is only used by SVGInlineTextBoxPainter, see // if we can change that to use the four parameter version above. @@ -335,7 +353,8 @@ const TextRunPaintInfo&, const FloatPoint&, const PaintFlags&, - DOMNodeId); + DOMNodeId, + const AutoDarkMode& auto_dark_mode); // TODO(layout-dev): This method is only used by NGTextPainter, see if the // four parameter overload can be removed or if it can wrap this method. @@ -343,32 +362,38 @@ const NGTextFragmentPaintInfo&, const FloatPoint&, const PaintFlags&, - DOMNodeId); + DOMNodeId, + const AutoDarkMode& auto_dark_mode); void DrawEmphasisMarks(const Font&, const TextRunPaintInfo&, const AtomicString& mark, - const FloatPoint&); + const FloatPoint&, + const AutoDarkMode& auto_dark_mode); void DrawEmphasisMarks(const Font&, const NGTextFragmentPaintInfo&, const AtomicString& mark, - const FloatPoint&); + const FloatPoint&, + const AutoDarkMode& auto_dark_mode); void DrawBidiText( const Font&, const TextRunPaintInfo&, const FloatPoint&, + const AutoDarkMode& auto_dark_mode, Font::CustomFontNotReadyAction = Font::kDoNotPaintIfFontNotReady); void DrawHighlightForText(const Font&, const TextRun&, const FloatPoint&, int h, const Color& background_color, + const AutoDarkMode& auto_dark_mode, int from = 0, int to = -1); void DrawLineForText(const FloatPoint&, float width, + const AutoDarkMode& auto_dark_mode, const PaintFlags* flags = nullptr); // beginLayer()/endLayer() behave like save()/restore() for CTM and clip @@ -396,8 +421,12 @@ void DrawFocusRingPath(const SkPath&, const Color&, float width, - float corner_radius); - void DrawFocusRingRect(const SkRRect&, const Color&, float width); + float corner_radius, + const AutoDarkMode& auto_dark_mode); + void DrawFocusRingRect(const SkRRect&, + const Color&, + float width, + const AutoDarkMode& auto_dark_mode); const PaintFlags& FillFlags() const { return ImmutableState()->FillFlags(); } // If the length of the path to be stroked is known, pass it in for correct @@ -463,8 +492,6 @@ static sk_sp<SkColorFilter> WebCoreColorFilterToSkiaColorFilter(ColorFilter); private: - friend class ScopedDarkModeElementRoleOverride; - const GraphicsContextState* ImmutableState() const { return paint_state_; } GraphicsContextState* MutableState() { @@ -476,16 +503,18 @@ void DrawTextInternal(const Font&, const TextPaintInfo&, const FloatPoint&, - DOMNodeId); + DOMNodeId, + const AutoDarkMode& auto_dark_mode); template <typename TextPaintInfo> void DrawEmphasisMarksInternal(const Font&, const TextPaintInfo&, const AtomicString& mark, - const FloatPoint&); + const FloatPoint&, + const AutoDarkMode& auto_dark_mode); template <typename DrawTextFunc> - void DrawTextPasses(const DrawTextFunc&); + void DrawTextPasses(const AutoDarkMode& auto_dark_mode, const DrawTextFunc&); void SaveLayer(const SkRect* bounds, const PaintFlags*); void RestoreLayer(); @@ -553,7 +582,6 @@ bool printing_ = false; bool in_drawing_recorder_ = false; - bool is_dark_mode_enabled_ = false; // The current node ID, which is used for marked content in a tagged PDF. DOMNodeId dom_node_id_ = kInvalidDOMNodeId;
diff --git a/third_party/blink/renderer/platform/graphics/graphics_context_test.cc b/third_party/blink/renderer/platform/graphics/graphics_context_test.cc index b6043fa6..73207698 100644 --- a/third_party/blink/renderer/platform/graphics/graphics_context_test.cc +++ b/third_party/blink/renderer/platform/graphics/graphics_context_test.cc
@@ -69,6 +69,10 @@ } \ } +AutoDarkMode AutoDarkModeDisabled() { + return AutoDarkMode(DarkModeFilter::ElementRole::kBackground, false); +} + TEST(GraphicsContextTest, Recording) { SkBitmap bitmap; bitmap.allocN32Pixels(100, 100); @@ -82,12 +86,14 @@ FloatRect bounds(0, 0, 100, 100); context.BeginRecording(bounds); - context.FillRect(FloatRect(0, 0, 50, 50), opaque, SkBlendMode::kSrcOver); + context.FillRect(FloatRect(0, 0, 50, 50), opaque, AutoDarkModeDisabled(), + SkBlendMode::kSrcOver); canvas.drawPicture(context.EndRecording()); EXPECT_OPAQUE_PIXELS_ONLY_IN_RECT(bitmap, IntRect(0, 0, 50, 50)) context.BeginRecording(bounds); - context.FillRect(FloatRect(0, 0, 100, 100), opaque, SkBlendMode::kSrcOver); + context.FillRect(FloatRect(0, 0, 100, 100), opaque, AutoDarkModeDisabled(), + SkBlendMode::kSrcOver); // Make sure the opaque region was unaffected by the rect drawn during // recording. EXPECT_OPAQUE_PIXELS_ONLY_IN_RECT(bitmap, IntRect(0, 0, 50, 50)) @@ -123,7 +129,8 @@ context.SetLineDash(dash_array, 0); // Make the device opaque in 10,10 40x40. - context.FillRect(FloatRect(10, 10, 40, 40), opaque, SkBlendMode::kSrcOver); + context.FillRect(FloatRect(10, 10, 40, 40), opaque, AutoDarkModeDisabled(), + SkBlendMode::kSrcOver); canvas.drawPicture(context.EndRecording()); EXPECT_OPAQUE_PIXELS_ONLY_IN_RECT(bitmap, IntRect(10, 10, 40, 40)); @@ -139,7 +146,7 @@ PaintFlags flags; flags.setColor(transparent.Rgb()); flags.setBlendMode(SkBlendMode::kSrcOut); - context.DrawPath(path.GetSkPath(), flags); + context.DrawPath(path.GetSkPath(), flags, AutoDarkModeDisabled()); canvas.drawPicture(context.EndRecording()); EXPECT_OPAQUE_PIXELS_IN_RECT(bitmap, IntRect(20, 10, 30, 40)); @@ -157,14 +164,21 @@ void DrawColorsToContext(bool is_dark_mode_on, const DarkModeSettings& settings) { GraphicsContext context(*paint_controller_); - context.SetDarkModeEnabled(is_dark_mode_on); if (is_dark_mode_on) context.UpdateDarkModeSettingsForTest(settings); context.BeginRecording(FloatRect(0, 0, 4, 1)); - context.FillRect(FloatRect(0, 0, 1, 1), Color(SK_ColorBLACK)); - context.FillRect(FloatRect(1, 0, 1, 1), Color(SK_ColorWHITE)); - context.FillRect(FloatRect(2, 0, 1, 1), Color(SK_ColorRED)); - context.FillRect(FloatRect(3, 0, 1, 1), Color(SK_ColorGRAY)); + context.FillRect(FloatRect(0, 0, 1, 1), Color(SK_ColorBLACK), + AutoDarkMode(DarkModeFilter::ElementRole::kBackground, + is_dark_mode_on)); + context.FillRect(FloatRect(1, 0, 1, 1), Color(SK_ColorWHITE), + AutoDarkMode(DarkModeFilter::ElementRole::kBackground, + is_dark_mode_on)); + context.FillRect(FloatRect(2, 0, 1, 1), Color(SK_ColorRED), + AutoDarkMode(DarkModeFilter::ElementRole::kBackground, + is_dark_mode_on)); + context.FillRect(FloatRect(3, 0, 1, 1), Color(SK_ColorGRAY), + AutoDarkMode(DarkModeFilter::ElementRole::kBackground, + is_dark_mode_on)); // Capture the result in the bitmap. canvas_->drawPicture(context.EndRecording()); }
diff --git a/third_party/blink/renderer/platform/graphics/image.cc b/third_party/blink/renderer/platform/graphics/image.cc index e0d5a8c..02b6b2b 100644 --- a/third_party/blink/renderer/platform/graphics/image.cc +++ b/third_party/blink/renderer/platform/graphics/image.cc
@@ -290,7 +290,7 @@ flags.setColor(tile_shader ? SK_ColorBLACK : SK_ColorTRANSPARENT); flags.setShader(std::move(tile_shader)); - context.DrawRect(dest_rect, flags); + context.DrawRect(dest_rect, flags, AutoDarkMode(draw_options)); StartAnimation();
diff --git a/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.cc b/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.cc index 3f26deca..c3a59059 100644 --- a/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.cc +++ b/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.cc
@@ -1728,7 +1728,7 @@ PaintFlags flags; flags.setAntiAlias(true); for (unsigned i = 0; i < count; i++) - context.DrawPath(path, flags); + context.DrawPath(path, flags, AutoDarkMode::Disabled()); } TEST_P(PaintControllerTest, BeginAndEndFrame) {
diff --git a/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.h b/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.h index 10dd1920..5c2f0a89 100644 --- a/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.h +++ b/third_party/blink/renderer/platform/graphics/paint/paint_controller_test.h
@@ -45,7 +45,7 @@ if (DrawingRecorder::UseCachedDrawingIfPossible(context, client, type)) return; DrawingRecorder recorder(context, client, type, bounds); - context.DrawRect(bounds); + context.DrawRect(bounds, AutoDarkMode::Disabled()); } protected:
diff --git a/third_party/blink/renderer/platform/media/web_media_player_impl.cc b/third_party/blink/renderer/platform/media/web_media_player_impl.cc index 0c9e279..ee4bc411 100644 --- a/third_party/blink/renderer/platform/media/web_media_player_impl.cc +++ b/third_party/blink/renderer/platform/media/web_media_player_impl.cc
@@ -1909,11 +1909,6 @@ if (power_status_helper_) power_status_helper_->SetMetadata(metadata); - UMA_HISTOGRAM_ENUMERATION( - "Media.VideoRotation", - metadata.video_decoder_config.video_transformation().rotation, - media::VIDEO_ROTATION_MAX + 1); - if (HasAudio()) { media_metrics_provider_->SetHasAudio(metadata.audio_decoder_config.codec()); RecordEncryptionScheme("Audio",
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index 7f514a5..92226f6 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -1120,7 +1120,7 @@ }, { name: "FractionalLineHeight", - status: "stable", + status: "experimental", }, { name: "FractionalScrollOffsets",
diff --git a/third_party/blink/web_tests/NeverFixTests b/third_party/blink/web_tests/NeverFixTests index 4d8e7ed..2120efb 100644 --- a/third_party/blink/web_tests/NeverFixTests +++ b/third_party/blink/web_tests/NeverFixTests
@@ -1097,6 +1097,7 @@ external/wpt/appmanifest/shortcuts-member/shortcuts-member-skip-for-out-of-scope-url-manual.html [ Skip ] external/wpt/appmanifest/shortcuts-member/shortcuts-member-skip-for-undefined-name-manual.html [ Skip ] external/wpt/appmanifest/shortcuts-member/shortcuts-member-skip-for-undefined-url-manual.html [ Skip ] +external/wpt/appmanifest/id-member/id-member-manifest-update-manual.tentative.html [ Skip ] external/wpt/audio-output/setSinkId-manual.https.html [ Skip ] external/wpt/battery-status/battery-charging-manual.https.html [ Skip ] external/wpt/battery-status/battery-discharging-manual.https.html [ Skip ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index a5e6419..c84cda37 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -2850,10 +2850,6 @@ # ====== New tests from wpt-importer added here ====== crbug.com/626703 external/wpt/css/css-ui/input-security-none-sensitive-text-input.html [ Failure ] -crbug.com/626703 [ Linux ] external/wpt/html/semantics/forms/the-selectmenu-element/selectmenu-parts-structure.tentative.html [ Timeout ] -crbug.com/626703 [ Mac ] external/wpt/html/semantics/forms/the-selectmenu-element/selectmenu-parts-structure.tentative.html [ Timeout ] -crbug.com/626703 [ Linux ] virtual/synchronous_html_parser/external/wpt/html/semantics/forms/the-selectmenu-element/selectmenu-parts-structure.tentative.html [ Timeout ] -crbug.com/626703 [ Mac ] virtual/synchronous_html_parser/external/wpt/html/semantics/forms/the-selectmenu-element/selectmenu-parts-structure.tentative.html [ Timeout ] crbug.com/626703 [ Linux ] virtual/coep-for-shared-worker/external/wpt/html/cross-origin-embedder-policy/reporting-subresource-corp.https.html [ Skip Timeout ] crbug.com/626703 [ Mac11.0 ] virtual/coep-for-shared-worker/external/wpt/html/cross-origin-embedder-policy/reporting-subresource-corp.https.html [ Skip Timeout ] crbug.com/626703 [ Linux ] external/wpt/css/css-flexbox/dynamic-isize-change-002.html [ Crash ] @@ -3528,6 +3524,13 @@ crbug.com/626703 [ Mac10.12 ] virtual/plz-dedicated-worker/external/wpt/service-workers/idlharness.https.any.worker.html [ Failure ] crbug.com/626703 [ Mac10.12 ] virtual/portals/external/wpt/portals/idlharness.window.html [ Failure ] +# selectmenu timeouts +crbug.com/1253971 [ Linux ] external/wpt/html/semantics/forms/the-selectmenu-element/selectmenu-parts-structure.tentative.html [ Timeout ] +crbug.com/1253971 [ Mac ] external/wpt/html/semantics/forms/the-selectmenu-element/selectmenu-parts-structure.tentative.html [ Timeout ] +crbug.com/1253971 [ Linux ] virtual/synchronous_html_parser/external/wpt/html/semantics/forms/the-selectmenu-element/selectmenu-parts-structure.tentative.html [ Timeout ] +crbug.com/1253971 [ Mac ] virtual/synchronous_html_parser/external/wpt/html/semantics/forms/the-selectmenu-element/selectmenu-parts-structure.tentative.html [ Timeout ] + + ### See crbug.com/891427 comment near the top of this file: crbug.com/626703 external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-block-margins-2.html [ Failure ] crbug.com/367760 external/wpt/svg/pservers/reftests/meshgradient-basic-004.svg [ Failure ] @@ -4192,6 +4195,7 @@ # Sheriff failures 2018-08-15 crbug.com/874837 [ Win ] ietestcenter/css3/bordersbackgrounds/background-attachment-local-scrolling.htm [ Failure Pass ] +crbug.com/874837 [ Linux ] ietestcenter/css3/bordersbackgrounds/background-attachment-local-scrolling.htm [ Failure Pass ] crbug.com/874931 virtual/threaded-prefer-compositing/fast/scroll-behavior/smooth-scroll/mousewheel-scroll.html [ Crash Failure Pass ] crbug.com/875003 [ Win ] editing/caret/caret-is-hidden-when-no-focus.html [ Failure Pass ] @@ -5287,7 +5291,6 @@ crbug.com/476553 virtual/scroll-unification/fast/events/mouse-cursor-change.html [ Crash Failure Pass Timeout ] crbug.com/476553 virtual/scroll-unification/fast/events/platform-wheelevent-paging-xy-in-scrolling-div.html [ Crash Failure Pass Timeout ] crbug.com/476553 virtual/scroll-unification/fast/events/remove-child-onscroll.html [ Crash Failure Pass Timeout ] -crbug.com/476553 virtual/scroll-unification/fast/events/scrollbar-double-click.html [ Crash Failure Pass Timeout ] crbug.com/476553 virtual/scroll-unification/fast/events/touch/scroll-without-mouse-lacks-mousemove-events.html [ Crash Failure Pass Timeout ] crbug.com/476553 virtual/scroll-unification/fast/events/touch/touch-latched-scroll-node-removed.html [ Crash Failure Pass Timeout ] crbug.com/476553 virtual/scroll-unification/fast/events/touch/gesture/focus-selectionchange-on-tap.html [ Crash Failure Pass Timeout ] @@ -5303,10 +5306,8 @@ crbug.com/476553 virtual/scroll-unification/fast/scrolling/resize-corner-tracking-touch.html [ Crash Failure Pass Timeout ] crbug.com/476553 virtual/scroll-unification/fast/scrolling/subpixel-overflow-mouse-drag.html [ Crash Failure Pass Timeout ] crbug.com/476553 virtual/scroll-unification/http/tests/misc/destroy-middle-click-locked-target-crash.html [ Crash Failure Pass Skip Timeout ] -crbug.com/476553 virtual/scroll-unification/http/tests/misc/lock-renderer-for-middle-click-autoscroll.html [ Crash Failure Pass Timeout ] crbug.com/476553 virtual/scroll-unification/http/tests/misc/scroll-cross-origin-iframes.html [ Crash Failure Pass Timeout ] crbug.com/476553 virtual/scroll-unification/http/tests/misc/scroll-cross-origin-iframes-scrollbar.html [ Crash Failure Pass Timeout ] -crbug.com/476553 virtual/scroll-unification/ietestcenter/css3/bordersbackgrounds/background-attachment-local-scrolling.htm [ Crash Failure Pass Timeout ] crbug.com/476553 virtual/scroll-unification/plugins/gesture-events-scrolled.html [ Crash Failure Pass Timeout ] crbug.com/476553 virtual/scroll-unification/plugins/gesture-events.html [ Crash Failure Pass Timeout ] crbug.com/476553 virtual/scroll-unification/plugins/mouse-click-iframe-to-plugin.html [ Crash Failure Pass Timeout ] @@ -5314,7 +5315,6 @@ crbug.com/476553 virtual/scroll-unification/plugins/transformed-events.html [ Crash Failure Pass Timeout ] crbug.com/476553 virtual/scroll-unification/scrollbars/listbox-scrollbar-combinations.html [ Crash Failure Pass Timeout ] crbug.com/476553 virtual/scroll-unification-layout_ng_block_frag/fast/forms/fieldset/fieldset-legend-change.html [ Crash Failure Pass Timeout ] -crbug.com/476553 virtual/scroll-unification-overlay-scrollbar/plugin-overlay-scrollbar-mouse-capture.html [ Crash Failure Pass Timeout ] crbug.com/476553 virtual/scroll-unification-percent-based-scrolling/fast/scrolling/scrollbars/mouse-autoscrolling-on-deleted-scrollbar.html [ Crash Failure Pass Timeout ] crbug.com/476553 virtual/scroll-unification-percent-based-scrolling/fast/scrolling/scrollbars/mouse-autoscrolling-on-scrollbar.html [ Crash Failure Pass Skip Timeout ] crbug.com/476553 virtual/scroll-unification-prefer_compositing_to_lcd_text/scrollbars/auto-scrollbar-fades-out.html [ Crash Failure Pass Timeout ] @@ -5331,6 +5331,9 @@ crbug.com/476553 virtual/scroll-unification-wheel-event-regions/fast/events/platform-wheelevent-paging-xy-in-scrolling-div.html [ Crash Failure Pass Timeout ] crbug.com/476553 virtual/scroll-unification-wheel-event-regions/fast/events/wheel/wheel-latched-scroll-node-removed.html [ Crash Failure Pass Timeout ] +crbug.com/1253630 [ Win ] virtual/scroll-unification-overlay-scrollbar/plugin-overlay-scrollbar-mouse-capture.html [ Failure Pass ] +crbug.com/1098383 [ Mac ] fast/events/scrollbar-double-click.html [ Failure Pass ] + # Sheriff 2020-02-07 crbug.com/1050039 [ Mac ] fast/events/onbeforeunload-focused-iframe.html [ Failure Pass ]
diff --git a/third_party/blink/web_tests/VirtualTestSuites b/third_party/blink/web_tests/VirtualTestSuites index 28d9d6e..b42fc01 100644 --- a/third_party/blink/web_tests/VirtualTestSuites +++ b/third_party/blink/web_tests/VirtualTestSuites
@@ -554,7 +554,9 @@ }, { "prefix": "wasm-csp", - "bases": ["wasm"], + "bases": [ + "wasm", + "external/wpt/content-security-policy/wasm-unsafe-eval"], "args": ["--enable-blink-features=WebAssemblyCSP"] }, {
diff --git a/third_party/blink/web_tests/dark-mode/colors/opt-out-background-color-expected.html b/third_party/blink/web_tests/dark-mode/colors/opt-out-background-color-expected.html new file mode 100644 index 0000000..7102442 --- /dev/null +++ b/third_party/blink/web_tests/dark-mode/colors/opt-out-background-color-expected.html
@@ -0,0 +1,4 @@ +<!DOCTYPE html> +<body style="background: white;"> + <div style="width: 100px; height: 100px; background: white;"></div> +</body>
diff --git a/third_party/blink/web_tests/dark-mode/colors/opt-out-background-color.html b/third_party/blink/web_tests/dark-mode/colors/opt-out-background-color.html new file mode 100644 index 0000000..d3357da --- /dev/null +++ b/third_party/blink/web_tests/dark-mode/colors/opt-out-background-color.html
@@ -0,0 +1,10 @@ +<!DOCTYPE html> +<style> + div { + color-scheme: light only; + background-color: white; + width: 100px; + height: 100px; + } +</style> +<div></div>
diff --git a/third_party/blink/web_tests/dark-mode/colors/opt-out-border-color-expected.html b/third_party/blink/web_tests/dark-mode/colors/opt-out-border-color-expected.html new file mode 100644 index 0000000..7102442 --- /dev/null +++ b/third_party/blink/web_tests/dark-mode/colors/opt-out-border-color-expected.html
@@ -0,0 +1,4 @@ +<!DOCTYPE html> +<body style="background: white;"> + <div style="width: 100px; height: 100px; background: white;"></div> +</body>
diff --git a/third_party/blink/web_tests/dark-mode/colors/opt-out-border-color.html b/third_party/blink/web_tests/dark-mode/colors/opt-out-border-color.html new file mode 100644 index 0000000..2f30ce4 --- /dev/null +++ b/third_party/blink/web_tests/dark-mode/colors/opt-out-border-color.html
@@ -0,0 +1,12 @@ +<!DOCTYPE html> +<style> + div { + color-scheme: light only; + border-color: white; + border-width: 50px; + border-style: solid; + width: 0px; + height: 0px; + } +</style> +<div></div>
diff --git a/third_party/blink/web_tests/editing/text-iterator/details-find-crash-expected.txt b/third_party/blink/web_tests/editing/text-iterator/details-find-crash-expected.txt new file mode 100644 index 0000000..29853939 --- /dev/null +++ b/third_party/blink/web_tests/editing/text-iterator/details-find-crash-expected.txt
@@ -0,0 +1 @@ +This test passes if it doesn't crash
diff --git a/third_party/blink/web_tests/editing/text-iterator/details-find-crash.html b/third_party/blink/web_tests/editing/text-iterator/details-find-crash.html new file mode 100644 index 0000000..9f49154d --- /dev/null +++ b/third_party/blink/web_tests/editing/text-iterator/details-find-crash.html
@@ -0,0 +1,16 @@ +This test passes if it doesn't crash + +<script> +if (window.testRunner) + testRunner.dumpAsText(); + +window.onload = () => { + window.getSelection().selectAllChildren(document.body); + document.querySelector('object').remove(); + window.find(0); +}; +</script> + +<details> + <object id='id6'></object> +</details>
diff --git a/third_party/blink/web_tests/external/wpt/appmanifest/id-member/icon.png b/third_party/blink/web_tests/external/wpt/appmanifest/id-member/icon.png new file mode 100644 index 0000000..4b9c7c8f --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/appmanifest/id-member/icon.png Binary files differ
diff --git a/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-manifest-update-manual-v1.tentative.html b/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-manifest-update-manual-v1.tentative.html new file mode 100644 index 0000000..3f4a331 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-manifest-update-manual-v1.tentative.html
@@ -0,0 +1,29 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>Manifest Id Web Platform Test</title> + <style> + body { + margin: 2em; + } + + ol { + line-height: 200%; + } + </style> + <!-- This points to manifest v2 with a different start_url, but the + id is url-equivalent to manifest v1. --> + <link rel="manifest" href="id-member-manifest-update-v2.webmanifest" /> + <script src="id-member-manifest-update.js"></script> + + </head> + <body> + <h1> + Manifest Id Test + </h1> + <h2 style="color: red"> + start_url v1 + </h2> + </body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-manifest-update-manual-v2.tentative.html b/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-manifest-update-manual-v2.tentative.html new file mode 100644 index 0000000..4454017ea --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-manifest-update-manual-v2.tentative.html
@@ -0,0 +1,25 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <title>Manifest Id Web Platform Test</title> + <style> + body { + margin: 2em; + } + + ol { + line-height: 200%; + } + </style> + <link rel="manifest" href="id-member-manifest-update-v1.webmanifest" /> + <script src="id-member-manifest-update.js"></script> + </head> + <body> + <h1> + Manifest Id Test + </h1> + <h2 style="color: green"> + start_url v2 + </h2> + </body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-manifest-update-manual.tentative.html b/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-manifest-update-manual.tentative.html new file mode 100644 index 0000000..c534d740 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-manifest-update-manual.tentative.html
@@ -0,0 +1,22 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <title>Manifest Id Web Platform Test</title> + <style> + body { + margin: 2em; + } + + ol { + line-height: 200%; + } + </style> + <link rel="manifest" href="id-member-manifest-update-v1.webmanifest" /> + <script src="id-member-manifest-update.js"></script> + </head> + <body> + <h1> + Manifest Id Test + </h1> + </body> +</html> \ No newline at end of file
diff --git a/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-manifest-update-v1.webmanifest b/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-manifest-update-v1.webmanifest new file mode 100644 index 0000000..342bab3 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-manifest-update-v1.webmanifest
@@ -0,0 +1,13 @@ +{ + "name": "id member test", + "id": "/testId", + "start_url": "id-member-manifest-update-manual-v1.tentative.html", + "icons": [ + { + "src": "icon.png", + "sizes": "256x256", + "type": "image/png" + } + ], + "display": "standalone" +}
diff --git a/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-manifest-update-v1.webmanifest.headers b/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-manifest-update-v1.webmanifest.headers new file mode 100644 index 0000000..23f36ea --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-manifest-update-v1.webmanifest.headers
@@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 \ No newline at end of file
diff --git a/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-manifest-update-v2.webmanifest b/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-manifest-update-v2.webmanifest new file mode 100644 index 0000000..b758920 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-manifest-update-v2.webmanifest
@@ -0,0 +1,13 @@ +{ + "name": "id member test", + "id": "testId", + "start_url": "id-member-manifest-update-manual-v2.tentative.html", + "icons": [ + { + "src": "icon.png", + "sizes": "256x256", + "type": "image/png" + } + ], + "display": "standalone" +}
diff --git a/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-manifest-update-v2.webmanifest.headers b/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-manifest-update-v2.webmanifest.headers new file mode 100644 index 0000000..23f36ea --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-manifest-update-v2.webmanifest.headers
@@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 \ No newline at end of file
diff --git a/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-manifest-update.js b/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-manifest-update.js new file mode 100644 index 0000000..8576db1e --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-manifest-update.js
@@ -0,0 +1,34 @@ +window.onload = () => { + const instruction = document.createElement("div"); + instruction.innerHTML = ` + <h2> + Instructions + </h2> + <ol> + <li>Install <a href="id-member-manifest-update-manual.tentative.html ">id-member-manifest-update-manual.tentative.html </a> as a PWA</li> + <li> + Launch the app from OS. The page should be launched to start_url v1. + </li> + <li> + Close the app window. + </li> + <li> + Trigger a manifest update event. + <p> + This step is specific to each browser implementation. + On Chrome, trigger the update by restarting the browser through chrome://restart. + </p> + </li> + <li> + Launch the app from OS again, start_url should be updated to v2. + </li> + </ol> +`; + + document.body.appendChild(instruction); +}; +async function main() { + await navigator.serviceWorker.register("id-member-service-worker.js"); + await navigator.serviceWorker.ready; +} +main(); \ No newline at end of file
diff --git a/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-service-worker.js b/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-service-worker.js new file mode 100644 index 0000000..c0a16c4 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/appmanifest/id-member/id-member-service-worker.js
@@ -0,0 +1,8 @@ +// Some user agents only offer app installation if there is a SW and it handles +// offline requests. + +self.addEventListener("fetch", e => { + e.respondWith(fetch(e.request).catch(_ => { + return new Response('Offline test.'); + })); +});
diff --git a/third_party/blink/web_tests/external/wpt/compute-pressure/OWNERS b/third_party/blink/web_tests/external/wpt/compute-pressure/OWNERS index 40ec9fc..5b2fdf3 100644 --- a/third_party/blink/web_tests/external/wpt/compute-pressure/OWNERS +++ b/third_party/blink/web_tests/external/wpt/compute-pressure/OWNERS
@@ -1,2 +1 @@ -oyiptong@chromium.org pwnall@chromium.org
diff --git a/third_party/blink/web_tests/external/wpt/compute-pressure/README.md b/third_party/blink/web_tests/external/wpt/compute-pressure/README.md index 9766bb0..05bacb7 100644 --- a/third_party/blink/web_tests/external/wpt/compute-pressure/README.md +++ b/third_party/blink/web_tests/external/wpt/compute-pressure/README.md
@@ -1,2 +1,2 @@ This directory contains (tentative) tests for the -[Compute Pressure](https://oyiptong.github.io/compute-pressure/) specification. +[Compute Pressure](https://wicg.github.io/compute-pressure/) specification.
diff --git a/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-blocks-wasm.any.js b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-blocks-wasm.any.js new file mode 100644 index 0000000..15e9d87 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-blocks-wasm.any.js
@@ -0,0 +1,8 @@ +// META: global=window,worker + +promise_test(t => { + return promise_rejects_js( + t, WebAssembly.CompileError, + WebAssembly.instantiate( + new Uint8Array([0, 0x61, 0x73, 0x6d, 0x1, 0, 0, 0]))); +});
diff --git a/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-blocks-wasm.any.js.headers b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-blocks-wasm.any.js.headers new file mode 100644 index 0000000..d3790b6f --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-blocks-wasm.any.js.headers
@@ -0,0 +1 @@ +Content-Security-Policy: default-src 'self' 'unsafe-inline' \ No newline at end of file
diff --git a/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any-expected.txt b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any-expected.txt new file mode 100644 index 0000000..3e495b5 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL default-src-wasm-unsafe-eval-allows-wasm promise_test: Unhandled rejection with value: object "CompileError: WebAssembly.instantiate(): Wasm code generation disallowed by embedder" +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-unsafe-eval-allows-wasm.any.js b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any.js similarity index 100% copy from third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-unsafe-eval-allows-wasm.any.js copy to third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any.js
diff --git a/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any.js.headers b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any.js.headers new file mode 100644 index 0000000..2cb4ec4 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any.js.headers
@@ -0,0 +1 @@ +Content-Security-Policy: default-src 'self' 'unsafe-inline' 'wasm-unsafe-eval' \ No newline at end of file
diff --git a/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any.serviceworker-expected.txt b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any.serviceworker-expected.txt new file mode 100644 index 0000000..3e495b5 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any.serviceworker-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL default-src-wasm-unsafe-eval-allows-wasm promise_test: Unhandled rejection with value: object "CompileError: WebAssembly.instantiate(): Wasm code generation disallowed by embedder" +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any.sharedworker-expected.txt b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any.sharedworker-expected.txt new file mode 100644 index 0000000..3e495b5 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any.sharedworker-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL default-src-wasm-unsafe-eval-allows-wasm promise_test: Unhandled rejection with value: object "CompileError: WebAssembly.instantiate(): Wasm code generation disallowed by embedder" +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any.worker-expected.txt b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any.worker-expected.txt new file mode 100644 index 0000000..3e495b5 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any.worker-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL default-src-wasm-unsafe-eval-allows-wasm promise_test: Unhandled rejection with value: object "CompileError: WebAssembly.instantiate(): Wasm code generation disallowed by embedder" +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-unsafe-eval-allows-wasm.any.js.headers b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-unsafe-eval-allows-wasm.any.js.headers deleted file mode 100644 index c0ce20d..0000000 --- a/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-unsafe-eval-allows-wasm.any.js.headers +++ /dev/null
@@ -1 +0,0 @@ -Content-Security-Policy: script-src 'self' 'unsafe-inline' 'unsafe-eval' \ No newline at end of file
diff --git a/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any-expected.txt b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any-expected.txt new file mode 100644 index 0000000..869ddf9 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL script-src-wasm-unsafe-eval-allows-wasm promise_test: Unhandled rejection with value: object "CompileError: WebAssembly.instantiate(): Wasm code generation disallowed by embedder" +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-unsafe-eval-allows-wasm.any.js b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any.js similarity index 100% rename from third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-unsafe-eval-allows-wasm.any.js rename to third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any.js
diff --git a/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any.js.headers b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any.js.headers new file mode 100644 index 0000000..34634035 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any.js.headers
@@ -0,0 +1 @@ +Content-Security-Policy: script-src 'self' 'unsafe-inline' 'wasm-unsafe-eval'
diff --git a/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any.serviceworker-expected.txt b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any.serviceworker-expected.txt new file mode 100644 index 0000000..869ddf9 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any.serviceworker-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL script-src-wasm-unsafe-eval-allows-wasm promise_test: Unhandled rejection with value: object "CompileError: WebAssembly.instantiate(): Wasm code generation disallowed by embedder" +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any.sharedworker-expected.txt b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any.sharedworker-expected.txt new file mode 100644 index 0000000..869ddf9 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any.sharedworker-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL script-src-wasm-unsafe-eval-allows-wasm promise_test: Unhandled rejection with value: object "CompileError: WebAssembly.instantiate(): Wasm code generation disallowed by embedder" +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any.worker-expected.txt b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any.worker-expected.txt new file mode 100644 index 0000000..869ddf9 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any.worker-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL script-src-wasm-unsafe-eval-allows-wasm promise_test: Unhandled rejection with value: object "CompileError: WebAssembly.instantiate(): Wasm code generation disallowed by embedder" +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/crashtests/white-space-pre-wrap-chash.html b/third_party/blink/web_tests/external/wpt/css/css-text/crashtests/white-space-pre-wrap-chash.html new file mode 100644 index 0000000..3c239fb --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text/crashtests/white-space-pre-wrap-chash.html
@@ -0,0 +1,11 @@ +<!DOCTYPE html> +<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property"> +<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" /> +<style> +<style> +div { + white-space: pre-wrap; + font-size: 24023in; +} +</style> +<div>A A A</div>
diff --git a/third_party/blink/web_tests/external/wpt/font-access/OWNERS b/third_party/blink/web_tests/external/wpt/font-access/OWNERS index 1390e10b..acea549 100644 --- a/third_party/blink/web_tests/external/wpt/font-access/OWNERS +++ b/third_party/blink/web_tests/external/wpt/font-access/OWNERS
@@ -1,2 +1,2 @@ -oyiptong@chromium.org +pwnall@chromium.org jsbell@chromium.org
diff --git a/third_party/blink/web_tests/fast/events/scrollbar-double-click.html b/third_party/blink/web_tests/fast/events/scrollbar-double-click.html index 5ff42a3c..4574cc49 100644 --- a/third_party/blink/web_tests/fast/events/scrollbar-double-click.html +++ b/third_party/blink/web_tests/fast/events/scrollbar-double-click.html
@@ -1,8 +1,9 @@ +<script src="../../resources/gesture-util.js"></script> <body style="margin:0"> <script> if (window.testRunner) { - testRunner.dumpAsText(); - testRunner.waitUntilDone(); + testRunner.dumpAsText(); + testRunner.waitUntilDone(); } </script> @@ -14,19 +15,31 @@ <div id="console"></div> <script> + +const scroller = document.getElementById('overflow'); +function scrollTop() { + return scroller.scrollTop; +} + if (window.eventSender) { + waitForCompositorCommit().then(() => { + const scrollPromise = waitForScrollEvent(scroller); + eventSender.mouseMoveTo(390, 300); eventSender.mouseDown(); eventSender.mouseUp(); eventSender.mouseDown(); eventSender.mouseUp(); - setTimeout(finished, 1000); + scrollPromise.then(() => { + waitForAnimationEndTimeBased(scrollTop).then(finished); + }); + }); } -function finished() -{ - document.getElementById('console').innerHTML = "Scroll offset is " + document.getElementById('overflow').scrollTop; - testRunner.notifyDone(); +function finished() { + document.getElementById('console').innerHTML = "Scroll offset is " + scroller.scrollTop; + testRunner.notifyDone(); } + </script>
diff --git a/third_party/blink/web_tests/http/tests/misc/lock-renderer-for-middle-click-autoscroll.html b/third_party/blink/web_tests/http/tests/misc/lock-renderer-for-middle-click-autoscroll.html index bf9f174c..64af76a0 100644 --- a/third_party/blink/web_tests/http/tests/misc/lock-renderer-for-middle-click-autoscroll.html +++ b/third_party/blink/web_tests/http/tests/misc/lock-renderer-for-middle-click-autoscroll.html
@@ -18,7 +18,7 @@ var scrollOffset; async_test(t => { - // On document load, perform middle click just above the container + // On document load, perform middle click 20px above the container // of iframe and start moving mouse in vertical direction such that cursor // is over OOPIF. If the bug repros (crbug.com/872832), cursor changes // back to pointer once mouse move over OOPIF and will not scroll the root @@ -26,20 +26,20 @@ window.addEventListener('load', async () => { container = document.getElementById('container'); var subFrame = document.getElementsByTagName('iframe')[0]; - var startx = subFrame.offsetLeft + (subFrame.offsetWidth / 2); - var starty = subFrame.offsetTop; - var endX = startx; - var endY = starty + 20; + var startX = subFrame.offsetLeft + (subFrame.offsetWidth / 2); + var startY = subFrame.offsetTop - 20; + var endX = startX; + var endY = subFrame.offsetTop + subFrame.offsetHeight / 2; - await mouseMoveTo(startx, starty); - // middle click at startx starty - await mouseClickOn(startx, starty, 1); - await mouseMoveTo(endX, endY + 50); + await mouseMoveTo(startX, startY); + // middle click at startX startY + await mouseClickOn(startX, startY, 1); + await mouseMoveTo(endX, endY); await waitFor(() => { return (container.scrollTop > 0); }); // Left click to cancel middle click autoscroll. - await mouseClickOn(endX,endY + 50); + await mouseClickOn(endX, endY); // Wait for the cursor shape to go back to normal. await waitFor(() => { var cursorInfo = internals.getCurrentCursorInfo();
diff --git a/third_party/blink/web_tests/ietestcenter/css3/bordersbackgrounds/background-attachment-local-scrolling.htm b/third_party/blink/web_tests/ietestcenter/css3/bordersbackgrounds/background-attachment-local-scrolling.htm index b7e4943e..8a37465 100644 --- a/third_party/blink/web_tests/ietestcenter/css3/bordersbackgrounds/background-attachment-local-scrolling.htm +++ b/third_party/blink/web_tests/ietestcenter/css3/bordersbackgrounds/background-attachment-local-scrolling.htm
@@ -27,65 +27,77 @@ POSSIBILITY OF SUCH DAMAGE. --> <html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <title>CSS Test: Scrolling when background-attachment: local</title> - <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> - <link rel="help" href="http://www.w3.org/TR/css3-background/#the-background-attachment" /> - <meta name="flags" content="" /> - <meta name="assert" content="If 'background-attachment: local' the background scrolls along with the element's contents (the UA may treat 'background-clip: border-box' as the same as 'background-clip: padding-box')." /> - <style type="text/css"> - #test - { - width: 2in; - height: 2in; - border: 50px double black; - background-image: url("../support/cat.png"); - background-attachment: local; - overflow: scroll; - } - </style> - </head> - <body> - <script> - if (window.testRunner) { - // Unfortunately, this needs to be a pixel test - testRunner.waitUntilDone(); - } - </script> +<head> +<title>CSS Test: Scrolling when background-attachment: local</title> +<link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> +<link rel="help" href="http://www.w3.org/TR/css3-background/#the-background-attachment" /> +<meta name="flags" content="" /> +<meta name="assert" content="If 'background-attachment: local' the background scrolls along with the element's contents (the UA may treat 'background-clip: border-box' as the same as 'background-clip: padding-box')." /> +<script src="../../../resources/gesture-util.js"></script> +<style type="text/css"> - <p>Test passes if the images of all the cats scroll when the box is scrolled. (Presence of cats behind the double border is UA dependent). </p> - <div id="test">Filler Text Filler Text - Filler Text Filler Text Filler Text - Filler Text Filler Text Filler Text - Filler Text Filler Text Filler Text - Filler Text Filler Text Filler Text - Filler Text Filler Text Filler Text - Filler Text Filler Text Filler Text - Filler Text Filler Text Filler Text - Filler Text Filler Text Filler Text - Filler Text Filler Text Filler Text - Filler Text Filler Text Filler Text - Filler Text Filler Text Filler Text - Filler Text Filler Text Filler Text - Filler Text Filler Text </div> - </body> +#test { + width: 2in; + height: 2in; + border: 50px double black; + background-image: url("../support/cat.png"); + background-attachment: local; + overflow: scroll; +} - <div id="console"></div> +</style> +</head> +<body> +<script> - <script> - if (window.eventSender) { - eventSender.mouseMoveTo(240, 250); - eventSender.mouseDown(); - eventSender.mouseUp(); +if (window.testRunner) { + // Unfortunately, this needs to be a pixel test + testRunner.waitUntilDone(); +} - setTimeout(finished, 1000); - } +</script> +<p>Test passes if the images of all the cats scroll when the box is scrolled. (Presence of cats behind the double border is UA dependent). </p> +<div id="test">Filler Text Filler Text +Filler Text Filler Text Filler Text +Filler Text Filler Text Filler Text +Filler Text Filler Text Filler Text +Filler Text Filler Text Filler Text +Filler Text Filler Text Filler Text +Filler Text Filler Text Filler Text +Filler Text Filler Text Filler Text +Filler Text Filler Text Filler Text +Filler Text Filler Text Filler Text +Filler Text Filler Text Filler Text +Filler Text Filler Text Filler Text +Filler Text Filler Text Filler Text +Filler Text Filler Text </div> - function finished() - { - testRunner.notifyDone(); - } +<div id="console"></div> +<script> - </script> +const scroller = document.getElementById('test'); +function scrollTop() { + return scroller.scrollTop; +} +if (window.eventSender) { + waitForCompositorCommit().then(() => { + const scrollPromise = waitForScrollEvent(scroller); + + eventSender.mouseMoveTo(240, 250); + eventSender.mouseDown(); + eventSender.mouseUp(); + + scrollPromise.then(() => { + waitForAnimationEndTimeBased(scrollTop).then(finished); + }); + }); +} + +function finished() { + testRunner.notifyDone(); +} + +</script> +</body> </html>
diff --git a/third_party/blink/web_tests/platform/mac/fast/events/scrollbar-double-click-expected.txt b/third_party/blink/web_tests/platform/mac/fast/events/scrollbar-double-click-expected.txt deleted file mode 100644 index 7a1ac5a6..0000000 --- a/third_party/blink/web_tests/platform/mac/fast/events/scrollbar-double-click-expected.txt +++ /dev/null
@@ -1 +0,0 @@ -Scroll offset is 720
diff --git a/third_party/blink/web_tests/virtual/dark-mode-default/dark-mode/colors/opt-out-background-color-expected.html b/third_party/blink/web_tests/virtual/dark-mode-default/dark-mode/colors/opt-out-background-color-expected.html new file mode 100644 index 0000000..946ebbd --- /dev/null +++ b/third_party/blink/web_tests/virtual/dark-mode-default/dark-mode/colors/opt-out-background-color-expected.html
@@ -0,0 +1,5 @@ +<!DOCTYPE html> +<meta name="color-scheme" content="dark"> +<body style="background: #121212;"> + <div style="width: 100px; height: 100px; background: white;"></div> +</body>
diff --git a/third_party/blink/web_tests/virtual/dark-mode-default/dark-mode/colors/opt-out-border-color-expected.html b/third_party/blink/web_tests/virtual/dark-mode-default/dark-mode/colors/opt-out-border-color-expected.html new file mode 100644 index 0000000..946ebbd --- /dev/null +++ b/third_party/blink/web_tests/virtual/dark-mode-default/dark-mode/colors/opt-out-border-color-expected.html
@@ -0,0 +1,5 @@ +<!DOCTYPE html> +<meta name="color-scheme" content="dark"> +<body style="background: #121212;"> + <div style="width: 100px; height: 100px; background: white;"></div> +</body>
diff --git a/third_party/blink/web_tests/virtual/dark-mode-increase-text-contrast/dark-mode/colors/opt-out-background-color-expected.html b/third_party/blink/web_tests/virtual/dark-mode-increase-text-contrast/dark-mode/colors/opt-out-background-color-expected.html new file mode 100644 index 0000000..946ebbd --- /dev/null +++ b/third_party/blink/web_tests/virtual/dark-mode-increase-text-contrast/dark-mode/colors/opt-out-background-color-expected.html
@@ -0,0 +1,5 @@ +<!DOCTYPE html> +<meta name="color-scheme" content="dark"> +<body style="background: #121212;"> + <div style="width: 100px; height: 100px; background: white;"></div> +</body>
diff --git a/third_party/blink/web_tests/virtual/dark-mode-increase-text-contrast/dark-mode/colors/opt-out-border-color-expected.html b/third_party/blink/web_tests/virtual/dark-mode-increase-text-contrast/dark-mode/colors/opt-out-border-color-expected.html new file mode 100644 index 0000000..946ebbd --- /dev/null +++ b/third_party/blink/web_tests/virtual/dark-mode-increase-text-contrast/dark-mode/colors/opt-out-border-color-expected.html
@@ -0,0 +1,5 @@ +<!DOCTYPE html> +<meta name="color-scheme" content="dark"> +<body style="background: #121212;"> + <div style="width: 100px; height: 100px; background: white;"></div> +</body>
diff --git a/third_party/blink/web_tests/virtual/file-system-access-access-handle-incognito/external/wpt/file-system-access/sandboxed_FileSystemBaseHandle-move.https.any-expected.txt b/third_party/blink/web_tests/virtual/file-system-access-access-handle-incognito/external/wpt/file-system-access/sandboxed_FileSystemBaseHandle-move.https.any-expected.txt deleted file mode 100644 index 484a904e..0000000 --- a/third_party/blink/web_tests/virtual/file-system-access-access-handle-incognito/external/wpt/file-system-access/sandboxed_FileSystemBaseHandle-move.https.any-expected.txt +++ /dev/null
@@ -1,27 +0,0 @@ -This is a testharness.js-based test. -PASS move(dir, name) to rename a file -PASS move(dir, name) to rename a file the same name -FAIL move(dir, name) to rename an empty directory promise_test: Unhandled rejection with value: object "AbortError: The user aborted a request." -FAIL move(dir, name) to rename a non-empty directory promise_test: Unhandled rejection with value: object "AbortError: The user aborted a request." -PASS move(dir) to move a file to a new directory -PASS move(dir, "") to move a file to a new directory -PASS move(dir, name) to move a file to a new directory -FAIL move(dir) to move an empty directory to a new directory promise_test: Unhandled rejection with value: object "AbortError: The user aborted a request." -FAIL move(dir, "") to move an empty directory to a new directory promise_test: Unhandled rejection with value: object "AbortError: The user aborted a request." -FAIL move(dir, name) to move an empty directory to a new directory promise_test: Unhandled rejection with value: object "AbortError: The user aborted a request." -FAIL move(dir, "") to move a non-empty directory to a new directory promise_test: Unhandled rejection with value: object "AbortError: The user aborted a request." -FAIL move(dir, name) to move a non-empty directory to a new directory promise_test: Unhandled rejection with value: object "AbortError: The user aborted a request." -PASS move(dir) can be called multiple times -PASS move(dir, "") can be called multiple times -PASS move(dir, name) can be called multiple times -PASS move(dir, name) with a name with invalid characters should fail -FAIL move(dir, name) to move a directory within itself fails promise_rejects_dom: function "function() { throw e }" threw object "AbortError: The user aborted a request." that is not a DOMException InvalidModificationError: property "code" is equal to 20, expected 13 -FAIL move(dir, name) to move a directory within itself and rename fails promise_rejects_dom: function "function() { throw e }" threw object "AbortError: The user aborted a request." that is not a DOMException InvalidModificationError: property "code" is equal to 20, expected 13 -FAIL move(dir) to move a directory within a descendent fails promise_rejects_dom: function "function() { throw e }" threw object "AbortError: The user aborted a request." that is not a DOMException InvalidModificationError: property "code" is equal to 20, expected 13 -FAIL move(dir, name) to move a directory within a descendent fails promise_rejects_dom: function "function() { throw e }" threw object "AbortError: The user aborted a request." that is not a DOMException InvalidModificationError: property "code" is equal to 20, expected 13 -PASS move(dir) while the file has an open writable fails -PASS move(dir, name) while the file has an open writable fails -PASS move(dir) while the destination file has an open writable fails -PASS move(dir, name) while the destination file has an open writable fails -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/file-system-access-access-handle-incognito/external/wpt/file-system-access/sandboxed_FileSystemBaseHandle-rename.https.any-expected.txt b/third_party/blink/web_tests/virtual/file-system-access-access-handle-incognito/external/wpt/file-system-access/sandboxed_FileSystemBaseHandle-rename.https.any-expected.txt deleted file mode 100644 index 95afc342..0000000 --- a/third_party/blink/web_tests/virtual/file-system-access-access-handle-incognito/external/wpt/file-system-access/sandboxed_FileSystemBaseHandle-rename.https.any-expected.txt +++ /dev/null
@@ -1,15 +0,0 @@ -This is a testharness.js-based test. -PASS rename(name) to rename a file -PASS rename(name) to rename a file the same name -PASS rename("") to rename a file fails -FAIL rename(name) to rename an empty directory promise_test: Unhandled rejection with value: object "AbortError: The user aborted a request." -FAIL rename("") to rename an empty directory fails promise_rejects_js: function "function() { throw e }" threw object "AbortError: The user aborted a request." ("AbortError") expected instance of function "function TypeError() { [native code] }" ("TypeError") -FAIL rename(name) to rename a non-empty directory promise_test: Unhandled rejection with value: object "AbortError: The user aborted a request." -PASS rename(name) can be called multiple times -PASS rename(dir) should rename to stringified dir object -PASS rename(name) with a name with a trailing period should fail -PASS rename(name) with a name with invalid characters should fail -PASS rename(name) while the file has an open writable fails -PASS rename(name) while the destination file has an open writable fails -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/overlay-scrollbar/plugin-overlay-scrollbar-mouse-capture-expected.txt b/third_party/blink/web_tests/virtual/overlay-scrollbar/plugin-overlay-scrollbar-mouse-capture-expected.txt index 1934109..018428fe 100644 --- a/third_party/blink/web_tests/virtual/overlay-scrollbar/plugin-overlay-scrollbar-mouse-capture-expected.txt +++ b/third_party/blink/web_tests/virtual/overlay-scrollbar/plugin-overlay-scrollbar-mouse-capture-expected.txt
@@ -1,3 +1,4 @@ +CONSOLE MESSAGE: Blink Test Plugin: initializing This tests whether scrolling still works correctly when an overlay scrollbar is over a plugin. Clicking on the overlay scrollbar should cause it to activate and capture input. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
diff --git a/third_party/blink/web_tests/virtual/overlay-scrollbar/plugin-overlay-scrollbar-mouse-capture.html b/third_party/blink/web_tests/virtual/overlay-scrollbar/plugin-overlay-scrollbar-mouse-capture.html index 0f37ff1..dc17bc9a 100644 --- a/third_party/blink/web_tests/virtual/overlay-scrollbar/plugin-overlay-scrollbar-mouse-capture.html +++ b/third_party/blink/web_tests/virtual/overlay-scrollbar/plugin-overlay-scrollbar-mouse-capture.html
@@ -1,5 +1,6 @@ <head> <script src="../../resources/js-test.js"></script> + <script src="../../resources/gesture-util.js"></script> <style> body { /* Hide the horizontal-scrollbar so that clicking right at the @@ -74,6 +75,6 @@ var d = document.getElementById('container'); d.appendChild(plugin); - runTest(); + waitForCompositorCommit().then(runTest); } </script>
diff --git a/third_party/blink/web_tests/virtual/scroll-unification-overlay-scrollbar/plugin-overlay-scrollbar-mouse-capture-expected.txt b/third_party/blink/web_tests/virtual/scroll-unification-overlay-scrollbar/plugin-overlay-scrollbar-mouse-capture-expected.txt new file mode 100644 index 0000000..018428fe --- /dev/null +++ b/third_party/blink/web_tests/virtual/scroll-unification-overlay-scrollbar/plugin-overlay-scrollbar-mouse-capture-expected.txt
@@ -0,0 +1,11 @@ +CONSOLE MESSAGE: Blink Test Plugin: initializing +This tests whether scrolling still works correctly when an overlay scrollbar is over a plugin. Clicking on the overlay scrollbar should cause it to activate and capture input. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + +PASS eventHistory.length is 0 +PASS window.scrollY > 0 is true +PASS successfullyParsed is true + +TEST COMPLETE +
diff --git a/third_party/blink/web_tests/virtual/scroll-unification-overlay-scrollbar/plugin-overlay-scrollbar-mouse-capture.html b/third_party/blink/web_tests/virtual/scroll-unification-overlay-scrollbar/plugin-overlay-scrollbar-mouse-capture.html index 0f37ff1..dc17bc9a 100644 --- a/third_party/blink/web_tests/virtual/scroll-unification-overlay-scrollbar/plugin-overlay-scrollbar-mouse-capture.html +++ b/third_party/blink/web_tests/virtual/scroll-unification-overlay-scrollbar/plugin-overlay-scrollbar-mouse-capture.html
@@ -1,5 +1,6 @@ <head> <script src="../../resources/js-test.js"></script> + <script src="../../resources/gesture-util.js"></script> <style> body { /* Hide the horizontal-scrollbar so that clicking right at the @@ -74,6 +75,6 @@ var d = document.getElementById('container'); d.appendChild(plugin); - runTest(); + waitForCompositorCommit().then(runTest); } </script>
diff --git a/third_party/blink/web_tests/virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any-expected.txt b/third_party/blink/web_tests/virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any-expected.txt new file mode 100644 index 0000000..2c71e7c --- /dev/null +++ b/third_party/blink/web_tests/virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +PASS default-src-wasm-unsafe-eval-allows-wasm +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any.serviceworker-expected.txt b/third_party/blink/web_tests/virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any.serviceworker-expected.txt new file mode 100644 index 0000000..2c71e7c --- /dev/null +++ b/third_party/blink/web_tests/virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any.serviceworker-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +PASS default-src-wasm-unsafe-eval-allows-wasm +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any.sharedworker-expected.txt b/third_party/blink/web_tests/virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any.sharedworker-expected.txt new file mode 100644 index 0000000..2c71e7c --- /dev/null +++ b/third_party/blink/web_tests/virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any.sharedworker-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +PASS default-src-wasm-unsafe-eval-allows-wasm +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any.worker-expected.txt b/third_party/blink/web_tests/virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any.worker-expected.txt new file mode 100644 index 0000000..2c71e7c --- /dev/null +++ b/third_party/blink/web_tests/virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/default-src-wasm-unsafe-eval-allows-wasm.any.worker-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +PASS default-src-wasm-unsafe-eval-allows-wasm +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any-expected.txt b/third_party/blink/web_tests/virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any-expected.txt new file mode 100644 index 0000000..eb63070 --- /dev/null +++ b/third_party/blink/web_tests/virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +PASS script-src-wasm-unsafe-eval-allows-wasm +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any.serviceworker-expected.txt b/third_party/blink/web_tests/virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any.serviceworker-expected.txt new file mode 100644 index 0000000..eb63070 --- /dev/null +++ b/third_party/blink/web_tests/virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any.serviceworker-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +PASS script-src-wasm-unsafe-eval-allows-wasm +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any.sharedworker-expected.txt b/third_party/blink/web_tests/virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any.sharedworker-expected.txt new file mode 100644 index 0000000..eb63070 --- /dev/null +++ b/third_party/blink/web_tests/virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any.sharedworker-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +PASS script-src-wasm-unsafe-eval-allows-wasm +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any.worker-expected.txt b/third_party/blink/web_tests/virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any.worker-expected.txt new file mode 100644 index 0000000..eb63070 --- /dev/null +++ b/third_party/blink/web_tests/virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/script-src-wasm-unsafe-eval-allows-wasm.any.worker-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +PASS script-src-wasm-unsafe-eval-allows-wasm +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/beforematch/auto-expand-details-text-fragment.html b/third_party/blink/web_tests/wpt_internal/display-lock/beforematch/auto-expand-details-text-fragment.html new file mode 100644 index 0000000..321d82c0 --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/display-lock/beforematch/auto-expand-details-text-fragment.html
@@ -0,0 +1,30 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>beforematch fired on ScrollToTextFragment</title> +<link rel="author" title="Joey Arhar" href="mailto:jarhar@chromium.org"> +<link rel="help" href="https://github.com/WICG/display-locking"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-vendor.js"></script> + +<script src="/common/utils.js"></script> +<script src="/scroll-to-text-fragment/stash.js"></script> + +<script> +promise_test(t => new Promise((resolve, reject) => { + const key = token(); + test_driver.bless('Open a scroll to text fragment URL', () => { + window.open( + `resources/auto-expand-details-text-fragment.html?key=${key}#:~:text=foo`, + '_blank', + 'noopener'); + }); + fetchResults(key, resolve, reject); +}).then(results => { + assert_true(results.detailsHasOpenAttribute, + 'The matching closed details element should be open.'); + assert_true(results.pageYOffsetAfterRaf > 0, + 'The page should be scrolled down to the match.'); +}), 'Verifies that the beforematch event is fired on the matching element of a ScrollToTextFragment navigation.'); +</script>
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/beforematch/hidden-until-found-text-fragment.html b/third_party/blink/web_tests/wpt_internal/display-lock/beforematch/hidden-until-found-text-fragment.html new file mode 100644 index 0000000..05220f7 --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/display-lock/beforematch/hidden-until-found-text-fragment.html
@@ -0,0 +1,30 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>beforematch fired on ScrollToTextFragment</title> +<link rel="author" title="Joey Arhar" href="mailto:jarhar@chromium.org"> +<link rel="help" href="https://github.com/WICG/display-locking"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-vendor.js"></script> + +<script src="/common/utils.js"></script> +<script src="/scroll-to-text-fragment/stash.js"></script> + +<script> +promise_test(t => new Promise((resolve, reject) => { + const key = token(); + test_driver.bless('Open a scroll to text fragment URL', () => { + window.open( + `resources/hidden-until-found-text-fragment.html?key=${key}#:~:text=foo`, + '_blank', + 'noopener'); + }); + fetchResults(key, resolve, reject); +}).then(results => { + assert_false(results.targetHasHiddenAttribute, + 'The matching hidden=until-found element should have its hidden attribute removed so it can be scrolled to.'); + assert_true(results.pageYOffsetAfterRaf > 0, + 'The page should be scrolled down to foo.'); +}), 'Verifies that the beforematch event is fired on the matching element of a ScrollToTextFragment navigation.'); +</script>
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/beforematch/resources/auto-expand-details-text-fragment.html b/third_party/blink/web_tests/wpt_internal/display-lock/beforematch/resources/auto-expand-details-text-fragment.html new file mode 100644 index 0000000..b95459f --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/display-lock/beforematch/resources/auto-expand-details-text-fragment.html
@@ -0,0 +1,27 @@ +<!DOCTYPE html> +<script src="/scroll-to-text-fragment/stash.js"></script> + +<!-- This test is navigated to with the fragment #:~:text=foo --> + +<body> + <div style="height: 4000px;">spacer</div> + <details> + <div>foo</div> + </details> + <script> + requestAnimationFrame(() => { + requestAnimationFrame(() => { + const results = {}; + // This should be true. The details element should be opened by + // ScrollToTextFragment because it has matching text. + results.detailsHasOpenAttribute = document.querySelector('details').hasAttribute('open'); + // This should be greater than zero. The page should be scrolled down + // to the matching target. + results.pageYOffsetAfterRaf = window.pageYOffset; + + params = new URLSearchParams(window.location.search); + stashResultsThenClose(params.get('key'), results); + }); + }); + </script> +</body>
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/beforematch/resources/hidden-until-found-text-fragment.html b/third_party/blink/web_tests/wpt_internal/display-lock/beforematch/resources/hidden-until-found-text-fragment.html new file mode 100644 index 0000000..fe89b40 --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/display-lock/beforematch/resources/hidden-until-found-text-fragment.html
@@ -0,0 +1,25 @@ +<!DOCTYPE html> +<script src="/scroll-to-text-fragment/stash.js"></script> + +<!-- This test is navigated to with the fragment #:~:text=foo --> + +<body> + <div style="height: 4000px;">spacer</div> + <div id=target hidden=until-found>foo</div> + <script> + requestAnimationFrame(() => { + requestAnimationFrame(() => { + const results = {}; + // This should be false. The hidden=until-found attribute should be + // removed in response to ScrollToTextFragment. + results.targetHasHiddenAttribute = document.getElementById('target').hasAttribute('hidden'); + // This should be greater than zero. The page should be scrolled down + // to foo. + results.pageYOffsetAfterRaf = window.pageYOffset; + + params = new URLSearchParams(window.location.search); + stashResultsThenClose(params.get('key'), results); + }); + }); + </script> +</body>
diff --git a/third_party/node/node_modules.tar.gz.sha1 b/third_party/node/node_modules.tar.gz.sha1 index 6a14535..80ed26b2 100644 --- a/third_party/node/node_modules.tar.gz.sha1 +++ b/third_party/node/node_modules.tar.gz.sha1
@@ -1 +1 @@ -5bc8bb9320e91495f03750915ea6f6204ef84118 +a837bef38a74972ffef5f41a51590c91dea937c9
diff --git a/third_party/node/package-lock.json b/third_party/node/package-lock.json index 7852f42..e00a8a22 100644 --- a/third_party/node/package-lock.json +++ b/third_party/node/package-lock.json
@@ -26,111 +26,100 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz", - "integrity": "sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==", + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.14.5.tgz", + "integrity": "sha512-9pzDqyc6OLDaqe+zbACgFkb6fKMNG6CObKpnYXChRsvYGyEdc7CA2BaqeOM+vOtCS5ndmJicPJhKAwYRI6UfFw==", "dependencies": { - "@babel/highlight": "^7.12.13" + "@babel/highlight": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/generator": { - "version": "7.14.3", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.14.3.tgz", - "integrity": "sha512-bn0S6flG/j0xtQdz3hsjJ624h3W0r3llttBMfyHX3YrZ/KtLYr15bjA0FXkgW7FpvrDuTuElXeVjiKlYRpnOFA==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.15.4.tgz", + "integrity": "sha512-d3itta0tu+UayjEORPNz6e1T3FtvWlP5N4V5M+lhp/CxT4oAA7/NcScnpRyspUMLK6tu9MNHmQHxRykuN2R7hw==", "dependencies": { - "@babel/types": "^7.14.2", + "@babel/types": "^7.15.4", "jsesc": "^2.5.1", "source-map": "^0.5.0" - } - }, - "node_modules/@babel/generator/node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + }, "engines": { - "node": ">=0.10.0" + "node": ">=6.9.0" } }, "node_modules/@babel/helper-function-name": { - "version": "7.14.2", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.14.2.tgz", - "integrity": "sha512-NYZlkZRydxw+YT56IlhIcS8PAhb+FEUiOzuhFTfqDyPmzAhRge6ua0dQYT/Uh0t/EDHq05/i+e5M2d4XvjgarQ==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.15.4.tgz", + "integrity": "sha512-Z91cOMM4DseLIGOnog+Z8OI6YseR9bua+HpvLAQ2XayUGU+neTtX+97caALaLdyu53I/fjhbeCnWnRH1O3jFOw==", "dependencies": { - "@babel/helper-get-function-arity": "^7.12.13", - "@babel/template": "^7.12.13", - "@babel/types": "^7.14.2" + "@babel/helper-get-function-arity": "^7.15.4", + "@babel/template": "^7.15.4", + "@babel/types": "^7.15.4" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/helper-get-function-arity": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.12.13.tgz", - "integrity": "sha512-DjEVzQNz5LICkzN0REdpD5prGoidvbdYk1BVgRUOINaWJP2t6avB27X1guXK1kXNrX0WMfsrm1A/ZBthYuIMQg==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.15.4.tgz", + "integrity": "sha512-1/AlxSF92CmGZzHnC515hm4SirTxtpDnLEJ0UyEMgTMZN+6bxXKg04dKhiRx5Enel+SUA1G1t5Ed/yQia0efrA==", "dependencies": { - "@babel/types": "^7.12.13" + "@babel/types": "^7.15.4" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-hoist-variables": { + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.15.4.tgz", + "integrity": "sha512-VTy085egb3jUGVK9ycIxQiPbquesq0HUQ+tPO0uv5mPEBZipk+5FkRKiWq5apuyTE9FUrjENB0rCf8y+n+UuhA==", + "dependencies": { + "@babel/types": "^7.15.4" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/helper-split-export-declaration": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.12.13.tgz", - "integrity": "sha512-tCJDltF83htUtXx5NLcaDqRmknv652ZWCHyoTETf1CXYJdPC7nohZohjUgieXhv0hTJdRf2FjDueFehdNucpzg==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.15.4.tgz", + "integrity": "sha512-HsFqhLDZ08DxCpBdEVtKmywj6PQbwnF6HHybur0MAnkAKnlS6uHkwnmRIkElB2Owpfb4xL4NwDmDLFubueDXsw==", "dependencies": { - "@babel/types": "^7.12.13" + "@babel/types": "^7.15.4" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.14.0", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.0.tgz", - "integrity": "sha512-V3ts7zMSu5lfiwWDVWzRDGIN+lnCEUdaXgtVHJgLb1rGaA6jMrtB9EmE7L18foXJIE8Un/A/h6NJfGQp/e1J4A==" + "version": "7.15.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz", + "integrity": "sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==", + "engines": { + "node": ">=6.9.0" + } }, "node_modules/@babel/highlight": { - "version": "7.14.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.14.0.tgz", - "integrity": "sha512-YSCOwxvTYEIMSGaBQb5kDDsCopDdiUGsqpatp3fOlI4+2HQSkTmEVWnVuySdAC5EWCqSWWTv0ib63RjR7dTBdg==", + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.14.5.tgz", + "integrity": "sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg==", "dependencies": { - "@babel/helper-validator-identifier": "^7.14.0", + "@babel/helper-validator-identifier": "^7.14.5", "chalk": "^2.0.0", "js-tokens": "^4.0.0" - } - }, - "node_modules/@babel/highlight/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" }, "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" + "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.14.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.14.3.tgz", - "integrity": "sha512-7MpZDIfI7sUC5zWo2+foJ50CSI5lcqDehZ0lVgIhSi4bFEk94fLAKlF3Q0nzSQQ+ca0lm+O6G9ztKVBeu8PMRQ==", + "version": "7.15.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.15.7.tgz", + "integrity": "sha512-rycZXvQ+xS9QyIcJ9HXeDWf1uxqlbVFAUq0Rq0dbc50Zb/+wUe/ehyfzGfm9KZZF0kBejYgxltBXocP+gKdL2g==", "bin": { "parser": "bin/babel-parser.js" }, @@ -139,37 +128,47 @@ } }, "node_modules/@babel/template": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.12.13.tgz", - "integrity": "sha512-/7xxiGA57xMo/P2GVvdEumr8ONhFOhfgq2ihK3h1e6THqzTAkHbkXgB0xI9yeTfIUoH3+oAeHhqm/I43OTbbjA==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.15.4.tgz", + "integrity": "sha512-UgBAfEa1oGuYgDIPM2G+aHa4Nlo9Lh6mGD2bDBGMTbYnc38vulXPuC1MGjYILIEmlwl6Rd+BPR9ee3gm20CBtg==", "dependencies": { - "@babel/code-frame": "^7.12.13", - "@babel/parser": "^7.12.13", - "@babel/types": "^7.12.13" + "@babel/code-frame": "^7.14.5", + "@babel/parser": "^7.15.4", + "@babel/types": "^7.15.4" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.14.2", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.14.2.tgz", - "integrity": "sha512-TsdRgvBFHMyHOOzcP9S6QU0QQtjxlRpEYOy3mcCO5RgmC305ki42aSAmfZEMSSYBla2oZ9BMqYlncBaKmD/7iA==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.15.4.tgz", + "integrity": "sha512-W6lQD8l4rUbQR/vYgSuCAE75ADyyQvOpFVsvPPdkhf6lATXAsQIG9YdtOcu8BB1dZ0LKu+Zo3c1wEcbKeuhdlA==", "dependencies": { - "@babel/code-frame": "^7.12.13", - "@babel/generator": "^7.14.2", - "@babel/helper-function-name": "^7.14.2", - "@babel/helper-split-export-declaration": "^7.12.13", - "@babel/parser": "^7.14.2", - "@babel/types": "^7.14.2", + "@babel/code-frame": "^7.14.5", + "@babel/generator": "^7.15.4", + "@babel/helper-function-name": "^7.15.4", + "@babel/helper-hoist-variables": "^7.15.4", + "@babel/helper-split-export-declaration": "^7.15.4", + "@babel/parser": "^7.15.4", + "@babel/types": "^7.15.4", "debug": "^4.1.0", "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/types": { - "version": "7.14.2", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.2.tgz", - "integrity": "sha512-SdjAG/3DikRHpUOjxZgnkbR11xUlyDMUFJdvnIgZEE16mqmY0BINMmc4//JMJglEmn6i7sq6p+mGrFWyZ98EEw==", + "version": "7.15.6", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", + "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", "dependencies": { - "@babel/helper-validator-identifier": "^7.14.0", + "@babel/helper-validator-identifier": "^7.14.9", "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@eslint/eslintrc": { @@ -192,43 +191,6 @@ "node": "^10.12.0 || >=12.0.0" } }, - "node_modules/@eslint/eslintrc/node_modules/acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/@eslint/eslintrc/node_modules/acorn-jsx": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", - "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==" - }, - "node_modules/@eslint/eslintrc/node_modules/eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "engines": { - "node": ">=4" - } - }, - "node_modules/@eslint/eslintrc/node_modules/espree": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.0.tgz", - "integrity": "sha512-dksIWsvKCixn1yrEXO8UosNSxaDoSYpq9reEjZSbHLpT5hpaCAKTLBwq0RHtLrIr+c0ByiYzWT8KTMRzoRCNlw==", - "dependencies": { - "acorn": "^7.4.0", - "acorn-jsx": "^5.2.0", - "eslint-visitor-keys": "^1.3.0" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, "node_modules/@eslint/eslintrc/node_modules/globals": { "version": "12.4.0", "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", @@ -238,13 +200,11 @@ }, "engines": { "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@eslint/eslintrc/node_modules/lodash": { - "version": "4.17.20", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", - "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==" - }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -266,9 +226,9 @@ } }, "node_modules/@nodelib/fs.walk": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.7.tgz", - "integrity": "sha512-BTIhocbPBSrRmHxOAJFtR18oLhxTtAFDAvL8hY1S3iU8k+E60W/YFs4jrixGzQjMpF4qPXxIQHcjVD9dz1C2QA==", + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" @@ -278,43 +238,43 @@ } }, "node_modules/@types/babel-generator": { - "version": "6.25.3", - "resolved": "https://registry.npmjs.org/@types/babel-generator/-/babel-generator-6.25.3.tgz", - "integrity": "sha512-pGgnuxVddKcYIc+VJkRDop7gxLhqclNKBdlsm/5Vp8d+37pQkkDK7fef8d9YYImRzw9xcojEPc18pUYnbxmjqA==", + "version": "6.25.4", + "resolved": "https://registry.npmjs.org/@types/babel-generator/-/babel-generator-6.25.4.tgz", + "integrity": "sha512-Rnsen+ckop5mbl9d43bempS7i9wdTN1vytiTlmQla/YiNm6kH8kEVABVSXmp1UbnpkUV44nUCPeDQoa+Mu7ALA==", "dependencies": { "@types/babel-types": "*" } }, "node_modules/@types/babel-traverse": { - "version": "6.25.5", - "resolved": "https://registry.npmjs.org/@types/babel-traverse/-/babel-traverse-6.25.5.tgz", - "integrity": "sha512-WrMbwmu+MWf8FiUMbmVOGkc7bHPzndUafn1CivMaBHthBBoo0VNIcYk1KV71UovYguhsNOwf3UF5oRmkkGOU3w==", + "version": "6.25.7", + "resolved": "https://registry.npmjs.org/@types/babel-traverse/-/babel-traverse-6.25.7.tgz", + "integrity": "sha512-BeQiEGLnVzypzBdsexEpZAHUx+WucOMXW6srEWDkl4SegBlaCy+iBvRO+4vz6EZ+BNQg22G4MCdDdvZxf+jW5A==", "dependencies": { "@types/babel-types": "*" } }, "node_modules/@types/babel-types": { - "version": "7.0.7", - "resolved": "https://registry.npmjs.org/@types/babel-types/-/babel-types-7.0.7.tgz", - "integrity": "sha512-dBtBbrc+qTHy1WdfHYjBwRln4+LWqASWakLHsWHR2NWHIFkv4W3O070IGoGLEBrJBvct3r0L1BUPuvURi7kYUQ==" + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/babel-types/-/babel-types-7.0.11.tgz", + "integrity": "sha512-pkPtJUUY+Vwv6B1inAz55rQvivClHJxc9aVEPPmaq2cbyeMLCiDpbKpcKyX4LAwpNGi+SHBv0tHv6+0gXv0P2A==" }, "node_modules/@types/babylon": { - "version": "6.16.5", - "resolved": "https://registry.npmjs.org/@types/babylon/-/babylon-6.16.5.tgz", - "integrity": "sha512-xH2e58elpj1X4ynnKp9qSnWlsRTIs6n3tgLGNfwAGHwePw0mulHQllV34n0T25uYSu1k0hRKkWXF890B1yS47w==", + "version": "6.16.6", + "resolved": "https://registry.npmjs.org/@types/babylon/-/babylon-6.16.6.tgz", + "integrity": "sha512-G4yqdVlhr6YhzLXFKy5F7HtRBU8Y23+iWy7UKthMq/OSQnL1hbsoeXESQ2LY8zEDlknipDG3nRGhUC9tkwvy/w==", "dependencies": { "@types/babel-types": "*" } }, "node_modules/@types/chai": { - "version": "4.1.7", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.1.7.tgz", - "integrity": "sha512-2Y8uPt0/jwjhQ6EiluT0XCri1Dbplr0ZxfFXUz+ye13gaqE8u5gL5ppao1JrUYr9cIip5S6MvQzBS7Kke7U9VA==" + "version": "4.2.22", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.22.tgz", + "integrity": "sha512-tFfcE+DSTzWAgifkjik9AySNqIyNoYwmR+uecPwwD/XRNfvOjmC/FjCxpiUGDkDVDphPfCUecSQVFw+lN3M3kQ==" }, "node_modules/@types/chai-subset": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.2.tgz", - "integrity": "sha512-VMA1aOXwPEJADlj5ykmYv77YKmbEuAxiLz/+lT6vFIWQ1EA06jF01TytVBAbVTNk0pjfW1Uhw5R5MaEq426N0A==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.3.tgz", + "integrity": "sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==", "dependencies": { "@types/chai": "*" } @@ -330,9 +290,9 @@ "integrity": "sha1-5zZWSMG0ITalnH1QQGN7O1yDthQ=" }, "node_modules/@types/cssbeautify": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/@types/cssbeautify/-/cssbeautify-0.3.1.tgz", - "integrity": "sha1-jgvuj33suVIlDaDK6+BeMFkcF+8=" + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@types/cssbeautify/-/cssbeautify-0.3.2.tgz", + "integrity": "sha512-b3PXlFAcS4gvGr2pDz0NoZEBo3MMQe8Ozy6+Mvm3XIEcHS4oQstvCnnCofBZD/0tQgxSzkYbW+cD3yD4yaKTxQ==" }, "node_modules/@types/doctrine": { "version": "0.0.1", @@ -345,9 +305,9 @@ "integrity": "sha512-8O84hHuVhMMLHLybf3y9SQpNcnQSuzVzcJaUNq9+4Ovb7fodS0aQXep4hyMtxd6fe/dyszbHFjFqtyawf4y46A==" }, "node_modules/@types/estree": { - "version": "0.0.37", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.37.tgz", - "integrity": "sha512-1IT6vNpmU9w18P3v6mN9idv18z5KPVTi4t7+rU9VLnkxo0LCam8IXy/eSVzOaQ1Wpabra2cN3A8K/SliPK/Suw==" + "version": "0.0.50", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.50.tgz", + "integrity": "sha512-C6N5s2ZFtuZRj54k2/zyRhNDjJwwcViAM3Nbm8zjBpbqAdZ00mr0CFxvSKeO8Y/e03WVFLpQMdHYVfUd6SB+Hw==" }, "node_modules/@types/google.analytics": { "version": "0.0.42", @@ -360,19 +320,19 @@ "integrity": "sha1-byTuSHMdMRaOpRBhDW3RXl/Jxv8=" }, "node_modules/@types/json-schema": { - "version": "7.0.7", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz", - "integrity": "sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA==" + "version": "7.0.9", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz", + "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==" }, "node_modules/@types/minimatch": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", - "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==" + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", + "integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==" }, "node_modules/@types/node": { - "version": "4.9.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-4.9.3.tgz", - "integrity": "sha512-Q9eESThBvAbfEzznF1qTAKUoPbJEbK3lTSO0S3mICvmG/vUSZ+HnCtidpuB58Po7CJt5A2goKsDiYScN8d1V4A==" + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-4.9.5.tgz", + "integrity": "sha512-+8fpgbXsbATKRF2ayAlYhPl2E9MPdLjrnK/79ZEpyPJ+k7dZwJm9YM8FK+l4rqL//xHk7PgQhGwz6aA2ckxbCQ==" }, "node_modules/@types/parse5": { "version": "0.0.31", @@ -393,9 +353,9 @@ "integrity": "sha512-hfnXRGugz+McgX2jxyy5qz9sB21LRzlGn24zlwN2KEgoPtEvjzNRrLtUkOOebPDPZl3Rq7ywKxYvylVcEZDnEw==" }, "node_modules/@types/q": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.2.tgz", - "integrity": "sha512-ce5d3q03Ex0sy4R14722Rmt6MT07Ua+k4FwDfdcToYJcMKNtRVQvJ6JCAPdAmAnbRb6CsX6aYb9m96NGod9uTw==" + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.5.tgz", + "integrity": "sha512-L28j2FcJfSZOnL1WBjDYp2vUHCeIFlyYI/53EwD/rKUBQ7MtUUfbQWiyKJGpcnv4/WgrhWsFKrcPstcAt/J0tQ==" }, "node_modules/@types/resolve": { "version": "0.0.6", @@ -447,36 +407,19 @@ }, "engines": { "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dependencies": { - "ms": "2.1.2" }, - "engines": { - "node": ">=6.0" - } - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", - "dependencies": { - "lru-cache": "^6.0.0" + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" }, - "bin": { - "semver": "bin/semver.js" + "peerDependencies": { + "@typescript-eslint/parser": "^4.0.0", + "eslint": "^5.0.0 || ^6.0.0 || ^7.0.0" }, - "engines": { - "node": ">=10" + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, "node_modules/@typescript-eslint/experimental-utils": { @@ -493,25 +436,13 @@ }, "engines": { "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/@typescript-eslint/experimental-utils/node_modules/eslint-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", - "dependencies": { - "eslint-visitor-keys": "^2.0.0" }, - "engines": { - "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" - } - }, - "node_modules/@typescript-eslint/experimental-utils/node_modules/eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "engines": { - "node": ">=10" + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "*" } }, "node_modules/@typescript-eslint/parser": { @@ -526,17 +457,18 @@ }, "engines": { "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/@typescript-eslint/parser/node_modules/debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dependencies": { - "ms": "2.1.2" }, - "engines": { - "node": ">=6.0" + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^5.0.0 || ^6.0.0 || ^7.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, "node_modules/@typescript-eslint/scope-manager": { @@ -549,6 +481,10 @@ }, "engines": { "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } }, "node_modules/@typescript-eslint/types": { @@ -557,6 +493,10 @@ "integrity": "sha512-STyMPxR3cS+LaNvS8yK15rb8Y0iL0tFXq0uyl6gY45glyI7w0CsyqyEXl/Fa0JlQy+pVANeK3sbwPneCbWE7yg==", "engines": { "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } }, "node_modules/@typescript-eslint/typescript-estree": { @@ -574,31 +514,15 @@ }, "engines": { "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dependencies": { - "ms": "2.1.2" }, - "engines": { - "node": ">=6.0" - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", - "dependencies": { - "lru-cache": "^6.0.0" + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, "node_modules/@typescript-eslint/visitor-keys": { @@ -611,20 +535,16 @@ }, "engines": { "node": "^8.10.0 || ^10.13.0 || >=11.10.1" - } - }, - "node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "engines": { - "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } }, "node_modules/acorn": { - "version": "5.7.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", - "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==", + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", "bin": { "acorn": "bin/acorn" }, @@ -633,22 +553,11 @@ } }, "node_modules/acorn-jsx": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", - "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", - "dependencies": { - "acorn": "^3.0.4" - } - }, - "node_modules/acorn-jsx/node_modules/acorn": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", - "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "node_modules/ajv": { @@ -660,6 +569,10 @@ "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" } }, "node_modules/ansi-colors": { @@ -682,19 +595,22 @@ } }, "node_modules/ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "engines": { - "node": ">=0.10.0" + "node": ">=8" } }, "node_modules/ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dependencies": { + "color-convert": "^1.9.0" + }, "engines": { - "node": ">=0.10.0" + "node": ">=4" } }, "node_modules/argparse": { @@ -742,15 +658,66 @@ "js-tokens": "^3.0.2" } }, + "node_modules/babel-code-frame/node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/babel-code-frame/node_modules/ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/babel-code-frame/node_modules/chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dependencies": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/babel-code-frame/node_modules/js-tokens": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=" }, + "node_modules/babel-code-frame/node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/babel-code-frame/node_modules/supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/babel-eslint": { "version": "10.0.2", "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.0.2.tgz", "integrity": "sha512-UdsurWPtgiPgpJ06ryUnuaSXC2s0WoSZnQmEpbAH65XZSdwowgN5MvyP7e88nW07FYXv72erVtpBkxyDVKhH1Q==", + "deprecated": "babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.", "dependencies": { "@babel/code-frame": "^7.0.0", "@babel/parser": "^7.0.0", @@ -761,6 +728,9 @@ }, "engines": { "node": ">=6" + }, + "peerDependencies": { + "eslint": ">= 4.12.1" } }, "node_modules/babel-eslint/node_modules/eslint-scope": { @@ -775,6 +745,14 @@ "node": ">=4.0.0" } }, + "node_modules/babel-eslint/node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "engines": { + "node": ">=4" + } + }, "node_modules/babel-generator": { "version": "6.26.1", "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz", @@ -798,14 +776,6 @@ "jsesc": "bin/jsesc" } }, - "node_modules/babel-generator/node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/babel-messages": { "version": "6.23.0", "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", @@ -888,9 +858,9 @@ } }, "node_modules/balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "node_modules/boolbase": { "version": "1.0.0", @@ -918,9 +888,21 @@ } }, "node_modules/buffer-from": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/callsites": { "version": "3.1.0", @@ -939,18 +921,16 @@ } }, "node_modules/chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dependencies": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" }, "engines": { - "node": ">=0.10.0" + "node": ">=4" } }, "node_modules/clone": { @@ -974,41 +954,6 @@ "node": ">= 4.0" } }, - "node_modules/coa/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/coa/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/coa/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -1051,15 +996,22 @@ "node": ">=0.12.0" } }, + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "node_modules/core-js": { - "version": "2.6.5", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.5.tgz", - "integrity": "sha512-klh/kDpwX8hryYL14M9w/xei6vrv6sE8gTHDG7/T/+SEovB/G4ejwcfE/CBzO6Edsu+OETZMZ3wcX/EjUkrl5A==" + "version": "2.6.12", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz", + "integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==", + "deprecated": "core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.", + "hasInstallScript": true }, "node_modules/crisper": { "version": "2.1.1", @@ -1088,12 +1040,12 @@ } }, "node_modules/css-select": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-2.0.2.tgz", - "integrity": "sha512-dSpYaDVoWaELjvZ3mS6IKZM/y2PMPa/XYoEfYNZePL4U/XgyxZNroHEHReDx/d+VgXh9VbCTtFqLkFbmeqeaRQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-2.1.0.tgz", + "integrity": "sha512-Dqk7LQKpwLoH3VovzZnkzegqNSuAziQyNZUcrdDM401iY+R5NkGBXGmtO05/yaXQziALuPogeG0b7UAgjnTJTQ==", "dependencies": { "boolbase": "^1.0.0", - "css-what": "^2.1.2", + "css-what": "^3.2.1", "domutils": "^1.7.0", "nth-check": "^1.0.2" } @@ -1115,25 +1067,20 @@ "node": ">=0.10.0" } }, - "node_modules/css-tree/node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/css-url-regex": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/css-url-regex/-/css-url-regex-1.1.0.tgz", "integrity": "sha1-g4NCMMyfdMRX3lnuvRVD/uuDt+w=" }, "node_modules/css-what": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz", - "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==", + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-3.4.2.tgz", + "integrity": "sha512-ACUm3L0/jiZTqfzRM3Hi9Q8eZqd6IK37mMWPLz9PJxkLWllYeRf+EHUSHYEtFop2Eqytaq1FizFVh7XfBnXCDQ==", "engines": { - "node": "*" + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" } }, "node_modules/cssbeautify": { @@ -1170,20 +1117,20 @@ "node": ">=0.10.0" } }, - "node_modules/csso/node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", "dependencies": { - "ms": "^2.1.1" + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, "node_modules/deep-extend": { @@ -1196,9 +1143,9 @@ } }, "node_modules/deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" }, "node_modules/define-properties": { "version": "1.1.3", @@ -1234,25 +1181,36 @@ } }, "node_modules/doctrine": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", "dependencies": { "esutils": "^2.0.2" }, "engines": { - "node": ">=0.10.0" + "node": ">=6.0.0" } }, "node_modules/dom-serializer": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz", - "integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==", + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz", + "integrity": "sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g==", "dependencies": { - "domelementtype": "^1.3.0", - "entities": "^1.1.1" + "domelementtype": "^2.0.1", + "entities": "^2.0.0" } }, + "node_modules/dom-serializer/node_modules/domelementtype": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz", + "integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ] + }, "node_modules/dom5": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/dom5/-/dom5-1.3.6.tgz", @@ -1296,30 +1254,48 @@ } }, "node_modules/entities": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", - "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==" + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", + "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } }, "node_modules/es-abstract": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.13.0.tgz", - "integrity": "sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg==", + "version": "1.18.6", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.6.tgz", + "integrity": "sha512-kAeIT4cku5eNLNuUKhlmtuk1/TRZvQoYccn6TO0cSVdf1kzB0T7+dYuVK9MWM7l+/53W2Q8M7N2c6MQvhXFcUQ==", "dependencies": { - "es-to-primitive": "^1.2.0", + "call-bind": "^1.0.2", + "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", + "get-intrinsic": "^1.1.1", + "get-symbol-description": "^1.0.0", "has": "^1.0.3", - "is-callable": "^1.1.4", - "is-regex": "^1.0.4", - "object-keys": "^1.0.12" + "has-symbols": "^1.0.2", + "internal-slot": "^1.0.3", + "is-callable": "^1.2.4", + "is-negative-zero": "^2.0.1", + "is-regex": "^1.1.4", + "is-string": "^1.0.7", + "object-inspect": "^1.11.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.2", + "string.prototype.trimend": "^1.0.4", + "string.prototype.trimstart": "^1.0.4", + "unbox-primitive": "^1.0.1" }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/es-to-primitive": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", - "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", "dependencies": { "is-callable": "^1.1.4", "is-date-object": "^1.0.1", @@ -1327,6 +1303,9 @@ }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/escape-string-regexp": { @@ -1385,6 +1364,9 @@ }, "engines": { "node": "^10.12.0 || >=12.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, "node_modules/eslint-scope": { @@ -1399,74 +1381,29 @@ "node": ">=8.0.0" } }, - "node_modules/eslint-scope/node_modules/esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dependencies": { - "estraverse": "^5.2.0" - }, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/eslint-scope/node_modules/esrecurse/node_modules/estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", - "engines": { - "node": ">=4.0" - } - }, "node_modules/eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", "dependencies": { - "eslint-visitor-keys": "^1.1.0" + "eslint-visitor-keys": "^2.0.0" }, "engines": { - "node": ">=6" - } - }, - "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "engines": { - "node": ">=4" + "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=5" } }, "node_modules/eslint-visitor-keys": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", - "integrity": "sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", "engines": { - "node": ">=4" - } - }, - "node_modules/eslint/node_modules/acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/eslint/node_modules/acorn-jsx": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", - "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==" - }, - "node_modules/eslint/node_modules/ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "engines": { - "node": ">=8" + "node": ">=10" } }, "node_modules/eslint/node_modules/ansi-styles": { @@ -1478,18 +1415,24 @@ }, "engines": { "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, "node_modules/eslint/node_modules/chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" }, "engines": { "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" } }, "node_modules/eslint/node_modules/color-convert": { @@ -1508,39 +1451,21 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, - "node_modules/eslint/node_modules/doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "node_modules/eslint/node_modules/eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", "dependencies": { - "esutils": "^2.0.2" + "eslint-visitor-keys": "^1.1.0" }, "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/eslint/node_modules/eslint-visitor-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz", - "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==", - "engines": { - "node": ">=10" - } - }, - "node_modules/eslint/node_modules/espree": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.0.tgz", - "integrity": "sha512-dksIWsvKCixn1yrEXO8UosNSxaDoSYpq9reEjZSbHLpT5hpaCAKTLBwq0RHtLrIr+c0ByiYzWT8KTMRzoRCNlw==", - "dependencies": { - "acorn": "^7.4.0", - "acorn-jsx": "^5.2.0", - "eslint-visitor-keys": "^1.3.0" + "node": ">=6" }, - "engines": { - "node": "^10.12.0 || >=12.0.0" + "funding": { + "url": "https://github.com/sponsors/mysticatea" } }, - "node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys": { + "node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", @@ -1557,6 +1482,9 @@ }, "engines": { "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/eslint/node_modules/has-flag": { @@ -1567,22 +1495,6 @@ "node": ">=8" } }, - "node_modules/eslint/node_modules/lodash": { - "version": "4.17.20", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", - "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==" - }, - "node_modules/eslint/node_modules/strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dependencies": { - "ansi-regex": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/eslint/node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -1595,15 +1507,24 @@ } }, "node_modules/espree": { - "version": "3.5.4", - "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz", - "integrity": "sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A==", + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", + "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", "dependencies": { - "acorn": "^5.5.0", - "acorn-jsx": "^3.0.0" + "acorn": "^7.4.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^1.3.0" }, "engines": { - "node": ">=0.10.0" + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "engines": { + "node": ">=4" } }, "node_modules/esprima": { @@ -1619,9 +1540,9 @@ } }, "node_modules/esquery": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz", - "integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", "dependencies": { "estraverse": "^5.1.0" }, @@ -1638,28 +1559,36 @@ } }, "node_modules/esrecurse": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", - "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", "dependencies": { - "estraverse": "^4.1.0" + "estraverse": "^5.2.0" }, "engines": { "node": ">=4.0" } }, - "node_modules/estraverse": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", - "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", + "node_modules/esrecurse/node_modules/estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", "engines": { - "node": ">=0.10.0" + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "engines": { + "node": ">=4.0" } }, "node_modules/esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "engines": { "node": ">=0.10.0" } @@ -1670,16 +1599,15 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, "node_modules/fast-glob": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", - "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", + "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==", "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.0", + "glob-parent": "^5.1.2", "merge2": "^1.3.0", - "micromatch": "^4.0.2", - "picomatch": "^2.2.1" + "micromatch": "^4.0.4" }, "engines": { "node": ">=8" @@ -1696,9 +1624,9 @@ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" }, "node_modules/fastq": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz", - "integrity": "sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g==", + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", "dependencies": { "reusify": "^1.0.4" } @@ -1781,10 +1709,38 @@ "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=" }, + "node_modules/get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -1795,12 +1751,15 @@ }, "engines": { "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/glob-parent": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", - "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dependencies": { "is-glob": "^4.0.1" }, @@ -1817,9 +1776,9 @@ } }, "node_modules/globby": { - "version": "11.0.3", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.3.tgz", - "integrity": "sha512-ffdmosjA807y7+lA1NM0jELARVmYul/715xiILEjo3hBLPTcirgQNnXECn5g3mtR8TOLCVbkfua1Hpen25/Xcg==", + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", + "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==", "dependencies": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", @@ -1830,6 +1789,9 @@ }, "engines": { "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/globby/node_modules/ignore": { @@ -1862,6 +1824,22 @@ "node": ">=0.10.0" } }, + "node_modules/has-ansi/node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/has-bigints": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", + "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -1871,11 +1849,28 @@ } }, "node_modules/has-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", - "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/ignore": { @@ -1887,15 +1882,18 @@ } }, "node_modules/import-fresh": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", - "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" }, "engines": { "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/imurmurhash": { @@ -1925,6 +1923,19 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, + "node_modules/internal-slot": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", + "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", + "dependencies": { + "get-intrinsic": "^1.1.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/invariant": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", @@ -1933,20 +1944,66 @@ "loose-envify": "^1.0.0" } }, - "node_modules/is-callable": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", + "node_modules/is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dependencies": { + "has-bigints": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-callable": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", + "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.6.0.tgz", + "integrity": "sha512-wShG8vs60jKfPWpF2KZRaAtvt3a20OAn7+IJ6hLPECpSABLcKtFKTTI4ZtH5QcBruBHlq+WsdHWyz0BCZW7svQ==", + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-date-object": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", - "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-extglob": { @@ -1958,14 +2015,14 @@ } }, "node_modules/is-finite": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", - "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", - "dependencies": { - "number-is-nan": "^1.0.0" - }, + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.1.0.tgz", + "integrity": "sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w==", "engines": { "node": ">=0.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/is-fullwidth-code-point": { @@ -1977,9 +2034,9 @@ } }, "node_modules/is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.2.tgz", + "integrity": "sha512-ZZTOjRcDjuAAAv2cTBQP/lL59ZTArx77+7UzHdWW/XB1mrfp7DEaVpKmZ0XIzx+M7AxfhKcqV+nMetUQmFifwg==", "dependencies": { "is-extglob": "^2.1.1" }, @@ -1987,6 +2044,17 @@ "node": ">=0.10.0" } }, + "node_modules/is-negative-zero": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", + "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -1995,26 +2063,61 @@ "node": ">=0.12.0" } }, - "node_modules/is-regex": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", - "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", + "node_modules/is-number-object": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz", + "integrity": "sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g==", "dependencies": { - "has": "^1.0.1" + "has-tostringtag": "^1.0.0" }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-symbol": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", - "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", "dependencies": { - "has-symbols": "^1.0.0" + "has-symbols": "^1.0.2" }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-windows": { @@ -2036,9 +2139,9 @@ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, "node_modules/js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -2069,9 +2172,9 @@ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=" }, "node_modules/jsonschema": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.2.4.tgz", - "integrity": "sha512-lz1nOH69GbsVHeVgEdvyavc/33oymY1AZwtePMiMj4HZPMbP5OIKK3zT9INMWjwua/V4Z4yq7wSlBbSG+g4AEw==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.4.0.tgz", + "integrity": "sha512-/YgW6pRMr6M7C+4o8kS+B/2myEpHCrxO4PEWnqJNBFMjn7EWXqlQ4tGwL6xTHeRplwuZmcAncdvfOad1nT2yMw==", "engines": { "node": "*" } @@ -2089,9 +2192,9 @@ } }, "node_modules/lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, "node_modules/lodash.camelcase": { "version": "4.3.0", @@ -2175,16 +2278,16 @@ } }, "node_modules/minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" }, "node_modules/mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", "dependencies": { - "minimist": "0.0.8" + "minimist": "^1.2.5" }, "bin": { "mkdirp": "bin/cmd.js" @@ -2208,12 +2311,12 @@ "boolbase": "~1.0.0" } }, - "node_modules/number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "engines": { - "node": ">=0.10.0" + "node_modules/object-inspect": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", + "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/object-keys": { @@ -2224,30 +2327,53 @@ "node": ">= 0.4" } }, - "node_modules/object.getownpropertydescriptors": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", - "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", + "node_modules/object.assign": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", "dependencies": { - "define-properties": "^1.1.2", - "es-abstract": "^1.5.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/object.values": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.0.tgz", - "integrity": "sha512-8mf0nKLAoFX6VlNVdhGj31SVYpaNFtUnuoOXWyFEstsWRgU837AK+JYM0iAxwkSzGRbwn8cbFmgbyxj1j4VbXg==", - "dependencies": { + "call-bind": "^1.0.0", "define-properties": "^1.1.3", - "es-abstract": "^1.12.0", - "function-bind": "^1.1.1", - "has": "^1.0.3" + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.getownpropertydescriptors": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.2.tgz", + "integrity": "sha512-WtxeKSzfBjlzL+F9b7M7hewDzMwy+C8NRssHd1YrNlzHzIDrXcXiNOMrezdAEM4UXixgV+vvnyBeN7Rygl2ttQ==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.2" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.values": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.4.tgz", + "integrity": "sha512-TnGo7j4XSnKQoK3MfvkzqKCi0nVe/D9I9IjwTNYdb/fxYHpjrluHVOgw0AF6jrRFGMPHdfuidR09tIDiIvnaSg==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.18.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/once": { @@ -2312,9 +2438,9 @@ } }, "node_modules/path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" }, "node_modules/path-type": { "version": "4.0.0", @@ -2330,6 +2456,9 @@ "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", "engines": { "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" } }, "node_modules/polymer-analyzer": { @@ -2392,6 +2521,22 @@ "@types/node": "*" } }, + "node_modules/polymer-analyzer/node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/polymer-analyzer/node_modules/ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/polymer-analyzer/node_modules/babylon": { "version": "7.0.0-beta.47", "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.47.tgz", @@ -2403,6 +2548,21 @@ "node": ">=6.0.0" } }, + "node_modules/polymer-analyzer/node_modules/chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dependencies": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/polymer-analyzer/node_modules/clone": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", @@ -2411,6 +2571,17 @@ "node": ">=0.8" } }, + "node_modules/polymer-analyzer/node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/polymer-analyzer/node_modules/dom5": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dom5/-/dom5-3.0.1.tgz", @@ -2426,6 +2597,25 @@ "resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz", "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==" }, + "node_modules/polymer-analyzer/node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/polymer-analyzer/node_modules/supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/polymer-bundler": { "version": "4.0.10", "resolved": "https://registry.npmjs.org/polymer-bundler/-/polymer-bundler-4.0.10.tgz", @@ -2453,11 +2643,6 @@ "polymer-bundler": "lib/bin/polymer-bundler.js" } }, - "node_modules/polymer-bundler/node_modules/@types/babel-types": { - "version": "6.25.2", - "resolved": "https://registry.npmjs.org/@types/babel-types/-/babel-types-6.25.2.tgz", - "integrity": "sha512-+3bMuktcY4a70a0KZc8aPJlEOArPuAKQYHU5ErjkOqGJdx8xuEEVK6nWogqigBOJ8nKPxRpyCUDTCPmZ3bUxGA==" - }, "node_modules/polymer-bundler/node_modules/@types/parse5": { "version": "2.2.34", "resolved": "https://registry.npmjs.org/@types/parse5/-/parse5-2.2.34.tgz", @@ -2466,15 +2651,34 @@ "@types/node": "*" } }, - "node_modules/polymer-bundler/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" + "node_modules/polymer-bundler/node_modules/acorn": { + "version": "5.7.4", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz", + "integrity": "sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==", + "bin": { + "acorn": "bin/acorn" }, "engines": { - "node": ">=4" + "node": ">=0.4.0" + } + }, + "node_modules/polymer-bundler/node_modules/acorn-jsx": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", + "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", + "dependencies": { + "acorn": "^3.0.4" + } + }, + "node_modules/polymer-bundler/node_modules/acorn-jsx/node_modules/acorn": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", + "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" } }, "node_modules/polymer-bundler/node_modules/array-back": { @@ -2485,30 +2689,6 @@ "node": ">=6" } }, - "node_modules/polymer-bundler/node_modules/babylon": { - "version": "7.0.0-beta.47", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.47.tgz", - "integrity": "sha512-+rq2cr4GDhtToEzKFD6KZZMDBXhjFAr9JjPw9pAppZACeEWqNM294j+NdBzkSHYXwzzBmVjZ3nEVJlOhbR2gOQ==", - "bin": { - "babylon": "bin/babylon.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/polymer-bundler/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/polymer-bundler/node_modules/clone": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", @@ -2518,11 +2698,11 @@ } }, "node_modules/polymer-bundler/node_modules/command-line-args": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.1.1.tgz", - "integrity": "sha512-hL/eG8lrll1Qy1ezvkant+trihbGnaKaeEjj6Scyr3DN+RC7iQ5Rz84IeLERfAWDGo0HBSNAakczwgCilDXnWg==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.2.0.tgz", + "integrity": "sha512-4zqtU1hYsSJzcJBOcNZIbW5Fbk9BkjCp1pZVhQKoRaWL5J7N4XphDLwo8aWwdQpTugxwu+jf9u2ZhkXiqp5Z6A==", "dependencies": { - "array-back": "^3.0.1", + "array-back": "^3.1.0", "find-replace": "^3.0.0", "lodash.camelcase": "^4.3.0", "typical": "^4.0.0" @@ -2531,6 +2711,14 @@ "node": ">=4.0.0" } }, + "node_modules/polymer-bundler/node_modules/command-line-args/node_modules/typical": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz", + "integrity": "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==", + "engines": { + "node": ">=8" + } + }, "node_modules/polymer-bundler/node_modules/command-line-usage": { "version": "5.0.5", "resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-5.0.5.tgz", @@ -2556,11 +2744,6 @@ "node": ">=4" } }, - "node_modules/polymer-bundler/node_modules/command-line-usage/node_modules/typical": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", - "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=" - }, "node_modules/polymer-bundler/node_modules/deep-extend": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", @@ -2579,6 +2762,18 @@ "parse5": "^4.0.0" } }, + "node_modules/polymer-bundler/node_modules/espree": { + "version": "3.5.4", + "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz", + "integrity": "sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A==", + "dependencies": { + "acorn": "^5.5.0", + "acorn-jsx": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/polymer-bundler/node_modules/find-replace": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-3.0.0.tgz", @@ -2595,103 +2790,6 @@ "resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz", "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==" }, - "node_modules/polymer-bundler/node_modules/polymer-analyzer": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/polymer-analyzer/-/polymer-analyzer-3.2.4.tgz", - "integrity": "sha512-JmxUhMajTuC18tLXbTtu2+aN2x9bTX+4MvCD4IZKJ0rtAL8jWi1iRLfogpHJB4Ig9Dc8EEEuEYipLuzPFl3vqA==", - "dependencies": { - "@babel/generator": "^7.0.0-beta.42", - "@babel/traverse": "^7.0.0-beta.42", - "@babel/types": "^7.0.0-beta.42", - "@types/babel-generator": "^6.25.1", - "@types/babel-traverse": "^6.25.2", - "@types/babel-types": "^6.25.1", - "@types/babylon": "^6.16.2", - "@types/chai-subset": "^1.3.0", - "@types/chalk": "^0.4.30", - "@types/clone": "^0.1.30", - "@types/cssbeautify": "^0.3.1", - "@types/doctrine": "^0.0.1", - "@types/is-windows": "^0.2.0", - "@types/minimatch": "^3.0.1", - "@types/parse5": "^2.2.34", - "@types/path-is-inside": "^1.0.0", - "@types/resolve": "0.0.6", - "@types/whatwg-url": "^6.4.0", - "babylon": "^7.0.0-beta.42", - "cancel-token": "^0.1.1", - "chalk": "^1.1.3", - "clone": "^2.0.0", - "cssbeautify": "^0.3.1", - "doctrine": "^2.0.2", - "dom5": "^3.0.0", - "indent": "0.0.2", - "is-windows": "^1.0.2", - "jsonschema": "^1.1.0", - "minimatch": "^3.0.4", - "parse5": "^4.0.0", - "path-is-inside": "^1.0.2", - "resolve": "^1.5.0", - "shady-css-parser": "^0.1.0", - "stable": "^0.1.6", - "strip-indent": "^2.0.0", - "vscode-uri": "=1.0.6", - "whatwg-url": "^6.4.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/polymer-bundler/node_modules/polymer-analyzer/node_modules/ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/polymer-bundler/node_modules/polymer-analyzer/node_modules/chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dependencies": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/polymer-bundler/node_modules/polymer-analyzer/node_modules/supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/polymer-bundler/node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/polymer-bundler/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/polymer-bundler/node_modules/table-layout": { "version": "0.4.5", "resolved": "https://registry.npmjs.org/table-layout/-/table-layout-0.4.5.tgz", @@ -2718,19 +2816,6 @@ "node": ">=4" } }, - "node_modules/polymer-bundler/node_modules/table-layout/node_modules/typical": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", - "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=" - }, - "node_modules/polymer-bundler/node_modules/typical": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz", - "integrity": "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==", - "engines": { - "node": ">=8" - } - }, "node_modules/polymer-bundler/node_modules/wordwrapjs": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-3.0.0.tgz", @@ -2743,11 +2828,6 @@ "node": ">=4.0.0" } }, - "node_modules/polymer-bundler/node_modules/wordwrapjs/node_modules/typical": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", - "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=" - }, "node_modules/polymer-css-build": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/polymer-css-build/-/polymer-css-build-0.7.0.tgz", @@ -2770,17 +2850,6 @@ "@types/node": "*" } }, - "node_modules/polymer-css-build/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/polymer-css-build/node_modules/array-back": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/array-back/-/array-back-3.1.0.tgz", @@ -2789,19 +2858,6 @@ "node": ">=6" } }, - "node_modules/polymer-css-build/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/polymer-css-build/node_modules/clone": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", @@ -2811,11 +2867,11 @@ } }, "node_modules/polymer-css-build/node_modules/command-line-args": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.1.1.tgz", - "integrity": "sha512-hL/eG8lrll1Qy1ezvkant+trihbGnaKaeEjj6Scyr3DN+RC7iQ5Rz84IeLERfAWDGo0HBSNAakczwgCilDXnWg==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.2.0.tgz", + "integrity": "sha512-4zqtU1hYsSJzcJBOcNZIbW5Fbk9BkjCp1pZVhQKoRaWL5J7N4XphDLwo8aWwdQpTugxwu+jf9u2ZhkXiqp5Z6A==", "dependencies": { - "array-back": "^3.0.1", + "array-back": "^3.1.0", "find-replace": "^3.0.0", "lodash.camelcase": "^4.3.0", "typical": "^4.0.0" @@ -2824,6 +2880,14 @@ "node": ">=4.0.0" } }, + "node_modules/polymer-css-build/node_modules/command-line-args/node_modules/typical": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz", + "integrity": "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==", + "engines": { + "node": ">=8" + } + }, "node_modules/polymer-css-build/node_modules/command-line-usage": { "version": "5.0.5", "resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-5.0.5.tgz", @@ -2849,11 +2913,6 @@ "node": ">=4" } }, - "node_modules/polymer-css-build/node_modules/command-line-usage/node_modules/typical": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", - "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=" - }, "node_modules/polymer-css-build/node_modules/deep-extend": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", @@ -2888,17 +2947,6 @@ "resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz", "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==" }, - "node_modules/polymer-css-build/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/polymer-css-build/node_modules/table-layout": { "version": "0.4.5", "resolved": "https://registry.npmjs.org/table-layout/-/table-layout-0.4.5.tgz", @@ -2925,19 +2973,6 @@ "node": ">=4" } }, - "node_modules/polymer-css-build/node_modules/table-layout/node_modules/typical": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", - "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=" - }, - "node_modules/polymer-css-build/node_modules/typical": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz", - "integrity": "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==", - "engines": { - "node": ">=8" - } - }, "node_modules/polymer-css-build/node_modules/wordwrapjs": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-3.0.0.tgz", @@ -2950,11 +2985,6 @@ "node": ">=4.0.0" } }, - "node_modules/polymer-css-build/node_modules/wordwrapjs/node_modules/typical": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", - "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=" - }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -2991,7 +3021,21 @@ "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] }, "node_modules/reduce-flatten": { "version": "1.0.1", @@ -3007,11 +3051,14 @@ "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" }, "node_modules/regexpp": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", - "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", "engines": { "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" } }, "node_modules/repeating": { @@ -3026,11 +3073,15 @@ } }, "node_modules/resolve": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz", - "integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==", + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", "dependencies": { + "is-core-module": "^2.2.0", "path-parse": "^1.0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/resolve-from": { @@ -3062,9 +3113,9 @@ } }, "node_modules/rollup": { - "version": "1.23.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.23.1.tgz", - "integrity": "sha512-95C1GZQpr/NIA0kMUQmSjuMDQ45oZfPgDBcN0yZwBG7Kee//m7H68vgIyg+SPuyrTZ5PrXfyLK80OzXeKG5dAA==", + "version": "1.32.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.32.1.tgz", + "integrity": "sha512-/2HA0Ec70TvQnXdzynFffkjA6XN+1e2pEv/uKS5Ulca40g2L7KuOE3riasHoNVHOsFD5KKZgDsMk1CP3Tw9s+A==", "dependencies": { "@types/estree": "*", "@types/node": "*", @@ -3074,21 +3125,24 @@ "rollup": "dist/bin/rollup" } }, - "node_modules/rollup/node_modules/acorn": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz", - "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], "dependencies": { "queue-microtask": "^1.2.2" } @@ -3099,9 +3153,12 @@ "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" }, "node_modules/semver": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dependencies": { + "lru-cache": "^6.0.0" + }, "bin": { "semver": "bin/semver.js" }, @@ -3133,6 +3190,19 @@ "node": ">=8" } }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -3154,29 +3224,18 @@ "node": ">=6" } }, - "node_modules/slice-ansi/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/source-map": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", - "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", "engines": { - "node": ">= 8" + "node": ">=0.10.0" } }, "node_modules/source-map-support": { - "version": "0.5.19", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", - "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "version": "0.5.20", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.20.tgz", + "integrity": "sha512-n1lZZ8Ve4ksRqizaBQgxXDgKwttHDhyfQjA6YZZn8+AroHbsIz+JjwxQDxbp+7y5OYCI8t1Yk7etjD9CRd2hIw==", "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -3232,15 +3291,39 @@ "node": ">=6" } }, - "node_modules/strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "node_modules/string.prototype.trimend": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", + "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", "dependencies": { - "ansi-regex": "^2.0.0" + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", + "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" }, "engines": { - "node": ">=0.10.0" + "node": ">=8" } }, "node_modules/strip-indent": { @@ -3257,14 +3340,20 @@ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "engines": { "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dependencies": { + "has-flag": "^3.0.0" + }, "engines": { - "node": ">=0.8.0" + "node": ">=4" } }, "node_modules/svgo": { @@ -3294,41 +3383,6 @@ "node": ">=4.0.0" } }, - "node_modules/svgo/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/svgo/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/svgo/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/table": { "version": "5.4.6", "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", @@ -3359,11 +3413,6 @@ "node": ">=0.12.0" } }, - "node_modules/table/node_modules/lodash": { - "version": "4.17.20", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", - "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==" - }, "node_modules/terser": { "version": "5.3.3", "resolved": "https://registry.npmjs.org/terser/-/terser-5.3.3.tgz", @@ -3380,10 +3429,13 @@ "node": ">=6.0.0" } }, - "node_modules/terser/node_modules/commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + "node_modules/terser/node_modules/source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "engines": { + "node": ">= 8" + } }, "node_modules/test-value": { "version": "2.1.0", @@ -3451,6 +3503,9 @@ }, "engines": { "node": ">= 6" + }, + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" } }, "node_modules/type-check": { @@ -3489,32 +3544,51 @@ "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=" }, + "node_modules/unbox-primitive": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", + "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", + "dependencies": { + "function-bind": "^1.1.1", + "has-bigints": "^1.0.1", + "has-symbols": "^1.0.2", + "which-boxed-primitive": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/unquote": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/unquote/-/unquote-1.1.1.tgz", "integrity": "sha1-j97XMk7G6IoP+LkF58CYzcCG1UQ=" }, "node_modules/uri-js": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz", - "integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dependencies": { "punycode": "^2.1.0" } }, "node_modules/util.promisify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz", - "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.1.tgz", + "integrity": "sha512-g9JpC/3He3bm38zsLupWryXHoEcS22YHthuPQSJdMy6KNrzIRzWqcsHzD/WUnqe45whVou4VIsPew37DoXWNrA==", "dependencies": { - "define-properties": "^1.1.2", - "object.getownpropertydescriptors": "^2.0.3" + "define-properties": "^1.1.3", + "es-abstract": "^1.17.2", + "has-symbols": "^1.0.1", + "object.getownpropertydescriptors": "^2.1.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/v8-compile-cache": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz", - "integrity": "sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ==" + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==" }, "node_modules/vlq": { "version": "0.2.3", @@ -3555,6 +3629,21 @@ "node": ">= 8" } }, + "node_modules/which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dependencies": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", @@ -3601,135 +3690,109 @@ }, "dependencies": { "@babel/code-frame": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz", - "integrity": "sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==", + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.14.5.tgz", + "integrity": "sha512-9pzDqyc6OLDaqe+zbACgFkb6fKMNG6CObKpnYXChRsvYGyEdc7CA2BaqeOM+vOtCS5ndmJicPJhKAwYRI6UfFw==", "requires": { - "@babel/highlight": "^7.12.13" + "@babel/highlight": "^7.14.5" } }, "@babel/generator": { - "version": "7.14.3", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.14.3.tgz", - "integrity": "sha512-bn0S6flG/j0xtQdz3hsjJ624h3W0r3llttBMfyHX3YrZ/KtLYr15bjA0FXkgW7FpvrDuTuElXeVjiKlYRpnOFA==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.15.4.tgz", + "integrity": "sha512-d3itta0tu+UayjEORPNz6e1T3FtvWlP5N4V5M+lhp/CxT4oAA7/NcScnpRyspUMLK6tu9MNHmQHxRykuN2R7hw==", "requires": { - "@babel/types": "^7.14.2", + "@babel/types": "^7.15.4", "jsesc": "^2.5.1", "source-map": "^0.5.0" - }, - "dependencies": { - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" - } } }, "@babel/helper-function-name": { - "version": "7.14.2", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.14.2.tgz", - "integrity": "sha512-NYZlkZRydxw+YT56IlhIcS8PAhb+FEUiOzuhFTfqDyPmzAhRge6ua0dQYT/Uh0t/EDHq05/i+e5M2d4XvjgarQ==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.15.4.tgz", + "integrity": "sha512-Z91cOMM4DseLIGOnog+Z8OI6YseR9bua+HpvLAQ2XayUGU+neTtX+97caALaLdyu53I/fjhbeCnWnRH1O3jFOw==", "requires": { - "@babel/helper-get-function-arity": "^7.12.13", - "@babel/template": "^7.12.13", - "@babel/types": "^7.14.2" + "@babel/helper-get-function-arity": "^7.15.4", + "@babel/template": "^7.15.4", + "@babel/types": "^7.15.4" } }, "@babel/helper-get-function-arity": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.12.13.tgz", - "integrity": "sha512-DjEVzQNz5LICkzN0REdpD5prGoidvbdYk1BVgRUOINaWJP2t6avB27X1guXK1kXNrX0WMfsrm1A/ZBthYuIMQg==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.15.4.tgz", + "integrity": "sha512-1/AlxSF92CmGZzHnC515hm4SirTxtpDnLEJ0UyEMgTMZN+6bxXKg04dKhiRx5Enel+SUA1G1t5Ed/yQia0efrA==", "requires": { - "@babel/types": "^7.12.13" + "@babel/types": "^7.15.4" + } + }, + "@babel/helper-hoist-variables": { + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.15.4.tgz", + "integrity": "sha512-VTy085egb3jUGVK9ycIxQiPbquesq0HUQ+tPO0uv5mPEBZipk+5FkRKiWq5apuyTE9FUrjENB0rCf8y+n+UuhA==", + "requires": { + "@babel/types": "^7.15.4" } }, "@babel/helper-split-export-declaration": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.12.13.tgz", - "integrity": "sha512-tCJDltF83htUtXx5NLcaDqRmknv652ZWCHyoTETf1CXYJdPC7nohZohjUgieXhv0hTJdRf2FjDueFehdNucpzg==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.15.4.tgz", + "integrity": "sha512-HsFqhLDZ08DxCpBdEVtKmywj6PQbwnF6HHybur0MAnkAKnlS6uHkwnmRIkElB2Owpfb4xL4NwDmDLFubueDXsw==", "requires": { - "@babel/types": "^7.12.13" + "@babel/types": "^7.15.4" } }, "@babel/helper-validator-identifier": { - "version": "7.14.0", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.0.tgz", - "integrity": "sha512-V3ts7zMSu5lfiwWDVWzRDGIN+lnCEUdaXgtVHJgLb1rGaA6jMrtB9EmE7L18foXJIE8Un/A/h6NJfGQp/e1J4A==" + "version": "7.15.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz", + "integrity": "sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==" }, "@babel/highlight": { - "version": "7.14.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.14.0.tgz", - "integrity": "sha512-YSCOwxvTYEIMSGaBQb5kDDsCopDdiUGsqpatp3fOlI4+2HQSkTmEVWnVuySdAC5EWCqSWWTv0ib63RjR7dTBdg==", + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.14.5.tgz", + "integrity": "sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg==", "requires": { - "@babel/helper-validator-identifier": "^7.14.0", + "@babel/helper-validator-identifier": "^7.14.5", "chalk": "^2.0.0", "js-tokens": "^4.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "requires": { - "has-flag": "^3.0.0" - } - } } }, "@babel/parser": { - "version": "7.14.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.14.3.tgz", - "integrity": "sha512-7MpZDIfI7sUC5zWo2+foJ50CSI5lcqDehZ0lVgIhSi4bFEk94fLAKlF3Q0nzSQQ+ca0lm+O6G9ztKVBeu8PMRQ==" + "version": "7.15.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.15.7.tgz", + "integrity": "sha512-rycZXvQ+xS9QyIcJ9HXeDWf1uxqlbVFAUq0Rq0dbc50Zb/+wUe/ehyfzGfm9KZZF0kBejYgxltBXocP+gKdL2g==" }, "@babel/template": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.12.13.tgz", - "integrity": "sha512-/7xxiGA57xMo/P2GVvdEumr8ONhFOhfgq2ihK3h1e6THqzTAkHbkXgB0xI9yeTfIUoH3+oAeHhqm/I43OTbbjA==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.15.4.tgz", + "integrity": "sha512-UgBAfEa1oGuYgDIPM2G+aHa4Nlo9Lh6mGD2bDBGMTbYnc38vulXPuC1MGjYILIEmlwl6Rd+BPR9ee3gm20CBtg==", "requires": { - "@babel/code-frame": "^7.12.13", - "@babel/parser": "^7.12.13", - "@babel/types": "^7.12.13" + "@babel/code-frame": "^7.14.5", + "@babel/parser": "^7.15.4", + "@babel/types": "^7.15.4" } }, "@babel/traverse": { - "version": "7.14.2", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.14.2.tgz", - "integrity": "sha512-TsdRgvBFHMyHOOzcP9S6QU0QQtjxlRpEYOy3mcCO5RgmC305ki42aSAmfZEMSSYBla2oZ9BMqYlncBaKmD/7iA==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.15.4.tgz", + "integrity": "sha512-W6lQD8l4rUbQR/vYgSuCAE75ADyyQvOpFVsvPPdkhf6lATXAsQIG9YdtOcu8BB1dZ0LKu+Zo3c1wEcbKeuhdlA==", "requires": { - "@babel/code-frame": "^7.12.13", - "@babel/generator": "^7.14.2", - "@babel/helper-function-name": "^7.14.2", - "@babel/helper-split-export-declaration": "^7.12.13", - "@babel/parser": "^7.14.2", - "@babel/types": "^7.14.2", + "@babel/code-frame": "^7.14.5", + "@babel/generator": "^7.15.4", + "@babel/helper-function-name": "^7.15.4", + "@babel/helper-hoist-variables": "^7.15.4", + "@babel/helper-split-export-declaration": "^7.15.4", + "@babel/parser": "^7.15.4", + "@babel/types": "^7.15.4", "debug": "^4.1.0", "globals": "^11.1.0" } }, "@babel/types": { - "version": "7.14.2", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.2.tgz", - "integrity": "sha512-SdjAG/3DikRHpUOjxZgnkbR11xUlyDMUFJdvnIgZEE16mqmY0BINMmc4//JMJglEmn6i7sq6p+mGrFWyZ98EEw==", + "version": "7.15.6", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", + "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", "requires": { - "@babel/helper-validator-identifier": "^7.14.0", + "@babel/helper-validator-identifier": "^7.14.9", "to-fast-properties": "^2.0.0" } }, @@ -3750,31 +3813,6 @@ "strip-json-comments": "^3.1.1" }, "dependencies": { - "acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==" - }, - "acorn-jsx": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", - "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==" - }, - "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==" - }, - "espree": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.0.tgz", - "integrity": "sha512-dksIWsvKCixn1yrEXO8UosNSxaDoSYpq9reEjZSbHLpT5hpaCAKTLBwq0RHtLrIr+c0ByiYzWT8KTMRzoRCNlw==", - "requires": { - "acorn": "^7.4.0", - "acorn-jsx": "^5.2.0", - "eslint-visitor-keys": "^1.3.0" - } - }, "globals": { "version": "12.4.0", "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", @@ -3782,11 +3820,6 @@ "requires": { "type-fest": "^0.8.1" } - }, - "lodash": { - "version": "4.17.20", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", - "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==" } } }, @@ -3805,52 +3838,52 @@ "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==" }, "@nodelib/fs.walk": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.7.tgz", - "integrity": "sha512-BTIhocbPBSrRmHxOAJFtR18oLhxTtAFDAvL8hY1S3iU8k+E60W/YFs4jrixGzQjMpF4qPXxIQHcjVD9dz1C2QA==", + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", "requires": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" } }, "@types/babel-generator": { - "version": "6.25.3", - "resolved": "https://registry.npmjs.org/@types/babel-generator/-/babel-generator-6.25.3.tgz", - "integrity": "sha512-pGgnuxVddKcYIc+VJkRDop7gxLhqclNKBdlsm/5Vp8d+37pQkkDK7fef8d9YYImRzw9xcojEPc18pUYnbxmjqA==", + "version": "6.25.4", + "resolved": "https://registry.npmjs.org/@types/babel-generator/-/babel-generator-6.25.4.tgz", + "integrity": "sha512-Rnsen+ckop5mbl9d43bempS7i9wdTN1vytiTlmQla/YiNm6kH8kEVABVSXmp1UbnpkUV44nUCPeDQoa+Mu7ALA==", "requires": { "@types/babel-types": "*" } }, "@types/babel-traverse": { - "version": "6.25.5", - "resolved": "https://registry.npmjs.org/@types/babel-traverse/-/babel-traverse-6.25.5.tgz", - "integrity": "sha512-WrMbwmu+MWf8FiUMbmVOGkc7bHPzndUafn1CivMaBHthBBoo0VNIcYk1KV71UovYguhsNOwf3UF5oRmkkGOU3w==", + "version": "6.25.7", + "resolved": "https://registry.npmjs.org/@types/babel-traverse/-/babel-traverse-6.25.7.tgz", + "integrity": "sha512-BeQiEGLnVzypzBdsexEpZAHUx+WucOMXW6srEWDkl4SegBlaCy+iBvRO+4vz6EZ+BNQg22G4MCdDdvZxf+jW5A==", "requires": { "@types/babel-types": "*" } }, "@types/babel-types": { - "version": "7.0.7", - "resolved": "https://registry.npmjs.org/@types/babel-types/-/babel-types-7.0.7.tgz", - "integrity": "sha512-dBtBbrc+qTHy1WdfHYjBwRln4+LWqASWakLHsWHR2NWHIFkv4W3O070IGoGLEBrJBvct3r0L1BUPuvURi7kYUQ==" + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/babel-types/-/babel-types-7.0.11.tgz", + "integrity": "sha512-pkPtJUUY+Vwv6B1inAz55rQvivClHJxc9aVEPPmaq2cbyeMLCiDpbKpcKyX4LAwpNGi+SHBv0tHv6+0gXv0P2A==" }, "@types/babylon": { - "version": "6.16.5", - "resolved": "https://registry.npmjs.org/@types/babylon/-/babylon-6.16.5.tgz", - "integrity": "sha512-xH2e58elpj1X4ynnKp9qSnWlsRTIs6n3tgLGNfwAGHwePw0mulHQllV34n0T25uYSu1k0hRKkWXF890B1yS47w==", + "version": "6.16.6", + "resolved": "https://registry.npmjs.org/@types/babylon/-/babylon-6.16.6.tgz", + "integrity": "sha512-G4yqdVlhr6YhzLXFKy5F7HtRBU8Y23+iWy7UKthMq/OSQnL1hbsoeXESQ2LY8zEDlknipDG3nRGhUC9tkwvy/w==", "requires": { "@types/babel-types": "*" } }, "@types/chai": { - "version": "4.1.7", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.1.7.tgz", - "integrity": "sha512-2Y8uPt0/jwjhQ6EiluT0XCri1Dbplr0ZxfFXUz+ye13gaqE8u5gL5ppao1JrUYr9cIip5S6MvQzBS7Kke7U9VA==" + "version": "4.2.22", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.22.tgz", + "integrity": "sha512-tFfcE+DSTzWAgifkjik9AySNqIyNoYwmR+uecPwwD/XRNfvOjmC/FjCxpiUGDkDVDphPfCUecSQVFw+lN3M3kQ==" }, "@types/chai-subset": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.2.tgz", - "integrity": "sha512-VMA1aOXwPEJADlj5ykmYv77YKmbEuAxiLz/+lT6vFIWQ1EA06jF01TytVBAbVTNk0pjfW1Uhw5R5MaEq426N0A==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.3.tgz", + "integrity": "sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==", "requires": { "@types/chai": "*" } @@ -3866,9 +3899,9 @@ "integrity": "sha1-5zZWSMG0ITalnH1QQGN7O1yDthQ=" }, "@types/cssbeautify": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/@types/cssbeautify/-/cssbeautify-0.3.1.tgz", - "integrity": "sha1-jgvuj33suVIlDaDK6+BeMFkcF+8=" + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@types/cssbeautify/-/cssbeautify-0.3.2.tgz", + "integrity": "sha512-b3PXlFAcS4gvGr2pDz0NoZEBo3MMQe8Ozy6+Mvm3XIEcHS4oQstvCnnCofBZD/0tQgxSzkYbW+cD3yD4yaKTxQ==" }, "@types/doctrine": { "version": "0.0.1", @@ -3881,9 +3914,9 @@ "integrity": "sha512-8O84hHuVhMMLHLybf3y9SQpNcnQSuzVzcJaUNq9+4Ovb7fodS0aQXep4hyMtxd6fe/dyszbHFjFqtyawf4y46A==" }, "@types/estree": { - "version": "0.0.37", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.37.tgz", - "integrity": "sha512-1IT6vNpmU9w18P3v6mN9idv18z5KPVTi4t7+rU9VLnkxo0LCam8IXy/eSVzOaQ1Wpabra2cN3A8K/SliPK/Suw==" + "version": "0.0.50", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.50.tgz", + "integrity": "sha512-C6N5s2ZFtuZRj54k2/zyRhNDjJwwcViAM3Nbm8zjBpbqAdZ00mr0CFxvSKeO8Y/e03WVFLpQMdHYVfUd6SB+Hw==" }, "@types/google.analytics": { "version": "0.0.42", @@ -3896,19 +3929,19 @@ "integrity": "sha1-byTuSHMdMRaOpRBhDW3RXl/Jxv8=" }, "@types/json-schema": { - "version": "7.0.7", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz", - "integrity": "sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA==" + "version": "7.0.9", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz", + "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==" }, "@types/minimatch": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", - "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==" + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", + "integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==" }, "@types/node": { - "version": "4.9.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-4.9.3.tgz", - "integrity": "sha512-Q9eESThBvAbfEzznF1qTAKUoPbJEbK3lTSO0S3mICvmG/vUSZ+HnCtidpuB58Po7CJt5A2goKsDiYScN8d1V4A==" + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-4.9.5.tgz", + "integrity": "sha512-+8fpgbXsbATKRF2ayAlYhPl2E9MPdLjrnK/79ZEpyPJ+k7dZwJm9YM8FK+l4rqL//xHk7PgQhGwz6aA2ckxbCQ==" }, "@types/parse5": { "version": "0.0.31", @@ -3931,9 +3964,9 @@ "integrity": "sha512-hfnXRGugz+McgX2jxyy5qz9sB21LRzlGn24zlwN2KEgoPtEvjzNRrLtUkOOebPDPZl3Rq7ywKxYvylVcEZDnEw==" }, "@types/q": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.2.tgz", - "integrity": "sha512-ce5d3q03Ex0sy4R14722Rmt6MT07Ua+k4FwDfdcToYJcMKNtRVQvJ6JCAPdAmAnbRb6CsX6aYb9m96NGod9uTw==" + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.5.tgz", + "integrity": "sha512-L28j2FcJfSZOnL1WBjDYp2vUHCeIFlyYI/53EwD/rKUBQ7MtUUfbQWiyKJGpcnv4/WgrhWsFKrcPstcAt/J0tQ==" }, "@types/resolve": { "version": "0.0.6", @@ -3982,29 +4015,6 @@ "regexpp": "^3.1.0", "semver": "^7.3.5", "tsutils": "^3.21.0" - }, - "dependencies": { - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "requires": { - "ms": "2.1.2" - } - }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", - "requires": { - "lru-cache": "^6.0.0" - } - } } }, "@typescript-eslint/experimental-utils": { @@ -4018,21 +4028,6 @@ "@typescript-eslint/typescript-estree": "4.26.1", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" - }, - "dependencies": { - "eslint-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", - "requires": { - "eslint-visitor-keys": "^2.0.0" - } - }, - "eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==" - } } }, "@typescript-eslint/parser": { @@ -4044,16 +4039,6 @@ "@typescript-eslint/types": "4.26.1", "@typescript-eslint/typescript-estree": "4.26.1", "debug": "^4.3.1" - }, - "dependencies": { - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "requires": { - "ms": "2.1.2" - } - } } }, "@typescript-eslint/scope-manager": { @@ -4082,24 +4067,6 @@ "is-glob": "^4.0.1", "semver": "^7.3.5", "tsutils": "^3.21.0" - }, - "dependencies": { - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "requires": { - "ms": "2.1.2" - } - }, - "semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", - "requires": { - "lru-cache": "^6.0.0" - } - } } }, "@typescript-eslint/visitor-keys": { @@ -4109,34 +4076,18 @@ "requires": { "@typescript-eslint/types": "4.26.1", "eslint-visitor-keys": "^2.0.0" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==" - } } }, "acorn": { - "version": "5.7.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", - "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==" + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==" }, "acorn-jsx": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", - "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", - "requires": { - "acorn": "^3.0.4" - }, - "dependencies": { - "acorn": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", - "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=" - } - } + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "requires": {} }, "ajv": { "version": "6.12.6", @@ -4163,14 +4114,17 @@ } }, "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" }, "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } }, "argparse": { "version": "1.0.10", @@ -4208,10 +4162,45 @@ "js-tokens": "^3.0.2" }, "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, "js-tokens": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=" + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" } } }, @@ -4236,6 +4225,11 @@ "esrecurse": "^4.1.0", "estraverse": "^4.1.1" } + }, + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==" } } }, @@ -4258,11 +4252,6 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=" - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" } } }, @@ -4343,9 +4332,9 @@ "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==" }, "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "boolbase": { "version": "1.0.0", @@ -4370,9 +4359,18 @@ } }, "buffer-from": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" + }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } }, "callsites": { "version": "3.1.0", @@ -4388,15 +4386,13 @@ } }, "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" } }, "clone": { @@ -4412,34 +4408,6 @@ "@types/q": "^1.5.1", "chalk": "^2.4.1", "q": "^1.1.2" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "requires": { - "has-flag": "^3.0.0" - } - } } }, "color-convert": { @@ -4478,15 +4446,20 @@ "typical": "^2.6.0" } }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "core-js": { - "version": "2.6.5", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.5.tgz", - "integrity": "sha512-klh/kDpwX8hryYL14M9w/xei6vrv6sE8gTHDG7/T/+SEovB/G4ejwcfE/CBzO6Edsu+OETZMZ3wcX/EjUkrl5A==" + "version": "2.6.12", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz", + "integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==" }, "crisper": { "version": "2.1.1", @@ -4509,12 +4482,12 @@ } }, "css-select": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-2.0.2.tgz", - "integrity": "sha512-dSpYaDVoWaELjvZ3mS6IKZM/y2PMPa/XYoEfYNZePL4U/XgyxZNroHEHReDx/d+VgXh9VbCTtFqLkFbmeqeaRQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-2.1.0.tgz", + "integrity": "sha512-Dqk7LQKpwLoH3VovzZnkzegqNSuAziQyNZUcrdDM401iY+R5NkGBXGmtO05/yaXQziALuPogeG0b7UAgjnTJTQ==", "requires": { "boolbase": "^1.0.0", - "css-what": "^2.1.2", + "css-what": "^3.2.1", "domutils": "^1.7.0", "nth-check": "^1.0.2" } @@ -4531,13 +4504,6 @@ "requires": { "mdn-data": "~1.1.0", "source-map": "^0.5.3" - }, - "dependencies": { - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" - } } }, "css-url-regex": { @@ -4546,9 +4512,9 @@ "integrity": "sha1-g4NCMMyfdMRX3lnuvRVD/uuDt+w=" }, "css-what": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz", - "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==" + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-3.4.2.tgz", + "integrity": "sha512-ACUm3L0/jiZTqfzRM3Hi9Q8eZqd6IK37mMWPLz9PJxkLWllYeRf+EHUSHYEtFop2Eqytaq1FizFVh7XfBnXCDQ==" }, "cssbeautify": { "version": "0.3.1", @@ -4571,20 +4537,15 @@ "mdn-data": "~1.1.0", "source-map": "^0.5.3" } - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" } } }, "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", "requires": { - "ms": "^2.1.1" + "ms": "2.1.2" } }, "deep-extend": { @@ -4593,9 +4554,9 @@ "integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=" }, "deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" }, "define-properties": { "version": "1.1.3", @@ -4622,20 +4583,27 @@ } }, "doctrine": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", "requires": { "esutils": "^2.0.2" } }, "dom-serializer": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz", - "integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==", + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz", + "integrity": "sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g==", "requires": { - "domelementtype": "^1.3.0", - "entities": "^1.1.1" + "domelementtype": "^2.0.1", + "entities": "^2.0.0" + }, + "dependencies": { + "domelementtype": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz", + "integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A==" + } } }, "dom5": { @@ -4678,27 +4646,39 @@ } }, "entities": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", - "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==" + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", + "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==" }, "es-abstract": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.13.0.tgz", - "integrity": "sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg==", + "version": "1.18.6", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.6.tgz", + "integrity": "sha512-kAeIT4cku5eNLNuUKhlmtuk1/TRZvQoYccn6TO0cSVdf1kzB0T7+dYuVK9MWM7l+/53W2Q8M7N2c6MQvhXFcUQ==", "requires": { - "es-to-primitive": "^1.2.0", + "call-bind": "^1.0.2", + "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", + "get-intrinsic": "^1.1.1", + "get-symbol-description": "^1.0.0", "has": "^1.0.3", - "is-callable": "^1.1.4", - "is-regex": "^1.0.4", - "object-keys": "^1.0.12" + "has-symbols": "^1.0.2", + "internal-slot": "^1.0.3", + "is-callable": "^1.2.4", + "is-negative-zero": "^2.0.1", + "is-regex": "^1.1.4", + "is-string": "^1.0.7", + "object-inspect": "^1.11.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.2", + "string.prototype.trimend": "^1.0.4", + "string.prototype.trimstart": "^1.0.4", + "unbox-primitive": "^1.0.1" } }, "es-to-primitive": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", - "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", "requires": { "is-callable": "^1.1.4", "is-date-object": "^1.0.1", @@ -4754,21 +4734,6 @@ "v8-compile-cache": "^2.0.3" }, "dependencies": { - "acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==" - }, - "acorn-jsx": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", - "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==" - }, - "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" - }, "ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -4778,9 +4743,9 @@ } }, "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "requires": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -4799,27 +4764,12 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, - "doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", "requires": { - "esutils": "^2.0.2" - } - }, - "eslint-visitor-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz", - "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==" - }, - "espree": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.0.tgz", - "integrity": "sha512-dksIWsvKCixn1yrEXO8UosNSxaDoSYpq9reEjZSbHLpT5hpaCAKTLBwq0RHtLrIr+c0ByiYzWT8KTMRzoRCNlw==", - "requires": { - "acorn": "^7.4.0", - "acorn-jsx": "^5.2.0", - "eslint-visitor-keys": "^1.3.0" + "eslint-visitor-keys": "^1.1.0" }, "dependencies": { "eslint-visitor-keys": { @@ -4842,19 +4792,6 @@ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" }, - "lodash": { - "version": "4.17.20", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", - "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==" - }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "requires": { - "ansi-regex": "^5.0.0" - } - }, "supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -4872,31 +4809,29 @@ "requires": { "esrecurse": "^4.3.0", "estraverse": "^4.1.1" - }, - "dependencies": { - "esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "requires": { - "estraverse": "^5.2.0" - }, - "dependencies": { - "estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==" - } - } - } } }, "eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", "requires": { - "eslint-visitor-keys": "^1.1.0" + "eslint-visitor-keys": "^2.0.0" + } + }, + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==" + }, + "espree": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", + "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", + "requires": { + "acorn": "^7.4.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^1.3.0" }, "dependencies": { "eslint-visitor-keys": { @@ -4906,29 +4841,15 @@ } } }, - "eslint-visitor-keys": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", - "integrity": "sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==" - }, - "espree": { - "version": "3.5.4", - "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz", - "integrity": "sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A==", - "requires": { - "acorn": "^5.5.0", - "acorn-jsx": "^3.0.0" - } - }, "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" }, "esquery": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz", - "integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", "requires": { "estraverse": "^5.1.0" }, @@ -4941,22 +4862,29 @@ } }, "esrecurse": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", - "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", "requires": { - "estraverse": "^4.1.0" + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==" + } } }, "estraverse": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", - "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=" + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==" }, "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==" }, "fast-deep-equal": { "version": "3.1.3", @@ -4964,16 +4892,15 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, "fast-glob": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", - "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", + "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==", "requires": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.0", + "glob-parent": "^5.1.2", "merge2": "^1.3.0", - "micromatch": "^4.0.2", - "picomatch": "^2.2.1" + "micromatch": "^4.0.4" } }, "fast-json-stable-stringify": { @@ -4987,9 +4914,9 @@ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" }, "fastq": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz", - "integrity": "sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g==", + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", "requires": { "reusify": "^1.0.4" } @@ -5057,10 +4984,29 @@ "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=" }, + "get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + } + }, + "get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + } + }, "glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -5071,9 +5017,9 @@ } }, "glob-parent": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", - "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "requires": { "is-glob": "^4.0.1" } @@ -5084,9 +5030,9 @@ "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==" }, "globby": { - "version": "11.0.3", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.3.tgz", - "integrity": "sha512-ffdmosjA807y7+lA1NM0jELARVmYul/715xiILEjo3hBLPTcirgQNnXECn5g3mtR8TOLCVbkfua1Hpen25/Xcg==", + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", + "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==", "requires": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", @@ -5117,17 +5063,37 @@ "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", "requires": { "ansi-regex": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + } } }, + "has-bigints": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", + "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==" + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" }, "has-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==" + }, + "has-tostringtag": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", - "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=" + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "requires": { + "has-symbols": "^1.0.2" + } }, "ignore": { "version": "4.0.6", @@ -5135,9 +5101,9 @@ "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==" }, "import-fresh": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", - "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", "requires": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" @@ -5167,6 +5133,16 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, + "internal-slot": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", + "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", + "requires": { + "get-intrinsic": "^1.1.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + } + }, "invariant": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", @@ -5175,15 +5151,43 @@ "loose-envify": "^1.0.0" } }, + "is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "requires": { + "has-bigints": "^1.0.1" + } + }, + "is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, "is-callable": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", + "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==" + }, + "is-core-module": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.6.0.tgz", + "integrity": "sha512-wShG8vs60jKfPWpF2KZRaAtvt3a20OAn7+IJ6hLPECpSABLcKtFKTTI4ZtH5QcBruBHlq+WsdHWyz0BCZW7svQ==", + "requires": { + "has": "^1.0.3" + } }, "is-date-object": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", - "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=" + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "requires": { + "has-tostringtag": "^1.0.0" + } }, "is-extglob": { "version": "2.1.1", @@ -5191,12 +5195,9 @@ "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" }, "is-finite": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", - "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", - "requires": { - "number-is-nan": "^1.0.0" - } + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.1.0.tgz", + "integrity": "sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w==" }, "is-fullwidth-code-point": { "version": "2.0.0", @@ -5204,32 +5205,54 @@ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" }, "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.2.tgz", + "integrity": "sha512-ZZTOjRcDjuAAAv2cTBQP/lL59ZTArx77+7UzHdWW/XB1mrfp7DEaVpKmZ0XIzx+M7AxfhKcqV+nMetUQmFifwg==", "requires": { "is-extglob": "^2.1.1" } }, + "is-negative-zero": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", + "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==" + }, "is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" }, - "is-regex": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", - "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", + "is-number-object": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz", + "integrity": "sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g==", "requires": { - "has": "^1.0.1" + "has-tostringtag": "^1.0.0" + } + }, + "is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "requires": { + "has-tostringtag": "^1.0.0" } }, "is-symbol": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", - "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", "requires": { - "has-symbols": "^1.0.0" + "has-symbols": "^1.0.2" } }, "is-windows": { @@ -5248,9 +5271,9 @@ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, "js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -5272,9 +5295,9 @@ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=" }, "jsonschema": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.2.4.tgz", - "integrity": "sha512-lz1nOH69GbsVHeVgEdvyavc/33oymY1AZwtePMiMj4HZPMbP5OIKK3zT9INMWjwua/V4Z4yq7wSlBbSG+g4AEw==" + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.4.0.tgz", + "integrity": "sha512-/YgW6pRMr6M7C+4o8kS+B/2myEpHCrxO4PEWnqJNBFMjn7EWXqlQ4tGwL6xTHeRplwuZmcAncdvfOad1nT2yMw==" }, "levn": { "version": "0.4.1", @@ -5286,9 +5309,9 @@ } }, "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, "lodash.camelcase": { "version": "4.3.0", @@ -5357,16 +5380,16 @@ } }, "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" }, "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", "requires": { - "minimist": "0.0.8" + "minimist": "^1.2.5" } }, "ms": { @@ -5387,34 +5410,45 @@ "boolbase": "~1.0.0" } }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" + "object-inspect": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", + "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==" }, "object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" }, - "object.getownpropertydescriptors": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", - "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", + "object.assign": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", "requires": { - "define-properties": "^1.1.2", - "es-abstract": "^1.5.1" + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + } + }, + "object.getownpropertydescriptors": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.2.tgz", + "integrity": "sha512-WtxeKSzfBjlzL+F9b7M7hewDzMwy+C8NRssHd1YrNlzHzIDrXcXiNOMrezdAEM4UXixgV+vvnyBeN7Rygl2ttQ==", + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.2" } }, "object.values": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.0.tgz", - "integrity": "sha512-8mf0nKLAoFX6VlNVdhGj31SVYpaNFtUnuoOXWyFEstsWRgU837AK+JYM0iAxwkSzGRbwn8cbFmgbyxj1j4VbXg==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.4.tgz", + "integrity": "sha512-TnGo7j4XSnKQoK3MfvkzqKCi0nVe/D9I9IjwTNYdb/fxYHpjrluHVOgw0AF6jrRFGMPHdfuidR09tIDiIvnaSg==", "requires": { + "call-bind": "^1.0.2", "define-properties": "^1.1.3", - "es-abstract": "^1.12.0", - "function-bind": "^1.1.1", - "has": "^1.0.3" + "es-abstract": "^1.18.2" } }, "once": { @@ -5467,9 +5501,9 @@ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" }, "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" }, "path-type": { "version": "4.0.0", @@ -5538,16 +5572,46 @@ "@types/node": "*" } }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" + }, "babylon": { "version": "7.0.0-beta.47", "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.47.tgz", "integrity": "sha512-+rq2cr4GDhtToEzKFD6KZZMDBXhjFAr9JjPw9pAppZACeEWqNM294j+NdBzkSHYXwzzBmVjZ3nEVJlOhbR2gOQ==" }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, "clone": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=" }, + "doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "requires": { + "esutils": "^2.0.2" + } + }, "dom5": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dom5/-/dom5-3.0.1.tgz", @@ -5562,6 +5626,19 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz", "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==" + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" } } }, @@ -5589,11 +5666,6 @@ "vscode-uri": "=1.0.6" }, "dependencies": { - "@types/babel-types": { - "version": "6.25.2", - "resolved": "https://registry.npmjs.org/@types/babel-types/-/babel-types-6.25.2.tgz", - "integrity": "sha512-+3bMuktcY4a70a0KZc8aPJlEOArPuAKQYHU5ErjkOqGJdx8xuEEVK6nWogqigBOJ8nKPxRpyCUDTCPmZ3bUxGA==" - }, "@types/parse5": { "version": "2.2.34", "resolved": "https://registry.npmjs.org/@types/parse5/-/parse5-2.2.34.tgz", @@ -5602,12 +5674,24 @@ "@types/node": "*" } }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "acorn": { + "version": "5.7.4", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz", + "integrity": "sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==" + }, + "acorn-jsx": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", + "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", "requires": { - "color-convert": "^1.9.0" + "acorn": "^3.0.4" + }, + "dependencies": { + "acorn": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", + "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=" + } } }, "array-back": { @@ -5615,35 +5699,27 @@ "resolved": "https://registry.npmjs.org/array-back/-/array-back-3.1.0.tgz", "integrity": "sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q==" }, - "babylon": { - "version": "7.0.0-beta.47", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.47.tgz", - "integrity": "sha512-+rq2cr4GDhtToEzKFD6KZZMDBXhjFAr9JjPw9pAppZACeEWqNM294j+NdBzkSHYXwzzBmVjZ3nEVJlOhbR2gOQ==" - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, "clone": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=" }, "command-line-args": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.1.1.tgz", - "integrity": "sha512-hL/eG8lrll1Qy1ezvkant+trihbGnaKaeEjj6Scyr3DN+RC7iQ5Rz84IeLERfAWDGo0HBSNAakczwgCilDXnWg==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.2.0.tgz", + "integrity": "sha512-4zqtU1hYsSJzcJBOcNZIbW5Fbk9BkjCp1pZVhQKoRaWL5J7N4XphDLwo8aWwdQpTugxwu+jf9u2ZhkXiqp5Z6A==", "requires": { - "array-back": "^3.0.1", + "array-back": "^3.1.0", "find-replace": "^3.0.0", "lodash.camelcase": "^4.3.0", "typical": "^4.0.0" + }, + "dependencies": { + "typical": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz", + "integrity": "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==" + } } }, "command-line-usage": { @@ -5664,11 +5740,6 @@ "requires": { "typical": "^2.6.1" } - }, - "typical": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", - "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=" } } }, @@ -5687,6 +5758,15 @@ "parse5": "^4.0.0" } }, + "espree": { + "version": "3.5.4", + "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz", + "integrity": "sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A==", + "requires": { + "acorn": "^5.5.0", + "acorn-jsx": "^3.0.0" + } + }, "find-replace": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-3.0.0.tgz", @@ -5700,87 +5780,6 @@ "resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz", "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==" }, - "polymer-analyzer": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/polymer-analyzer/-/polymer-analyzer-3.2.4.tgz", - "integrity": "sha512-JmxUhMajTuC18tLXbTtu2+aN2x9bTX+4MvCD4IZKJ0rtAL8jWi1iRLfogpHJB4Ig9Dc8EEEuEYipLuzPFl3vqA==", - "requires": { - "@babel/generator": "^7.0.0-beta.42", - "@babel/traverse": "^7.0.0-beta.42", - "@babel/types": "^7.0.0-beta.42", - "@types/babel-generator": "^6.25.1", - "@types/babel-traverse": "^6.25.2", - "@types/babel-types": "^6.25.1", - "@types/babylon": "^6.16.2", - "@types/chai-subset": "^1.3.0", - "@types/chalk": "^0.4.30", - "@types/clone": "^0.1.30", - "@types/cssbeautify": "^0.3.1", - "@types/doctrine": "^0.0.1", - "@types/is-windows": "^0.2.0", - "@types/minimatch": "^3.0.1", - "@types/parse5": "^2.2.34", - "@types/path-is-inside": "^1.0.0", - "@types/resolve": "0.0.6", - "@types/whatwg-url": "^6.4.0", - "babylon": "^7.0.0-beta.42", - "cancel-token": "^0.1.1", - "chalk": "^1.1.3", - "clone": "^2.0.0", - "cssbeautify": "^0.3.1", - "doctrine": "^2.0.2", - "dom5": "^3.0.0", - "indent": "0.0.2", - "is-windows": "^1.0.2", - "jsonschema": "^1.1.0", - "minimatch": "^3.0.4", - "parse5": "^4.0.0", - "path-is-inside": "^1.0.2", - "resolve": "^1.5.0", - "shady-css-parser": "^0.1.0", - "stable": "^0.1.6", - "strip-indent": "^2.0.0", - "vscode-uri": "=1.0.6", - "whatwg-url": "^6.4.0" - }, - "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" - } - } - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "requires": { - "has-flag": "^3.0.0" - } - }, "table-layout": { "version": "0.4.5", "resolved": "https://registry.npmjs.org/table-layout/-/table-layout-0.4.5.tgz", @@ -5800,19 +5799,9 @@ "requires": { "typical": "^2.6.1" } - }, - "typical": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", - "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=" } } }, - "typical": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz", - "integrity": "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==" - }, "wordwrapjs": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-3.0.0.tgz", @@ -5820,13 +5809,6 @@ "requires": { "reduce-flatten": "^1.0.1", "typical": "^2.6.1" - }, - "dependencies": { - "typical": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", - "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=" - } } } } @@ -5850,43 +5832,32 @@ "@types/node": "*" } }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { - "color-convert": "^1.9.0" - } - }, "array-back": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/array-back/-/array-back-3.1.0.tgz", "integrity": "sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q==" }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, "clone": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=" }, "command-line-args": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.1.1.tgz", - "integrity": "sha512-hL/eG8lrll1Qy1ezvkant+trihbGnaKaeEjj6Scyr3DN+RC7iQ5Rz84IeLERfAWDGo0HBSNAakczwgCilDXnWg==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.2.0.tgz", + "integrity": "sha512-4zqtU1hYsSJzcJBOcNZIbW5Fbk9BkjCp1pZVhQKoRaWL5J7N4XphDLwo8aWwdQpTugxwu+jf9u2ZhkXiqp5Z6A==", "requires": { - "array-back": "^3.0.1", + "array-back": "^3.1.0", "find-replace": "^3.0.0", "lodash.camelcase": "^4.3.0", "typical": "^4.0.0" + }, + "dependencies": { + "typical": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz", + "integrity": "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==" + } } }, "command-line-usage": { @@ -5907,11 +5878,6 @@ "requires": { "typical": "^2.6.1" } - }, - "typical": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", - "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=" } } }, @@ -5943,14 +5909,6 @@ "resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz", "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==" }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "requires": { - "has-flag": "^3.0.0" - } - }, "table-layout": { "version": "0.4.5", "resolved": "https://registry.npmjs.org/table-layout/-/table-layout-0.4.5.tgz", @@ -5970,19 +5928,9 @@ "requires": { "typical": "^2.6.1" } - }, - "typical": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", - "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=" } } }, - "typical": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz", - "integrity": "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==" - }, "wordwrapjs": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-3.0.0.tgz", @@ -5990,13 +5938,6 @@ "requires": { "reduce-flatten": "^1.0.1", "typical": "^2.6.1" - }, - "dependencies": { - "typical": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", - "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=" - } } } } @@ -6037,9 +5978,9 @@ "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" }, "regexpp": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", - "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==" + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==" }, "repeating": { "version": "2.0.1", @@ -6050,10 +5991,11 @@ } }, "resolve": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz", - "integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==", + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", "requires": { + "is-core-module": "^2.2.0", "path-parse": "^1.0.6" } }, @@ -6076,20 +6018,13 @@ } }, "rollup": { - "version": "1.23.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.23.1.tgz", - "integrity": "sha512-95C1GZQpr/NIA0kMUQmSjuMDQ45oZfPgDBcN0yZwBG7Kee//m7H68vgIyg+SPuyrTZ5PrXfyLK80OzXeKG5dAA==", + "version": "1.32.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.32.1.tgz", + "integrity": "sha512-/2HA0Ec70TvQnXdzynFffkjA6XN+1e2pEv/uKS5Ulca40g2L7KuOE3riasHoNVHOsFD5KKZgDsMk1CP3Tw9s+A==", "requires": { "@types/estree": "*", "@types/node": "*", "acorn": "^7.1.0" - }, - "dependencies": { - "acorn": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz", - "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==" - } } }, "run-parallel": { @@ -6106,9 +6041,12 @@ "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" }, "semver": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==" + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "requires": { + "lru-cache": "^6.0.0" + } }, "shady-css-parser": { "version": "0.1.0", @@ -6128,6 +6066,16 @@ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" }, + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, "slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -6141,27 +6089,17 @@ "ansi-styles": "^3.2.0", "astral-regex": "^1.0.0", "is-fullwidth-code-point": "^2.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { - "color-convert": "^1.9.0" - } - } } }, "source-map": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", - "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==" + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" }, "source-map-support": { - "version": "0.5.19", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", - "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "version": "0.5.20", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.20.tgz", + "integrity": "sha512-n1lZZ8Ve4ksRqizaBQgxXDgKwttHDhyfQjA6YZZn8+AroHbsIz+JjwxQDxbp+7y5OYCI8t1Yk7etjD9CRd2hIw==", "requires": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -6209,12 +6147,30 @@ } } }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "string.prototype.trimend": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", + "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", "requires": { - "ansi-regex": "^2.0.0" + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + } + }, + "string.prototype.trimstart": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", + "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "requires": { + "ansi-regex": "^5.0.1" } }, "strip-indent": { @@ -6228,9 +6184,12 @@ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==" }, "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } }, "svgo": { "version": "1.2.0", @@ -6251,34 +6210,6 @@ "stable": "^0.1.8", "unquote": "~1.1.1", "util.promisify": "~1.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "requires": { - "has-flag": "^3.0.0" - } - } } }, "table": { @@ -6290,13 +6221,6 @@ "lodash": "^4.17.14", "slice-ansi": "^2.1.0", "string-width": "^3.0.0" - }, - "dependencies": { - "lodash": { - "version": "4.17.20", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", - "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==" - } } }, "table-layout": { @@ -6322,10 +6246,10 @@ "source-map-support": "~0.5.19" }, "dependencies": { - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + "source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==" } } }, @@ -6405,32 +6329,45 @@ "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=" }, + "unbox-primitive": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", + "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", + "requires": { + "function-bind": "^1.1.1", + "has-bigints": "^1.0.1", + "has-symbols": "^1.0.2", + "which-boxed-primitive": "^1.0.2" + } + }, "unquote": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/unquote/-/unquote-1.1.1.tgz", "integrity": "sha1-j97XMk7G6IoP+LkF58CYzcCG1UQ=" }, "uri-js": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz", - "integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "requires": { "punycode": "^2.1.0" } }, "util.promisify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz", - "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.1.tgz", + "integrity": "sha512-g9JpC/3He3bm38zsLupWryXHoEcS22YHthuPQSJdMy6KNrzIRzWqcsHzD/WUnqe45whVou4VIsPew37DoXWNrA==", "requires": { - "define-properties": "^1.1.2", - "object.getownpropertydescriptors": "^2.0.3" + "define-properties": "^1.1.3", + "es-abstract": "^1.17.2", + "has-symbols": "^1.0.1", + "object.getownpropertydescriptors": "^2.1.0" } }, "v8-compile-cache": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz", - "integrity": "sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ==" + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==" }, "vlq": { "version": "0.2.3", @@ -6465,6 +6402,18 @@ "isexe": "^2.0.0" } }, + "which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "requires": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + } + }, "word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
diff --git a/tools/mb/mb_config.pyl b/tools/mb/mb_config.pyl index 2081fbb..31fea1c 100644 --- a/tools/mb/mb_config.pyl +++ b/tools/mb/mb_config.pyl
@@ -324,7 +324,7 @@ 'fuchsia-fyi-x64-dbg': 'debug_bot_fuchsia', 'fuchsia-fyi-x64-rel': 'release_bot_fuchsia', 'ios14-beta-simulator': 'ios_simulator_debug_static_bot_xctest', - 'ios14-sdk-simulator': 'ios_simulator_debug_static_bot_xctest', + 'ios14-sdk-simulator': 'ios_simulator_debug_static_bot_xctest_arm64', 'ios15-beta-simulator': 'ios_simulator_debug_static_bot_xctest', 'ios15-sdk-device': 'ios_device_release_static_bot_xctest', 'ios15-sdk-simulator': 'ios_simulator_debug_static_bot_xctest', @@ -1103,7 +1103,7 @@ 'gpu-try-mac-intel-dbg': 'gpu_tests_debug_bot', 'ios-device': 'ios_device_release_compile_only', 'ios14-beta-simulator': 'ios_simulator_debug_static_bot_xctest', - 'ios14-sdk-simulator': 'ios_simulator_debug_static_bot_xctest', + 'ios14-sdk-simulator': 'ios_simulator_debug_static_bot_xctest_arm64', 'ios15-beta-simulator': 'ios_simulator_debug_static_bot_xctest', 'ios15-sdk-simulator': 'ios_simulator_debug_static_bot_xctest', 'ios-simulator': 'ios_simulator_code_coverage_partial_instrumentation_xctest', @@ -2429,6 +2429,10 @@ 'debug_static_bot', 'ios', 'ios_simulator', 'ios_cpu_x64', 'xctest', 'ios_disable_xcode_project_generation', ], + 'ios_simulator_debug_static_bot_xctest_arm64': [ + 'debug_static_bot', 'ios', 'ios_simulator', 'ios_cpu_arm64', 'xctest', 'ios_disable_xcode_project_generation', + ], + 'ios_simulator_debug_static_bot_invert_fieldtrials_xctest': [ 'debug_static_bot', 'ios', 'ios_simulator', 'ios_cpu_x64', 'invert_fieldtrials', 'xctest', 'ios_disable_xcode_project_generation', ],
diff --git a/tools/mb/mb_config_expectations/chromium.fyi.json b/tools/mb/mb_config_expectations/chromium.fyi.json index ba98dcb..f38783c 100644 --- a/tools/mb/mb_config_expectations/chromium.fyi.json +++ b/tools/mb/mb_config_expectations/chromium.fyi.json
@@ -736,7 +736,7 @@ "is_component_build": false, "is_debug": true, "symbol_level": 1, - "target_cpu": "x64", + "target_cpu": "arm64", "target_environment": "simulator", "target_os": "ios", "use_goma": true
diff --git a/tools/mb/mb_config_expectations/tryserver.chromium.mac.json b/tools/mb/mb_config_expectations/tryserver.chromium.mac.json index aa73d84a..b328cde 100644 --- a/tools/mb/mb_config_expectations/tryserver.chromium.mac.json +++ b/tools/mb/mb_config_expectations/tryserver.chromium.mac.json
@@ -384,7 +384,7 @@ "is_component_build": false, "is_debug": true, "symbol_level": 1, - "target_cpu": "x64", + "target_cpu": "arm64", "target_environment": "simulator", "target_os": "ios", "use_goma": true
diff --git a/tools/metrics/actions/actions.xml b/tools/metrics/actions/actions.xml index a4d3edd..7938e7ac 100644 --- a/tools/metrics/actions/actions.xml +++ b/tools/metrics/actions/actions.xml
@@ -23161,6 +23161,47 @@ </description> </action> +<action name="ShareSubmenu.Abandoned"> + <owner>ellyjones@chromium.org</owner> + <owner>src/chrome/browser/share/OWNERS</owner> + <description> + The share submenu was opened, but closed without choosing any of the + options. + </description> +</action> + +<action name="ShareSubmenu.CopyLinkSelected"> + <owner>ellyjones@chromium.org</owner> + <owner>src/chrome/browser/share/OWNERS</owner> + <description> + The "copy link" option was selected in the share submenu. + </description> +</action> + +<action name="ShareSubmenu.QRCodeSelected"> + <owner>ellyjones@chromium.org</owner> + <owner>src/chrome/browser/share/OWNERS</owner> + <description> + The "generate QR code" option was selected in the share submenu. + </description> +</action> + +<action name="ShareSubmenu.SendTabToSelfSelected"> + <owner>ellyjones@chromium.org</owner> + <owner>src/chrome/browser/share/OWNERS</owner> + <description> + The "send tab to self" option was selected in the share submenu. + </description> +</action> + +<action name="ShareSubmenu.ThirdPartySelected"> + <owner>ellyjones@chromium.org</owner> + <owner>src/chrome/browser/share/OWNERS</owner> + <description> + One of the third-party targets was selected in the share submenu. + </description> +</action> + <action name="SharingHubAndroid.BottomRowScrolled"> <obsolete> Renamed to SharingHubAndroid.ThirdPartyAppsScrolled 09/2020.
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 9f7d751d..b7bb975c 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -29369,6 +29369,7 @@ <int value="1590" label="SPEECHRECOGNITIONPRIVATE_START"/> <int value="1591" label="SPEECHRECOGNITIONPRIVATE_STOP"/> <int value="1592" label="FILEMANAGERPRIVATEINTERNAL_STARTIOTASK"/> + <int value="1593" label="WALLPAPERPRIVATE_ISSWAENABLED"/> </enum> <enum name="ExtensionIconState">
diff --git a/tools/metrics/histograms/metadata/apps/histograms.xml b/tools/metrics/histograms/metadata/apps/histograms.xml index 407009fc..85730137 100644 --- a/tools/metrics/histograms/metadata/apps/histograms.xml +++ b/tools/metrics/histograms/metadata/apps/histograms.xml
@@ -634,7 +634,7 @@ </histogram> <histogram name="Apps.AppList.OmniboxProvider.QueryTime" units="ms" - expires_after="2022-01-23"> + expires_after="2022-03-27"> <owner>jennyz@chromium.org</owner> <owner>newcomer@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/ash/histograms.xml b/tools/metrics/histograms/metadata/ash/histograms.xml index 1aafe7b..01b59a8 100644 --- a/tools/metrics/histograms/metadata/ash/histograms.xml +++ b/tools/metrics/histograms/metadata/ash/histograms.xml
@@ -1020,7 +1020,7 @@ </histogram> <histogram name="Ash.Desks.PresentationTime.UpdateGesture" units="ms" - expires_after="2022-01-23"> + expires_after="2022-03-27"> <owner>afakhry@chromium.org</owner> <owner>sammiequon@chromium.org</owner> <owner>tclaiborne@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/autofill/histograms.xml b/tools/metrics/histograms/metadata/autofill/histograms.xml index c3b2f783..eb769d7 100644 --- a/tools/metrics/histograms/metadata/autofill/histograms.xml +++ b/tools/metrics/histograms/metadata/autofill/histograms.xml
@@ -2092,6 +2092,49 @@ </summary> </histogram> +<histogram name="Autofill.ProfileImport.UpdateProfileAffectedType.{Decision}" + enum="AutofillSettingsVisibleTypes" expires_after="M98"> + <owner>koerber@google.com</owner> + <owner>src/components/autofill/OWNERS</owner> + <summary> + Logs that a specific type would have changed in a profile update process + that received a specific {Decision}. The update was shown to the user + because a profile similar to an already existing profile was observed in a + form submission. Note that this metric collects the changed types before the + user potentially applies additional edits. The metric is recorded on form + submission once the user decision is final. + </summary> + <token key="Decision"> + <variant name="Accepted" + summary="The user accepted the update flow from the initial prompt."/> + <variant name="Any" summary="Any decision."/> + <variant name="AutoDeclined" + summary="The prompt is suppressed most likely because there is + already another prompt shown on the same tab."/> + <variant name="Declined" + summary="The user declined the update flow from the initial prompt."/> + <variant name="EditAccepted" + summary="The user accepted the update flow from the edit dialog."/> + <variant name="EditDeclined" + summary="The user declined the update flow from the edit dialog."/> + <variant name="Ignored" summary="The user ignored the prompt."/> + <variant name="MessageDeclined" + summary="The user swipes away the update Message. This is only + relevant on mobile."/> + <variant name="MessageTimeout" + summary="The update message timed out before the user interacted. + This is only relevant on mobile."/> + <variant name="Never" + summary="The user selected to never save a new profile on a given + domain or update a specific profile (currently not + supported)."/> + <variant name="Undefined" summary="Undefined"/> + <variant name="UserNotAsked" + summary="No prompt is shown and no decision is needed to proceed with + the process."/> + </token> +</histogram> + <histogram name="Autofill.ProfileImport.UpdateProfileDecision" enum="AutofillProfileImportDecision" expires_after="M96"> <owner>koerber@google.com</owner> @@ -2128,6 +2171,48 @@ </summary> </histogram> +<histogram + name="Autofill.ProfileImport.UpdateProfileNumberOfAffectedFields.{Decision}" + units="fields" expires_after="M98"> + <owner>koerber@google.com</owner> + <owner>src/components/autofill/OWNERS</owner> + <summary> + Logs the number of fields that would be changed by an accepted update for + any possible Decision. Note that this metric collects the number of changed + fields before the user potentially applies additional edits. The metric is + recorded on form submission once the user decision is final. + </summary> + <token key="Decision"> + <variant name="Accepted" + summary="The user accepted the update flow from the initial prompt."/> + <variant name="Any" summary="Any decision."/> + <variant name="AutoDeclined" + summary="The prompt is suppressed most likely because there is + already another prompt shown on the same tab."/> + <variant name="Declined" + summary="The user declined the update flow from the initial prompt."/> + <variant name="EditAccepted" + summary="The user accepted the update flow from the edit dialog."/> + <variant name="EditDeclined" + summary="The user declined the update flow from the edit dialog."/> + <variant name="Ignored" summary="The user ignored the prompt."/> + <variant name="MessageDeclined" + summary="The user swipes away the update Message. This is only + relevant on mobile."/> + <variant name="MessageTimeout" + summary="The update message timed out before the user interacted. + This is only relevant on mobile."/> + <variant name="Never" + summary="The user selected to never save a new profile on a given + domain or update a specific profile (currently not + supported)."/> + <variant name="Undefined" summary="Undefined"/> + <variant name="UserNotAsked" + summary="No prompt is shown and no decision is needed to proceed with + the process."/> + </token> +</histogram> + <histogram name="Autofill.ProfileImport.UpdateProfileNumberOfEditedFields" units="fields" expires_after="M96"> <owner>koerber@google.com</owner>
diff --git a/tools/metrics/histograms/metadata/blink/histograms.xml b/tools/metrics/histograms/metadata/blink/histograms.xml index 711dd85..597e00b 100644 --- a/tools/metrics/histograms/metadata/blink/histograms.xml +++ b/tools/metrics/histograms/metadata/blink/histograms.xml
@@ -1161,7 +1161,7 @@ <histogram name="Blink.Fonts.DataAccess.StreamCreation" enum="BooleanSuccess" expires_after="2021-10-15"> - <owner>oyiptong@chromium.org</owner> + <owner>pwnall@chromium.org</owner> <owner>layout-dev@chromium.org</owner> <owner>storage-dev@chromium.org</owner> <summary> @@ -1189,7 +1189,7 @@ Removed in M89. Obsolete and unused. This has been replaced with Fonts.AccessAPI.EnumerationCache.* </obsolete> - <owner>oyiptong@chromium.org</owner> + <owner>pwnall@chromium.org</owner> <owner>layout-dev@chromium.org</owner> <owner>storage-dev@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/chromeos/histograms.xml b/tools/metrics/histograms/metadata/chromeos/histograms.xml index 3ee2060..66c3420 100644 --- a/tools/metrics/histograms/metadata/chromeos/histograms.xml +++ b/tools/metrics/histograms/metadata/chromeos/histograms.xml
@@ -57,6 +57,10 @@ <owner>hansenmichael@google.com</owner> <owner>nearby-share-chromeos-eng@google.com</owner> </variant> + <variant name="SmartLock" summary="Smart Lock"> + <owner>hansberry@chromium.org</owner> + <owner>chromeos-cross-device-eng@google.com</owner> + </variant> <variant name="StylusDetachedFromDockSession" summary="Time spent from stylus being undocked, to being re-docked"> <owner>kenalba@google.com</owner> @@ -401,7 +405,7 @@ </histogram> <histogram name="ChromeOS.CWP.UploadPerf" units="reports" - expires_after="2022-01-23"> + expires_after="2022-03-27"> <owner>aalexand@google.com</owner> <owner>gmx@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/compositing/histograms.xml b/tools/metrics/histograms/metadata/compositing/histograms.xml index 1d3829b..661c61b 100644 --- a/tools/metrics/histograms/metadata/compositing/histograms.xml +++ b/tools/metrics/histograms/metadata/compositing/histograms.xml
@@ -307,7 +307,7 @@ </histogram> <histogram name="Compositing.Display.DrawToSwapUs" units="microseconds" - expires_after="2022-01-23"> + expires_after="2022-03-27"> <owner>backer@chromium.org</owner> <owner>rjkroege@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/content/histograms.xml b/tools/metrics/histograms/metadata/content/histograms.xml index 147cb2d..deeeb3ad 100644 --- a/tools/metrics/histograms/metadata/content/histograms.xml +++ b/tools/metrics/histograms/metadata/content/histograms.xml
@@ -1547,6 +1547,23 @@ </summary> </histogram> +<histogram + name="ContentSuggestions.Feed.WebFeed.LoadedCardCount.{ContentOrder}" + units="index" expires_after="2022-07-01"> + <owner>harringtond@chromium.org</owner> + <owner>feed@chromium.org</owner> + <summary> + Android: Reports the total number of {ContentOrder} cards in the Following + feed when data is successfully loaded to be presented to the user. Reported + after an initial load. Only one of 'Grouped' or 'ReverseChron' is reported + for each stream load. + </summary> + <token key="ContentOrder"> + <variant name="Grouped" summary="Grouped"/> + <variant name="ReverseChron" summary="ReverseChron"/> + </token> +</histogram> + <histogram name="ContentSuggestions.Feed.WebFeed.NewFollow.IsRecommended" enum="Boolean" expires_after="2022-09-01"> <owner>harringtond@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/download/histograms.xml b/tools/metrics/histograms/metadata/download/histograms.xml index 0f1b5163..4fb151d 100644 --- a/tools/metrics/histograms/metadata/download/histograms.xml +++ b/tools/metrics/histograms/metadata/download/histograms.xml
@@ -315,7 +315,7 @@ </histogram> <histogram name="Download.InsecureBlocking.Totals" - enum="InsecureDownloadSecurityStatus" expires_after="2022-01-23"> + enum="InsecureDownloadSecurityStatus" expires_after="2022-03-27"> <owner>jdeblasio@chromium.org</owner> <owner>estark@chromium.org</owner> <owner>cthomp@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/extensions/histograms.xml b/tools/metrics/histograms/metadata/extensions/histograms.xml index a26b6cf8..6c9bcc5 100644 --- a/tools/metrics/histograms/metadata/extensions/histograms.xml +++ b/tools/metrics/histograms/metadata/extensions/histograms.xml
@@ -652,6 +652,7 @@ <token key="ExtensionsDatabaseOpen"> <variant name=""/> <variant name=".Rules" summary="Rules backing stores"/> + <variant name=".Scripts" summary="Scripts backing stores"/> <variant name=".Settings" summary="Settings backing stores"/> <variant name=".State" summary="State backing stores"/> </token>
diff --git a/tools/metrics/histograms/metadata/input/histograms.xml b/tools/metrics/histograms/metadata/input/histograms.xml index d9c27e2..b4f73ec0 100644 --- a/tools/metrics/histograms/metadata/input/histograms.xml +++ b/tools/metrics/histograms/metadata/input/histograms.xml
@@ -99,7 +99,7 @@ </histogram> <histogram name="InputMethod.Assistive.Disabled" enum="IMEAssistiveAction" - expires_after="2022-01-23"> + expires_after="2022-03-27"> <owner>jiwan@google.com</owner> <owner>essential-inputs-team@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/media/histograms.xml b/tools/metrics/histograms/metadata/media/histograms.xml index cfc6b5d..3fbe461 100644 --- a/tools/metrics/histograms/metadata/media/histograms.xml +++ b/tools/metrics/histograms/metadata/media/histograms.xml
@@ -4952,6 +4952,9 @@ </histogram> <histogram name="Media.VideoRotation" enum="VideoRotation" expires_after="M79"> + <obsolete> + Went untouched since M79. Removed as of 11/21. + </obsolete> <owner>dalecurtis@chromium.org</owner> <summary>Metadata rotation in mp4 videos. Emitted during demuxing.</summary> </histogram> @@ -5190,7 +5193,7 @@ </histogram> <histogram name="MediaRouter.Cast.Channel.ConnectResult" enum="BooleanSuccess" - expires_after="2021-11-07"> + expires_after="2022-02-01"> <owner>mfoltz@chromium.org</owner> <owner>openscreen-eng@google.com</owner> <summary> @@ -5211,7 +5214,7 @@ </histogram> <histogram name="MediaRouter.Cast.Discovery.CachedSinksAvailableCount" - units="devices" expires_after="2021-11-07"> + units="devices" expires_after="2022-02-01"> <owner>btolsch@chromium.org</owner> <owner>openscreen-eng@google.com</owner> <summary> @@ -5231,7 +5234,7 @@ </histogram> <histogram name="MediaRouter.Cast.Discovery.KnownDevicesCount" units="devices" - expires_after="2021-11-07"> + expires_after="2022-02-01"> <owner>mfoltz@chromium.org</owner> <owner>openscreen-eng@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/new_tab_page/histograms.xml b/tools/metrics/histograms/metadata/new_tab_page/histograms.xml index 12f6a2e9..c1c9e47 100644 --- a/tools/metrics/histograms/metadata/new_tab_page/histograms.xml +++ b/tools/metrics/histograms/metadata/new_tab_page/histograms.xml
@@ -1286,7 +1286,7 @@ <histogram name="NewTabPage.Promo.EnhancedProtectionPromo.ImpressionUntilDismissal" - units="units" expires_after="2022-01-23"> + units="units" expires_after="2022-03-27"> <owner>bdea@chromium.org</owner> <owner>chrome-safebrowsing-core@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/omnibox/histograms.xml b/tools/metrics/histograms/metadata/omnibox/histograms.xml index 047d31a..3de928e 100644 --- a/tools/metrics/histograms/metadata/omnibox/histograms.xml +++ b/tools/metrics/histograms/metadata/omnibox/histograms.xml
@@ -166,7 +166,7 @@ </histogram> <histogram name="Omnibox.ClipboardSuggestionShownNumTimes" units="units" - expires_after="2022-01-23"> + expires_after="2022-03-27"> <owner>gangwu@chromium.org</owner> <owner>jdonnelly@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/others/histograms.xml b/tools/metrics/histograms/metadata/others/histograms.xml index 9025bf8..6fcd2b9 100644 --- a/tools/metrics/histograms/metadata/others/histograms.xml +++ b/tools/metrics/histograms/metadata/others/histograms.xml
@@ -3519,7 +3519,7 @@ </histogram> <histogram name="ContextMenu.LensSupportStatus" enum="LensSupportStatus" - expires_after="2022-01-23"> + expires_after="2022-03-27"> <owner>benwgold@google.com</owner> <owner>lens-chrome@google.com</owner> <summary> @@ -7456,7 +7456,7 @@ <histogram name="Graphics.Smoothness.PerSession.MaxPercentDroppedFrames_1sWindow" - units="%" expires_after="2022-01-23"> + units="%" expires_after="2022-03-27"> <owner>sadrul@chromium.org</owner> <owner>graphics-dev@chromium.org</owner> <summary> @@ -11869,7 +11869,7 @@ </histogram> <histogram name="PaintHolding.CommitTrigger2" enum="PaintHoldingCommitTrigger2" - expires_after="2022-01-23"> + expires_after="2022-03-27"> <owner>schenney@chromium.org</owner> <owner>paint-dev@chromium.org</owner> <summary> @@ -12414,7 +12414,8 @@ </summary> </histogram> -<histogram name="PerformanceMonitor.ResourceCoalition.EnergyImpact" +<histogram + name="PerformanceMonitor.ResourceCoalition.EnergyImpact{UsageScenario}" units="centi-EnergyImpact" expires_after="2021-11-30"> <owner>siggi@chromium.org</owner> <owner>catan-team@chromium.org</owner> @@ -12430,6 +12431,9 @@ Chrome processes no matter how short-lived, as well as XPC services running on Chrome's behalf. </summary> +<!-- Usage scenario variant defined in tools/metrics/histograms/metadata/power/histograms.xml --> + + <token key="UsageScenario" variants="UsageScenario"/> </histogram> <histogram name="PerformanceMonitor.ResourceCoalition.GPUTime" @@ -13792,7 +13796,7 @@ </histogram> <histogram name="ReadingList.BookmarkBarState.On{Frequency}AddToReadingList" - enum="BookmarkBarState" expires_after="M96"> + enum="BookmarkBarState" expires_after="2022-02-20"> <owner>corising@chromium.org</owner> <owner>chrome-desktop-ui-sea@google.com</owner> <summary> @@ -13960,7 +13964,7 @@ </histogram> <histogram name="ReadingList.{ReadStatus}.Count.{Variation}" units="count" - expires_after="M96"> + expires_after="2022-02-20"> <owner>corising@chromium.org</owner> <owner>chrome-desktop-ui-sea@google.com</owner> <summary> @@ -14691,7 +14695,7 @@ </histogram> <histogram name="SB2.RemoteCall.Result" enum="SB2RemoteCallResult" - expires_after="2022-01-23"> + expires_after="2022-03-27"> <owner>vakh@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/password/histograms.xml b/tools/metrics/histograms/metadata/password/histograms.xml index 7f52c84..118d867 100644 --- a/tools/metrics/histograms/metadata/password/histograms.xml +++ b/tools/metrics/histograms/metadata/password/histograms.xml
@@ -2244,7 +2244,7 @@ </histogram> <histogram name="PasswordManager.ReusedPasswordType" enum="ReusedPasswordType" - expires_after="2022-01-23"> + expires_after="2022-03-27"> <owner>vakh@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/power/histograms.xml b/tools/metrics/histograms/metadata/power/histograms.xml index 551fbcb5..854cc7b 100644 --- a/tools/metrics/histograms/metadata/power/histograms.xml +++ b/tools/metrics/histograms/metadata/power/histograms.xml
@@ -125,7 +125,7 @@ </histogram> <histogram name="Power.BatteryDischargeRate" units="mW" - expires_after="2022-03-20"> + expires_after="2022-03-27"> <owner>puthik@chromium.org</owner> <owner>chromeos-platform-power@google.com</owner> <summary> @@ -1338,7 +1338,7 @@ </histogram> <histogram name="PowerML.NonModelDim.Result" enum="PowerMLFinalResult" - expires_after="2022-01-23"> + expires_after="2022-03-27"> <owner>napper@chromium.org</owner> <owner>thanhdng@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/profile/histograms.xml b/tools/metrics/histograms/metadata/profile/histograms.xml index ca7e832..5895cf6 100644 --- a/tools/metrics/histograms/metadata/profile/histograms.xml +++ b/tools/metrics/histograms/metadata/profile/histograms.xml
@@ -422,7 +422,7 @@ </histogram> <histogram name="Profile.NumberOfActiveProfiles" units="profiles" - expires_after="2022-01-23"> + expires_after="2022-03-27"> <owner>droger@chromium.org</owner> <owner>feuunk@chromium.org</owner> <summary> @@ -534,7 +534,7 @@ </histogram> <histogram name="Profile.NumberOfUnusedProfiles" units="profiles" - expires_after="2022-01-23"> + expires_after="2022-03-27"> <owner>msarda@chromium.org</owner> <owner>droger@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/software/histograms.xml b/tools/metrics/histograms/metadata/software/histograms.xml index ab0993f..fa510d31 100644 --- a/tools/metrics/histograms/metadata/software/histograms.xml +++ b/tools/metrics/histograms/metadata/software/histograms.xml
@@ -311,7 +311,7 @@ </histogram> <histogram name="SoftwareReporter.MemoryUsed" units="KB" - expires_after="2022-01-23"> + expires_after="2022-03-27"> <owner>drubery@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary> @@ -441,7 +441,7 @@ </histogram> <histogram name="SoftwareReporter.RunningTimeAccordingToChrome" units="ms" - expires_after="2022-01-21"> + expires_after="2022-03-27"> <owner>drubery@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/tab/histograms.xml b/tools/metrics/histograms/metadata/tab/histograms.xml index 2d50ebe0..64d1045 100644 --- a/tools/metrics/histograms/metadata/tab/histograms.xml +++ b/tools/metrics/histograms/metadata/tab/histograms.xml
@@ -2298,7 +2298,7 @@ </histogram> <histogram name="Tabs.TabSearch.NumTabsClosedPerInstance" units="tabs" - expires_after="2022-01-23"> + expires_after="2022-03-27"> <owner>tluk@chromium.org</owner> <owner>robliao@chromium.org</owner> <summary> @@ -2311,7 +2311,7 @@ </histogram> <histogram name="Tabs.TabSearch.NumTabsOnOpen" units="tabs" - expires_after="2022-01-23"> + expires_after="2022-03-27"> <owner>tluk@chromium.org</owner> <owner>robliao@chromium.org</owner> <summary> @@ -2322,7 +2322,7 @@ </histogram> <histogram name="Tabs.TabSearch.NumWindowsOnOpen" units="windows" - expires_after="2022-01-23"> + expires_after="2022-03-27"> <owner>tluk@chromium.org</owner> <owner>robliao@chromium.org</owner> <summary> @@ -2349,7 +2349,7 @@ </histogram> <histogram name="Tabs.TabSearch.PageHandlerConstructionDelay" units="ms" - expires_after="2022-01-23"> + expires_after="2022-03-27"> <owner>tluk@chromium.org</owner> <owner>robliao@chromium.org</owner> <owner>yuhengh@chromium.org</owner> @@ -2439,7 +2439,7 @@ </histogram> <histogram name="Tabs.TabSearch.WebUI.LoadCompletedTime" units="ms" - expires_after="2022-01-23"> + expires_after="2022-03-27"> <owner>tluk@chromium.org</owner> <owner>robliao@chromium.org</owner> <summary> @@ -2450,7 +2450,7 @@ </histogram> <histogram name="Tabs.TabSearch.WebUI.LoadDocumentTime" units="ms" - expires_after="2022-01-23"> + expires_after="2022-03-27"> <owner>tluk@chromium.org</owner> <owner>robliao@chromium.org</owner> <summary> @@ -2476,7 +2476,7 @@ </histogram> <histogram name="Tabs.TabSearch.WebUI.TabListDataReceived" units="ms" - expires_after="2022-01-23"> + expires_after="2022-03-27"> <owner>tluk@chromium.org</owner> <owner>robliao@chromium.org</owner> <owner>yuhengh@chromium.org</owner> @@ -2526,7 +2526,7 @@ </histogram> <histogram name="Tabs.TabSearch.WindowDisplayedDuration3" units="ms" - expires_after="2022-01-23"> + expires_after="2022-03-27"> <owner>tluk@chromium.org</owner> <owner>robliao@chromium.org</owner> <summary> @@ -2568,7 +2568,7 @@ </histogram> <histogram name="Tabs.TabSearch.WindowTimeToShowUncachedWebView" units="ms" - expires_after="2022-01-23"> + expires_after="2022-03-27"> <owner>tluk@chromium.org</owner> <owner>robliao@chromium.org</owner> <owner>yuhengh@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/uma/histograms.xml b/tools/metrics/histograms/metadata/uma/histograms.xml index aeaf128..5e88da6 100644 --- a/tools/metrics/histograms/metadata/uma/histograms.xml +++ b/tools/metrics/histograms/metadata/uma/histograms.xml
@@ -634,7 +634,7 @@ </histogram> <histogram name="UMA.PrimaryUserType" enum="UserType" - expires_after="2022-01-23"> + expires_after="2022-03-27"> <owner>michaelpg@chromium.org</owner> <owner>yilkal@chromium.org</owner> <owner>src/base/metrics/OWNERS</owner>
diff --git a/tools/metrics/histograms/metadata/web_apk/histograms.xml b/tools/metrics/histograms/metadata/web_apk/histograms.xml index f92761c..7746637 100644 --- a/tools/metrics/histograms/metadata/web_apk/histograms.xml +++ b/tools/metrics/histograms/metadata/web_apk/histograms.xml
@@ -142,7 +142,7 @@ </histogram> <histogram name="WebApk.Install.RequestTokenDurationV2" units="ms" - expires_after="2022-01-23"> + expires_after="2022-03-27"> <owner>hartmanng@chromium.org</owner> <owner>rayankans@chromium.org</owner> <owner>
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index 0fa7cd3..0798e15 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -6,7 +6,7 @@ }, "win": { "hash": "3c729194d00d24ccda4c9cf8d9e6f636f800270c", - "remote_path": "perfetto_binaries/trace_processor_shell/win/1ca3e3aad7533285a091fdb3ece47548d5666edb/trace_processor_shell.exe" + "remote_path": "perfetto_binaries/trace_processor_shell/win/76a8111c0c02fe2535caa7eb1269c939db3b759d/trace_processor_shell.exe" }, "mac": { "hash": "fd0bd0a0a3e15c6c55ca0331194e9d64bbcb9d17",
diff --git a/tools/perf/core/results_processor/processor.py b/tools/perf/core/results_processor/processor.py index 30d57bd5..ec5c9785 100644 --- a/tools/perf/core/results_processor/processor.py +++ b/tools/perf/core/results_processor/processor.py
@@ -480,7 +480,7 @@ 'Skipping.') return - devices = adb_wrapper.PersistentShell.Devices() + devices = adb_wrapper.AdbWrapper.Devices() # Each docker host in chrome-swarming has one device attached, so we'll use # the first AdbWrapper instance as the assumed attached device in question utils = device_utils.DeviceUtils(devices[0])
diff --git a/ui/accessibility/platform/ax_platform_node_win.cc b/ui/accessibility/platform/ax_platform_node_win.cc index 0e7d40c5..f749fcf 100644 --- a/ui/accessibility/platform/ax_platform_node_win.cc +++ b/ui/accessibility/platform/ax_platform_node_win.cc
@@ -8259,7 +8259,6 @@ // These properties are used by non-screenreader UIA clients. They should // not cause additional enablement. case UIA_HasKeyboardFocusPropertyId: - case UIA_IsControlElementPropertyId: case UIA_FrameworkIdPropertyId: case UIA_IsEnabledPropertyId: break;
diff --git a/ui/android/java/src/org/chromium/ui/widget/ChipView.java b/ui/android/java/src/org/chromium/ui/widget/ChipView.java index 67e762f6..0b6d67013 100644 --- a/ui/android/java/src/org/chromium/ui/widget/ChipView.java +++ b/ui/android/java/src/org/chromium/ui/widget/ChipView.java
@@ -23,6 +23,7 @@ import androidx.annotation.IdRes; import androidx.annotation.Px; import androidx.annotation.StyleRes; +import androidx.appcompat.widget.AppCompatTextView; import androidx.core.view.ViewCompat; import org.chromium.base.ApiCompatibilityUtils; @@ -44,7 +45,7 @@ private static final int MAX_LINES = 2; private final RippleBackgroundHelper mRippleBackgroundHelper; - private final TextView mPrimaryText; + private final AppCompatTextView mPrimaryText; private final ChromeImageView mStartIcon; private final boolean mUseRoundedStartIcon; private final LoadingView mLoadingView; @@ -56,7 +57,7 @@ private final int mCornerRadius; private ViewGroup mEndIconWrapper; - private TextView mSecondaryText; + private AppCompatTextView mSecondaryText; /** Constructor for applying a theme overlay. */ public ChipView(Context context, @StyleRes int themeOverlay) { @@ -160,7 +161,8 @@ // remaining 8dp. ViewCompat.setPaddingRelative(this, leadingElementPadding, 0, endPadding, 0); - mPrimaryText = new TextView(new ContextThemeWrapper(getContext(), R.style.ChipTextView)); + mPrimaryText = + new AppCompatTextView(new ContextThemeWrapper(getContext(), R.style.ChipTextView)); ApiCompatibilityUtils.setTextAppearance(mPrimaryText, primaryTextAppearance); // If false fall back to single line defined in XML styles. @@ -320,8 +322,8 @@ */ public TextView getSecondaryTextView() { if (mSecondaryText == null) { - mSecondaryText = - new TextView(new ContextThemeWrapper(getContext(), R.style.ChipTextView)); + mSecondaryText = new AppCompatTextView( + new ContextThemeWrapper(getContext(), R.style.ChipTextView)); ApiCompatibilityUtils.setTextAppearance(mSecondaryText, mSecondaryTextAppearanceId); // Ensure that basic state changes are aligned with the ChipView. They update // automatically once the view is part of the hierarchy.