diff --git a/BUILD.gn b/BUILD.gn index a6b18de..3f7b9ae 100644 --- a/BUILD.gn +++ b/BUILD.gn
@@ -218,6 +218,13 @@ ] } + if (is_android) { + deps += [ + "//weblayer/browser/android/javatests:browserfragment_support_instrumentation_test_apk", + "//weblayer/browser/java:weblayer_junit_tests", + ] + } + if (!is_ios && !is_android) { deps += [ "//components/cronet:cronet_tests",
diff --git a/DEPS b/DEPS index a1db9858..c0444a97 100644 --- a/DEPS +++ b/DEPS
@@ -307,19 +307,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': '3a990bac0bd53e13f105914a7ab0f657398719aa', + 'skia_revision': 'bcc5d0bd8e857427f025962ea8b1d70ae423fd0a', # 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': 'e6852566c1c828247d1729307214cd2ad935183d', + 'v8_revision': '9492d1dcb06157a95489b20f4ea8efb5aa5854d5', # 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': 'e2477b824c885cdc56ccc13d2afa896594b055d0', + 'angle_revision': 'b354aa4d2540f79a0b1e276f3aeb2c8b9d846036', # 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': '4de33dcbca0e075116988fac95580ab7cc194a6b', + 'swiftshader_revision': '00b601d8ad244776d1b7b64d0d52cdf6750a9ece', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. @@ -386,7 +386,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': '75e1a0a79da4b549b032160d636cb240140c64f3', + 'devtools_frontend_revision': 'be45b3f944601508509e6a84694683ad5f967e28', # 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. @@ -490,7 +490,7 @@ # If you change this, also update the libc++ revision in # //buildtools/deps_revisions.gni. - 'libcxx_revision': 'de4575635003f3af708e1ae3cb05c0b219aa58b4', + 'libcxx_revision': 'e6caea47f873bd039e10e3e178112225a0d959fa', # GN CIPD package version. 'gn_version': 'git_revision:b9c6c19be95a3863e02f00f1fe403b2502e345b6', @@ -818,7 +818,7 @@ 'src/clank': { 'url': 'https://chrome-internal.googlesource.com/clank/internal/apps.git' + '@' + - '15d766b5331c1eb876c2e286499e3aa4ebb92957', + '0db905ab4301f1134a31d4a8e5cdeb687d4655db', 'condition': 'checkout_android and checkout_src_internal and not checkout_clank_via_src_internal', }, @@ -912,7 +912,7 @@ 'packages': [ { 'package': 'chromium/rts/model/linux-amd64', - 'version': 'EfmSydRmaHZLEzKybOjZGr_iCsiy-WeqbTT5gtB5Pa0C', + 'version': '0fgHQL2-jbKIrING_AE5wx_8AdSBfKi8lh6ONDXZiEEC', }, ], 'dep_type': 'cipd', @@ -923,7 +923,7 @@ 'packages': [ { 'package': 'chromium/rts/model/mac-amd64', - 'version': 'alIvgo1cVcseDQ4OQNlulgH_cA-2D7lahpubdi-DnXgC', + 'version': '-CNldWgHHiN7aXkS6fbfQ7WPIWb4qD_MmLdZYygmXYQC', }, ], 'dep_type': 'cipd', @@ -934,7 +934,7 @@ 'packages': [ { 'package': 'chromium/rts/model/windows-amd64', - 'version': 'q4X8jlN1IoDJW4E44DcwaXleNgnCilQ5hzakmZ9wJhEC', + 'version': 'Kj77Og-xM1oYNPL8PFm-cSAS3zleXDtAf0c65cqybGIC', }, ], 'dep_type': 'cipd', @@ -1217,7 +1217,7 @@ # Tools used when building Chrome for Chrome OS. This affects both the Simple # Chrome workflow, as well as the chromeos-chrome ebuild. 'src/third_party/chromite': { - 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '9228819210db890f87660845ab104d96cc2bebc2', + 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + 'f50ef8dbf7f6c312caeea95d490ca85472072339', 'condition': 'checkout_chromeos', }, @@ -1251,7 +1251,7 @@ Var('chromium_git') + '/devtools/devtools-frontend' + '@' + Var('devtools_frontend_revision'), 'src/third_party/devtools-frontend-internal': { - 'url': 'https://chrome-internal.googlesource.com/devtools/devtools-internal.git' + '@' + '60875f925c52de27441d0254826800e269807457', + 'url': 'https://chrome-internal.googlesource.com/devtools/devtools-internal.git' + '@' + '9214ab997f24cd9540c6391f82c878567b12c587', 'condition': 'checkout_src_internal', }, @@ -1666,7 +1666,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + 'd905018c08900932c36d228953cf1c0dc8fdf31f', + Var('android_git') + '/platform/external/perfetto.git' + '@' + '96db79eeca95ba3068331ab1642e757b5879828e', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1848,10 +1848,10 @@ Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + 'd1b65aa5a88f6efd900604dfcda840154e9f16e2', 'src/third_party/webgpu-cts/src': - Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + '54213a2e237f1bcbccf3b16e99a6b6ff51c75d1c', + Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + 'afb5c81b795ba43b16fbaf5f0cb2c480eb21dfb3', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + 'a92ba289224ed9425bffe59edc41a0cc79292fb1', + Var('webrtc_git') + '/src.git' + '@' + 'f0e65bab0e6cce9cb2453f703f7561c080fbcfd0', # Wuffs' canonical repository is at github.com/google/wuffs, but we use # Skia's mirror of Wuffs, the same as in upstream Skia's DEPS file. @@ -1921,7 +1921,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@aa231cdfa69a852a7fc65579f73447655409afb7', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@98d1fc4260efd43215fa709b42c2eacbccd1473e', 'condition': 'checkout_src_internal', }, @@ -1951,7 +1951,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/help_app/app', - 'version': 'X66_m5F2iT1rgsaryceKazVSF3UkFUU6qoj1ncqH2dMC', + 'version': 'R9xy1GiPS4unDxsFwLqCRcBzzyplYUHw7UKbb8DlOKUC', }, ], 'condition': 'checkout_chromeos and checkout_src_internal', @@ -1962,7 +1962,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/media_app/app', - 'version': '_HneiL0D47_aCGGnVSA8KaEvsQgR079NGYKvaU5JdiEC', + 'version': 'qkaPSvtWCwpXTG5OoaLiTT7e9dEzVPQshJntCEh3EeAC', }, ], 'condition': 'checkout_chromeos and checkout_src_internal',
diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 6d90eb13..5394f41 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py
@@ -6418,3 +6418,23 @@ """, error_locations)) return results + +def CheckNoJsInIos(input_api, output_api): + """Checks to make sure that JavaScript files are not used on iOS.""" + + def _FilterFile(affected_file): + return input_api.FilterSourceFile( + affected_file, + files_to_skip=input_api.DEFAULT_FILES_TO_SKIP + + (r'^ios/third_party/*', r'^third_party/*'), + files_to_check=[r'^ios/.*\.js$', r'.*/ios/.*\.js$']) + + errors = [] + for f in input_api.AffectedSourceFiles(_FilterFile): + if input_api.os_path.splitext(f.LocalPath())[1] == '.js': + errors.append(output_api.PresubmitError( + 'Do not use JavaScript on iOS as TypeScript is fully support. ' + 'See //ios/web/public/js_messaging/README.md for help using ' + 'scripts on iOS.', f)) + + return errors
diff --git a/PRESUBMIT_test.py b/PRESUBMIT_test.py index e76debd4..9f6b438 100755 --- a/PRESUBMIT_test.py +++ b/PRESUBMIT_test.py
@@ -4738,5 +4738,29 @@ errors = PRESUBMIT.CheckNoLayoutCallsInTests(mock_input, MockOutputApi()) self.assertEqual(0, len(errors)) +class AssertNoJsInIosTest(unittest.TestCase): + def testError(self): + input_api = MockInputApi() + input_api.files = [ + MockFile('components/feature/ios/resources/script.js', []), + MockFile('ios/chrome/feature/resources/script.js', []), + MockFile('ios/web/feature/resources/script.js', []) + ] + errors = PRESUBMIT.CheckNoJsInIos(input_api, MockOutputApi()) + self.assertEqual(3, len(errors)) + + def testNonError(self): + input_api = MockInputApi() + input_api.files = [ + MockFile('chrome/resources/script.js', []), + MockFile('components/feature/ios/resources/script.ts', []), + MockFile('ios/chrome/feature/resources/script.ts', []), + MockFile('ios/web/feature/resources/script.ts', []), + MockFile('ios/third_party/script.js', []), + MockFile('third_party/ios/script.js', []) + ] + errors = PRESUBMIT.CheckNoJsInIos(input_api, MockOutputApi()) + self.assertEqual(0, len(errors)) + if __name__ == '__main__': unittest.main()
diff --git a/android_webview/browser/aw_browser_context.cc b/android_webview/browser/aw_browser_context.cc index f9e48dc..90db18d9 100644 --- a/android_webview/browser/aw_browser_context.cc +++ b/android_webview/browser/aw_browser_context.cc
@@ -452,7 +452,7 @@ } if (!client_hints_controller_delegate_.get()) { client_hints_controller_delegate_ = - std::make_unique<AwClientHintsControllerDelegate>(); + std::make_unique<AwClientHintsControllerDelegate>(GetPrefService()); } return client_hints_controller_delegate_.get(); }
diff --git a/android_webview/browser/aw_client_hints_controller_delegate.cc b/android_webview/browser/aw_client_hints_controller_delegate.cc index 3041131..b7735db 100644 --- a/android_webview/browser/aw_client_hints_controller_delegate.cc +++ b/android_webview/browser/aw_client_hints_controller_delegate.cc
@@ -5,31 +5,26 @@ #include "android_webview/browser/aw_client_hints_controller_delegate.h" #include "base/notreached.h" +#include "components/embedder_support/user_agent_utils.h" #include "content/public/browser/client_hints_controller_delegate.h" #include "content/public/browser/render_frame_host.h" #include "services/network/public/cpp/network_quality_tracker.h" -#include "services/network/public/mojom/web_client_hints_types.mojom.h" #include "third_party/blink/public/common/client_hints/enabled_client_hints.h" #include "third_party/blink/public/common/user_agent/user_agent_metadata.h" -#include "ui/gfx/geometry/size_f.h" #include "url/gurl.h" #include "url/origin.h" namespace android_webview { -AwClientHintsControllerDelegate::AwClientHintsControllerDelegate() { - // TODO(crbug.com/921655): Actually implement function. - NOTIMPLEMENTED(); -} -AwClientHintsControllerDelegate::~AwClientHintsControllerDelegate() { - // TODO(crbug.com/921655): Actually implement function. - NOTIMPLEMENTED(); -} +AwClientHintsControllerDelegate::AwClientHintsControllerDelegate( + PrefService* pref_service) + : pref_service_(pref_service) {} + +AwClientHintsControllerDelegate::~AwClientHintsControllerDelegate() = default; network::NetworkQualityTracker* AwClientHintsControllerDelegate::GetNetworkQualityTracker() { - // TODO(crbug.com/921655): Actually implement function. - NOTIMPLEMENTED(); + // Android WebViews lack a Network Quality Tracker. return nullptr; } @@ -57,9 +52,7 @@ blink::UserAgentMetadata AwClientHintsControllerDelegate::GetUserAgentMetadata() { - // TODO(crbug.com/921655): Actually implement function. - NOTIMPLEMENTED(); - return blink::UserAgentMetadata(); + return embedder_support::GetUserAgentMetadata(pref_service_); } void AwClientHintsControllerDelegate::PersistClientHints( @@ -71,27 +64,22 @@ } void AwClientHintsControllerDelegate::SetAdditionalClientHints( - const std::vector<network::mojom::WebClientHintsType>&) { - // TODO(crbug.com/921655): Actually implement function. - NOTIMPLEMENTED(); + const std::vector<network::mojom::WebClientHintsType>& hints) { + additional_hints_ = hints; } void AwClientHintsControllerDelegate::ClearAdditionalClientHints() { - // TODO(crbug.com/921655): Actually implement function. - NOTIMPLEMENTED(); + additional_hints_.clear(); } void AwClientHintsControllerDelegate::SetMostRecentMainFrameViewportSize( const gfx::Size& viewport_size) { - // TODO(crbug.com/921655): Actually implement function. - NOTIMPLEMENTED(); + viewport_size_ = viewport_size; } gfx::Size AwClientHintsControllerDelegate::GetMostRecentMainFrameViewportSize() { - // TODO(crbug.com/921655): Actually implement function. - NOTIMPLEMENTED(); - return gfx::Size(0, 0); + return viewport_size_; } } // namespace android_webview
diff --git a/android_webview/browser/aw_client_hints_controller_delegate.h b/android_webview/browser/aw_client_hints_controller_delegate.h index 2ba83810..5119a1b0 100644 --- a/android_webview/browser/aw_client_hints_controller_delegate.h +++ b/android_webview/browser/aw_client_hints_controller_delegate.h
@@ -5,8 +5,10 @@ #ifndef ANDROID_WEBVIEW_BROWSER_AW_CLIENT_HINTS_CONTROLLER_DELEGATE_H_ #define ANDROID_WEBVIEW_BROWSER_AW_CLIENT_HINTS_CONTROLLER_DELEGATE_H_ +#include "components/prefs/pref_service.h" #include "content/public/browser/client_hints_controller_delegate.h" -#include "services/network/public/mojom/web_client_hints_types.mojom-forward.h" +#include "services/network/public/mojom/web_client_hints_types.mojom.h" +#include "ui/gfx/geometry/size_f.h" namespace blink { class EnabledClientHints; @@ -17,10 +19,6 @@ class RenderFrameHost; } // namespace content -namespace gfx { -class Size; -} // namespace gfx - namespace network { class NetworkQualityTracker; } // namespace network @@ -35,7 +33,7 @@ class AwClientHintsControllerDelegate : public content::ClientHintsControllerDelegate { public: - AwClientHintsControllerDelegate(); + explicit AwClientHintsControllerDelegate(PrefService* pref_service); ~AwClientHintsControllerDelegate() override; network::NetworkQualityTracker* GetNetworkQualityTracker() override; @@ -57,7 +55,7 @@ client_hints) override; void SetAdditionalClientHints( - const std::vector<network::mojom::WebClientHintsType>&) override; + const std::vector<network::mojom::WebClientHintsType>& hints) override; void ClearAdditionalClientHints() override; @@ -65,6 +63,11 @@ const gfx::Size& viewport_size) override; gfx::Size GetMostRecentMainFrameViewportSize() override; + + private: + std::vector<network::mojom::WebClientHintsType> additional_hints_; + raw_ptr<PrefService> pref_service_; + gfx::Size viewport_size_; }; } // namespace android_webview
diff --git a/android_webview/browser/aw_client_hints_controller_delegate_unittest.cc b/android_webview/browser/aw_client_hints_controller_delegate_unittest.cc index fd37c3d..a5204f0 100644 --- a/android_webview/browser/aw_client_hints_controller_delegate_unittest.cc +++ b/android_webview/browser/aw_client_hints_controller_delegate_unittest.cc
@@ -5,6 +5,8 @@ #include "android_webview/browser/aw_client_hints_controller_delegate.h" #include "base/memory/ref_counted.h" +#include "components/embedder_support/user_agent_utils.h" +#include "components/prefs/testing_pref_service.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/user_agent/user_agent_metadata.h" #include "url/gurl.h" @@ -15,16 +17,17 @@ class AwClientHintsControllerDelegateTest : public testing::Test { protected: void SetUp() override { + prefs_ = std::make_unique<TestingPrefServiceSimple>(); client_hints_controller_delegate_ = - std::make_unique<AwClientHintsControllerDelegate>(); + std::make_unique<AwClientHintsControllerDelegate>(prefs_.get()); } std::unique_ptr<content::ClientHintsControllerDelegate> client_hints_controller_delegate_; + std::unique_ptr<TestingPrefServiceSimple> prefs_; }; TEST_F(AwClientHintsControllerDelegateTest, GetNetworkQualityTracker) { - // TODO(crbug.com/921655): Actually test function once implemented. EXPECT_EQ(nullptr, client_hints_controller_delegate_->GetNetworkQualityTracker()); } @@ -48,8 +51,7 @@ } TEST_F(AwClientHintsControllerDelegateTest, GetUserAgentMetadata) { - // TODO(crbug.com/921655): Actually test function once implemented. - EXPECT_EQ(blink::UserAgentMetadata(), + EXPECT_EQ(embedder_support::GetUserAgentMetadata(prefs_.get()), client_hints_controller_delegate_->GetUserAgentMetadata()); } @@ -60,25 +62,29 @@ } TEST_F(AwClientHintsControllerDelegateTest, SetAdditionalClientHints) { - // TODO(crbug.com/921655): Actually test function once implemented. - client_hints_controller_delegate_->SetAdditionalClientHints({}); + client_hints_controller_delegate_->SetAdditionalClientHints( + {network::mojom::WebClientHintsType::kDeviceMemory}); + // TODO(crbug.com/921655): Test with GetAllowedClientHintsFromSource } TEST_F(AwClientHintsControllerDelegateTest, ClearAdditionalClientHints) { - // TODO(crbug.com/921655): Actually test function once implemented. + client_hints_controller_delegate_->SetAdditionalClientHints( + {network::mojom::WebClientHintsType::kDeviceMemory}); client_hints_controller_delegate_->ClearAdditionalClientHints(); + // TODO(crbug.com/921655): Test with GetAllowedClientHintsFromSource } TEST_F(AwClientHintsControllerDelegateTest, SetMostRecentMainFrameViewportSize) { - // TODO(crbug.com/921655): Actually test function once implemented. client_hints_controller_delegate_->SetMostRecentMainFrameViewportSize( - gfx::Size(0, 0)); + gfx::Size(1, 1)); + EXPECT_EQ( + gfx::Size(1, 1), + client_hints_controller_delegate_->GetMostRecentMainFrameViewportSize()); } TEST_F(AwClientHintsControllerDelegateTest, GetMostRecentMainFrameViewportSize) { - // TODO(crbug.com/921655): Actually test function once implemented. EXPECT_EQ( gfx::Size(0, 0), client_hints_controller_delegate_->GetMostRecentMainFrameViewportSize());
diff --git a/android_webview/browser/aw_permission_manager.cc b/android_webview/browser/aw_permission_manager.cc index 058a96f..cc49280d 100644 --- a/android_webview/browser/aw_permission_manager.cc +++ b/android_webview/browser/aw_permission_manager.cc
@@ -341,7 +341,7 @@ case PermissionType::AR: case PermissionType::STORAGE_ACCESS_GRANT: case PermissionType::CAMERA_PAN_TILT_ZOOM: - case PermissionType::WINDOW_PLACEMENT: + case PermissionType::WINDOW_MANAGEMENT: case PermissionType::LOCAL_FONTS: case PermissionType::DISPLAY_CAPTURE: NOTIMPLEMENTED() << "RequestPermissions is not implemented for " @@ -577,7 +577,7 @@ case PermissionType::AR: case PermissionType::STORAGE_ACCESS_GRANT: case PermissionType::CAMERA_PAN_TILT_ZOOM: - case PermissionType::WINDOW_PLACEMENT: + case PermissionType::WINDOW_MANAGEMENT: case PermissionType::LOCAL_FONTS: case PermissionType::DISPLAY_CAPTURE: NOTIMPLEMENTED() << "CancelPermission not implemented for "
diff --git a/android_webview/test/BUILD.gn b/android_webview/test/BUILD.gn index fd7bb78..7a66b50 100644 --- a/android_webview/test/BUILD.gn +++ b/android_webview/test/BUILD.gn
@@ -568,6 +568,7 @@ "//components/autofill/core/browser", "//components/component_updater", "//components/component_updater/android:embedded_component_loader", + "//components/embedder_support:browser_util", "//components/embedder_support/android:util", "//components/embedder_support/android/metrics:metrics", "//components/flags_ui:flags_ui",
diff --git a/ash/app_list/app_list_test_api.cc b/ash/app_list/app_list_test_api.cc index e01141df..cf93469 100644 --- a/ash/app_list/app_list_test_api.cc +++ b/ash/app_list/app_list_test_api.cc
@@ -517,11 +517,6 @@ item_list->MoveItem(from_index, to_index); } -void AppListTestApi::AddPageBreakItemAfterId(const std::string& item_id) { - auto* model = GetAppListModel(); - model->AddPageBreakItemAfter(model->FindItem(item_id)); -} - int AppListTestApi::GetTopListItemCount() { return GetAppListModel()->top_level_item_list()->item_count(); }
diff --git a/ash/app_list/model/app_list_item.h b/ash/app_list/model/app_list_item.h index ebbc7ebe..44dbbc6 100644 --- a/ash/app_list/model/app_list_item.h +++ b/ash/app_list/model/app_list_item.h
@@ -111,9 +111,6 @@ bool is_folder() const { return metadata_->is_folder; } - void set_is_page_break(bool is_page_break) { - metadata_->is_page_break = is_page_break; - } bool is_page_break() const { return metadata_->is_page_break; } bool has_notification_badge() const { return has_notification_badge_; }
diff --git a/ash/app_list/model/app_list_item_list.cc b/ash/app_list/model/app_list_item_list.cc index 942b87d..874f409 100644 --- a/ash/app_list/model/app_list_item_list.cc +++ b/ash/app_list/model/app_list_item_list.cc
@@ -153,46 +153,6 @@ return true; } -AppListItem* AppListItemList::AddPageBreakItemAfter( - const AppListItem* previous_item) { - DCHECK(!features::IsProductivityLauncherEnabled()); - - size_t previous_index; - CHECK(FindItemIndex(previous_item->id(), &previous_index)); - CHECK(!previous_item->IsInFolder()); - - const size_t next_index = previous_index + 1; - const AppListItem* next_item = - next_index < item_count() ? item_at(next_index) : nullptr; - syncer::StringOrdinal position; - if (!next_item) { - position = previous_item->position().CreateAfter(); - } else { - // It is possible that items were added with the same ordinal. To - // successfully add the page break item we need to fix this. We do not try - // to fix this when an item is added in order to avoid possible edge cases - // with sync. - if (previous_item->position().Equals(next_item->position())) - FixItemPosition(next_index); - position = previous_item->position().CreateBetween(next_item->position()); - } - - auto page_break_item = std::make_unique<AppListItem>(base::GenerateGUID()); - page_break_item->set_position(position); - page_break_item->set_is_page_break(true); - - AppListItem* item = page_break_item.get(); - size_t index = GetItemSortOrderIndex(item->position(), item->id()); - DVLOG(2) << "AddPageBreakItemAfter: " << previous_item->id() << " prev index " - << previous_index << " next index " << next_index << " count " - << item_count() << " add index " << index; - app_list_items_.insert(app_list_items_.begin() + index, - std::move(page_break_item)); - for (auto& observer : observers_) - observer.OnListItemAdded(index, item); - return item; -} - std::string AppListItemList::ToString() { std::string out; for (size_t i = 0; i < app_list_items_.size(); ++i) {
diff --git a/ash/app_list/model/app_list_item_list.h b/ash/app_list/model/app_list_item_list.h index 6b79ec1..1a035e8 100644 --- a/ash/app_list/model/app_list_item_list.h +++ b/ash/app_list/model/app_list_item_list.h
@@ -72,9 +72,6 @@ // external classes. Fixing this issue can eliminate such confusion. bool SetItemPosition(AppListItem* item, syncer::StringOrdinal new_position); - // Add a "page break" item right after the specified item in item list. - AppListItem* AddPageBreakItemAfter(const AppListItem* previous_item); - AppListItem* item_at(size_t index) { DCHECK_LT(index, app_list_items_.size()); return app_list_items_[index].get();
diff --git a/ash/app_list/model/app_list_item_list_unittest.cc b/ash/app_list/model/app_list_item_list_unittest.cc index a0ee8ea..73a3728 100644 --- a/ash/app_list/model/app_list_item_list_unittest.cc +++ b/ash/app_list/model/app_list_item_list_unittest.cc
@@ -197,26 +197,6 @@ AppListItemList* item_list_ = nullptr; }; -class AppListItemListWithPageBreaksTest : public AppListItemListTest { - public: - AppListItemListWithPageBreaksTest() { - // Productivity launcher does not use page breaks (which are filtered out of - // the app list model in chrome), so disable productivity launcher for tests - // that use page breaks. - feature_list_.InitAndDisableFeature(features::kProductivityLauncher); - } - - AppListItemListWithPageBreaksTest(const AppListItemListWithPageBreaksTest&) = - delete; - AppListItemListWithPageBreaksTest& operator=( - const AppListItemListWithPageBreaksTest&) = delete; - - ~AppListItemListWithPageBreaksTest() override = default; - - private: - base::test::ScopedFeatureList feature_list_; -}; - TEST_F(AppListItemListTest, FindItemIndex) { AppListItem* item_0 = CreateAndAddItem(GetItemId(0)); AppListItem* item_1 = CreateAndAddItem(GetItemId(1)); @@ -438,41 +418,6 @@ EXPECT_TRUE(VerifyItemOrder4(2, 0, 3, 1)); } -// Test adding a page break item between two items with different position. -TEST_F(AppListItemListWithPageBreaksTest, AddPageBreakItem) { - AppListItem* item_0 = CreateAndAddItem(GetItemId(0)); - AppListItem* item_1 = CreateAndAddItem(GetItemId(1)); - EXPECT_EQ(item_0, item_list_->item_at(0)); - EXPECT_EQ(item_1, item_list_->item_at(1)); - EXPECT_TRUE(item_0->position().LessThan(item_1->position())); - - AppListItem* page_break_item = item_list_->AddPageBreakItemAfter(item_0); - EXPECT_EQ(item_0, item_list_->item_at(0)); - EXPECT_EQ(page_break_item, item_list_->item_at(1)); - EXPECT_EQ(item_1, item_list_->item_at(2)); - EXPECT_TRUE(item_0->position().LessThan(page_break_item->position())); - EXPECT_TRUE(page_break_item->position().LessThan(item_1->position())); -} - -// Test adding a page break item between two items with the same position. -TEST_F(AppListItemListWithPageBreaksTest, AddPageBreakItemWithSamePosition) { - AppListItem* item_0 = CreateAndAddItem(GetItemId(0)); - AppListItem* item_1 = CreateAndAddItem(GetItemId(1)); - item_list_->SetItemPosition(item_list_->item_at(1), - item_list_->item_at(0)->position()); - EXPECT_EQ(item_0, item_list_->item_at(0)); - EXPECT_EQ(item_1, item_list_->item_at(1)); - EXPECT_TRUE(item_0->position().Equals(item_1->position())); - - // Position of items should be fixed. - AppListItem* page_break_item = item_list_->AddPageBreakItemAfter(item_0); - EXPECT_EQ(item_0, item_list_->item_at(0)); - EXPECT_EQ(page_break_item, item_list_->item_at(1)); - EXPECT_EQ(item_1, item_list_->item_at(2)); - EXPECT_TRUE(item_0->position().LessThan(page_break_item->position())); - EXPECT_TRUE(page_break_item->position().LessThan(item_1->position())); -} - TEST_F(AppListItemListTest, MoveItemPastEnd) { CreateAndAddItem(GetItemId(0)); CreateAndAddItem(GetItemId(1));
diff --git a/ash/app_list/model/app_list_model.cc b/ash/app_list/model/app_list_model.cc index 4d65675..6f05d699 100644 --- a/ash/app_list/model/app_list_model.cc +++ b/ash/app_list/model/app_list_model.cc
@@ -82,13 +82,6 @@ return AddItemToRootListAndNotify(std::move(item), ReparentItemReason::kAdd); } -void AppListModel::AddPageBreakItemAfter(const AppListItem* previous_item) { - AppListItem* page_break_item = - top_level_item_list()->AddPageBreakItemAfter(previous_item); - for (auto& observer : observers_) - observer.OnAppListItemAdded(page_break_item); -} - void AppListModel::SetItemMetadata(const std::string& id, std::unique_ptr<AppListItemMetadata> data) { AppListItem* item = FindItem(id);
diff --git a/ash/app_list/model/app_list_model.h b/ash/app_list/model/app_list_model.h index 077a316f..d8a9f60 100644 --- a/ash/app_list/model/app_list_model.h +++ b/ash/app_list/model/app_list_model.h
@@ -64,11 +64,6 @@ AppListItem* AddItemToFolder(std::unique_ptr<AppListItem> item, const std::string& folder_id); - // Add a "page break" item right after the specified item in item list. - // TODO(crbug.com/1366414): Delete this method. The launcher no longer - // supports page breaks. - void AddPageBreakItemAfter(const AppListItem* previous_item); - // Updates an item's metadata (e.g. name, position, etc). void SetItemMetadata(const std::string& id, std::unique_ptr<AppListItemMetadata> data);
diff --git a/ash/app_list/paged_view_structure.cc b/ash/app_list/paged_view_structure.cc index 2e20cd0..6465b6e 100644 --- a/ash/app_list/paged_view_structure.cc +++ b/ash/app_list/paged_view_structure.cc
@@ -142,29 +142,7 @@ ++i; ++item_index; } - - // When removing launcher spaces is enabled, all launcher pages expect for - // the last one should be full (i.e. no empty spaces). Therefore page break - // items are useless. It is why we should only create page break items when - // the feature flag is disabled. - if (!features::IsProductivityLauncherEnabled() && - item_index < item_list->item_count() && - !item_list->item_at(item_index)->is_page_break()) { - // Remove AppListItemListObserver temporarily to avoid |pages_| being - // reloaded. - item_list->RemoveObserver(apps_grid_view_); - - // There's no "page break" item at the end of current page, so add one to - // push overflowing items to next page. - model->AddPageBreakItemAfter(item_list->item_at(item_index - 1)); - item_list->AddObserver(apps_grid_view_); - } } - - // Note that we do not remove redundant "page break" items here because the - // item list we can access here may not be complete (e.g. Devices that do not - // support ARC++ or Crostini apps filter out those items.). We leave this - // operation to AppListSyncableService which has complete item list. } void PagedViewStructure::Move(AppListItemView* view,
diff --git a/ash/app_list/test/app_list_test_helper.cc b/ash/app_list/test/app_list_test_helper.cc index 5dbc7782..9fb9872a 100644 --- a/ash/app_list/test/app_list_test_helper.cc +++ b/ash/app_list/test/app_list_test_helper.cc
@@ -191,12 +191,6 @@ } } -void AppListTestHelper::AddPageBreakItem() { - auto page_break_item = std::make_unique<AppListItem>(base::GenerateGUID()); - page_break_item->set_is_page_break(true); - AppListModelProvider::Get()->model()->AddItem(std::move(page_break_item)); -} - void AppListTestHelper::AddContinueSuggestionResults(int num_results) { for (int i = 0; i < num_results; i++) { auto result = std::make_unique<TestSearchResult>();
diff --git a/ash/app_list/test/app_list_test_helper.h b/ash/app_list/test/app_list_test_helper.h index 7c530614..8a0993b 100644 --- a/ash/app_list/test/app_list_test_helper.h +++ b/ash/app_list/test/app_list_test_helper.h
@@ -126,9 +126,6 @@ IconColorType color_type, bool set_name); - // Adds a page break item to the app list model. - void AddPageBreakItem(); - // Adds `num_results` to continue section in the app list. void AddContinueSuggestionResults(int num_results);
diff --git a/ash/app_list/views/apps_container_view.cc b/ash/app_list/views/apps_container_view.cc index 13d970e..8fe6e874 100644 --- a/ash/app_list/views/apps_container_view.cc +++ b/ash/app_list/views/apps_container_view.cc
@@ -382,15 +382,14 @@ CalculateAvailableBoundsForAppsGrid(contents_bounds); std::unique_ptr<AppListConfig> new_config = - AppListConfigProvider::Get().CreateForFullscreenAppList( + AppListConfigProvider::Get().CreateForTabletAppList( display::Screen::GetScreen() ->GetDisplayNearestView(GetWidget()->GetNativeView()) .work_area() .size(), - grid_layout.rows, grid_layout.columns, available_bounds.size(), - app_list_config_.get()); + grid_layout.columns, available_bounds.size(), app_list_config_.get()); - // `CreateForFullscreenAppList()` will create a new config only if it differs + // `CreateForTabletAppList()` will create a new config only if it differs // from the current `app_list_config_`. Nothing to do if the old // `AppListConfig` can be used for the updated apps container bounds. if (!new_config)
diff --git a/ash/app_list/views/paged_apps_grid_view_unittest.cc b/ash/app_list/views/paged_apps_grid_view_unittest.cc index 2e096f97..ac1ff62 100644 --- a/ash/app_list/views/paged_apps_grid_view_unittest.cc +++ b/ash/app_list/views/paged_apps_grid_view_unittest.cc
@@ -282,22 +282,6 @@ EXPECT_EQ(5, GetPagedAppsGridView()->cols()); } -// Test that spacing between pages is removed when the remove empty space flag -// is enabled. -TEST_F(PagedAppsGridViewTest, TestPaging) { - GetAppListTestHelper()->AddAppItems(1); - GetAppListTestHelper()->AddPageBreakItem(); - GetAppListTestHelper()->AddAppItems(1); - GetAppListTestHelper()->AddPageBreakItem(); - GetAppListTestHelper()->AddAppItems(1); - - EXPECT_EQ(1, GetAppListTestHelper() - ->GetRootPagedAppsGridView() - ->pagination_model() - ->total_pages()); - EXPECT_EQ(3, grid_test_api_->AppsOnPage(0)); -} - // Test that an app cannot be dragged to create a new page when the remove empty // space flag is enabled. TEST_F(PagedAppsGridViewTest, DragItemToNextPage) {
diff --git a/ash/app_list/views/scrollable_apps_grid_view_unittest.cc b/ash/app_list/views/scrollable_apps_grid_view_unittest.cc index f1cf4e1..a89384ec 100644 --- a/ash/app_list/views/scrollable_apps_grid_view_unittest.cc +++ b/ash/app_list/views/scrollable_apps_grid_view_unittest.cc
@@ -156,8 +156,6 @@ index_range->last_index == last_index; } - void AddPageBreakItem() { GetAppListTestHelper()->AddPageBreakItem(); } - std::unique_ptr<test::AppListTestModel> app_list_test_model_; std::unique_ptr<SearchModel> search_model_; std::unique_ptr<ShelfItemFactoryFake> shelf_item_factory_; @@ -167,22 +165,6 @@ views::ScrollView* scroll_view_ = nullptr; }; -TEST_F(ScrollableAppsGridViewTest, PageBreaksDoNotCauseExtraRowsInLayout) { - AddAppListItem("1"); - AddAppListItem("2"); - AddAppListItem("3"); - AddAppListItem("4"); - AddPageBreakItem(); - AddAppListItem("5"); - ShowAppList(); - - ScrollableAppsGridView* view = GetScrollableAppsGridView(); - const int tile_height = view->app_list_config()->grid_tile_height(); - const gfx::Size grid_size = view->GetTileGridSize(); - // The layout is one tile tall because it has only one row. - EXPECT_EQ(grid_size.height(), tile_height); -} - TEST_F(ScrollableAppsGridViewTest, ClickOnApp) { AddAppListItem("id"); @@ -249,10 +231,8 @@ TEST_F(ScrollableAppsGridViewTest, ItemIndicesForMove) { AddAppListItem("aaa"); // App list item index 0, visual index 0,0. - AddPageBreakItem(); // Not visible. - AddAppListItem("bbb"); // App list item index 2, visual index 0,1. - AddPageBreakItem(); // Not visible. - AddAppListItem("ccc"); // App list item index 4, visual index 0,2. + AddAppListItem("bbb"); // App list item index 1, visual index 0,1. + AddAppListItem("ccc"); // App list item index 2, visual index 0,2. ShowAppList(); auto* view = GetScrollableAppsGridView(); @@ -281,27 +261,26 @@ // Target is after "aaa". EXPECT_EQ(1, structure->GetTargetItemListIndexForMove(nullptr, GridIndex(0, 1))); - // Target is after "aaa" + break + "bbb". - EXPECT_EQ(3, + // Target is after "aaa" + "bbb". + EXPECT_EQ(2, structure->GetTargetItemListIndexForMove(nullptr, GridIndex(0, 2))); - // Target is after "aaa" + break + "bbb" + break + "ccc". - EXPECT_EQ(5, + // Target is after "aaa" + "bbb" + "ccc". + EXPECT_EQ(3, structure->GetTargetItemListIndexForMove(nullptr, GridIndex(0, 3))); } TEST_F(ScrollableAppsGridViewTest, DragAppAfterScrollingDown) { - // Simulate data from another device that has a page break after 20 items. + // Simulate data from another device. PopulateApps(20); - AddPageBreakItem(); AddAppListItem("aaa"); AddAppListItem("bbb"); ShowAppList(); // "aaa" and "bbb" are the last two items. AppListItemList* item_list = app_list_test_model_->top_level_item_list(); - ASSERT_EQ(23u, item_list->item_count()); - ASSERT_EQ("aaa", item_list->item_at(21)->id()); - ASSERT_EQ("bbb", item_list->item_at(22)->id()); + ASSERT_EQ(22u, item_list->item_count()); + ASSERT_EQ("aaa", item_list->item_at(20)->id()); + ASSERT_EQ("bbb", item_list->item_at(21)->id()); // Scroll down to the "aaa" item. auto* apps_grid_view = GetScrollableAppsGridView(); @@ -319,8 +298,8 @@ generator->ReleaseLeftButton(); // The last 2 items were reordered. - EXPECT_EQ("bbb", item_list->item_at(21)->id()) << item_list->ToString(); - EXPECT_EQ("aaa", item_list->item_at(22)->id()) << item_list->ToString(); + EXPECT_EQ("bbb", item_list->item_at(20)->id()) << item_list->ToString(); + EXPECT_EQ("aaa", item_list->item_at(21)->id()) << item_list->ToString(); } TEST_F(ScrollableAppsGridViewTest, AutoScrollDown) {
diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd index 2a2ddde..267caff 100644 --- a/ash/ash_strings.grd +++ b/ash/ash_strings.grd
@@ -2078,6 +2078,9 @@ <message name="IDS_ASH_DESKS_CLOSE_ALL_UNDONE_NOTIFICATION" desc="ChromeVox announcement that is read when the user presses the button to undo desk removal."> Desk and windows reopened </message> + <message name="IDS_ASH_DESKS_NAME_HIGHLIGHT_NOTIFICATION" desc="Alert spoken by screen readers when user tabs to the name view of a virtual desk."> + Press enter or search + space to select the text for editing. + </message> <!-- Status tray charging strings. --> <message name="IDS_ASH_STATUS_TRAY_LOW_POWER_CHARGER_TITLE" desc="The title of a notification indicating that a low-current USB charger has been connected.">
diff --git a/ash/ash_strings_grd/IDS_ASH_DESKS_NAME_HIGHLIGHT_NOTIFICATION.png.sha1 b/ash/ash_strings_grd/IDS_ASH_DESKS_NAME_HIGHLIGHT_NOTIFICATION.png.sha1 new file mode 100644 index 0000000..2fa38ced --- /dev/null +++ b/ash/ash_strings_grd/IDS_ASH_DESKS_NAME_HIGHLIGHT_NOTIFICATION.png.sha1
@@ -0,0 +1 @@ +9e5746bd25e53c3cd96c4f5be6a6cb9b19068d59 \ No newline at end of file
diff --git a/ash/constants/ash_pref_names.cc b/ash/constants/ash_pref_names.cc index 4b2c9d0..d63916ab 100644 --- a/ash/constants/ash_pref_names.cc +++ b/ash/constants/ash_pref_names.cc
@@ -94,6 +94,10 @@ const char kAudioOutputDevicesUserPriority[] = "settings.audio.output_user_priority"; +// A dictionary pref that maps device id string to the timestamp of the last +// time the audio device was connected, in `base::Time::ToDoubleT()`'s format. +const char kAudioDevicesLastSeen[] = "settings.audio.last_seen"; + // A string pref storing an identifier that is getting sent with parental // consent in EDU account addition flow. const char kEduCoexistenceId[] = "account_manager.edu_coexistence_id";
diff --git a/ash/constants/ash_pref_names.h b/ash/constants/ash_pref_names.h index f487b8b..3c6c0dab 100644 --- a/ash/constants/ash_pref_names.h +++ b/ash/constants/ash_pref_names.h
@@ -41,6 +41,8 @@ extern const char kAudioInputDevicesUserPriority[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kAudioOutputDevicesUserPriority[]; +COMPONENT_EXPORT(ASH_CONSTANTS) +extern const char kAudioDevicesLastSeen[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kEduCoexistenceId[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kEduCoexistenceToSVersion[];
diff --git a/ash/public/cpp/app_list/app_list_config.h b/ash/public/cpp/app_list/app_list_config.h index 62e175e..18f67162 100644 --- a/ash/public/cpp/app_list/app_list_config.h +++ b/ash/public/cpp/app_list/app_list_config.h
@@ -234,6 +234,7 @@ // Current config scale values - should be different from 1 for // AppListConfigType::kShared only. + // TODO(crbug.com/1374423): Revisit to see if scale_y_ is still needed. const float scale_x_; const float scale_y_;
diff --git a/ash/public/cpp/app_list/app_list_config_provider.cc b/ash/public/cpp/app_list/app_list_config_provider.cc index 7cb2a70..504f5f422 100644 --- a/ash/public/cpp/app_list/app_list_config_provider.cc +++ b/ash/public/cpp/app_list/app_list_config_provider.cc
@@ -69,16 +69,15 @@ return result; } -std::unique_ptr<AppListConfig> -AppListConfigProvider::CreateForFullscreenAppList( +std::unique_ptr<AppListConfig> AppListConfigProvider::CreateForTabletAppList( const gfx::Size& display_work_area_size, - int grid_rows, int grid_columns, const gfx::Size& available_size, const AppListConfig* current_config) { const AppListConfig& base_config = GetBaseConfigForDisplaySize(display_work_area_size); + // TODO(crbug.com/1374423): Clean up scale_y below. float scale_x = 1; float scale_y = 1; float inner_tile_scale_y = 1; @@ -88,30 +87,6 @@ const int min_grid_width = grid_columns * base_config.grid_tile_width(); - // `scale_y` does not change when productivity launcher is enabled. Instead, - // the number of rows will be reduced to fit the grid vertically. - if (!features::IsProductivityLauncherEnabled()) { - const int min_grid_height = grid_rows * base_config.grid_tile_height(); - if (available_size.height() < min_grid_height) { - scale_y = std::max( - min_config_scale, - static_cast<float>(available_size.height()) / min_grid_height); - - // Adjust scale to reflect the fact the app list item title height does - // not get scaled. The adjustment is derived from: s * x + c = S * (x + c) - // and t = x + c With: S - the target grid scale, - // x - scalable part of the tile (total title padding), - // c - constant part of the tile, - // t - tile height, and - // s - the adjusted scale. - const int total_title_padding = base_config.grid_title_bottom_padding() + - base_config.grid_title_top_padding(); - inner_tile_scale_y = (base_config.grid_tile_height() * (scale_y - 1) + - total_title_padding) / - total_title_padding; - } - } - if (available_size.width() < min_grid_width) { scale_x = std::max(min_config_scale,
diff --git a/ash/public/cpp/app_list/app_list_config_provider.h b/ash/public/cpp/app_list/app_list_config_provider.h index 6d862f2..44b5a47 100644 --- a/ash/public/cpp/app_list/app_list_config_provider.h +++ b/ash/public/cpp/app_list/app_list_config_provider.h
@@ -59,15 +59,15 @@ // based on the app list display, and available size for the apps grid. // Returns nullptr if the new app list config is the same as `current_config`. // `work_area_size`: The work area size of the display showing the app list. - // `grid_rows`: The number of rows the root apps grid has. - // `grid_columns`: The number of columns the root apps grid has. + // `grid_columns`: The number of columns the root apps grid has. Note that the + // number of rows will be reduced to fit the grid vertically. + // `available_size`: The size of the space available for the root apps grid // layout. // `current_config`: If not null, the app list config currently used by the // app list. - std::unique_ptr<AppListConfig> CreateForFullscreenAppList( + std::unique_ptr<AppListConfig> CreateForTabletAppList( const gfx::Size& display_work_area_size, - int grid_rows, int grid_columns, const gfx::Size& available_size, const AppListConfig* current_config);
diff --git a/ash/public/cpp/app_list/app_list_config_provider_unittest.cc b/ash/public/cpp/app_list/app_list_config_provider_unittest.cc index 706fb7b..8f5f1ae 100644 --- a/ash/public/cpp/app_list/app_list_config_provider_unittest.cc +++ b/ash/public/cpp/app_list/app_list_config_provider_unittest.cc
@@ -19,21 +19,8 @@ namespace { -// Returns expected number of rows in the fullscreen app list apps grid -// depending on the display work area (when ProductivityLauncher is not -// enabled). -int GetPreferredGridRowsForWorkArea(const gfx::Size& work_area_size) { - return work_area_size.width() > work_area_size.height() ? 4 : 5; -} - -// Returns expected number of columns in the fullscreen app list apps grid -// depending on the display work area (when ProductivityLauncher is not -// enabled). -int GetPreferredGridColumnsForWorkArea(const gfx::Size& work_area_size) { - if (ash::features::IsProductivityLauncherEnabled()) - return 5; - return work_area_size.width() > work_area_size.height() ? 5 : 4; -} +// The expected number of columns in the tablet app list apps grid. +constexpr int kPreferredGridColumnsForWorkArea = 5; // Does sanity check on apps grid item tile dimensions in config. On error, it // causes test failure with additional |scoped_trace| message. @@ -230,10 +217,8 @@ << static_cast<int>(test_case.config_type)); std::unique_ptr<AppListConfig> config = - AppListConfigProvider::Get().CreateForFullscreenAppList( - test_case.work_area_size, - -1 /*row count is ignored when productivity launcher is enabled*/, - GetPreferredGridColumnsForWorkArea(test_case.work_area_size), + AppListConfigProvider::Get().CreateForTabletAppList( + test_case.work_area_size, kPreferredGridColumnsForWorkArea, test_case.available_size, nullptr); ASSERT_TRUE(config.get()); @@ -256,10 +241,8 @@ // Verify CreateForAppListWidget returns nullptr if the created config would // be the same as |config|. - EXPECT_FALSE(AppListConfigProvider::Get().CreateForFullscreenAppList( - test_case.work_area_size, - GetPreferredGridRowsForWorkArea(test_case.work_area_size), - GetPreferredGridColumnsForWorkArea(test_case.work_area_size), + EXPECT_FALSE(AppListConfigProvider::Get().CreateForTabletAppList( + test_case.work_area_size, kPreferredGridColumnsForWorkArea, test_case.available_size, config.get())); } } @@ -272,10 +255,8 @@ gfx::Size work_area(1200, 768); gfx::Size available_size(1088, 572); std::unique_ptr<AppListConfig> config = - AppListConfigProvider::Get().CreateForFullscreenAppList( - work_area, -1 /*rows not used for productivity launcher configs*/, - GetPreferredGridColumnsForWorkArea(work_area), available_size, - nullptr); + AppListConfigProvider::Get().CreateForTabletAppList( + work_area, kPreferredGridColumnsForWorkArea, available_size, nullptr); ASSERT_TRUE(config); EXPECT_EQ(AppListConfigType::kRegular, config->type()); @@ -283,18 +264,16 @@ // be the same as `config`. work_area = gfx::Size(768, 1200); available_size = gfx::Size(656, 1004); - EXPECT_FALSE(AppListConfigProvider::Get().CreateForFullscreenAppList( - work_area, -1 /*rows not used for productivity launcher configs*/, - GetPreferredGridColumnsForWorkArea(work_area), available_size, + EXPECT_FALSE(AppListConfigProvider::Get().CreateForTabletAppList( + work_area, kPreferredGridColumnsForWorkArea, available_size, config.get())); // Create different config. work_area = gfx::Size(960, 600); available_size = gfx::Size(848, 412); std::unique_ptr<AppListConfig> updated_config = - AppListConfigProvider::Get().CreateForFullscreenAppList( - work_area, GetPreferredGridRowsForWorkArea(work_area), - GetPreferredGridColumnsForWorkArea(work_area), available_size, + AppListConfigProvider::Get().CreateForTabletAppList( + work_area, kPreferredGridColumnsForWorkArea, available_size, config.get()); ASSERT_TRUE(updated_config); EXPECT_EQ(AppListConfigType::kDense, updated_config->type()); @@ -305,13 +284,9 @@ // The available grid size fits the grid - created config is not scaled. const gfx::Size work_area(1200, 768); const gfx::Size initial_available_size(1088, 572); - // Rows are not used for calculating productivity launcher configs - select a - // reasonable arbitrary value for number of rows. - const int preferred_rows = 4; - const int preferred_columns = GetPreferredGridColumnsForWorkArea(work_area); std::unique_ptr<AppListConfig> base_config = - AppListConfigProvider::Get().CreateForFullscreenAppList( - work_area, preferred_rows, preferred_columns, initial_available_size, + AppListConfigProvider::Get().CreateForTabletAppList( + work_area, kPreferredGridColumnsForWorkArea, initial_available_size, nullptr); ASSERT_TRUE(base_config.get()); @@ -319,7 +294,8 @@ ASSERT_EQ(1, base_config->scale_x()); ASSERT_EQ(1, base_config->scale_y()); - const int kMinGridWidth = base_config->grid_tile_width() * preferred_columns; + const int kMinGridWidth = + base_config->grid_tile_width() * kPreferredGridColumnsForWorkArea; { SCOPED_TRACE("Horizontal scaling"); @@ -327,8 +303,8 @@ // Reduce available width so the grid scales down horizontally. const gfx::Size available_size(480, initial_available_size.height()); std::unique_ptr<AppListConfig> config = - AppListConfigProvider::Get().CreateForFullscreenAppList( - work_area, preferred_rows, preferred_columns, available_size, + AppListConfigProvider::Get().CreateForTabletAppList( + work_area, kPreferredGridColumnsForWorkArea, available_size, nullptr); VerifyScaledConfig(*base_config, config.get(), 480.0f / kMinGridWidth, 1); } @@ -341,8 +317,8 @@ // number of visible rows in this case. const gfx::Size available_size(initial_available_size.width(), 400); std::unique_ptr<AppListConfig> config = - AppListConfigProvider::Get().CreateForFullscreenAppList( - work_area, preferred_rows, preferred_columns, available_size, + AppListConfigProvider::Get().CreateForTabletAppList( + work_area, kPreferredGridColumnsForWorkArea, available_size, nullptr); VerifyScaledConfig(*base_config, config.get(), 1, 1); } @@ -354,8 +330,8 @@ // horizontally only. const gfx::Size available_size(480, 400); std::unique_ptr<AppListConfig> config = - AppListConfigProvider::Get().CreateForFullscreenAppList( - work_area, preferred_rows, preferred_columns, available_size, + AppListConfigProvider::Get().CreateForTabletAppList( + work_area, kPreferredGridColumnsForWorkArea, available_size, nullptr); VerifyScaledConfig(*base_config, config.get(), 480.0f / kMinGridWidth, 1); } @@ -366,20 +342,17 @@ // The available grid size fits the grid - created config is not scaled. const gfx::Size work_area(960, 600); const gfx::Size initial_available_size(848, 412); - // Rows are not used for calculating productivity launcher configs - select a - // reasonable arbitrary value for number of rows. - const int preferred_rows = 4; - const int preferred_columns = GetPreferredGridColumnsForWorkArea(work_area); std::unique_ptr<AppListConfig> base_config = - AppListConfigProvider::Get().CreateForFullscreenAppList( - work_area, preferred_rows, preferred_columns, initial_available_size, + AppListConfigProvider::Get().CreateForTabletAppList( + work_area, kPreferredGridColumnsForWorkArea, initial_available_size, nullptr); ASSERT_TRUE(base_config.get()); ASSERT_EQ(AppListConfigType::kDense, base_config->type()); ASSERT_EQ(1, base_config->scale_x()); ASSERT_EQ(1, base_config->scale_y()); - const int kMinGridWidth = base_config->grid_tile_width() * preferred_columns; + const int kMinGridWidth = + base_config->grid_tile_width() * kPreferredGridColumnsForWorkArea; { SCOPED_TRACE("Horizontal scaling"); @@ -387,8 +360,8 @@ // Reduce available width so the grid scales down horizontally. const gfx::Size available_size(300, initial_available_size.height()); std::unique_ptr<AppListConfig> config = - AppListConfigProvider::Get().CreateForFullscreenAppList( - work_area, preferred_rows, preferred_columns, available_size, + AppListConfigProvider::Get().CreateForTabletAppList( + work_area, kPreferredGridColumnsForWorkArea, available_size, nullptr); VerifyScaledConfig(*base_config, config.get(), 300.0f / kMinGridWidth, 1); } @@ -401,8 +374,8 @@ // number of visible rows in this case. const gfx::Size available_size(initial_available_size.width(), 200); std::unique_ptr<AppListConfig> config = - AppListConfigProvider::Get().CreateForFullscreenAppList( - work_area, preferred_rows, preferred_columns, available_size, + AppListConfigProvider::Get().CreateForTabletAppList( + work_area, kPreferredGridColumnsForWorkArea, available_size, nullptr); VerifyScaledConfig(*base_config, config.get(), 1, 1); } @@ -414,8 +387,8 @@ // horizontally only. const gfx::Size available_size(300, 200); std::unique_ptr<AppListConfig> config = - AppListConfigProvider::Get().CreateForFullscreenAppList( - work_area, preferred_rows, preferred_columns, available_size, + AppListConfigProvider::Get().CreateForTabletAppList( + work_area, kPreferredGridColumnsForWorkArea, available_size, nullptr); VerifyScaledConfig(*base_config, config.get(), 300.0f / kMinGridWidth, 1); } @@ -426,13 +399,9 @@ // The available grid size fits the grid - created config is not scaled. const gfx::Size work_area(768, 1200); const gfx::Size initial_available_size(656, 1004); - // Rows are not used for calculating productivity launcher configs - select a - // reasonable arbitrary value for number of rows. - const int preferred_rows = 5; - const int preferred_columns = GetPreferredGridColumnsForWorkArea(work_area); std::unique_ptr<AppListConfig> base_config = - AppListConfigProvider::Get().CreateForFullscreenAppList( - work_area, preferred_rows, preferred_columns, initial_available_size, + AppListConfigProvider::Get().CreateForTabletAppList( + work_area, kPreferredGridColumnsForWorkArea, initial_available_size, nullptr); ASSERT_TRUE(base_config.get()); @@ -440,7 +409,8 @@ ASSERT_EQ(1, base_config->scale_x()); ASSERT_EQ(1, base_config->scale_y()); - const int kMinGridWidth = base_config->grid_tile_width() * preferred_columns; + const int kMinGridWidth = + base_config->grid_tile_width() * kPreferredGridColumnsForWorkArea; { SCOPED_TRACE("Horizontal scaling"); @@ -448,8 +418,8 @@ // Reduce available width so the grid scales down horizontally. const gfx::Size available_size(440, initial_available_size.height()); std::unique_ptr<AppListConfig> config = - AppListConfigProvider::Get().CreateForFullscreenAppList( - work_area, preferred_rows, preferred_columns, available_size, + AppListConfigProvider::Get().CreateForTabletAppList( + work_area, kPreferredGridColumnsForWorkArea, available_size, nullptr); VerifyScaledConfig(*base_config, config.get(), 440.0f / kMinGridWidth, 1); } @@ -462,8 +432,8 @@ // number of visible rows in this case. const gfx::Size available_size(initial_available_size.width(), 532); std::unique_ptr<AppListConfig> config = - AppListConfigProvider::Get().CreateForFullscreenAppList( - work_area, preferred_rows, preferred_columns, available_size, + AppListConfigProvider::Get().CreateForTabletAppList( + work_area, kPreferredGridColumnsForWorkArea, available_size, nullptr); VerifyScaledConfig(*base_config, config.get(), 1, 1); } @@ -475,8 +445,8 @@ // horizontally only. const gfx::Size available_size(440, 532); std::unique_ptr<AppListConfig> config = - AppListConfigProvider::Get().CreateForFullscreenAppList( - work_area, preferred_rows, preferred_columns, available_size, + AppListConfigProvider::Get().CreateForTabletAppList( + work_area, kPreferredGridColumnsForWorkArea, available_size, nullptr); VerifyScaledConfig(*base_config, config.get(), 440.0f / kMinGridWidth, 1); } @@ -487,13 +457,9 @@ // The available grid size fits the grid - created config is not scaled. const gfx::Size work_area(600, 960); const gfx::Size initial_available_size(488, 764); - // Rows are not used for calculating productivity launcher configs - select a - // reasonable arbitrary value for number of rows. - const int preferred_rows = 5; - const int preferred_columns = GetPreferredGridColumnsForWorkArea(work_area); std::unique_ptr<AppListConfig> base_config = - AppListConfigProvider::Get().CreateForFullscreenAppList( - work_area, preferred_rows, preferred_columns, initial_available_size, + AppListConfigProvider::Get().CreateForTabletAppList( + work_area, kPreferredGridColumnsForWorkArea, initial_available_size, nullptr); ASSERT_TRUE(base_config.get()); @@ -501,7 +467,8 @@ ASSERT_EQ(1, base_config->scale_x()); ASSERT_EQ(1, base_config->scale_y()); - const int kMinGridWidth = base_config->grid_tile_width() * preferred_columns; + const int kMinGridWidth = + base_config->grid_tile_width() * kPreferredGridColumnsForWorkArea; { SCOPED_TRACE("Horizontal scaling"); @@ -509,8 +476,8 @@ // Reduce available width so the grid scales down horizontally. const gfx::Size available_size(300, initial_available_size.height()); std::unique_ptr<AppListConfig> config = - AppListConfigProvider::Get().CreateForFullscreenAppList( - work_area, preferred_rows, preferred_columns, available_size, + AppListConfigProvider::Get().CreateForTabletAppList( + work_area, kPreferredGridColumnsForWorkArea, available_size, nullptr); VerifyScaledConfig(*base_config, config.get(), 300.0f / kMinGridWidth, 1); } @@ -523,8 +490,8 @@ // number of visible rows in this case. const gfx::Size available_size(initial_available_size.width(), 360); std::unique_ptr<AppListConfig> config = - AppListConfigProvider::Get().CreateForFullscreenAppList( - work_area, preferred_rows, preferred_columns, available_size, + AppListConfigProvider::Get().CreateForTabletAppList( + work_area, kPreferredGridColumnsForWorkArea, available_size, nullptr); VerifyScaledConfig(*base_config, config.get(), 1, 1); } @@ -536,8 +503,8 @@ // horizontally only. const gfx::Size available_size(300, 320); std::unique_ptr<AppListConfig> config = - AppListConfigProvider::Get().CreateForFullscreenAppList( - work_area, preferred_rows, preferred_columns, available_size, + AppListConfigProvider::Get().CreateForTabletAppList( + work_area, kPreferredGridColumnsForWorkArea, available_size, nullptr); VerifyScaledConfig(*base_config, config.get(), 300.0f / kMinGridWidth, 1); }
diff --git a/ash/webui/diagnostics_ui/resources/touchscreen_tester.ts b/ash/webui/diagnostics_ui/resources/touchscreen_tester.ts index 3687e5c5..6a2e3ce 100644 --- a/ash/webui/diagnostics_ui/resources/touchscreen_tester.ts +++ b/ash/webui/diagnostics_ui/resources/touchscreen_tester.ts
@@ -17,7 +17,19 @@ // Rather than looking for the correct display and find their size // from backend, we take a simpler approach to set it as a very large // number. The number is based on largest known supported resolution. -const SCREEN_MAX_LENGTH = 9999; +export const SCREEN_MAX_LENGTH = 9999; + +// The dialog type enum, including intro-dialog and canvas-dialog. +export enum DialogType { + INTRO = 'intro-dialog', + CANVAS = 'canvas-dialog', +} + +// The x and y coordinates to describe the touch location. +interface Point { + x: number; + y: number; +} const TouchscreenTesterElementBase = I18nMixin(PolymerElement); @@ -33,6 +45,25 @@ // Drawing provider. private drawingProvider: CanvasDrawingProvider; + // A map that stores all the touches. + // The key is the identifier of the touch. Value is the x and y coordinates + // of the touch point. + private touches: Map<number, Point> = new Map<number, Point>(); + + /** + * For testing only. + */ + getDrawingProvider(): CanvasDrawingProvider { + return this.drawingProvider; + } + + /** + * For testing only. + */ + getTouches(): Map<number, Point> { + return this.touches; + } + getDialog(dialogId: string): CrDialogElement { const dialog = this.shadowRoot!.getElementById(dialogId); assert(dialog); @@ -43,7 +74,7 @@ * Shows the tester's dialog. */ async showTester(): Promise<void> { - const introDialog = this.getDialog('intro-dialog'); + const introDialog = this.getDialog(DialogType.INTRO); await introDialog.requestFullscreen(); introDialog.showModal(); @@ -60,8 +91,8 @@ this.shadowRoot!.addEventListener('fullscreenchange', (e: Event) => { e.preventDefault(); if (!document.fullscreenElement) { - this.getDialog('intro-dialog').close(); - this.getDialog('canvas-dialog').close(); + this.getDialog(DialogType.INTRO).close(); + this.getDialog(DialogType.CANVAS).close(); } }); } @@ -70,8 +101,8 @@ * Handle when get start button is clicked. */ private onStartClick(): void { - this.getDialog('intro-dialog').close(); - this.getDialog('canvas-dialog').showModal(); + this.getDialog(DialogType.INTRO).close(); + this.getDialog(DialogType.CANVAS).showModal(); this.setupCanvas(); } @@ -90,7 +121,7 @@ // CSS in .html file does not have access to this element, // therefore adjust it here to make the canvas cover the whole screen. const topContainer = - this.getDialog('canvas-dialog')!.shadowRoot!.querySelector( + this.getDialog(DialogType.CANVAS)!.shadowRoot!.querySelector( '.top-container') as HTMLElement; topContainer!.style.display = 'none'; @@ -98,6 +129,20 @@ assert(ctx); this.drawingProvider = new CanvasDrawingProvider(ctx); } + + /** + * Handle when a 'touchstart' event is fired from Touch API, or a new touch + * starts from evdev. + * @param touchId The identifier of a touch. + * @param touchPt The coordinates of a touch point. + * @param pressure The pressure of a touch. + */ + onDrawStart(touchId: number, touchPt: Point, pressure: number): void { + this.touches.set(touchId, touchPt); + this.drawingProvider.drawTrailMark(touchPt.x, touchPt.y); + this.drawingProvider.drawTrail( + touchPt.x - 1, touchPt.y, touchPt.x, touchPt.y, pressure); + } } declare global {
diff --git a/ash/webui/shortcut_customization_ui/backend/accelerator_configuration_provider.cc b/ash/webui/shortcut_customization_ui/backend/accelerator_configuration_provider.cc index 4a48460..2dd75b3 100644 --- a/ash/webui/shortcut_customization_ui/backend/accelerator_configuration_provider.cc +++ b/ash/webui/shortcut_customization_ui/backend/accelerator_configuration_provider.cc
@@ -87,6 +87,7 @@ mojo::PendingReceiver< shortcut_customization::mojom::AcceleratorConfigurationProvider> receiver) { + receiver_.reset(); receiver_.Bind(std::move(receiver)); }
diff --git a/ash/webui/shortcut_customization_ui/backend/accelerator_configuration_provider_unittest.cc b/ash/webui/shortcut_customization_ui/backend/accelerator_configuration_provider_unittest.cc index 3adf0f33..47d0421 100644 --- a/ash/webui/shortcut_customization_ui/backend/accelerator_configuration_provider_unittest.cc +++ b/ash/webui/shortcut_customization_ui/backend/accelerator_configuration_provider_unittest.cc
@@ -124,6 +124,18 @@ std::unique_ptr<AcceleratorConfigurationProvider> provider_; }; +TEST_F(AcceleratorConfigurationProviderTest, ResetReceiverOnBindInterface) { + mojo::Remote<shortcut_customization::mojom::AcceleratorConfigurationProvider> + remote; + provider_->BindInterface(remote.BindNewPipeAndPassReceiver()); + base::RunLoop().RunUntilIdle(); + + remote.reset(); + + provider_->BindInterface(remote.BindNewPipeAndPassReceiver()); + base::RunLoop().RunUntilIdle(); +} + TEST_F(AcceleratorConfigurationProviderTest, BrowserIsMutable) { // Verify that requesting IsMutable state for Browser accelerators returns // false.
diff --git a/ash/wm/desks/desk_name_view.cc b/ash/wm/desks/desk_name_view.cc index 41757359..dc6b2e8 100644 --- a/ash/wm/desks/desk_name_view.cc +++ b/ash/wm/desks/desk_name_view.cc
@@ -6,11 +6,14 @@ #include <memory> +#include "ash/accessibility/accessibility_controller_impl.h" #include "ash/shell.h" +#include "ash/strings/grit/ash_strings.h" #include "ash/wm/desks/desk_mini_view.h" #include "ash/wm/desks/desks_bar_view.h" #include "ash/wm/overview/overview_controller.h" #include "ash/wm/overview/overview_grid.h" +#include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/gfx/text_elider.h" #include "ui/views/focus/focus_manager.h" @@ -63,6 +66,16 @@ } void DeskNameView::OnViewHighlighted() { + if (!HasFocus()) { + // When the highlight is the result of tabbing, as opposed to clicking or + // chromevoxing, the name view will not have focus, so the user should be + // told how to focus and edit the field. + Shell::Get() + ->accessibility_controller() + ->TriggerAccessibilityAlertWithMessage(l10n_util::GetStringUTF8( + IDS_ASH_DESKS_NAME_HIGHLIGHT_NOTIFICATION)); + } + DesksTextfield::OnViewHighlighted(); mini_view_->owner_bar()->ScrollToShowMiniViewIfNecessary(mini_view_); }
diff --git a/base/debug/stack_trace_fuchsia.cc b/base/debug/stack_trace_fuchsia.cc index 0491efd..1c55e93 100644 --- a/base/debug/stack_trace_fuchsia.cc +++ b/base/debug/stack_trace_fuchsia.cc
@@ -201,6 +201,22 @@ valid_ = true; } +// Returns true if |address| is contained by any of the memory regions +// mapped for |module_entry|. +bool ModuleContainsFrameAddress(void* address, + const SymbolMap::Module& module_entry) { + for (size_t i = 0; i < module_entry.segment_count; ++i) { + const SymbolMap::Segment& segment = module_entry.segments[i]; + const void* segment_end = reinterpret_cast<const void*>( + reinterpret_cast<const char*>(segment.addr) + segment.size - 1); + + if (address >= segment.addr && address <= segment_end) { + return true; + } + } + return false; +} + } // namespace // static @@ -231,12 +247,22 @@ SymbolMap map; int module_id = 0; - for (const SymbolMap::Module& entry : map.GetModules()) { - *os << "{{{module:" << module_id << ":" << entry.name - << ":elf:" << entry.build_id << "}}}\n"; + for (const SymbolMap::Module& module_entry : map.GetModules()) { + // Don't emit information on modules that aren't useful for the actual + // stack trace, so as to reduce the load on the symbolizer and syslog. + bool should_emit_module = false; + for (size_t i = 0; i < count_ && !should_emit_module; ++i) { + should_emit_module = ModuleContainsFrameAddress(trace_[i], module_entry); + } + if (!should_emit_module) { + continue; + } - for (size_t i = 0; i < entry.segment_count; ++i) { - const SymbolMap::Segment& segment = entry.segments[i]; + *os << "{{{module:" << module_id << ":" << module_entry.name + << ":elf:" << module_entry.build_id << "}}}\n"; + + for (size_t i = 0; i < module_entry.segment_count; ++i) { + const SymbolMap::Segment& segment = module_entry.segments[i]; char permission_string[4] = {}; *os << "{{{mmap:" << segment.addr << ":0x" << std::hex << segment.size
diff --git a/build/android/gyp/assert_static_initializers.py b/build/android/gyp/assert_static_initializers.py index 4d4e3f3..3d036b48 100755 --- a/build/android/gyp/assert_static_initializers.py +++ b/build/android/gyp/assert_static_initializers.py
@@ -156,9 +156,6 @@ _AnalyzeStaticInitializers(args.apk_or_aab, args.tool_prefix, True, '.', ignored_libs, no_initializers_libs) print() - print('If the above list is not useful, consider listing them with:') - print(' //tools/binary_size/diagnose_bloat.py') - print() print('For more information:') print(' https://chromium.googlesource.com/chromium/src/+/main/docs/' 'static_initializers.md')
diff --git a/build/android/pylib/results/presentation/test_results_presentation.py b/build/android/pylib/results/presentation/test_results_presentation.py index 93d51482..e2648fa0e 100755 --- a/build/android/pylib/results/presentation/test_results_presentation.py +++ b/build/android/pylib/results/presentation/test_results_presentation.py
@@ -108,18 +108,21 @@ } -def flakiness_dashbord_link(test_name, suite_name): - url_args = urlencode([('testType', suite_name), ('tests', test_name)]) - return ('https://test-results.appspot.com/' - 'dashboards/flakiness_dashboard.html#%s' % url_args) +def flakiness_dashbord_link(test_name, suite_name, bucket): + # Assume the bucket will be like "foo-bar-baz", we will take "foo" + # as the test_project. + test_project = bucket.split('-')[0] + query = '%s/%s' % (suite_name, test_name) + url_args = urlencode([('t', 'TESTS'), ('q', query), ('tp', test_project)]) + return 'https://ci.chromium.org/ui/search?%s' % url_args -def logs_cell(result, test_name, suite_name): +def logs_cell(result, test_name, suite_name, bucket): """Formats result logs data for processing in jinja template.""" link_list = [] result_link_dict = result.get('links', {}) result_link_dict['flakiness'] = flakiness_dashbord_link( - test_name, suite_name) + test_name, suite_name, bucket) for name, href in sorted(result_link_dict.items()): link_list.append(link( data=name, @@ -146,7 +149,7 @@ return status -def create_test_table(results_dict, cs_base_url, suite_name): +def create_test_table(results_dict, cs_base_url, suite_name, bucket): """Format test data for injecting into HTML table.""" header_row = [ @@ -179,7 +182,8 @@ html_class=('center %s' % status_class(result['status']))), cell(data=result['elapsed_time_ms']), # elapsed_time_ms - logs_cell(result, test_name, suite_name), # logs + logs_cell(result, test_name, suite_name, bucket), + # logs pre_cell(data=result['output_snippet'], # output_snippet html_class='left'), ]) @@ -288,7 +292,7 @@ just a local file. """ test_rows_header, test_rows = create_test_table( - results_dict, cs_base_url, test_name) + results_dict, cs_base_url, test_name, bucket) suite_rows_header, suite_rows, suite_row_footer = create_suite_table( results_dict)
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 177a8d4..f646f74 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn
@@ -738,7 +738,7 @@ ldflags += [ "-Wl,--no-rosegment" ] } - # TODO(crbug.com/1374347): Cleanup undefined symbol errors caught by + # TODO(crbug.com/1374347): Cleanup undefined symbol errors caught by # --no-undefined-version. if (use_lld && !is_win && !is_mac && !is_ios) { ldflags += [ "-Wl,--undefined-version" ] @@ -946,10 +946,6 @@ cflags += [ "--target=aarch64-linux-gnu" ] ldflags += [ "--target=aarch64-linux-gnu" ] } - if (is_android) { - # Outline atomics crash on Exynos 9810. http://crbug.com/1272795 - cflags += [ "-mno-outline-atomics" ] - } } else if (current_cpu == "mipsel" && !is_nacl) { ldflags += [ "-Wl,--hash-style=sysv" ] if (custom_toolchain == "") {
diff --git a/build/config/fuchsia/test/README.md b/build/config/fuchsia/test/README.md index 000a096a..009cc2d 100644 --- a/build/config/fuchsia/test/README.md +++ b/build/config/fuchsia/test/README.md
@@ -28,7 +28,7 @@ Required by tests that execute JavaScript. Should only be required in a small number of tests. -#### minimum_capabilites.test-cmx and minimum.shard.test-cml +#### minimum.shard.test-cml Capabilities required by anything that uses `//base/test`, used as the base fragment for all test suites. @@ -36,10 +36,6 @@ ICU timezone data to these tests when they are being run. A more general approach is discussed in https://fxbug.dev/85845. -#### read_debug_data.test-cmx -Required by tests that need access to its debug directory. Should only be -required in a small number of tests. - #### logger.shard.test-cml For tests that test logging functionality by providing `fuchsia.logger.Log`. @@ -65,27 +61,20 @@ For tests that need access to network services, including those that access a local HTTP server. -#### network_capabilities.test-cmx +#### network.shard.test-cml Corresponds to the `NETWORK` flag. Required for enabling network access. Note that access to the root SSL certificates is not needed if ContextProvider is used to launch the `Context`. The `fuchsia.device.NameProvider` dependency comes -from fdio. The injected `netstack.cmx` requires `fuchsia.stash.SecureStore`. +from fdio. #### present_view.shard.test-cml Services that are needed to render web content in a Scenic view and present it. Most services are required per the FIDL documentation. -#### vulkan_capabilities.test-cmx -Corresponds to the `VULKAN` flag. Required for enabling GPU-accelerated -rendering of the web content. - -CFv2 tests should use -`//third_party/fuchsia-sdk/sdk/pkg/vulkan/client.shard.cml`. - -#### web_instance.shard.test-cml and web_engine_required_capabilities.test-cmx +#### web_instance.shard.test-cml Contains services that need to be present when creating a `fuchsia.web.Context`. Note that the `fuchsia.scheduler.ProfileProvider` service is only used in tests that encounter memory pressure code. -#### web_instance_host_capabilities.test-cmx and web_instance_host.shard.test-cml +#### web_instance_host.shard.test-cml Contains services that need to be present to use `WebInstanceHost`.
diff --git a/build/config/fuchsia/test/audio_capabilities.test-cmx b/build/config/fuchsia/test/audio_capabilities.test-cmx deleted file mode 100644 index baa9bc2..0000000 --- a/build/config/fuchsia/test/audio_capabilities.test-cmx +++ /dev/null
@@ -1,20 +0,0 @@ -{ - "facets": { - "fuchsia.test": { - "injected-services": { - "fuchsia.mediacodec.CodecFactory": "fuchsia-pkg://fuchsia.com/codec_factory#meta/codec_factory.cmx" - }, - "system-services": [ - "fuchsia.media.Audio", - "fuchsia.media.AudioDeviceEnumerator" - ] - } - }, - "sandbox": { - "services": [ - "fuchsia.media.Audio", - "fuchsia.media.AudioDeviceEnumerator", - "fuchsia.mediacodec.CodecFactory" - ] - } -}
diff --git a/build/config/fuchsia/test/minimum_capabilities.test-cmx b/build/config/fuchsia/test/minimum_capabilities.test-cmx deleted file mode 100644 index ed903be..0000000 --- a/build/config/fuchsia/test/minimum_capabilities.test-cmx +++ /dev/null
@@ -1,37 +0,0 @@ -{ - "facets": { - "fuchsia.test": { - "injected-services": { - "fuchsia.buildinfo.Provider": "fuchsia-pkg://fuchsia.com/build-info-service#meta/build-info.cmx", - "fuchsia.factory.MiscFactoryStoreProvider": [ - "fuchsia-pkg://fuchsia.com/fake_factory_store_providers#meta/misc.cmx", - "--config=/config/data/fuchsia.factory.MiscFactoryStoreProvider.config" - ], - "fuchsia.hwinfo.Product": "fuchsia-pkg://fuchsia.com/hwinfo#meta/hwinfo.cmx", - "fuchsia.intl.PropertyProvider": "fuchsia-pkg://fuchsia.com/intl_property_manager#meta/intl_property_manager_v1.cmx" - }, - "system-services": [ - "fuchsia.boot.ReadOnlyLog", - "fuchsia.media.ProfileProvider" - ] - } - }, - "sandbox": { - "features": [ - "isolated-persistent-storage", - "isolated-temp", - "config-data" - ], - "services": [ - "fuchsia.buildinfo.Provider", - "fuchsia.factory.MiscFactoryStoreProvider", - "fuchsia.hwinfo.Product", - "fuchsia.intl.PropertyProvider", - "fuchsia.logger.LogSink", - "fuchsia.media.ProfileProvider", - "fuchsia.process.Launcher", - "fuchsia.sys.Launcher", - "fuchsia.sys.Loader" - ] - } -}
diff --git a/build/config/fuchsia/test/network_capabilities.test-cmx b/build/config/fuchsia/test/network_capabilities.test-cmx deleted file mode 100644 index 7b40c358..0000000 --- a/build/config/fuchsia/test/network_capabilities.test-cmx +++ /dev/null
@@ -1,26 +0,0 @@ -{ - "facets": { - "fuchsia.test": { - "injected-services": { - "fuchsia.net.interfaces.State": "fuchsia-pkg://fuchsia.com/network-legacy-deprecated#meta/netstack.cmx", - "fuchsia.net.name.Lookup": "fuchsia-pkg://fuchsia.com/network-legacy-deprecated#meta/dns-resolver.cmx", - "fuchsia.posix.socket.Provider": "fuchsia-pkg://fuchsia.com/network-legacy-deprecated#meta/netstack.cmx", - "fuchsia.stash.SecureStore": "fuchsia-pkg://fuchsia.com/stash#meta/stash_secure.cmx" - }, - "system-services": [ - "fuchsia.device.NameProvider" - ] - } - }, - "sandbox": { - "features": [ - "root-ssl-certificates" - ], - "services": [ - "fuchsia.device.NameProvider", - "fuchsia.net.name.Lookup", - "fuchsia.net.interfaces.State", - "fuchsia.posix.socket.Provider" - ] - } -}
diff --git a/build/config/fuchsia/test/read_debug_data.test-cmx b/build/config/fuchsia/test/read_debug_data.test-cmx deleted file mode 100644 index b0c95b0..0000000 --- a/build/config/fuchsia/test/read_debug_data.test-cmx +++ /dev/null
@@ -1,7 +0,0 @@ -{ - "sandbox": { - "features": [ - "hub" - ] - } -} \ No newline at end of file
diff --git a/build/config/fuchsia/test/vulkan_capabilities.test-cmx b/build/config/fuchsia/test/vulkan_capabilities.test-cmx deleted file mode 100644 index 0436ffd..0000000 --- a/build/config/fuchsia/test/vulkan_capabilities.test-cmx +++ /dev/null
@@ -1,19 +0,0 @@ -{ - "facets": { - "fuchsia.test": { - "system-services": [ - "fuchsia.sysmem.Allocator", - "fuchsia.vulkan.loader.Loader" - ] - } - }, - "sandbox": { - "features": [ - "vulkan" - ], - "services": [ - "fuchsia.sysmem.Allocator", - "fuchsia.vulkan.loader.Loader" - ] - } -} \ No newline at end of file
diff --git a/build/config/fuchsia/test/web_engine_required_capabilities.test-cmx b/build/config/fuchsia/test/web_engine_required_capabilities.test-cmx deleted file mode 100644 index 5f56800..0000000 --- a/build/config/fuchsia/test/web_engine_required_capabilities.test-cmx +++ /dev/null
@@ -1,28 +0,0 @@ -{ - "facets": { - "fuchsia.test": { - "injected-services": { - "fuchsia.fonts.Provider": "fuchsia-pkg://fuchsia.com/fonts#meta/fonts.cmx", - "fuchsia.hardware.display.Provider": "fuchsia-pkg://fuchsia.com/fake-hardware-display-controller-provider#meta/hdcp.cmx", - "fuchsia.memorypressure.Provider": "fuchsia-pkg://fuchsia.com/memory_monitor#meta/memory_monitor.cmx", - "fuchsia.ui.scenic.Scenic": "fuchsia-pkg://fuchsia.com/scenic#meta/scenic.cmx", - "fuchsia.web.ContextProvider": "fuchsia-pkg://fuchsia.com/web_engine#meta/context_provider.cmx", - }, - "system-services": [ - "fuchsia.device.NameProvider", - "fuchsia.scheduler.ProfileProvider", - "fuchsia.sysmem.Allocator", - ] - } - }, - "sandbox": { - "services": [ - "fuchsia.device.NameProvider", - "fuchsia.fonts.Provider", - "fuchsia.memorypressure.Provider", - "fuchsia.sysmem.Allocator", - "fuchsia.web.ContextProvider", - "fuchsia.ui.scenic.Scenic" - ] - } -}
diff --git a/build/config/fuchsia/test/web_instance_host_capabilities.test-cmx b/build/config/fuchsia/test/web_instance_host_capabilities.test-cmx deleted file mode 100644 index 762916ba..0000000 --- a/build/config/fuchsia/test/web_instance_host_capabilities.test-cmx +++ /dev/null
@@ -1,8 +0,0 @@ -{ - "sandbox": { - "services": [ - "fuchsia.sys.Environment", - "fuchsia.sys.Loader" - ] - } -} \ No newline at end of file
diff --git a/build/fuchsia/linux_internal.sdk.sha1 b/build/fuchsia/linux_internal.sdk.sha1 index e04d521..d43610a 100644 --- a/build/fuchsia/linux_internal.sdk.sha1 +++ b/build/fuchsia/linux_internal.sdk.sha1
@@ -1 +1 @@ -10.20221014.1.1 +10.20221013.0.1
diff --git a/build/fuchsia/run_test_package.py b/build/fuchsia/run_test_package.py index 0eb86ea..426c0bfd 100644 --- a/build/fuchsia/run_test_package.py +++ b/build/fuchsia/run_test_package.py
@@ -184,6 +184,7 @@ Returns the exit code of the remote package process.""" + assert not args.code_coverage or ffx_session kernel_logger = _AttachKernelLogReader(target) try: # Spin up a thread to asynchronously dump the system log to stdout @@ -211,15 +212,6 @@ if ffx_session: process = ffx_session.test_run(target.GetFfxTarget(), component_uri, package_args) - elif args.code_coverage: - # TODO(crbug.com/1156768): Deprecate runtests. - # runtests requires specifying an output directory and a double dash - # before the argument list. - command = ['runtests', '-o', '/tmp', component_uri] - if args.test_realm_label: - command += ['--realm-label', args.test_realm_label] - command += ['--'] - command.extend(package_args) elif args.use_run_test_component: command = ['run-test-component'] if args.test_realm_label:
diff --git a/build/fuchsia/test_runner.py b/build/fuchsia/test_runner.py index e1e7dec..e0ddd32 100755 --- a/build/fuchsia/test_runner.py +++ b/build/fuchsia/test_runner.py
@@ -256,21 +256,12 @@ if not args.out_dir: raise ValueError("out-dir must be specified.") + if args.code_coverage and args.component_version != "2": + parser.error('--code-coverage requires --component-version=2') + if args.component_version == "2": args.use_run_test_component = False - if (args.code_coverage and args.component_version != "2" - and not args.use_run_test_component): - if args.enable_test_server: - # TODO(1254563): Tests that need access to the test server cannot be run - # as test component under CFv1. Because code coverage requires it, force - # the test to run as a test component. It is expected that test that tries - # to use the external test server will fail. - args.use_run_test_component = True - else: - raise ValueError('Collecting code coverage info requires using ' - 'run-test-component.') - ConfigureLogging(args) child_args = []
diff --git a/build/lacros/test_runner.py b/build/lacros/test_runner.py index 6e1ce457..f053102 100755 --- a/build/lacros/test_runner.py +++ b/build/lacros/test_runner.py
@@ -375,6 +375,35 @@ return '--test-launcher-bot-mode' in forward_args +def _KillNicely(proc, timeout_secs=0.5): + """Kills a subprocess nicely. + + Args: + proc: The subprocess to kill. + timeout_secs: The timeout to wait in seconds. + """ + if proc and proc.poll() is None: + proc.terminate() + try: + proc.wait(timeout_secs) + except subprocess.TimeoutExpired: + proc.kill() + proc.wait() + + +def _ClearDir(dirpath): + """Deletes everything within the directory. + + Args: + dirpath: The path of the directory. + """ + for e in os.scandir(dirpath): + if e.is_dir(): + shutil.rmtree(e.path) + elif e.is_file(): + os.remove(e.path) + + def _RunTestWithAshChrome(args, forward_args): """Runs tests with ash-chrome. @@ -501,8 +530,11 @@ logging.warning('Are you using test_ash_chrome?') logging.warning('Printing the output of "ps aux" for debugging:') subprocess.call(['ps', 'aux']) - if ash_process and ash_process.poll() is None: - ash_process.kill() + _KillNicely(ash_process) + + # Clean up for retry. + _ClearDir(tmp_xdg_dir_name) + _ClearDir(tmp_ash_data_dir_name) if not ash_process_has_started: raise RuntimeError('Timed out waiting for ash-chrome to start') @@ -519,11 +551,7 @@ return test_process.wait() finally: - if ash_process and ash_process.poll() is None: - ash_process.terminate() - # Allow process to do cleanup and exit gracefully before killing. - time.sleep(0.5) - ash_process.kill() + _KillNicely(ash_process) shutil.rmtree(tmp_xdg_dir_name, ignore_errors=True) shutil.rmtree(tmp_ash_data_dir_name, ignore_errors=True) @@ -540,10 +568,7 @@ p = subprocess.Popen([args.command] + forward_args) return p.wait() finally: - if p and p.poll() is None: - p.terminate() - time.sleep(0.5) - p.kill() + _KillNicely(p) def _HandleSignal(sig, _):
diff --git a/build/util/lib/results/result_sink.py b/build/util/lib/results/result_sink.py index f062ce4..003fa39 100644 --- a/build/util/lib/results/result_sink.py +++ b/build/util/lib/results/result_sink.py
@@ -53,11 +53,23 @@ self.test_results_url = base_url + '/ReportTestResults' self.report_artifacts_url = base_url + '/ReportInvocationLevelArtifacts' - self.headers = { + headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'ResultSink %s' % context['auth_token'], } + self.session = requests.Session() + self.session.headers.update(headers) + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + self.close() + + def close(self): + """Closes the session backing the sink.""" + self.session.close() def Post(self, test_id, @@ -142,9 +154,8 @@ 'repo': 'https://chromium.googlesource.com/chromium/src', } - res = requests.post(url=self.test_results_url, - headers=self.headers, - data=json.dumps({'testResults': [tr]})) + res = self.session.post(url=self.test_results_url, + data=json.dumps({'testResults': [tr]})) res.raise_for_status() def ReportInvocationLevelArtifacts(self, artifacts): @@ -157,9 +168,7 @@ artifacts: A dict of artifacts to attach to the invocation. """ req = {'artifacts': artifacts} - res = requests.post(url=self.report_artifacts_url, - headers=self.headers, - data=json.dumps(req)) + res = self.session.post(url=self.report_artifacts_url, data=json.dumps(req)) res.raise_for_status()
diff --git a/build/util/lib/results/result_sink_test.py b/build/util/lib/results/result_sink_test.py index 9dc35ea..c6dd8209 100755 --- a/build/util/lib/results/result_sink_test.py +++ b/build/util/lib/results/result_sink_test.py
@@ -21,6 +21,11 @@ from lib.results import result_sink from lib.results import result_types +_FAKE_CONTEXT = { + 'address': 'some-ip-address', + 'auth_token': 'some-auth-token', +} + class InitClientTest(unittest.TestCase): @mock.patch.dict(os.environ, {}, clear=True) @@ -32,10 +37,7 @@ @mock.patch.dict(os.environ, {'LUCI_CONTEXT': 'some-file.json'}) def testBasicClient(self): luci_context_json = { - 'result_sink': { - 'address': 'some-ip-address', - 'auth_token': 'some-auth-token', - }, + 'result_sink': _FAKE_CONTEXT, } if six.PY2: open_builtin_path = '__builtin__.open' @@ -47,19 +49,35 @@ self.assertEqual( client.test_results_url, 'http://some-ip-address/prpc/luci.resultsink.v1.Sink/ReportTestResults') - self.assertEqual(client.headers['Authorization'], + self.assertEqual(client.session.headers['Authorization'], 'ResultSink some-auth-token') + @mock.patch('requests.Session') + def testReuseSession(self, mock_session): + client = result_sink.ResultSinkClient(_FAKE_CONTEXT) + client.Post('some-test', result_types.PASS, 0, 'some-test-log', None) + client.Post('some-test', result_types.PASS, 0, 'some-test-log', None) + self.assertEqual(mock_session.call_count, 1) + self.assertEqual(client.session.post.call_count, 2) + + @mock.patch('requests.Session.close') + def testCloseClient(self, mock_close): + client = result_sink.ResultSinkClient(_FAKE_CONTEXT) + client.close() + mock_close.assert_called_once() + + @mock.patch('requests.Session.close') + def testClientAsContextManager(self, mock_close): + with result_sink.ResultSinkClient(_FAKE_CONTEXT) as client: + mock_close.assert_not_called() + mock_close.assert_called_once() + class ClientTest(unittest.TestCase): def setUp(self): - context = { - 'address': 'some-ip-address', - 'auth_token': 'some-auth-token', - } - self.client = result_sink.ResultSinkClient(context) + self.client = result_sink.ResultSinkClient(_FAKE_CONTEXT) - @mock.patch('requests.post') + @mock.patch('requests.Session.post') def testPostPassingTest(self, mock_post): self.client.Post('some-test', result_types.PASS, 0, 'some-test-log', None) self.assertEqual( @@ -69,7 +87,7 @@ self.assertEqual(data['testResults'][0]['testId'], 'some-test') self.assertEqual(data['testResults'][0]['status'], 'PASS') - @mock.patch('requests.post') + @mock.patch('requests.Session.post') def testPostFailingTest(self, mock_post): self.client.Post('some-test', result_types.FAIL, @@ -85,7 +103,7 @@ data['testResults'][0]['failureReason']['primaryErrorMessage'], 'omg test failure') - @mock.patch('requests.post') + @mock.patch('requests.Session.post') def testPostWithTestFile(self, mock_post): self.client.Post('some-test', result_types.PASS, 0, 'some-test-log', '//some/test.cc')
diff --git a/buildtools/deps_revisions.gni b/buildtools/deps_revisions.gni index a2547f3..697a60b9 100644 --- a/buildtools/deps_revisions.gni +++ b/buildtools/deps_revisions.gni
@@ -5,5 +5,5 @@ declare_args() { # Used to cause full rebuilds on libc++ rolls. This should be kept in sync # with the libcxx_revision vars in //DEPS. - libcxx_revision = "de4575635003f3af708e1ae3cb05c0b219aa58b4" + libcxx_revision = "e6caea47f873bd039e10e3e178112225a0d959fa" }
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn index 58879be..a0403be 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn
@@ -1847,6 +1847,29 @@ } if (is_chromeos_lacros && is_official_build) { + # This target is responsible for stripping symbols out of lacros files. + # Adding/removing targets here, you also need a corresponding change + # in src-internal for the release builder. + group("strip_lacros_files") { + deps = [ + ":strip_chrome_binary", + ":strip_chrome_crashpad_handler", + ":strip_libegl_so", + ":strip_libglesv2_so", + ] + if (target_cpu == "x64") { + deps += [ ":strip_nacl_helper" ] + } else if (target_cpu == "arm") { + deps += [ + ":strip_nacl_helper", + ":strip_nacl_helper_bootstrap", + ] + } else { + assert(target_cpu == "arm64") + #TODO(crbug.com/1365963): Add nacl. + } + } + # This will strip chrome binary and produce chrome.debug with symbols. strip_binary("strip_chrome_binary") { binary_input = "$root_out_dir/chrome" @@ -1854,4 +1877,38 @@ stripped_binary_output = "$root_out_dir/chrome.stripped" deps = [ ":chrome" ] } + strip_binary("strip_chrome_crashpad_handler") { + binary_input = "$root_out_dir/chrome_crashpad_handler" + symbol_output = "$root_out_dir/chrome_crashpad_handler.debug" + stripped_binary_output = "$root_out_dir/chrome_crashpad_handler.stripped" + deps = [ "//components/crash/core/app:chrome_crashpad_handler" ] + } + strip_binary("strip_libegl_so") { + binary_input = "$root_out_dir/libEGL.so" + symbol_output = "$root_out_dir/libEGL.so.debug" + stripped_binary_output = "$root_out_dir/libEGL.so.stripped" + deps = [ "//third_party/angle:libEGL" ] + } + strip_binary("strip_libglesv2_so") { + binary_input = "$root_out_dir/libGLESv2.so" + symbol_output = "$root_out_dir/libGLESv2.so.debug" + stripped_binary_output = "$root_out_dir/libGLESv2.so.stripped" + deps = [ "//third_party/angle:libGLESv2" ] + } + if (target_cpu != "arm64") { + strip_binary("strip_nacl_helper") { + binary_input = "$root_out_dir/nacl_helper" + symbol_output = "$root_out_dir/nacl_helper.debug" + stripped_binary_output = "$root_out_dir/nacl_helper.stripped" + deps = [ "//components/nacl/loader:nacl_helper" ] + } + } + if (target_cpu == "arm") { + strip_binary("strip_nacl_helper_bootstrap") { + binary_input = "$root_out_dir/nacl_helper_bootstrap" + symbol_output = "$root_out_dir/nacl_helper_bootstrap.debug" + stripped_binary_output = "$root_out_dir/nacl_helper_bootstrap.stripped" + deps = [ "//native_client/src/trusted/service_runtime/linux:bootstrap" ] + } + } }
diff --git a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/PasswordAccessoryInfoView.java b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/PasswordAccessoryInfoView.java index 262edc3c..0df963e 100644 --- a/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/PasswordAccessoryInfoView.java +++ b/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/sheet_tabs/PasswordAccessoryInfoView.java
@@ -4,6 +4,7 @@ package org.chromium.chrome.browser.keyboard_accessory.sheet_tabs; +import android.app.Activity; import android.content.Context; import android.graphics.drawable.Drawable; import android.util.AttributeSet; @@ -16,6 +17,8 @@ import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; +import org.chromium.base.ContextUtils; +import org.chromium.chrome.browser.ActivityUtils; import org.chromium.chrome.browser.keyboard_accessory.R; import org.chromium.components.browser_ui.widget.chips.ChipView; @@ -65,6 +68,8 @@ } static void showWarningDialog(Context context) { + Activity activity = ContextUtils.activityFromContext(context); + if (ActivityUtils.isActivityFinishingOrDestroyed(activity)) return; AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.ThemeOverlay_BrowserUI_AlertDialog); LayoutInflater inflater = LayoutInflater.from(builder.getContext());
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorAction.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorAction.java index 35a17f3..07146ded 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorAction.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorAction.java
@@ -211,8 +211,9 @@ * Processes the selected tabs from the selection list this includes related tabs if * {@link #editorSupportsActionOnRelatedTabs()} is true. * @param tabs a list of tabs from getTabsFromSelection(). + * @return Whether an action was performed without an error. */ - public abstract void performAction(List<Tab> tabs); + public abstract boolean performAction(List<Tab> tabs); /** * @return Whether to hide the editor after tabking the action. @@ -235,7 +236,9 @@ obs.preProcessSelectedTabs(tabs); } } - performAction(tabs); + if (!performAction(tabs)) { + return false; + }; if (shouldHideEditorAfterAction()) { mActionDelegate.hide(); RecordUserAction.record("TabMultiSelectV2.ClosedAutomatically");
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorCloseAction.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorCloseAction.java index f819d40..eed654a5 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorCloseAction.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorCloseAction.java
@@ -48,7 +48,7 @@ } @Override - public void performAction(List<Tab> tabs) { + public boolean performAction(List<Tab> tabs) { assert !tabs.isEmpty() : "Close action should not be enabled for no tabs."; if (tabs.size() == 1) { @@ -58,6 +58,7 @@ getTabModelSelector().getCurrentModel().closeMultipleTabs(tabs, true); } RecordUserAction.record("TabMultiSelectV2.CloseTabs"); + return true; } @Override
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorGroupAction.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorGroupAction.java index e551b5d1..7e52fbe 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorGroupAction.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorGroupAction.java
@@ -54,7 +54,7 @@ } @Override - public void performAction(List<Tab> tabs) { + public boolean performAction(List<Tab> tabs) { assert getTabModelSelector().getTabModelFilterProvider().getCurrentTabModelFilter() instanceof TabGroupModelFilter; @@ -68,6 +68,7 @@ RecordUserAction.record("TabMultiSelectV2.GroupTabs"); RecordUserAction.record("TabGroup.Created.TabMultiSelect"); + return true; } @Override
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorSelectionAction.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorSelectionAction.java index beadb221..09b5836 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorSelectionAction.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorSelectionAction.java
@@ -82,7 +82,7 @@ } @Override - public void performAction(List<Tab> tabs) { + public boolean performAction(List<Tab> tabs) { if (mActionState == ActionState.SELECT_ALL) { getActionDelegate().selectAll(); RecordUserAction.record("TabMultiSelectV2.SelectAll"); @@ -92,6 +92,7 @@ } else { assert false : "Invalid selection state"; } + return true; } @Override
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorShareAction.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorShareAction.java index 7e91dd2..08eaa96 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorShareAction.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorShareAction.java
@@ -8,24 +8,52 @@ import android.content.Context; import android.graphics.drawable.Drawable; +import androidx.annotation.IntDef; +import androidx.annotation.VisibleForTesting; import androidx.appcompat.content.res.AppCompatResources; +import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.metrics.RecordUserAction; import org.chromium.base.supplier.Supplier; import org.chromium.chrome.browser.share.ChromeShareExtras; import org.chromium.chrome.browser.share.ShareDelegate; import org.chromium.chrome.browser.share.ShareDelegate.ShareOrigin; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.tabmodel.TabList; import org.chromium.chrome.tab_ui.R; import org.chromium.components.browser_ui.share.ShareParams; +import org.chromium.components.embedder_support.util.UrlConstants; +import org.chromium.content_public.common.ContentUrlConstants; +import org.chromium.url.GURL; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; import java.util.List; /** * Share action for the {@link TabSelectionEditorMenu}. */ public class TabSelectionEditorShareAction extends TabSelectionEditorAction { + private static final List<String> UNSUPPORTED_SCHEMES = + new ArrayList<>(Arrays.asList(UrlConstants.CHROME_SCHEME, + UrlConstants.CHROME_NATIVE_SCHEME, ContentUrlConstants.ABOUT_SCHEME)); private Supplier<ShareDelegate> mShareDelegateSupplier; + private boolean mSkipUrlCheckForTesting; + + // These values are persisted to logs. Entries should not be renumbered and + // numeric values should never be reused. + @IntDef({TabSelectionEditorShareActionState.UNKNOWN, TabSelectionEditorShareActionState.SUCCESS, + TabSelectionEditorShareActionState.ALL_TABS_FILTERED, + TabSelectionEditorShareActionState.NUM_ENTRIES}) + public @interface TabSelectionEditorShareActionState { + int UNKNOWN = 0; + int SUCCESS = 1; + int ALL_TABS_FILTERED = 2; + + // Be sure to also update enums.xml when updating these values. + int NUM_ENTRIES = 3; + } /** * Create an action for sharing tabs. @@ -63,18 +91,31 @@ } @Override - public void performAction(List<Tab> tabs) { + public boolean performAction(List<Tab> tabs) { assert !tabs.isEmpty() : "Share action should not be enabled for no tabs."; - boolean isOnlyOneTab = (tabs.size() == 1); - String tabText = isOnlyOneTab ? "" : getTabListStringForSharing(tabs); - String tabTitle = isOnlyOneTab ? tabs.get(0).getTitle() : ""; - String tabUrl = isOnlyOneTab ? tabs.get(0).getUrl().getSpec() : ""; + TabList tabList = getTabModelSelector().getCurrentModel(); + List<Integer> sortedTabIndexList = filterTabs(tabs, tabList); + + if (sortedTabIndexList.size() == 0) { + logShareActionState(TabSelectionEditorShareActionState.ALL_TABS_FILTERED); + return false; + } + + boolean isOnlyOneTab = (sortedTabIndexList.size() == 1); + String tabText = + isOnlyOneTab ? "" : getTabListStringForSharing(sortedTabIndexList, tabList); + String tabTitle = + isOnlyOneTab ? tabList.getTabAt(sortedTabIndexList.get(0)).getTitle() : ""; + String tabUrl = + isOnlyOneTab ? tabList.getTabAt(sortedTabIndexList.get(0)).getUrl().getSpec() : ""; String userAction = isOnlyOneTab ? "TabMultiSelectV2.SharedTabAsTextList" : "TabMultiSelectV2.SharedTabsListAsTextList"; ShareParams shareParams = - new ShareParams.Builder(tabs.get(0).getWindowAndroid(), tabTitle, tabUrl) + new ShareParams + .Builder(tabList.getTabAt(sortedTabIndexList.get(0)).getWindowAndroid(), + tabTitle, tabUrl) .setText(tabText) .setCallback(new ShareParams.TargetChosenCallback() { @Override @@ -91,6 +132,8 @@ .setSaveLastUsed(true) .build(); mShareDelegateSupplier.get().share(shareParams, chromeShareExtras, ShareOrigin.TAB_GROUP); + logShareActionState(TabSelectionEditorShareActionState.SUCCESS); + return true; } @Override @@ -98,12 +141,49 @@ return true; } - private String getTabListStringForSharing(List<Tab> tabs) { - StringBuilder sb = new StringBuilder(); + // TODO(crbug.com/1373579): Current filtering does not remove duplicates or show a "Toast" if + // no shareable URLs are present after filtering. + private List<Integer> filterTabs(List<Tab> tabs, TabList tabList) { assert tabs.size() > 0; - for (int i = 0; i < tabs.size(); i++) { - sb.append(i + 1).append(". ").append(tabs.get(i).getUrl().getSpec()).append("\n"); + List<Integer> sortedTabIndexList = new ArrayList<Integer>(); + + HashSet<Tab> selectedTabs = new HashSet<Tab>(tabs); + for (int i = 0; i < tabList.getCount(); i++) { + Tab tab = tabList.getTabAt(i); + if (!selectedTabs.contains(tab)) continue; + + GURL url = tab.getUrl(); + if (url != null + && (mSkipUrlCheckForTesting + || (url.isValid() && !url.isEmpty() + && !UNSUPPORTED_SCHEMES.contains(url.getScheme())))) { + sortedTabIndexList.add(i); + } + } + return sortedTabIndexList; + } + + private String getTabListStringForSharing(List<Integer> sortedTabIndexList, TabList list) { + StringBuilder sb = new StringBuilder(); + + // TODO(crbug.com/1373579): Check if this string builder assembles the shareable URLs in + // accordance with internationalization and translation standards + for (int i = 0; i < sortedTabIndexList.size(); i++) { + sb.append(i + 1) + .append(". ") + .append(list.getTabAt(sortedTabIndexList.get(i)).getUrl().getSpec()) + .append("\n"); } return sb.toString(); } + + private static void logShareActionState(@TabSelectionEditorShareActionState int action) { + RecordHistogram.recordEnumeratedHistogram("Android.TabMultiSelectV2.SharingState", action, + TabSelectionEditorShareActionState.NUM_ENTRIES); + } + + @VisibleForTesting + void setSkipUrlCheckForTesting(boolean skip) { + mSkipUrlCheckForTesting = skip; + } }
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorUngroupAction.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorUngroupAction.java index 80bfb4a..c80e886 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorUngroupAction.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorUngroupAction.java
@@ -51,7 +51,7 @@ } @Override - public void performAction(List<Tab> tabs) { + public boolean performAction(List<Tab> tabs) { assert getTabModelSelector().getTabModelFilterProvider().getCurrentTabModelFilter() instanceof TabGroupModelFilter; assert !editorSupportsActionOnRelatedTabs() @@ -65,6 +65,7 @@ } RecordUserAction.record("TabMultiSelectV2.UngroupTabs"); RecordUserAction.record("TabGridDialog.RemoveFromGroup.TabMultiSelect"); + return true; } @Override
diff --git a/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorMenuTest.java b/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorMenuTest.java index 0fdbd6b..03356f78 100644 --- a/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorMenuTest.java +++ b/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorMenuTest.java
@@ -132,7 +132,9 @@ } @Override - public void performAction(List<Tab> tabs) {} + public boolean performAction(List<Tab> tabs) { + return true; + } @Override public boolean shouldHideEditorAfterAction() {
diff --git a/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorTest.java b/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorTest.java index e39635d..94e650d 100644 --- a/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorTest.java +++ b/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorTest.java
@@ -607,9 +607,13 @@ @EnableFeatures({ChromeFeatureList.TAB_SELECTION_EDITOR_V2}) public void testToolbarMenuItem_ShareActionView() throws IOException { Intents.init(); - prepareBlankTab(3, false); + prepareBlankTab(1, false); List<Tab> tabs = getTabsInCurrentTabModel(); + final String httpsCanonicalUrl = + sActivityTestRule.getTestServer().getURL(PAGE_WITH_HTTPS_CANONICAL_URL); + sActivityTestRule.loadUrl(httpsCanonicalUrl); + TestThreadUtils.runOnUiThreadBlocking(() -> { List<TabSelectionEditorAction> actions = new ArrayList<>(); actions.add(TabSelectionEditorShareAction.createAction(sActivityTestRule.getActivity(), @@ -624,13 +628,13 @@ mRobot.resultRobot.verifyToolbarActionViewWithText(shareId, "Share tabs"); mRobot.resultRobot.verifyToolbarActionViewDisabled(shareId); - mRobot.actionRobot.clickItemAtAdapterPosition(0).clickItemAtAdapterPosition(2); + mRobot.actionRobot.clickItemAtAdapterPosition(0); mRobot.resultRobot.verifyToolbarActionViewEnabled(shareId).verifyToolbarSelectionText( - "2 tabs"); + "1 tab"); View share = mTabSelectionEditorLayout.getToolbar().findViewById(shareId); - assertEquals("Share 2 selected tabs", share.getContentDescription()); + assertEquals("Share 1 selected tab", share.getContentDescription()); mRobot.actionRobot.clickToolbarActionView(shareId); @@ -681,9 +685,8 @@ String sharedUrls[] = shareParamsCaptorValue.getTextAndUrl().split("\\r?\\n"); - assertEquals(2, sharedUrls.length); - assertEquals("1. about:blank", sharedUrls[0]); - assertEquals("2. " + httpsCanonicalUrl, sharedUrls[1]); + assertEquals(1, sharedUrls.length); + assertEquals(httpsCanonicalUrl, sharedUrls[0]); } @Test @@ -694,6 +697,7 @@ urls.add(sActivityTestRule.getTestServer().getURL(PAGE_WITH_HTTPS_CANONICAL_URL)); urls.add(sActivityTestRule.getTestServer().getURL(PAGE_WITH_HTTP_CANONICAL_URL)); urls.add(sActivityTestRule.getTestServer().getURL(PAGE_WITH_NO_CANONICAL_URL)); + urls.add(sActivityTestRule.getTestServer().getURL(PAGE_WITH_NO_CANONICAL_URL)); prepareTabGroupWithUrls(urls, false); prepareBlankTabGroup(2, false); @@ -723,21 +727,30 @@ String sharedUrls[] = shareParamsCaptorValue.getTextAndUrl().split("\\r?\\n"); - assertEquals(5, sharedUrls.length); + assertEquals(4, sharedUrls.length); assertEquals("1. " + urls.get(0), sharedUrls[0]); assertEquals("2. " + urls.get(1), sharedUrls[1]); assertEquals("3. " + urls.get(2), sharedUrls[2]); - assertEquals("4. about:blank", sharedUrls[3]); - assertEquals("5. about:blank", sharedUrls[4]); + assertEquals("4. " + urls.get(3), sharedUrls[3]); } @Test @MediumTest @EnableFeatures({ChromeFeatureList.TAB_SELECTION_EDITOR_V2}) public void testToolbarMenuItem_ShareActionTabsWithGroups() throws IOException { - prepareBlankTab(1, false); - prepareBlankTabGroup(3, false); + prepareBlankTab(2, false); + + final String httpsCanonicalUrl = + sActivityTestRule.getTestServer().getURL(PAGE_WITH_HTTPS_CANONICAL_URL); + sActivityTestRule.loadUrl(httpsCanonicalUrl); + prepareBlankTabGroup(2, false); + + ArrayList<String> urls = new ArrayList<String>(); + urls.add(sActivityTestRule.getTestServer().getURL(PAGE_WITH_HTTP_CANONICAL_URL)); + urls.add(sActivityTestRule.getTestServer().getURL(PAGE_WITH_NO_CANONICAL_URL)); + prepareTabGroupWithUrls(urls, false); + List<Tab> tabs = getTabsInCurrentTabModelFilter(); TestThreadUtils.runOnUiThreadBlocking(() -> { @@ -750,11 +763,10 @@ mTabSelectionEditorController.show(tabs); }); - mRobot.actionRobot.clickItemAtAdapterPosition(0).clickItemAtAdapterPosition(2); - - final String httpsCanonicalUrl = - sActivityTestRule.getTestServer().getURL(PAGE_WITH_HTTPS_CANONICAL_URL); - sActivityTestRule.loadUrl(httpsCanonicalUrl); + mRobot.actionRobot.clickItemAtAdapterPosition(0) + .clickItemAtAdapterPosition(1) + .clickItemAtAdapterPosition(2) + .clickItemAtAdapterPosition(3); final int shareId = R.id.tab_selection_editor_share_menu_item; mRobot.actionRobot.clickToolbarActionView(shareId); @@ -768,9 +780,9 @@ String sharedUrls[] = shareParamsCaptorValue.getTextAndUrl().split("\\r?\\n"); assertEquals(3, sharedUrls.length); - assertEquals("1. about:blank", sharedUrls[0]); - assertEquals("2. about:blank", sharedUrls[1]); - assertEquals("3. " + httpsCanonicalUrl, sharedUrls[2]); + assertEquals("1. " + httpsCanonicalUrl, sharedUrls[0]); + assertEquals("2. " + urls.get(0), sharedUrls[1]); + assertEquals("3. " + urls.get(1), sharedUrls[2]); } @Test
diff --git a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorShareActionUnitTest.java b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorShareActionUnitTest.java index 4e3eb3f7..dc63bcbe 100644 --- a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorShareActionUnitTest.java +++ b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorShareActionUnitTest.java
@@ -4,7 +4,9 @@ package org.chromium.chrome.browser.tasks.tab_management; +import static org.mockito.Mockito.any; import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.never; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -18,6 +20,7 @@ import org.junit.Assert; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; @@ -30,9 +33,11 @@ import org.chromium.base.supplier.Supplier; import org.chromium.base.test.BaseRobolectricTestRunner; import org.chromium.base.test.util.CallbackHelper; +import org.chromium.base.test.util.JniMocker; import org.chromium.chrome.browser.share.ChromeShareExtras; import org.chromium.chrome.browser.share.ShareDelegate; import org.chromium.chrome.browser.share.ShareDelegate.ShareOrigin; +import org.chromium.chrome.browser.tab.MockTab; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tasks.tab_management.TabSelectionEditorAction.ActionDelegate; @@ -44,10 +49,15 @@ import org.chromium.chrome.test.util.browser.tabmodel.MockTabModel; import org.chromium.components.browser_ui.share.ShareParams; import org.chromium.components.browser_ui.widget.selectable_list.SelectionDelegate; +import org.chromium.components.dom_distiller.core.DomDistillerUrlUtilsJni; +import org.chromium.url.GURL; +import org.chromium.url.JUnitTestGURLs; import java.util.ArrayList; +import java.util.HashMap; import java.util.LinkedHashSet; import java.util.List; +import java.util.Map; import java.util.Set; /** @@ -56,6 +66,9 @@ @RunWith(BaseRobolectricTestRunner.class) @Config(manifest = Config.NONE) public class TabSelectionEditorShareActionUnitTest { + @Rule + public JniMocker mJniMocker = new JniMocker(); + @Mock private TabModelSelector mTabModelSelector; @Mock @@ -66,23 +79,44 @@ private Supplier<ShareDelegate> mShareDelegateSupplier; @Mock private ShareDelegate mShareDelegate; + @Mock + private DomDistillerUrlUtilsJni mDomDistillerUrlUtilsJni; private Context mContext; private MockTabModel mTabModel; - private TabSelectionEditorAction mAction; + private TabSelectionEditorShareAction mAction; @Captor ArgumentCaptor<ShareParams> mShareParamsCaptor; @Captor ArgumentCaptor<ChromeShareExtras> mChromeShareExtrasCaptor; + Map<Integer, GURL> mIdUrlMap = new HashMap<Integer, GURL>() { + { + put(1, JUnitTestGURLs.getGURL(JUnitTestGURLs.URL_1)); + put(2, JUnitTestGURLs.getGURL(JUnitTestGURLs.URL_2)); + put(3, JUnitTestGURLs.getGURL(JUnitTestGURLs.URL_3)); + put(4, JUnitTestGURLs.getGURL(JUnitTestGURLs.NTP_URL)); + put(5, JUnitTestGURLs.getGURL(JUnitTestGURLs.ABOUT_BLANK)); + } + }; + @Before public void setUp() { MockitoAnnotations.initMocks(this); mContext = RuntimeEnvironment.application; - mAction = TabSelectionEditorShareAction.createAction(mContext, ShowMode.MENU_ONLY, - ButtonType.TEXT, IconPosition.START, mShareDelegateSupplier); - mTabModel = spy(new MockTabModel(false, null)); + mAction = (TabSelectionEditorShareAction) TabSelectionEditorShareAction.createAction( + mContext, ShowMode.MENU_ONLY, ButtonType.TEXT, IconPosition.START, + mShareDelegateSupplier); + mTabModel = spy(new MockTabModel(false, new MockTabModel.MockTabModelDelegate() { + @Override + public Tab createTab(int id, boolean incognito) { + MockTab tab = new MockTab(id, incognito); + tab.setGurlOverrideForTesting(mIdUrlMap.get(id)); + return tab; + } + })); when(mTabModelSelector.getCurrentModel()).thenReturn(mTabModel); + mJniMocker.mock(DomDistillerUrlUtilsJni.TEST_HOOKS, mDomDistillerUrlUtilsJni); mAction.configure(mTabModelSelector, mSelectionDelegate, mDelegate, false); } @@ -121,15 +155,19 @@ @Test @SmallTest public void testShareActionWithOneTab() throws Exception { + mAction.setSkipUrlCheckForTesting(true); List<Integer> tabIds = new ArrayList<>(); - tabIds.add(5); + tabIds.add(1); List<Tab> tabs = new ArrayList<>(); for (int id : tabIds) { tabs.add(mTabModel.addTab(id)); } + Set<Integer> tabIdsSet = new LinkedHashSet<>(tabIds); when(mSelectionDelegate.getSelectedItems()).thenReturn(tabIdsSet); + when(mDomDistillerUrlUtilsJni.getOriginalUrlFromDistillerUrl(any(String.class))) + .thenReturn(JUnitTestGURLs.getGURL(JUnitTestGURLs.URL_1)); mAction.onSelectionStateChange(tabIds); Assert.assertEquals( @@ -193,15 +231,18 @@ Assert.assertEquals( chromeShareExtras.saveLastUsed(), chromeShareExtrasCaptorValue.saveLastUsed()); Assert.assertEquals(1, helper.getCallCount()); + mAction.setSkipUrlCheckForTesting(false); } @Test @SmallTest public void testShareActionWithMultipleTabs() throws Exception { + mAction.setSkipUrlCheckForTesting(true); List<Integer> tabIds = new ArrayList<>(); - tabIds.add(5); + tabIds.add(1); + tabIds.add(2); tabIds.add(3); - tabIds.add(7); + List<Tab> tabs = new ArrayList<>(); for (int id : tabIds) { tabs.add(mTabModel.addTab(id)); @@ -215,9 +256,11 @@ Assert.assertEquals( 3, mAction.getPropertyModel().get(TabSelectionEditorActionProperties.ITEM_COUNT)); - ShareParams shareParams = new ShareParams.Builder(tabs.get(0).getWindowAndroid(), "", "") - .setText("1. \n2. \n3. \n") - .build(); + ShareParams shareParams = + new ShareParams.Builder(tabs.get(0).getWindowAndroid(), "", "") + .setText( + "1. https://www.one.com/\n2. https://www.two.com/\n3. https://www.three.com/\n") + .build(); ChromeShareExtras chromeShareExtras = new ChromeShareExtras.Builder() .setSharingTabGroup(true) .setSaveLastUsed(true) @@ -267,5 +310,31 @@ Assert.assertEquals( chromeShareExtras.saveLastUsed(), chromeShareExtrasCaptorValue.saveLastUsed()); Assert.assertEquals(1, helper.getCallCount()); + mAction.setSkipUrlCheckForTesting(false); + } + + @Test + @SmallTest + public void testShareActionWithAllFilterableTabs() throws Exception { + List<Integer> tabIds = new ArrayList<>(); + tabIds.add(4); + tabIds.add(5); + + for (int id : tabIds) { + mTabModel.addTab(id); + } + Set<Integer> tabIdsSet = new LinkedHashSet<>(tabIds); + when(mSelectionDelegate.getSelectedItems()).thenReturn(tabIdsSet); + + mAction.onSelectionStateChange(tabIds); + Assert.assertEquals( + true, mAction.getPropertyModel().get(TabSelectionEditorActionProperties.ENABLED)); + Assert.assertEquals( + 2, mAction.getPropertyModel().get(TabSelectionEditorActionProperties.ITEM_COUNT)); + + Assert.assertFalse(mAction.perform()); + verify(mShareDelegate, never()) + .share(any(ShareParams.class), any(ChromeShareExtras.class), + eq(ShareOrigin.TAB_GROUP)); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/dom_distiller/ReaderModeManager.java b/chrome/android/java/src/org/chromium/chrome/browser/dom_distiller/ReaderModeManager.java index 30c196b6..b675d8a7 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/dom_distiller/ReaderModeManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/dom_distiller/ReaderModeManager.java
@@ -43,6 +43,7 @@ import org.chromium.chrome.browser.tab.TabHidingType; import org.chromium.chrome.browser.tab.TabSelectionType; import org.chromium.chrome.browser.tab.TabUtils; +import org.chromium.chrome.browser.toolbar.adaptive.AdaptiveToolbarFeatures; import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils; import org.chromium.components.messages.DismissReason; import org.chromium.components.messages.MessageBannerProperties; @@ -505,6 +506,9 @@ void tryShowingPrompt() { if (mTab == null || mTab.getWebContents() == null) return; + // If a reader mode button will be shown on the toolbar then don't show a message. + if (AdaptiveToolbarFeatures.isReaderModePageActionEnabled()) return; + // Test if the user is requesting the desktop site. Ignore this if distiller is set to // ALWAYS_TRUE. boolean usingRequestDesktopSite =
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java index e2d9aca..89ddc61 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java
@@ -13,7 +13,6 @@ import android.content.pm.PackageManager; import android.graphics.Typeface; import android.net.Uri; -import android.os.Build; import android.text.Spannable; import android.text.SpannableString; import android.text.TextUtils; @@ -363,9 +362,7 @@ * @return URI for other apps to use the file via {@link android.content.ContentResolver}. */ public static Uri getUriForOtherApps(String filePath) { - // Some old Samsung devices with Android M- must use file URI. See https://crbug.com/705748. - return Build.VERSION.SDK_INT > Build.VERSION_CODES.M ? getUriForItem(filePath) - : Uri.fromFile(new File(filePath)); + return getUriForItem(filePath); } @CalledByNative
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ui/RootUiCoordinator.java b/chrome/android/java/src/org/chromium/chrome/browser/ui/RootUiCoordinator.java index 7811843..b86b224 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ui/RootUiCoordinator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ui/RootUiCoordinator.java
@@ -1111,7 +1111,7 @@ mActivity, mActivityLifecycleDispatcher, mProfileSupplier); PriceTrackingButtonController priceTrackingButtonController = new PriceTrackingButtonController(mActivityTabProvider, - mModalDialogManagerSupplier.get(), + mModalDialogManagerSupplier.get(), getBottomSheetController(), AppCompatResources.getDrawable( mActivity, R.drawable.price_tracking_disabled), mTabBookmarkerSupplier);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNoShippingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNoShippingTest.java index e873910b3..3329e1c 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNoShippingTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNoShippingTest.java
@@ -134,12 +134,22 @@ */ @Test @MediumTest - @DisabledTest(message = "crbug.com/1182234") @Feature({"Payments"}) public void testQuickDismissAndPayShouldNotCrash() throws TimeoutException { - mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); + // Install two payment apps, so that the PaymentRequest UI is shown rather than skipped. + mPaymentRequestTestRule.addPaymentAppFactory( + "https://bobpay.com", AppPresence.HAVE_APPS, FactorySpeed.FAST_FACTORY); + mPaymentRequestTestRule.addPaymentAppFactory( + "https://alicepay.com", AppPresence.HAVE_APPS, FactorySpeed.FAST_FACTORY); - // Quickly dismiss and then press on "pay." + mPaymentRequestTestRule.openPage(); + + mPaymentRequestTestRule.runJavaScriptAndWaitForUIEvent( + "triggerPaymentRequest([{supportedMethods:'https://bobpay.com'}, " + + "{supportedMethods:'https://alicepay.com'}]);", + mPaymentRequestTestRule.getReadyToPay()); + + // Quickly dismiss and then press on "Continue" int callCount = mPaymentRequestTestRule.getDismissed().getCallCount(); TestThreadUtils.runOnUiThreadBlocking(() -> { mPaymentRequestTestRule.getPaymentRequestUI().getDialogForTest().onBackPressed(); @@ -150,8 +160,16 @@ }); mPaymentRequestTestRule.getDismissed().waitForCallback(callCount); - mPaymentRequestTestRule.expectResultContains( - new String[] {"User closed the Payment Request UI."}); + // Currently, the above calls for the back button and pay button result in the + // PaymentRequest being in a bad state. The back button call is handled asynchronously by + // Android, and so the pay click happens first. The show() promise resolves, kicking off the + // must-call-complete timer, however the back button cancellation then tears down the + // PaymentRequest state - including setting the must-call-complete timer to failed. + // + // TODO(crbug.com/1375286): Avoid ending up in this state. + Assert.assertEquals("\"Failed to execute 'complete' on 'PaymentResponse': " + + "Timed out after 60 seconds, complete() called too late\"", + mPaymentRequestTestRule.runJavaScriptAndWaitForPromise("getResult()")); } /**
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/dom_distiller/ReaderModeManagerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/dom_distiller/ReaderModeManagerTest.java index ca33174..39286ea4 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/dom_distiller/ReaderModeManagerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/dom_distiller/ReaderModeManagerTest.java
@@ -38,6 +38,7 @@ import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabObserver; import org.chromium.chrome.test.util.browser.Features; +import org.chromium.chrome.test.util.browser.Features.DisableFeatures; import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils; import org.chromium.components.dom_distiller.core.DomDistillerUrlUtilsJni; import org.chromium.components.messages.MessageDispatcher; @@ -54,6 +55,8 @@ /** This class tests the behavior of the {@link ReaderModeManager}. */ @RunWith(BaseRobolectricTestRunner.class) +@DisableFeatures({ChromeFeatureList.CONTEXTUAL_PAGE_ACTIONS, + ChromeFeatureList.CONTEXTUAL_PAGE_ACTION_READER_MODE}) public class ReaderModeManagerTest { private static final GURL MOCK_DISTILLER_URL = JUnitTestGURLs.getGURL(JUnitTestGURLs.DOM_DISILLER_URL); @@ -248,6 +251,23 @@ @Test @Feature("ReaderMode") + @Features.EnableFeatures({ChromeFeatureList.MESSAGES_FOR_ANDROID_READER_MODE, + ChromeFeatureList.CONTEXTUAL_PAGE_ACTIONS, + ChromeFeatureList.CONTEXTUAL_PAGE_ACTION_READER_MODE}) + public void + testUI_notTriggered_contextualPageActionUiEnabled() { + mDistillabilityObserver.onIsPageDistillableResult(mTab, true, true, false); + assertEquals("Distillation should be possible.", DistillationStatus.POSSIBLE, + mManager.getDistillationStatus()); + verify(mMessageDispatcher, + never().description("Message should be suppressed as the CPA UI will be shown")) + .enqueueMessage( + any(), eq(mWebContents), eq(MessageScopeType.NAVIGATION), eq(false)); + verifyNoMoreInteractions(mReaderModeInfobarJniMock); + } + + @Test + @Feature("ReaderMode") public void testWebContentsObserver_distillerNavigationRemoved() { when(mNavController.getEntryAtIndex(0)) .thenReturn(createNavigationEntry(0, MOCK_DISTILLER_URL));
diff --git a/chrome/android/static_initializers.gni b/chrome/android/static_initializers.gni index 64f0050..70e4c02 100644 --- a/chrome/android/static_initializers.gni +++ b/chrome/android/static_initializers.gni
@@ -20,36 +20,48 @@ (!is_debug && !using_sanitizer && proprietary_codecs)) { # Comments show static_initializers according to # tools/linux/dump-static-initializers.py. + _chrome_count = 0 - # TODO(https://crbug.com/1177849): Remove from tflite: - # tflite_engine.cc (initializer offset 0x34cb88c size 0x2c) - # __ThumbV7PILongThunk__ZNSt3__18ios_base4InitC1Ev - # __ThumbV7PILongThunk___cxa_atexit - expected_static_initializer_count = 1 - - # From v8 I think: - # token.cc (initializer offset 0x27f024c size 0x11c) - expected_static_initializer_count += 1 - - # This one is from //third_party/gvr-android-sdk - # base_logging.cc (initializer offset 0x9a4b0c size 0x48) - expected_static_initializer_count += 1 - - if (build_with_internal_optimization_guide) { - # 000081d1 t _GLOBAL__I_000101 - expected_static_initializer_count += 1 + if (target_cpu == "arm64") { + # Caused by "outline atomics". https://crbug.com/1272795 + # cpu_model.c: init_have_lse_atomics + _chrome_count += 1 } + # iostream.cpp: _GLOBAL__I_000101 + _chrome_count += 1 + + # v8/src/parsing/token.cc: _GLOBAL__sub_I_token.cc + _chrome_count += 1 + + # From //third_party/gvr-android-sdk: _GLOBAL__sub_I_base_logging.cc + _chrome_count += 1 + if (use_static_angle && !is_official_build && (is_debug || dcheck_always_on)) { # TODO(https://crbug.com/1172451): remove global variables from ANGLE: # # doc.cpp (initializer offset 0xcf9c6c size 0x138) # SPVRemapper.cpp (initializer offset 0xcf2924 size 0x64) - expected_static_initializer_count += 2 + _chrome_count += 2 } if (use_clang_coverage) { # InstrProfilingRuntime.cpp, Only in coverage builds, not production. - expected_static_initializer_count += 1 + _chrome_count += 1 } + + _optimization_guide_count = 0 + + if (build_with_internal_optimization_guide) { + if (target_cpu == "arm64") { + # Caused by "outline atomics". https://crbug.com/1272795 + # cpu_model.c: init_have_lse_atomics + _optimization_guide_count += 1 + } + + # iostream_init.h: _GLOBAL__I_000100 + _optimization_guide_count += 1 + } + + expected_static_initializer_count = _chrome_count + _optimization_guide_count }
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index d978f4a..3c05f0f 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -13954,9 +13954,16 @@ <message name="IDS_BATTERY_SAVER_BUBBLE_TITLE" desc="The title of the battery saver bubble dialog"> Energy Saver is on </message> - <message name="IDS_BATTERY_SAVER_BUBBLE_DESCRIPTION" desc="The description text of the battery saver bubble dialog"> - Background activity and some visual effects, like smooth scrolling, may be limited. - </message> + <if expr="use_titlecase"> + <message name="IDS_BATTERY_SAVER_BUBBLE_DESCRIPTION" desc="The description text of the battery saver bubble dialog"> + Background activity and some visual effects, like smooth scrolling, may be limited. + </message> + </if> + <if expr="not use_titlecase"> + <message name="IDS_BATTERY_SAVER_BUBBLE_DESCRIPTION" desc="The description text of the battery saver bubble dialog"> + Background activity and some visual effects, like smooth scrolling, may be limited + </message> + </if> <if expr="use_titlecase"> <message name="IDS_BATTERY_SAVER_SESSION_TURN_OFF" desc="In Title Case: The label for the turn off battery saver for current session button in battery saver bubble dialog"> Turn Off Now
diff --git a/chrome/app/generated_resources_grd/IDS_BATTERY_SAVER_BUBBLE_DESCRIPTION.png.sha1 b/chrome/app/generated_resources_grd/IDS_BATTERY_SAVER_BUBBLE_DESCRIPTION.png.sha1 index 573c723..68a28ef 100644 --- a/chrome/app/generated_resources_grd/IDS_BATTERY_SAVER_BUBBLE_DESCRIPTION.png.sha1 +++ b/chrome/app/generated_resources_grd/IDS_BATTERY_SAVER_BUBBLE_DESCRIPTION.png.sha1
@@ -1 +1 @@ -bd261f0c0da03977a7c5da043f8b138d8eac2070 \ No newline at end of file +d4507c2c44b0cb618f489809eded7fedad8b6aeb \ No newline at end of file
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 46e2cf7..a86d91a 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
@@ -17,6 +17,7 @@ #include "chrome/browser/web_applications/os_integration/web_app_file_handler_manager.h" #include "chrome/browser/web_applications/os_integration/web_app_shortcut_mac.h" #include "chrome/browser/web_applications/web_app.h" +#include "chrome/browser/web_applications/web_app_command_scheduler.h" #include "chrome/browser/web_applications/web_app_constants.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/browser/web_applications/web_app_registrar.h" @@ -112,8 +113,10 @@ std::move(persist_done)); } else { DCHECK(is_file_launch); - PersistFileHandlersUserChoice(profile, app_id, allowed, - std::move(persist_done)); + WebAppProvider::GetForWebApps(profile) + ->scheduler() + .PersistFileHandlersUserChoice(app_id, allowed, + std::move(persist_done)); } } else { std::move(persist_done).Run();
diff --git a/chrome/browser/ash/BUILD.gn b/chrome/browser/ash/BUILD.gn index f7cce228..bb42c2bfc 100644 --- a/chrome/browser/ash/BUILD.gn +++ b/chrome/browser/ash/BUILD.gn
@@ -3540,6 +3540,7 @@ "//chromeos/ime:gencode", "//chromeos/services/machine_learning/public/cpp", "//chromeos/services/network_config:in_process_instance", + "//chromeos/services/network_health:in_process_instance", "//chromeos/strings", "//chromeos/ui/vector_icons", "//chromeos/utils",
diff --git a/chrome/browser/ash/accessibility/select_to_speak_browsertest.cc b/chrome/browser/ash/accessibility/select_to_speak_browsertest.cc index 51be0bc..915810f 100644 --- a/chrome/browser/ash/accessibility/select_to_speak_browsertest.cc +++ b/chrome/browser/ash/accessibility/select_to_speak_browsertest.cc
@@ -5,6 +5,7 @@ #include <memory> #include <vector> +#include "ash/accessibility/magnifier/fullscreen_magnifier_controller.h" #include "ash/accessibility/ui/accessibility_focus_ring_controller_impl.h" #include "ash/accessibility/ui/accessibility_focus_ring_layer.h" #include "ash/accessibility/ui/accessibility_highlight_layer.h" @@ -34,6 +35,7 @@ #include "content/public/test/browser_test.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_utils.h" +#include "extensions/browser/browsertest_util.h" #include "extensions/browser/extension_host.h" #include "extensions/browser/extension_host_test_helper.h" #include "extensions/browser/notification_types.h" @@ -97,11 +99,13 @@ ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL))); } - void SetUpInProcessBrowserTestFixture() override { + void SetUpCommandLine(base::CommandLine* command_line) override { // TODO (leileilei@google.com): Provide a way to disable the pop up dialog. // Disable kEnhancedNetworkVoices To avoid its pop up dialog. scoped_feature_list_.InitAndDisableFeature( ::features::kEnhancedNetworkVoices); + + InProcessBrowserTest::SetUpCommandLine(command_line); } test::SpeechMonitor sm_; @@ -174,11 +178,10 @@ } void RunJavaScriptInSelectToSpeakBackgroundPage(const std::string& script) { - extensions::ExtensionHost* host = - extensions::ProcessManager::Get(browser()->profile()) - ->GetBackgroundHostForExtension( - extension_misc::kSelectToSpeakExtensionId); - CHECK(content::ExecuteScript(host->host_contents(), script)); + extensions::browsertest_util::ExecuteScriptInBackgroundPage( + /*context=*/browser()->profile(), + /*extension_id=*/extension_misc::kSelectToSpeakExtensionId, + /*script=*/script); } content::WebContents* GetWebContents() { @@ -197,14 +200,56 @@ base::WeakPtrFactory<SelectToSpeakTest> weak_ptr_factory_{this}; }; -/* Test fixture enabling experimental accessibility language detection switch */ -class SelectToSpeakTestWithLanguageDetection : public SelectToSpeakTest { +// TODO(crbug.com/1375293): Extract MagnifierAnimationWaiter to helper. +class MagnifierAnimationWaiter { + public: + explicit MagnifierAnimationWaiter(FullscreenMagnifierController* controller) + : controller_(controller) {} + + MagnifierAnimationWaiter(const MagnifierAnimationWaiter&) = delete; + MagnifierAnimationWaiter& operator=(const MagnifierAnimationWaiter&) = delete; + + void Wait() { + base::RepeatingTimer check_timer; + check_timer.Start(FROM_HERE, base::Milliseconds(10), this, + &MagnifierAnimationWaiter::OnTimer); + runner_ = new content::MessageLoopRunner; + runner_->Run(); + } + + private: + void OnTimer() { + DCHECK(runner_.get()); + if (!controller_->IsOnAnimationForTesting()) { + runner_->Quit(); + } + } + + FullscreenMagnifierController* controller_; // not owned + scoped_refptr<content::MessageLoopRunner> runner_; +}; + +class SelectToSpeakTestWithVoiceSwitching : public SelectToSpeakTest { protected: void SetUpCommandLine(base::CommandLine* command_line) override { SelectToSpeakTest::SetUpCommandLine(command_line); - command_line->AppendSwitch( - ::switches::kEnableExperimentalAccessibilityLanguageDetection); + scoped_feature_list_.InitAndEnableFeature( + ::features::kExperimentalAccessibilitySelectToSpeakVoiceSwitching); } + + void SetUpOnMainThread() override { + SelectToSpeakTest::SetUpOnMainThread(); + + // Enable voice switching using chrome.storage API. + std::string script = R"( + chrome.storage.sync.set({voiceSwitching: true}); + window.domAutomationController.send("done"); + )"; + RunJavaScriptInSelectToSpeakBackgroundPage(script); + } + + private: + base::test::ScopedFeatureList scoped_feature_list_; }; IN_PROC_BROWSER_TEST_F(SelectToSpeakTest, SpeakStatusTray) { @@ -484,10 +529,14 @@ sm_.Replay(); } -// TODO(crbug.com/1107958): Re-enable this test after fixing flakes. -// TODO(crbug.com/950391): Re-enable this test before launching voice switching. -IN_PROC_BROWSER_TEST_F(SelectToSpeakTestWithLanguageDetection, - DISABLED_BreaksAtLanguageBounds) { +#if defined(MEMORY_SANITIZER) +#define MAYBE_BreaksAtLanguageBounds DISABLED_BreaksAtLanguageBounds +#else +#define MAYBE_BreaksAtLanguageBounds BreaksAtLanguageBounds +#endif +// TODO(crbug.com/1107958): Re-enable this test on msan after fixing flakes. +IN_PROC_BROWSER_TEST_F(SelectToSpeakTestWithVoiceSwitching, + MAYBE_BreaksAtLanguageBounds) { ActivateSelectToSpeakInWindowBounds( "data:text/html;charset=utf-8,<div>" "<span lang='en-US'>The first paragraph</span>" @@ -601,6 +650,51 @@ EXPECT_EQ(focus_rings.size(), 0u); } +IN_PROC_BROWSER_TEST_F(SelectToSpeakTest, + SelectToSpeakPansFullscreenMagnifier) { + FullscreenMagnifierController* fullscreen_magnifier_controller = + Shell::Get()->fullscreen_magnifier_controller(); + fullscreen_magnifier_controller->SetEnabled(true); + + // Wait for Fullscreen magnifier to initialize. + MagnifierAnimationWaiter waiter(fullscreen_magnifier_controller); + waiter.Wait(); + gfx::Point const initial_window_position = + fullscreen_magnifier_controller->GetWindowPosition(); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), + GURL("data:text/html;charset=utf-8," + "<p>This is some text</p>"))); + gfx::Rect bounds = GetWebContentsBounds(); + PrepareToWaitForFocusRingChanged(); + + // Hold down Search, and move mouse to start of text. + generator_->PressKey(ui::VKEY_LWIN, 0 /* flags */); + generator_->MoveMouseTo(bounds.x(), bounds.y()); + + // FullscreenMagnifierController moves the magnifier window with animation + // when the magnifier is set to be enabled. Wait until the animation + // completes, so that the mouse movement controls the position of magnifier + // window later. + waiter.Wait(); + + // Press and drag mouse past bounds of magnified screen, to move the viewport. + generator_->PressLeftButton(); + + // Move mouse to bottom right area of screen. Multiply by scale as fullscreen + // magnifier is enabled, so input needs to be transformed. + const float scale = fullscreen_magnifier_controller->GetScale(); + generator_->MoveMouseTo( + (bounds.right() - initial_window_position.x()) * scale, + (bounds.bottom() - initial_window_position.y()) * scale); + + gfx::Point const final_window_position = + fullscreen_magnifier_controller->GetWindowPosition(); + + // Expect Magnifier window to move with mouse drag. + EXPECT_GT(final_window_position.x(), initial_window_position.x()); + EXPECT_GT(final_window_position.y(), initial_window_position.y()); +} + // crbug.com/1114854 - Times out on MSAN bots. #if defined(MEMORY_SANITIZER) #define MAYBE_ContinuesReadingDuringResize DISABLED_ContinuesReadingDuringResize
diff --git a/chrome/browser/ash/arc/print_spooler/print_session_impl.cc b/chrome/browser/ash/arc/print_spooler/print_session_impl.cc index 754678a..4d51822 100644 --- a/chrome/browser/ash/arc/print_spooler/print_session_impl.cc +++ b/chrome/browser/ash/arc/print_spooler/print_session_impl.cc
@@ -189,20 +189,20 @@ return false; } - content::WebContents* contents_to_use = - printing::GetWebContentsToUse(web_contents); - if (contents_to_use == web_contents) { - VLOG(1) << "No plugin WebContents found yet."; + content::RenderFrameHost* plugin_frame = + printing::GetFullPagePlugin(web_contents); + if (!plugin_frame) { + VLOG(1) << "No plugin frame found yet."; return false; } - GURL url = contents_to_use->GetPrimaryMainFrame()->GetLastCommittedURL(); + GURL url = plugin_frame->GetLastCommittedURL(); if (!url.SchemeIs("chrome-extension")) { VLOG(1) << "Plugin frame URL not loaded yet."; return false; } - if (!contents_to_use->IsDocumentOnLoadCompletedInPrimaryMainFrame()) { + if (!plugin_frame->IsDocumentOnLoadCompletedInMainFrame()) { VLOG(1) << "Plugin frame still loading."; return false; }
diff --git a/chrome/browser/ash/crosapi/browser_data_migrator_util.h b/chrome/browser/ash/crosapi/browser_data_migrator_util.h index ef6b1c8..f8808ee 100644 --- a/chrome/browser/ash/crosapi/browser_data_migrator_util.h +++ b/chrome/browser/ash/crosapi/browser_data_migrator_util.h
@@ -134,6 +134,7 @@ "structured_metrics", "Sync Data", "Trusted Vault", + "trusted_vault.pb", "WebRTC Logs", "webrtc_event_logs", "zero_state_group_ranker.pb",
diff --git a/chrome/browser/ash/login/session/user_session_initializer.cc b/chrome/browser/ash/login/session/user_session_initializer.cc index 0bf6b30..b8e28289 100644 --- a/chrome/browser/ash/login/session/user_session_initializer.cc +++ b/chrome/browser/ash/login/session/user_session_initializer.cc
@@ -23,6 +23,7 @@ #include "chrome/browser/ash/child_accounts/screen_time_controller_factory.h" #include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/ash/eche_app/eche_app_manager_factory.h" +#include "chrome/browser/ash/guest_os/guest_os_session_tracker.h" #include "chrome/browser/ash/lock_screen_apps/state_controller.h" #include "chrome/browser/ash/login/startup_utils.h" #include "chrome/browser/ash/phonehub/phone_hub_manager_factory.h" @@ -227,6 +228,7 @@ } arc::ArcServiceLauncher::Get()->OnPrimaryUserProfilePrepared(profile); + guest_os::GuestOsSessionTracker::GetForProfile(profile); crostini::CrostiniManager* crostini_manager = crostini::CrostiniManager::GetForProfile(profile);
diff --git a/chrome/browser/ash/net/network_health/network_health_manager.cc b/chrome/browser/ash/net/network_health/network_health_manager.cc index 1094106e..cc888788 100644 --- a/chrome/browser/ash/net/network_health/network_health_manager.cc +++ b/chrome/browser/ash/net/network_health/network_health_manager.cc
@@ -7,14 +7,15 @@ #include "base/no_destructor.h" #include "chrome/browser/ash/net/network_diagnostics/network_diagnostics.h" #include "chromeos/ash/components/dbus/debug_daemon/debug_daemon_client.h" +#include "chromeos/services/network_health/in_process_instance.h" #include "chromeos/services/network_health/network_health_service.h" namespace ash { namespace network_health { NetworkHealthManager::NetworkHealthManager() { - network_health_service_ = - std::make_unique<chromeos::network_health::NetworkHealthService>(); + // Ensure that the NetworkHealthService instance is running. + chromeos::network_health::GetInProcessInstance(); network_diagnostics_ = std::make_unique<network_diagnostics::NetworkDiagnostics>( DebugDaemonClient::Get()); @@ -41,7 +42,8 @@ void NetworkHealthManager::BindHealthReceiver( mojo::PendingReceiver<chromeos::network_health::mojom::NetworkHealthService> receiver) { - network_health_service_->BindReceiver(std::move(receiver)); + chromeos::network_health::GetInProcessInstance()->BindReceiver( + std::move(receiver)); } void NetworkHealthManager::BindDiagnosticsReceiver( @@ -54,7 +56,8 @@ void NetworkHealthManager::AddObserver( mojo::PendingRemote<chromeos::network_health::mojom::NetworkEventsObserver> observer) { - network_health_service_->AddObserver(std::move(observer)); + chromeos::network_health::GetInProcessInstance()->AddObserver( + std::move(observer)); } NetworkHealthManager* NetworkHealthManager::GetInstance() {
diff --git a/chrome/browser/ash/net/network_health/network_health_manager.h b/chrome/browser/ash/net/network_health/network_health_manager.h index 3bdc5b1d..6da030e 100644 --- a/chrome/browser/ash/net/network_health/network_health_manager.h +++ b/chrome/browser/ash/net/network_health/network_health_manager.h
@@ -47,8 +47,6 @@ chromeos::network_health::mojom::NetworkEventsObserver> observer); private: - std::unique_ptr<chromeos::network_health::NetworkHealthService> - network_health_service_; std::unique_ptr<network_diagnostics::NetworkDiagnostics> network_diagnostics_; };
diff --git a/chrome/browser/chromeos/reporting/metric_default_utils.h b/chrome/browser/chromeos/reporting/metric_default_utils.h index 963ca40..f815a4c 100644 --- a/chrome/browser/chromeos/reporting/metric_default_utils.h +++ b/chrome/browser/chromeos/reporting/metric_default_utils.h
@@ -11,7 +11,7 @@ // Default audio telemetry collection rate. constexpr base::TimeDelta kDefaultAudioTelemetryCollectionRate = - base::Minutes(10); + base::Minutes(15); // Default metric collection rate used for testing purposes. constexpr base::TimeDelta kDefaultCollectionRateForTesting = base::Minutes(2);
diff --git a/chrome/browser/commerce/price_tracking/android/java/src/org/chromium/chrome/browser/price_tracking/PriceTrackingButtonController.java b/chrome/browser/commerce/price_tracking/android/java/src/org/chromium/chrome/browser/price_tracking/PriceTrackingButtonController.java index 7daba3d..cdc5f12 100644 --- a/chrome/browser/commerce/price_tracking/android/java/src/org/chromium/chrome/browser/price_tracking/PriceTrackingButtonController.java +++ b/chrome/browser/commerce/price_tracking/android/java/src/org/chromium/chrome/browser/price_tracking/PriceTrackingButtonController.java
@@ -15,6 +15,10 @@ import org.chromium.chrome.browser.toolbar.BaseButtonDataProvider; import org.chromium.chrome.browser.toolbar.adaptive.AdaptiveToolbarFeatures.AdaptiveToolbarButtonVariant; import org.chromium.chrome.browser.user_education.IPHCommandBuilder; +import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; +import org.chromium.components.browser_ui.bottomsheet.BottomSheetController.SheetState; +import org.chromium.components.browser_ui.bottomsheet.BottomSheetObserver; +import org.chromium.components.browser_ui.bottomsheet.EmptyBottomSheetObserver; import org.chromium.components.feature_engagement.FeatureConstants; import org.chromium.ui.modaldialog.ModalDialogManager; @@ -24,17 +28,29 @@ */ public class PriceTrackingButtonController extends BaseButtonDataProvider { private final Supplier<TabBookmarker> mTabBookmarkerSupplier; + private final BottomSheetController mBottomSheetController; + private final BottomSheetObserver mBottomSheetObserver; /** Constructor. */ public PriceTrackingButtonController(ObservableSupplier<Tab> tabSupplier, - ModalDialogManager modalDialogManager, Drawable buttonDrawable, - Supplier<TabBookmarker> tabBookmarkerSupplier) { + ModalDialogManager modalDialogManager, BottomSheetController bottomSheetController, + Drawable buttonDrawable, Supplier<TabBookmarker> tabBookmarkerSupplier) { super(tabSupplier, modalDialogManager, buttonDrawable, R.string.enable_price_tracking_menu_item, /* actionChipLabelResId= */ R.string.enable_price_tracking_menu_item, /*supportsTinting=*/true, /*iphCommandBuilder*/ null, AdaptiveToolbarButtonVariant.PRICE_TRACKING); mTabBookmarkerSupplier = tabBookmarkerSupplier; + mBottomSheetController = bottomSheetController; + + mBottomSheetObserver = new EmptyBottomSheetObserver() { + @Override + public void onSheetStateChanged(int newState, int reason) { + mButtonData.setEnabled(newState == SheetState.HIDDEN); + notifyObservers(mButtonData.canShow()); + } + }; + mBottomSheetController.addObserver(mBottomSheetObserver); } @Override
diff --git a/chrome/browser/commerce/price_tracking/android/javatests/src/org/chromium/chrome/browser/price_tracking/PriceTrackingButtonControllerUnitTest.java b/chrome/browser/commerce/price_tracking/android/javatests/src/org/chromium/chrome/browser/price_tracking/PriceTrackingButtonControllerUnitTest.java new file mode 100644 index 0000000..8224ab9e --- /dev/null +++ b/chrome/browser/commerce/price_tracking/android/javatests/src/org/chromium/chrome/browser/price_tracking/PriceTrackingButtonControllerUnitTest.java
@@ -0,0 +1,179 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.price_tracking; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import android.app.Activity; +import android.graphics.drawable.Drawable; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.robolectric.Robolectric; +import org.robolectric.annotation.Config; + +import org.chromium.base.FeatureList; +import org.chromium.base.supplier.ObservableSupplier; +import org.chromium.base.supplier.Supplier; +import org.chromium.base.test.BaseRobolectricTestRunner; +import org.chromium.chrome.R; +import org.chromium.chrome.browser.bookmarks.TabBookmarker; +import org.chromium.chrome.browser.flags.ChromeFeatureList; +import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.toolbar.ButtonData; +import org.chromium.chrome.browser.toolbar.ButtonDataProvider; +import org.chromium.chrome.test.util.browser.Features; +import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; +import org.chromium.components.browser_ui.bottomsheet.BottomSheetController.SheetState; +import org.chromium.components.browser_ui.bottomsheet.BottomSheetController.StateChangeReason; +import org.chromium.components.browser_ui.bottomsheet.BottomSheetObserver; +import org.chromium.ui.modaldialog.ModalDialogManager; + +/** + * Unit test for {@link PriceTrackingButtonController}. + */ +@RunWith(BaseRobolectricTestRunner.class) +@Config(manifest = Config.NONE) +@Features.EnableFeatures({ChromeFeatureList.CONTEXTUAL_PAGE_ACTION_PRICE_TRACKING, + ChromeFeatureList.ADAPTIVE_BUTTON_IN_TOP_TOOLBAR_CUSTOMIZATION_V2}) +public class PriceTrackingButtonControllerUnitTest { + @Rule + public TestRule mFeaturesProcessor = new Features.JUnitProcessor(); + + private Activity mActivity; + @Mock + private Tab mMockTab; + @Mock + private ObservableSupplier<Tab> mMockTabSupplier; + @Mock + private Supplier<TabBookmarker> mMockTabBookmarkerSupplier; + @Mock + private TabBookmarker mMockTabBookmarker; + @Mock + private BottomSheetController mMockBottomSheetController; + @Mock + private ModalDialogManager mMockModalDialogManager; + @Captor + private ArgumentCaptor<BottomSheetObserver> mBottomSheetObserverCaptor; + + @Before + public void setUp() { + mActivity = Robolectric.setupActivity(Activity.class); + mActivity.setTheme(R.style.Theme_BrowserUI_DayNight); + + MockitoAnnotations.initMocks(this); + + when(mMockTab.getContext()).thenReturn(mActivity); + when(mMockTabSupplier.get()).thenReturn(mMockTab); + when(mMockTabBookmarkerSupplier.get()).thenReturn(mMockTabBookmarker); + } + + @Test + public void testButtonData_QuietVariation() { + PriceTrackingButtonController priceTrackingButtonController = + new PriceTrackingButtonController(mMockTabSupplier, mMockModalDialogManager, + mMockBottomSheetController, mock(Drawable.class), + mMockTabBookmarkerSupplier); + ButtonData buttonData = priceTrackingButtonController.get(mMockTab); + + // Quiet variation uses an IPHCommandBuilder to highlight the action. + Assert.assertNotNull(buttonData.getButtonSpec().getIPHCommandBuilder()); + } + + @Test + public void testButtonData_ActionChipVariation() { + FeatureList.TestValues testValues = new FeatureList.TestValues(); + testValues.addFeatureFlagOverride(ChromeFeatureList.CONTEXTUAL_PAGE_ACTIONS, true); + testValues.addFieldTrialParamOverride( + ChromeFeatureList.CONTEXTUAL_PAGE_ACTIONS, "action_chip", "true"); + testValues.addFeatureFlagOverride( + ChromeFeatureList.ADAPTIVE_BUTTON_IN_TOP_TOOLBAR_CUSTOMIZATION_V2, true); + FeatureList.setTestValues(testValues); + + PriceTrackingButtonController priceTrackingButtonController = + new PriceTrackingButtonController(mMockTabSupplier, mMockModalDialogManager, + mMockBottomSheetController, mock(Drawable.class), + mMockTabBookmarkerSupplier); + ButtonData buttonData = priceTrackingButtonController.get(mMockTab); + + // Action chip variation should not set an IPH command builder. + Assert.assertNull(buttonData.getButtonSpec().getIPHCommandBuilder()); + } + + @Test + public void testPriceTrackingButtonClick() { + PriceTrackingButtonController priceTrackingButtonController = + new PriceTrackingButtonController(mMockTabSupplier, mMockModalDialogManager, + mMockBottomSheetController, mock(Drawable.class), + mMockTabBookmarkerSupplier); + ButtonData buttonData = priceTrackingButtonController.get(mMockTab); + + buttonData.getButtonSpec().getOnClickListener().onClick(null); + + verify(mMockTabBookmarker).startOrModifyPriceTracking(mMockTab); + } + + @Test + public void testPriceTrackingButton_IsDisabledWhenBottomSheetAppears() { + PriceTrackingButtonController priceTrackingButtonController = + new PriceTrackingButtonController(mMockTabSupplier, mMockModalDialogManager, + mMockBottomSheetController, mock(Drawable.class), + mMockTabBookmarkerSupplier); + ButtonDataProvider.ButtonDataObserver buttonDataObserver = + Mockito.mock(ButtonDataProvider.ButtonDataObserver.class); + priceTrackingButtonController.addObserver(buttonDataObserver); + ButtonData buttonData = priceTrackingButtonController.get(mMockTab); + + // The controller should have registered an observer to listen to bottom sheet events. + verify(mMockBottomSheetController).addObserver(mBottomSheetObserverCaptor.capture()); + + mBottomSheetObserverCaptor.getValue().onSheetStateChanged( + SheetState.FULL, StateChangeReason.NONE); + + Assert.assertFalse(buttonData.isEnabled()); + verify(buttonDataObserver).buttonDataChanged(true); + } + + @Test + public void testPriceTrackingButton_IsReenabledWhenBottomSheetDismissed() { + PriceTrackingButtonController priceTrackingButtonController = + new PriceTrackingButtonController(mMockTabSupplier, mMockModalDialogManager, + mMockBottomSheetController, mock(Drawable.class), + mMockTabBookmarkerSupplier); + + ButtonDataProvider.ButtonDataObserver buttonDataObserver = + Mockito.mock(ButtonDataProvider.ButtonDataObserver.class); + priceTrackingButtonController.addObserver(buttonDataObserver); + ButtonData buttonData = priceTrackingButtonController.get(mMockTab); + + // The controller should have registered an observer to listen to bottom sheet events. + verify(mMockBottomSheetController).addObserver(mBottomSheetObserverCaptor.capture()); + + // Show bottom sheet to disable button. + mBottomSheetObserverCaptor.getValue().onSheetStateChanged( + SheetState.FULL, StateChangeReason.NONE); + + // Close the bottom sheet, button should be enabled again. + mBottomSheetObserverCaptor.getValue().onSheetStateChanged( + SheetState.HIDDEN, StateChangeReason.NONE); + + // After the bottom sheet is closed the button should be enabled. + Assert.assertTrue(buttonData.isEnabled()); + // We should have notified of changes twice (when disabled and when enabled again). + verify(buttonDataObserver, times(2)).buttonDataChanged(true); + } +}
diff --git a/chrome/browser/commerce/price_tracking/android/test_java_sources.gni b/chrome/browser/commerce/price_tracking/android/test_java_sources.gni index f54d7a7..665fa0f1 100644 --- a/chrome/browser/commerce/price_tracking/android/test_java_sources.gni +++ b/chrome/browser/commerce/price_tracking/android/test_java_sources.gni
@@ -9,5 +9,6 @@ price_tracking_junit_test_java_sources = [ "//chrome/browser/commerce/price_tracking/android/javatests/src/org/chromium/chrome/browser/price_tracking/PriceDropNotifierUnitTest.java", + "//chrome/browser/commerce/price_tracking/android/javatests/src/org/chromium/chrome/browser/price_tracking/PriceTrackingButtonControllerUnitTest.java", "//chrome/browser/commerce/price_tracking/android/javatests/src/org/chromium/chrome/browser/price_tracking/PriceTrackingNotificationBridgeUnitTest.java", ]
diff --git a/chrome/browser/extensions/api/web_request/web_request_apitest.cc b/chrome/browser/extensions/api/web_request/web_request_apitest.cc index 649d64ec..fc0cbd28 100644 --- a/chrome/browser/extensions/api/web_request/web_request_apitest.cc +++ b/chrome/browser/extensions/api/web_request/web_request_apitest.cc
@@ -709,10 +709,7 @@ ASSERT_EQ(*cookie_value, "cookieValue"); } -// This test times out regularly on ASAN/MSAN trybots. See -// https://crbug.com/733395. -// TODO(crbug.com/1177120) Re-enable test -IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, DISABLED_WebRequestTypes) { +IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, WebRequestTypes) { ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("webrequest/test_types")) << message_; }
diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc index bfab38f..9162244c 100644 --- a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc +++ b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
@@ -757,7 +757,10 @@ } } #endif // BUILDFLAG(ENABLE_SUPERVISED_USERS) - HandleInstallProceed(); + bool withhold_permissions = + payload.result == + ExtensionInstallPrompt::Result::ACCEPTED_AND_OPTION_CHECKED; + HandleInstallProceed(withhold_permissions); break; } case ExtensionInstallPrompt::Result::USER_CANCELED: @@ -798,7 +801,8 @@ Release(); } -void WebstorePrivateBeginInstallWithManifest3Function::HandleInstallProceed() { +void WebstorePrivateBeginInstallWithManifest3Function::HandleInstallProceed( + bool withhold_permissions) { // This gets cleared in CrxInstaller::ConfirmInstall(). TODO(asargent) - in // the future we may also want to add time-based expiration, where an // allowlist entry is only valid for some number of minutes. @@ -812,6 +816,7 @@ approval->dummy_extension = dummy_extension_.get(); approval->installing_icon = gfx::ImageSkia::CreateFrom1xBitmap(icon_); approval->bypassed_safebrowsing_friction = friction_dialog_shown_; + approval->withhold_permissions = withhold_permissions; if (details().authuser) approval->authuser = *details().authuser; g_pending_approvals.Get().PushApproval(std::move(approval));
diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_api.h b/chrome/browser/extensions/api/webstore_private/webstore_private_api.h index 72b8032..973eeb2 100644 --- a/chrome/browser/extensions/api/webstore_private/webstore_private_api.h +++ b/chrome/browser/extensions/api/webstore_private/webstore_private_api.h
@@ -110,7 +110,8 @@ void OnRequestPromptDone(ExtensionInstallPrompt::DoneCallbackPayload payload); void OnBlockByPolicyPromptDone(); - void HandleInstallProceed(); + // Permissions are granted by default. + void HandleInstallProceed(bool withhold_permissions = false); void HandleInstallAbort(bool user_initiated); ExtensionFunction::ResponseValue BuildResponse(
diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc index 028dcad..5710c38f 100644 --- a/chrome/browser/extensions/crx_installer.cc +++ b/chrome/browser/extensions/crx_installer.cc
@@ -56,6 +56,7 @@ #include "extensions/browser/policy_check.h" #include "extensions/browser/preload_check_group.h" #include "extensions/browser/requirements_checker.h" +#include "extensions/common/extension_features.h" #include "extensions/common/extension_icon_set.h" #include "extensions/common/extension_urls.h" #include "extensions/common/file_util.h" @@ -880,8 +881,8 @@ if (ExtensionPrefs::Get(profile())->AllowFileAccess(extension()->id())) creation_flags_ |= Extension::ALLOW_FILE_ACCESS; - if (withholding_behavior == kWithholdPermissions) - creation_flags_ |= Extension::WITHHOLD_PERMISSIONS; + if (withholding_behavior == WithholdingBehavior::kWithholdPermissions) + set_withhold_permissions(); ExtensionManagement* extension_management = ExtensionManagementFactory::GetForBrowserContext(profile()); @@ -1219,6 +1220,12 @@ return unpacker_task_runner_.get(); } +void CrxInstaller::set_withhold_permissions() { + DCHECK(base::FeatureList::IsEnabled( + extensions_features::kAllowWithholdingExtensionPermissionsOnInstall)); + creation_flags_ |= Extension::WITHHOLD_PERMISSIONS; +} + void CrxInstaller::set_installer_callback(InstallerResultCallback callback) { installer_callback_ = std::move(callback); }
diff --git a/chrome/browser/extensions/crx_installer.h b/chrome/browser/extensions/crx_installer.h index 4783afaf..86e289d 100644 --- a/chrome/browser/extensions/crx_installer.h +++ b/chrome/browser/extensions/crx_installer.h
@@ -196,6 +196,7 @@ else creation_flags_ &= ~Extension::FROM_WEBSTORE; } + void set_withhold_permissions(); // If |apps_require_extension_mime_type_| is set to true, be sure to set // |original_mime_type_| as well.
diff --git a/chrome/browser/extensions/extension_management_unittest.cc b/chrome/browser/extensions/extension_management_unittest.cc index 95c6c9f..5381293 100644 --- a/chrome/browser/extensions/extension_management_unittest.cc +++ b/chrome/browser/extensions/extension_management_unittest.cc
@@ -356,7 +356,6 @@ bool BlocklistedByDefault(const base::Value::List* blocklist); bool UserMayLoad(const base::Value::List* blocklist, const base::Value::List* allowlist, - const base::DictionaryValue* forcelist, const base::Value::List* allowed_types, const Extension* extension, std::u16string* error); @@ -383,7 +382,6 @@ bool ExtensionAdminPolicyTest::UserMayLoad( const base::Value::List* blocklist, const base::Value::List* allowlist, - const base::DictionaryValue* forcelist, const base::Value::List* allowed_types, const Extension* extension, std::u16string* error) { @@ -394,8 +392,6 @@ if (allowlist) SetPref(true, pref_names::kInstallAllowList, base::Value(allowlist->Clone())); - if (forcelist) - SetPref(true, pref_names::kInstallForceList, forcelist->CreateDeepCopy()); if (allowed_types) SetPref(true, pref_names::kAllowedTypes, base::Value(allowed_types->Clone())); @@ -1138,35 +1134,34 @@ // Tests UserMayLoad for required extensions. TEST_F(ExtensionAdminPolicyTest, UserMayLoadRequired) { CreateExtension(ManifestLocation::kComponent); - EXPECT_TRUE(UserMayLoad(nullptr, nullptr, nullptr, nullptr, extension_.get(), - nullptr)); + EXPECT_TRUE( + UserMayLoad(nullptr, nullptr, nullptr, extension_.get(), nullptr)); std::u16string error; - EXPECT_TRUE(UserMayLoad(nullptr, nullptr, nullptr, nullptr, extension_.get(), - &error)); + EXPECT_TRUE(UserMayLoad(nullptr, nullptr, nullptr, extension_.get(), &error)); EXPECT_TRUE(error.empty()); // Required extensions may load even if they're on the blocklist. base::Value::List blocklist; blocklist.Append(extension_->id()); - EXPECT_TRUE(UserMayLoad(&blocklist, nullptr, nullptr, nullptr, - extension_.get(), nullptr)); + EXPECT_TRUE( + UserMayLoad(&blocklist, nullptr, nullptr, extension_.get(), nullptr)); blocklist.Append("*"); - EXPECT_TRUE(UserMayLoad(&blocklist, nullptr, nullptr, nullptr, - extension_.get(), nullptr)); + EXPECT_TRUE( + UserMayLoad(&blocklist, nullptr, nullptr, extension_.get(), nullptr)); } // Tests UserMayLoad when no blocklist exists, or it's empty. TEST_F(ExtensionAdminPolicyTest, UserMayLoadNoBlocklist) { CreateExtension(ManifestLocation::kInternal); - EXPECT_TRUE(UserMayLoad(nullptr, nullptr, nullptr, nullptr, extension_.get(), - nullptr)); + EXPECT_TRUE( + UserMayLoad(nullptr, nullptr, nullptr, extension_.get(), nullptr)); base::Value::List blocklist; - EXPECT_TRUE(UserMayLoad(&blocklist, nullptr, nullptr, nullptr, - extension_.get(), nullptr)); + EXPECT_TRUE( + UserMayLoad(&blocklist, nullptr, nullptr, extension_.get(), nullptr)); std::u16string error; - EXPECT_TRUE(UserMayLoad(&blocklist, nullptr, nullptr, nullptr, - extension_.get(), &error)); + EXPECT_TRUE( + UserMayLoad(&blocklist, nullptr, nullptr, extension_.get(), &error)); EXPECT_TRUE(error.empty()); } @@ -1176,16 +1171,16 @@ base::Value::List allowlist; allowlist.Append(extension_->id()); - EXPECT_TRUE(UserMayLoad(nullptr, &allowlist, nullptr, nullptr, - extension_.get(), nullptr)); + EXPECT_TRUE( + UserMayLoad(nullptr, &allowlist, nullptr, extension_.get(), nullptr)); base::Value::List blocklist; blocklist.Append(extension_->id()); - EXPECT_TRUE(UserMayLoad(nullptr, &allowlist, nullptr, nullptr, - extension_.get(), nullptr)); + EXPECT_TRUE( + UserMayLoad(nullptr, &allowlist, nullptr, extension_.get(), nullptr)); std::u16string error; - EXPECT_TRUE(UserMayLoad(nullptr, &allowlist, nullptr, nullptr, - extension_.get(), &error)); + EXPECT_TRUE( + UserMayLoad(nullptr, &allowlist, nullptr, extension_.get(), &error)); EXPECT_TRUE(error.empty()); } @@ -1196,52 +1191,52 @@ // Blocklisted by default. base::Value::List blocklist; blocklist.Append("*"); - EXPECT_FALSE(UserMayLoad(&blocklist, nullptr, nullptr, nullptr, - extension_.get(), nullptr)); + EXPECT_FALSE( + UserMayLoad(&blocklist, nullptr, nullptr, extension_.get(), nullptr)); std::u16string error; - EXPECT_FALSE(UserMayLoad(&blocklist, nullptr, nullptr, nullptr, - extension_.get(), &error)); + EXPECT_FALSE( + UserMayLoad(&blocklist, nullptr, nullptr, extension_.get(), &error)); EXPECT_FALSE(error.empty()); // Extension on the blocklist, with and without wildcard. blocklist.Append(extension_->id()); - EXPECT_FALSE(UserMayLoad(&blocklist, nullptr, nullptr, nullptr, - extension_.get(), nullptr)); + EXPECT_FALSE( + UserMayLoad(&blocklist, nullptr, nullptr, extension_.get(), nullptr)); blocklist.clear(); blocklist.Append(extension_->id()); - EXPECT_FALSE(UserMayLoad(&blocklist, nullptr, nullptr, nullptr, - extension_.get(), nullptr)); + EXPECT_FALSE( + UserMayLoad(&blocklist, nullptr, nullptr, extension_.get(), nullptr)); // With a allowlist. There's no such thing as a allowlist wildcard. base::Value::List allowlist; allowlist.Append("behllobkkfkfnphdnhnkndlbkcpglgmj"); - EXPECT_FALSE(UserMayLoad(&blocklist, &allowlist, nullptr, nullptr, - extension_.get(), nullptr)); + EXPECT_FALSE( + UserMayLoad(&blocklist, &allowlist, nullptr, extension_.get(), nullptr)); allowlist.Append("*"); - EXPECT_FALSE(UserMayLoad(&blocklist, &allowlist, nullptr, nullptr, - extension_.get(), nullptr)); + EXPECT_FALSE( + UserMayLoad(&blocklist, &allowlist, nullptr, extension_.get(), nullptr)); } TEST_F(ExtensionAdminPolicyTest, UserMayLoadAllowedTypes) { CreateExtension(ManifestLocation::kInternal); - EXPECT_TRUE(UserMayLoad(nullptr, nullptr, nullptr, nullptr, extension_.get(), - nullptr)); + EXPECT_TRUE( + UserMayLoad(nullptr, nullptr, nullptr, extension_.get(), nullptr)); base::Value::List allowed_types; - EXPECT_FALSE(UserMayLoad(nullptr, nullptr, nullptr, &allowed_types, - extension_.get(), nullptr)); + EXPECT_FALSE( + UserMayLoad(nullptr, nullptr, &allowed_types, extension_.get(), nullptr)); allowed_types.Append(Manifest::TYPE_EXTENSION); - EXPECT_TRUE(UserMayLoad(nullptr, nullptr, nullptr, &allowed_types, - extension_.get(), nullptr)); + EXPECT_TRUE( + UserMayLoad(nullptr, nullptr, &allowed_types, extension_.get(), nullptr)); CreateHostedApp(ManifestLocation::kInternal); - EXPECT_FALSE(UserMayLoad(nullptr, nullptr, nullptr, &allowed_types, - extension_.get(), nullptr)); + EXPECT_FALSE( + UserMayLoad(nullptr, nullptr, &allowed_types, extension_.get(), nullptr)); CreateHostedApp(ManifestLocation::kExternalPolicyDownload); - EXPECT_FALSE(UserMayLoad(nullptr, nullptr, nullptr, &allowed_types, - extension_.get(), nullptr)); + EXPECT_FALSE( + UserMayLoad(nullptr, nullptr, &allowed_types, extension_.get(), nullptr)); } TEST_F(ExtensionAdminPolicyTest, UserMayModifySettings) {
diff --git a/chrome/browser/extensions/webstore_installer.cc b/chrome/browser/extensions/webstore_installer.cc index a71eb2f..1a03d83f 100644 --- a/chrome/browser/extensions/webstore_installer.cc +++ b/chrome/browser/extensions/webstore_installer.cc
@@ -716,6 +716,8 @@ crx_installer_->set_allow_silent_install(true); crx_installer_->set_installer_callback(base::BindOnce( &WebstoreInstaller::OnInstallerDone, weak_ptr_factory_.GetWeakPtr())); + if (approval->withhold_permissions) + crx_installer_->set_withhold_permissions(); crx_installer_->InstallCrx(download.GetFullPath()); }
diff --git a/chrome/browser/extensions/webstore_installer.h b/chrome/browser/extensions/webstore_installer.h index c8b9026..0d6e7e9 100644 --- a/chrome/browser/extensions/webstore_installer.h +++ b/chrome/browser/extensions/webstore_installer.h
@@ -166,6 +166,10 @@ // the user has enabled Enhanced Protection. bool bypassed_safebrowsing_friction = false; + // Whether to withhold permissions at installation. By default, permissions + // are granted at installation. + bool withhold_permissions = false; + private: Approval(); };
diff --git a/chrome/browser/extensions/webstore_installer_browsertest.cc b/chrome/browser/extensions/webstore_installer_browsertest.cc index 43b6d0f..aea77d5 100644 --- a/chrome/browser/extensions/webstore_installer_browsertest.cc +++ b/chrome/browser/extensions/webstore_installer_browsertest.cc
@@ -4,32 +4,35 @@ #include "chrome/browser/extensions/webstore_installer.h" +#include <memory> #include <utility> -#include "base/bind.h" #include "base/run_loop.h" #include "chrome/browser/extensions/extension_service.h" +#include "chrome/browser/extensions/scripting_permissions_modifier.h" #include "chrome/browser/extensions/webstore_installer_test.h" -#include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/tabs/tab_strip_model.h" -#include "chrome/common/extensions/webstore_install_result.h" #include "content/public/test/browser_test.h" #include "extensions/browser/extension_registry.h" +#include "extensions/browser/permissions_manager.h" #include "extensions/common/extension.h" #include "extensions/common/extension_builder.h" +#include "extensions/common/extension_features.h" #include "extensions/common/value_builder.h" namespace extensions { namespace { -const char kExtensionName[] = "InstallerExtension"; const char kWebstoreDomain[] = "cws.com"; const char kAppDomain[] = "app.com"; const char kNonAppDomain[] = "nonapp.com"; const char kTestExtensionId[] = "ecglahbcnmdpdciemllbhojghbkagdje"; +const char kTestExtensionWithPermissionsId[] = + "lpbboafeefjeccjhdhcfdibnjcecpmhd"; const char kTestDataPath[] = "extensions/api_test/webstore_inline_install"; const char kCrxFilename[] = "extension.crx"; +const char kCrxWithPermissionsFilename[] = + "extension_with_host_permissions.crx"; } // namespace @@ -66,14 +69,17 @@ : public WebstoreInstallerTest, public WebstoreInstaller::Delegate { public: - WebstoreInstallerBrowserTest() - : WebstoreInstallerTest( - kWebstoreDomain, - kTestDataPath, - kCrxFilename, - kAppDomain, - kNonAppDomain) {} - ~WebstoreInstallerBrowserTest() override {} + WebstoreInstallerBrowserTest(const std::string& webstore_domain, + const std::string& test_data_path, + const std::string& crx_filename, + const std::string& verified_domain, + const std::string& unverified_domain) + : WebstoreInstallerTest(webstore_domain, + test_data_path, + crx_filename, + verified_domain, + unverified_domain) {} + ~WebstoreInstallerBrowserTest() override = default; void SetDoneClosure(base::OnceClosure done_closure) { done_closure_ = std::move(done_closure); @@ -83,51 +89,52 @@ // Overridden from WebstoreInstaller::Delegate: void OnExtensionDownloadStarted(const std::string& id, - download::DownloadItem* item) override; + download::DownloadItem* item) override {} void OnExtensionDownloadProgress(const std::string& id, - download::DownloadItem* item) override; - void OnExtensionInstallSuccess(const std::string& id) override; + download::DownloadItem* item) override {} + void OnExtensionInstallSuccess(const std::string& id) override { + success_ = true; + std::move(done_closure_).Run(); + } void OnExtensionInstallFailure( const std::string& id, const std::string& error, - WebstoreInstaller::FailureReason reason) override; + WebstoreInstaller::FailureReason reason) override { + success_ = false; + std::move(done_closure_).Run(); + } private: base::OnceClosure done_closure_; bool success_; }; -void WebstoreInstallerBrowserTest::OnExtensionDownloadStarted( - const std::string& id, - download::DownloadItem* item) {} +class WebstoreInstallerMV2BrowserTest : public WebstoreInstallerBrowserTest { + public: + WebstoreInstallerMV2BrowserTest() + : WebstoreInstallerBrowserTest(kWebstoreDomain, + kTestDataPath, + kCrxFilename, + kAppDomain, + kNonAppDomain) {} + ~WebstoreInstallerMV2BrowserTest() override = default; -void WebstoreInstallerBrowserTest::OnExtensionDownloadProgress( - const std::string& id, - download::DownloadItem* item) {} + // The manifest used by the test installer must match `kCrxFilename` manifest + // in the test directory. + std::unique_ptr<base::DictionaryValue> GetManifest() { + std::unique_ptr<base::DictionaryValue> manifest( + DictionaryBuilder() + .Set("name", "Installer Extension") + .Set("manifest_version", 2) + .Set("version", "1.0") + .Set("permissions", ListBuilder().Append("tabs").Build()) + .Build()); + return manifest; + } +}; -void WebstoreInstallerBrowserTest::OnExtensionInstallSuccess( - const std::string& id) { - success_ = true; - std::move(done_closure_).Run(); -} - -void WebstoreInstallerBrowserTest::OnExtensionInstallFailure( - const std::string& id, - const std::string& error, - WebstoreInstaller::FailureReason reason) { - success_ = false; - std::move(done_closure_).Run(); -} - -IN_PROC_BROWSER_TEST_F(WebstoreInstallerBrowserTest, WebstoreInstall) { - std::unique_ptr<base::DictionaryValue> manifest( - DictionaryBuilder() - .Set("name", kExtensionName) - .Set("description", "Foo") - .Set("manifest_version", 2) - .Set("version", "1.0") - .Set("permissions", ListBuilder().Append("tabs").Build()) - .Build()); +IN_PROC_BROWSER_TEST_F(WebstoreInstallerMV2BrowserTest, WebstoreInstall) { + std::unique_ptr<base::DictionaryValue> manifest = GetManifest(); content::WebContents* active_web_contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -152,15 +159,8 @@ ASSERT_TRUE(registry->enabled_extensions().GetByID(kTestExtensionId)); } -IN_PROC_BROWSER_TEST_F(WebstoreInstallerBrowserTest, SimultaneousInstall) { - std::unique_ptr<base::DictionaryValue> manifest( - DictionaryBuilder() - .Set("name", kExtensionName) - .Set("description", "Foo") - .Set("manifest_version", 2) - .Set("version", "1.0") - .Set("permissions", ListBuilder().Append("tabs").Build()) - .Build()); +IN_PROC_BROWSER_TEST_F(WebstoreInstallerMV2BrowserTest, SimultaneousInstall) { + std::unique_ptr<base::DictionaryValue> manifest = GetManifest(); content::WebContents* active_web_contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -208,4 +208,88 @@ ASSERT_TRUE(registry->disabled_extensions().GetByID(kTestExtensionId)); } +class WebstoreInstallerWithWithholdingUIBrowserTest + : public WebstoreInstallerBrowserTest, + public testing::WithParamInterface<bool> { + public: + WebstoreInstallerWithWithholdingUIBrowserTest() + : WebstoreInstallerBrowserTest(kWebstoreDomain, + kTestDataPath, + kCrxWithPermissionsFilename, + kAppDomain, + kNonAppDomain) { + feature_list_.InitAndEnableFeature( + extensions_features::kAllowWithholdingExtensionPermissionsOnInstall); + } + ~WebstoreInstallerWithWithholdingUIBrowserTest() override = default; + + // Th manifest used by the test installer must match + // `kCrxWithPermissionsFilename` manifest in the test directory. + std::unique_ptr<base::DictionaryValue> GetManifest() { + std::unique_ptr<base::DictionaryValue> manifest( + DictionaryBuilder() + .Set("name", "Installer Extension") + .Set("manifest_version", 3) + .Set("version", "1.0") + .Set("host_permissions", ListBuilder().Append("<all_urls>").Build()) + .Build()); + return manifest; + } + + private: + base::test::ScopedFeatureList feature_list_; +}; + +// Tests host permissions are withheld at installation only when the checkbox is +// selected. +IN_PROC_BROWSER_TEST_P(WebstoreInstallerWithWithholdingUIBrowserTest, + WithholdingHostsOnInstall) { + bool should_check_box = GetParam(); + std::unique_ptr<base::DictionaryValue> manifest = GetManifest(); + + content::WebContents* active_web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); + ASSERT_TRUE(active_web_contents); + + // Create an approval with the check box selection. + std::unique_ptr<WebstoreInstaller::Approval> approval = + WebstoreInstaller::Approval::CreateWithNoInstallPrompt( + browser()->profile(), kTestExtensionWithPermissionsId, + std::move(manifest), false); + if (should_check_box) + approval->withhold_permissions = true; + + // Create and run a WebstoreInstaller. + base::RunLoop run_loop; + SetDoneClosure(run_loop.QuitClosure()); + TestWebstoreInstaller* installer = new TestWebstoreInstaller( + browser()->profile(), this, active_web_contents, + kTestExtensionWithPermissionsId, std::move(approval), + WebstoreInstaller::INSTALL_SOURCE_OTHER); + installer->Start(); + run_loop.Run(); + + // Verify extension was installed. + EXPECT_TRUE(success()); + ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); + const Extension* extension = + registry->enabled_extensions().GetByID(kTestExtensionWithPermissionsId); + ASSERT_TRUE(extension); + + // Host permissions should be withheld only when the box was checked. + ScriptingPermissionsModifier modifier(browser()->profile(), extension); + EXPECT_EQ(modifier.HasWithheldHostPermissions(), should_check_box); + + // Access to google.com should be withheld only when the box was checked. + const PermissionsManager::ExtensionSiteAccess site_access = + PermissionsManager::Get(profile())->GetSiteAccess( + *extension, GURL("https://www.google.com")); + EXPECT_EQ(site_access.withheld_site_access, should_check_box); + EXPECT_EQ(site_access.has_site_access, !should_check_box); +} + +INSTANTIATE_TEST_SUITE_P(All, + WebstoreInstallerWithWithholdingUIBrowserTest, + testing::Bool()); + } // namespace extensions
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 27a1c21..f762c05 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -5540,7 +5540,7 @@ { "name": "per-desk-wallpaper", "owners": ["xiaohuic", "skau", "janetmac"], - "expiry_milestone": 107 + "expiry_milestone": 118 }, { "name": "performant-split-view-resizing", @@ -5636,7 +5636,7 @@ "johnidel", "jkarlin", "pauljensen"], - "expiry_milestone": 108 + "expiry_milestone": 112 }, { "name": "private-aggregation-developer-mode", @@ -6144,7 +6144,7 @@ { "name": "sharing-desktop-share-preview", "owners": ["ellyjones", "chrome-with-friends-robots@google.com"], - "expiry_milestone": 108 + "expiry_milestone": 111 }, { "name": "sharing-desktop-share-to-google-collections", @@ -6164,7 +6164,7 @@ { "name": "shelf-auto-hide-separation", "owners": [ "etuck", "//ash/shelf/OWNERS" ], - "expiry_milestone": 108 + "expiry_milestone": 112 }, { "name": "shelf-drag-to-pin", @@ -6346,7 +6346,7 @@ { "name": "smart-sorting-new-overflow-menu", "owners": [ "bwwilliams@google.com", "bling-flags@google.com" ], - "expiry_milestone": 108 + "expiry_milestone": 110 }, { "name": "smart-suggestion-for-large-downloads",
diff --git a/chrome/browser/media/media_engagement_score.cc b/chrome/browser/media/media_engagement_score.cc index 2a44784..f44a76b 100644 --- a/chrome/browser/media/media_engagement_score.cc +++ b/chrome/browser/media/media_engagement_score.cc
@@ -35,27 +35,26 @@ const double kHighScoreLowerThresholdParamDefault = 0.2; const double kHighScoreUpperThresholdParamDefault = 0.3; -std::unique_ptr<base::DictionaryValue> GetMediaEngagementScoreDictForSettings( +base::Value::Dict GetMediaEngagementScoreDictForSettings( const HostContentSettingsMap* settings, const url::Origin& origin) { if (!settings) - return std::make_unique<base::DictionaryValue>(); + return base::Value::Dict(); - std::unique_ptr<base::DictionaryValue> value = base::DictionaryValue::From( - content_settings::ToNullableUniquePtrValue(settings->GetWebsiteSetting( - origin.GetURL(), origin.GetURL(), - ContentSettingsType::MEDIA_ENGAGEMENT, nullptr))); + base::Value value = settings->GetWebsiteSetting( + origin.GetURL(), origin.GetURL(), ContentSettingsType::MEDIA_ENGAGEMENT, + nullptr); + if (value.is_dict()) + return std::move(value).TakeDict(); - if (value.get()) - return value; - return std::make_unique<base::DictionaryValue>(); + return base::Value::Dict(); } -void GetIntegerFromScore(base::DictionaryValue* dict, +void GetIntegerFromScore(const base::Value::Dict& dict, base::StringPiece key, int* out) { - if (base::Value* v = dict->FindKeyOfType(key, base::Value::Type::INTEGER)) - *out = v->GetInt(); + if (absl::optional<int> v = dict.FindInt(key)) + *out = v.value(); } } // namespace @@ -90,18 +89,14 @@ GetMediaEngagementScoreDictForSettings(settings, origin), settings) {} -MediaEngagementScore::MediaEngagementScore( - base::Clock* clock, - const url::Origin& origin, - std::unique_ptr<base::DictionaryValue> score_dict, - HostContentSettingsMap* settings) +MediaEngagementScore::MediaEngagementScore(base::Clock* clock, + const url::Origin& origin, + base::Value::Dict score_dict, + HostContentSettingsMap* settings) : origin_(origin), clock_(clock), - score_dict_(score_dict.release()), + score_dict_(std::move(score_dict)), settings_map_(settings) { - if (!score_dict_) - return; - // This is to prevent using previously saved data to mark an HTTP website as // allowed to autoplay. if (base::FeatureList::IsEnabled(media::kMediaEngagementHTTPSOnly) && @@ -109,18 +104,18 @@ return; } - GetIntegerFromScore(score_dict_.get(), kVisitsKey, &visits_); - GetIntegerFromScore(score_dict_.get(), kMediaPlaybacksKey, &media_playbacks_); + GetIntegerFromScore(score_dict_, kVisitsKey, &visits_); + GetIntegerFromScore(score_dict_, kMediaPlaybacksKey, &media_playbacks_); - if (base::Value* value = score_dict_->FindKeyOfType( - kHasHighScoreKey, base::Value::Type::BOOLEAN)) { - is_high_ = value->GetBool(); + if (absl::optional<bool> has_high_score = + score_dict_.FindBool(kHasHighScoreKey)) { + is_high_ = has_high_score.value(); } - if (base::Value* value = score_dict_->FindKeyOfType( - kLastMediaPlaybackTimeKey, base::Value::Type::DOUBLE)) { + if (absl::optional<double> last_time = + score_dict_.FindDouble(kLastMediaPlaybackTimeKey)) { last_media_playback_time_ = - base::Time::FromInternalValue(value->GetDouble()); + base::Time::FromInternalValue(last_time.value()); } // Recalculate the total score and high bit. If the high bit changed we @@ -163,8 +158,8 @@ base::Time::Now() + kScoreExpirationDuration}; settings_map_->SetWebsiteSettingDefaultScope( origin_.GetURL(), GURL(), ContentSettingsType::MEDIA_ENGAGEMENT, - content_settings::FromNullableUniquePtrValue(std::move(score_dict_)), - constraints); + base::Value(std::move(score_dict_)), constraints); + score_dict_.clear(); } void MediaEngagementScore::IncrementMediaPlaybacks() { @@ -178,28 +173,24 @@ double stored_last_media_playback_internal = 0; bool is_high = false; - if (!score_dict_) - return false; - // This is to prevent saving data that we would otherwise not use. if (base::FeatureList::IsEnabled(media::kMediaEngagementHTTPSOnly) && origin_.scheme() != url::kHttpsScheme) { return false; } - if (base::Value* value = score_dict_->FindKeyOfType( - kHasHighScoreKey, base::Value::Type::BOOLEAN)) { - is_high = value->GetBool(); + if (absl::optional<bool> has_high_score = + score_dict_.FindBool(kHasHighScoreKey)) { + is_high = has_high_score.value(); } - if (base::Value* value = score_dict_->FindKeyOfType( - kLastMediaPlaybackTimeKey, base::Value::Type::DOUBLE)) { - stored_last_media_playback_internal = value->GetDouble(); + if (absl::optional<double> last_time = + score_dict_.FindDouble(kLastMediaPlaybackTimeKey)) { + stored_last_media_playback_internal = last_time.value(); } - GetIntegerFromScore(score_dict_.get(), kVisitsKey, &stored_visits); - GetIntegerFromScore(score_dict_.get(), kMediaPlaybacksKey, - &stored_media_playbacks); + GetIntegerFromScore(score_dict_, kVisitsKey, &stored_visits); + GetIntegerFromScore(score_dict_, kMediaPlaybacksKey, &stored_media_playbacks); bool changed = stored_visits != visits() || stored_media_playbacks != media_playbacks() || @@ -210,23 +201,23 @@ if (!changed && !force_update) return false; - score_dict_->SetInteger(kVisitsKey, visits_); - score_dict_->SetInteger(kMediaPlaybacksKey, media_playbacks_); - score_dict_->SetDoubleKey(kLastMediaPlaybackTimeKey, - last_media_playback_time_.ToInternalValue()); - score_dict_->SetBoolean(kHasHighScoreKey, is_high_); + score_dict_.Set(kVisitsKey, visits_); + score_dict_.Set(kMediaPlaybacksKey, media_playbacks_); + score_dict_.Set(kLastMediaPlaybackTimeKey, + double(last_media_playback_time_.ToInternalValue())); + score_dict_.Set(kHasHighScoreKey, is_high_); // visitsWithMediaTag was deprecated in https://crbug.com/998687 and should // be removed if we see it in |score_dict_|. - score_dict_->RemoveKey("visitsWithMediaTag"); + score_dict_.Remove("visitsWithMediaTag"); // These keys were deprecated in https://crbug.com/998892 and should be // removed if we see it in |score_dict_|. - score_dict_->RemoveKey("audiblePlaybacks"); - score_dict_->RemoveKey("significantPlaybacks"); - score_dict_->RemoveKey("highScoreChanges"); - score_dict_->RemoveKey("mediaElementPlaybacks"); - score_dict_->RemoveKey("audioContextPlaybacks"); + score_dict_.Remove("audiblePlaybacks"); + score_dict_.Remove("significantPlaybacks"); + score_dict_.Remove("highScoreChanges"); + score_dict_.Remove("mediaElementPlaybacks"); + score_dict_.Remove("audioContextPlaybacks"); return true; }
diff --git a/chrome/browser/media/media_engagement_score.h b/chrome/browser/media/media_engagement_score.h index c04c2a6..3f74653 100644 --- a/chrome/browser/media/media_engagement_score.h +++ b/chrome/browser/media/media_engagement_score.h
@@ -5,8 +5,6 @@ #ifndef CHROME_BROWSER_MEDIA_MEDIA_ENGAGEMENT_SCORE_H_ #define CHROME_BROWSER_MEDIA_MEDIA_ENGAGEMENT_SCORE_H_ -#include <memory> - #include "base/memory/raw_ptr.h" #include "base/time/clock.h" #include "base/time/time.h" @@ -95,7 +93,7 @@ // Only used by the Media Engagement service when bulk loading data. MediaEngagementScore(base::Clock* clock, const url::Origin& origin, - std::unique_ptr<base::DictionaryValue> score_dict, + base::Value::Dict score_dict, HostContentSettingsMap* settings); static const char kScoreMinVisitsParamName[]; @@ -142,7 +140,7 @@ raw_ptr<base::Clock> clock_; // The dictionary that represents this engagement score. - std::unique_ptr<base::DictionaryValue> score_dict_; + base::Value::Dict score_dict_; // The content settings map that will persist the score, // has a lifetime of the Profile like the service which owns |this|.
diff --git a/chrome/browser/media/media_engagement_score_unittest.cc b/chrome/browser/media/media_engagement_score_unittest.cc index 3884212e..8a2656f 100644 --- a/chrome/browser/media/media_engagement_score_unittest.cc +++ b/chrome/browser/media/media_engagement_score_unittest.cc
@@ -83,7 +83,7 @@ } void TestScoreInitializesAndUpdates( - std::unique_ptr<base::DictionaryValue> score_dict, + base::Value::Dict score_dict, int expected_visits, int expected_media_playbacks, base::Time expected_last_media_playback_time, @@ -179,16 +179,15 @@ // Test that scores are read / written correctly from / to empty score // dictionaries. TEST_F(MediaEngagementScoreTest, EmptyDictionary) { - std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); - TestScoreInitializesAndUpdates(std::move(dict), 0, 0, base::Time(), false, + TestScoreInitializesAndUpdates(base::Value::Dict(), 0, 0, base::Time(), false, true); } // Test that scores are read / written correctly from / to partially empty // score dictionaries. TEST_F(MediaEngagementScoreTest, PartiallyEmptyDictionary) { - std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); - dict->SetInteger(MediaEngagementScore::kVisitsKey, 2); + base::Value::Dict dict; + dict.Set(MediaEngagementScore::kVisitsKey, int(2)); TestScoreInitializesAndUpdates(std::move(dict), 2, 0, base::Time(), false, true); @@ -197,12 +196,12 @@ // Test that scores are read / written correctly from / to populated score // dictionaries. TEST_F(MediaEngagementScoreTest, PopulatedDictionary) { - std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); - dict->SetInteger(MediaEngagementScore::kVisitsKey, 20); - dict->SetInteger(MediaEngagementScore::kMediaPlaybacksKey, 12); - dict->SetDoubleKey(MediaEngagementScore::kLastMediaPlaybackTimeKey, - test_clock.Now().ToInternalValue()); - dict->SetBoolean(MediaEngagementScore::kHasHighScoreKey, true); + base::Value::Dict dict; + dict.Set(MediaEngagementScore::kVisitsKey, int(20)); + dict.Set(MediaEngagementScore::kMediaPlaybacksKey, int(12)); + dict.Set(MediaEngagementScore::kLastMediaPlaybackTimeKey, + double(test_clock.Now().ToInternalValue())); + dict.Set(MediaEngagementScore::kHasHighScoreKey, true); TestScoreInitializesAndUpdates(std::move(dict), 20, 12, test_clock.Now(), true, true); @@ -249,17 +248,16 @@ // Store some example data in content settings. url::Origin origin = url::Origin::Create(GURL("https://www.google.com")); - std::unique_ptr<base::DictionaryValue> score_dict = - std::make_unique<base::DictionaryValue>(); - score_dict->SetInteger(MediaEngagementScore::kVisitsKey, example_num_visits); - score_dict->SetInteger(MediaEngagementScore::kMediaPlaybacksKey, - example_media_playbacks); - score_dict->SetDoubleKey(MediaEngagementScore::kLastMediaPlaybackTimeKey, - test_clock.Now().ToInternalValue()); - score_dict->SetBoolean(MediaEngagementScore::kHasHighScoreKey, false); + base::Value::Dict score_dict; + score_dict.Set(MediaEngagementScore::kVisitsKey, example_num_visits); + score_dict.Set(MediaEngagementScore::kMediaPlaybacksKey, + example_media_playbacks); + score_dict.Set(MediaEngagementScore::kLastMediaPlaybackTimeKey, + double(test_clock.Now().ToInternalValue())); + score_dict.Set(MediaEngagementScore::kHasHighScoreKey, false); settings_map->SetWebsiteSettingDefaultScope( origin.GetURL(), GURL(), ContentSettingsType::MEDIA_ENGAGEMENT, - base::Value::FromUniquePtrValue(std::move(score_dict))); + base::Value(std::move(score_dict))); // Make sure we read that data back correctly. MediaEngagementScore score(&test_clock, origin, settings_map); @@ -452,13 +450,13 @@ // Test that scores are read / written correctly from / to populated score // dictionaries. TEST_F(MediaEngagementScoreWithHTTPSOnlyTest, PopulatedDictionary_HTTPSOnly) { - std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); - dict->SetInteger(MediaEngagementScore::kVisitsKey, 20); - dict->SetInteger(MediaEngagementScore::kMediaPlaybacksKey, 12); - dict->SetDoubleKey( + base::Value::Dict dict; + dict.Set(MediaEngagementScore::kVisitsKey, int(20)); + dict.Set(MediaEngagementScore::kMediaPlaybacksKey, int(12)); + dict.Set( MediaEngagementScore::kLastMediaPlaybackTimeKey, - test_clock.Now().ToDeltaSinceWindowsEpoch().InMicroseconds()); - dict->SetBoolean(MediaEngagementScore::kHasHighScoreKey, true); + double(test_clock.Now().ToDeltaSinceWindowsEpoch().InMicroseconds())); + dict.Set(MediaEngagementScore::kHasHighScoreKey, true); TestScoreInitializesAndUpdates(std::move(dict), 0, 0, base::Time(), false, false);
diff --git a/chrome/browser/media/media_engagement_service.cc b/chrome/browser/media/media_engagement_service.cc index bd35d7b..18e14d19 100644 --- a/chrome/browser/media/media_engagement_service.cc +++ b/chrome/browser/media/media_engagement_service.cc
@@ -364,12 +364,11 @@ const auto& origin = it.first; auto* const site = it.second; - std::unique_ptr<base::Value> clone = - base::Value::ToUniquePtrValue(site->setting_value.Clone()); + base::Value clone = site->setting_value.Clone(); + DCHECK(clone.is_dict()); - data.push_back(MediaEngagementScore( - clock_, origin, base::DictionaryValue::From(std::move(clone)), - settings)); + data.push_back(MediaEngagementScore(clock_, origin, + std::move(clone).TakeDict(), settings)); } return data;
diff --git a/chrome/browser/media/router/discovery/access_code/access_code_cast_sink_service_browsertest.cc b/chrome/browser/media/router/discovery/access_code/access_code_cast_sink_service_browsertest.cc index bbbb902..ae8f9e2 100644 --- a/chrome/browser/media/router/discovery/access_code/access_code_cast_sink_service_browsertest.cc +++ b/chrome/browser/media/router/discovery/access_code/access_code_cast_sink_service_browsertest.cc
@@ -45,22 +45,8 @@ class AccessCodeCastSinkServiceBrowserTest : public AccessCodeCastIntegrationBrowserTest {}; -// TODO(b/242928209): Saved device tests are flaky on linux-rel/Mac. -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) -#define MAYBE_PRE_InstantExpiration DISABLED_PRE_InstantExpiration -#define MAYBE_InstantExpiration DISABLED_InstantExpiration -#else -#define MAYBE_PRE_InstantExpiration PRE_InstantExpiration -#define MAYBE_InstantExpiration InstantExpiration -#endif IN_PROC_BROWSER_TEST_F(AccessCodeCastSinkServiceBrowserTest, - MAYBE_PRE_InstantExpiration) { -#if BUILDFLAG(IS_WIN) - // TODO(b/235896651): This test sometimes timesout on win10. - if (base::win::GetVersion() >= base::win::Version::WIN10) - GTEST_SKIP() << "This test is flaky on win10"; -#endif - + PRE_InstantExpiration) { // This pre test adds a device successfully to the browser. The next test // then ensures the devices was not saved when the browsertest starts up // again. @@ -108,13 +94,7 @@ } IN_PROC_BROWSER_TEST_F(AccessCodeCastSinkServiceBrowserTest, - MAYBE_InstantExpiration) { -#if BUILDFLAG(IS_WIN) - // TODO(b/235896651): This test sometimes timesout on win10. - if (base::win::GetVersion() >= base::win::Version::WIN10) - GTEST_SKIP() << "This test is flaky on win10"; -#endif - + InstantExpiration) { // This test is run after an instant expiration device was successfully // added to the browser. Upon restart it should not exists in prefs nor should // it be added to the media router. @@ -131,21 +111,7 @@ weak_ptr_factory_.GetWeakPtr())); } -// TODO(b/242928209): Saved device tests are flaky on linux-rel/Mac/ChromeOS. -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) -#define MAYBE_PRE_SavedDevice DISABLED_PRE_SavedDevice -#define MAYBE_SavedDevice DISABLED_SavedDevice -#else -#define MAYBE_PRE_SavedDevice PRE_SavedDevice -#define MAYBE_SavedDevice SavedDevice -#endif -IN_PROC_BROWSER_TEST_F(AccessCodeCastSinkServiceBrowserTest, - MAYBE_PRE_SavedDevice) { -#if BUILDFLAG(IS_WIN) - // TODO(b/235896651): This test sometimes timesout on win10. - if (base::win::GetVersion() >= base::win::Version::WIN10) - GTEST_SKIP() << "This test is flaky on win10"; -#endif +IN_PROC_BROWSER_TEST_F(AccessCodeCastSinkServiceBrowserTest, PRE_SavedDevice) { // This pre test adds a device successfully to the browser. The next test then // ensures the devices was saved when the browsertest starts up again. @@ -197,14 +163,7 @@ GetPrefUpdater()->GetMediaSinkInternalValueBySinkId("cast:<1234>")); } -IN_PROC_BROWSER_TEST_F(AccessCodeCastSinkServiceBrowserTest, - MAYBE_SavedDevice) { -#if BUILDFLAG(IS_WIN) - // TODO(b/235896651): This test sometimes timesout on win10. - if (base::win::GetVersion() >= base::win::Version::WIN10) - GTEST_SKIP() << "This test is flaky on win10"; -#endif - +IN_PROC_BROWSER_TEST_F(AccessCodeCastSinkServiceBrowserTest, SavedDevice) { // This test is run after a saved device was successfully added to the // browser. Upon restart it should exists in prefs && it should be added // to the media router.
diff --git a/chrome/browser/password_manager/account_password_store_factory.cc b/chrome/browser/password_manager/account_password_store_factory.cc index 66b54b3c..4787dc3 100644 --- a/chrome/browser/password_manager/account_password_store_factory.cc +++ b/chrome/browser/password_manager/account_password_store_factory.cc
@@ -21,7 +21,6 @@ #include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" -#include "chrome/browser/web_data_service_factory.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/password_manager/core/browser/login_database.h" #include "components/password_manager/core/browser/password_manager_constants.h" @@ -159,9 +158,7 @@ AccountPasswordStoreFactory::AccountPasswordStoreFactory() : RefcountedBrowserContextKeyedServiceFactory( "AccountPasswordStore", - BrowserContextDependencyManager::GetInstance()) { - DependsOn(WebDataServiceFactory::GetInstance()); -} + BrowserContextDependencyManager::GetInstance()) {} AccountPasswordStoreFactory::~AccountPasswordStoreFactory() = default; @@ -190,14 +187,9 @@ profile))); #endif - if (!ps->Init(profile->GetPrefs(), - /*affiliated_match_helper=*/nullptr, - base::BindRepeating(&SyncEnabledOrDisabled, profile))) { - // TODO(crbug.com/479725): Remove the LOG once this error is visible in the - // UI. - LOG(WARNING) << "Could not initialize password store."; - return nullptr; - } + ps->Init(profile->GetPrefs(), + /*affiliated_match_helper=*/nullptr, + base::BindRepeating(&SyncEnabledOrDisabled, profile)); auto network_context_getter = base::BindRepeating( [](Profile* profile) -> network::mojom::NetworkContext* {
diff --git a/chrome/browser/password_manager/password_store_factory.cc b/chrome/browser/password_manager/password_store_factory.cc index f537b8b..d4aadc2 100644 --- a/chrome/browser/password_manager/password_store_factory.cc +++ b/chrome/browser/password_manager/password_store_factory.cc
@@ -16,7 +16,6 @@ #include "chrome/browser/password_manager/password_store_utils.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" -#include "chrome/browser/web_data_service_factory.h" #include "chrome/common/chrome_paths_internal.h" #include "components/password_manager/core/browser/password_manager_constants.h" #include "components/password_manager/core/browser/password_manager_util.h" @@ -55,7 +54,6 @@ "PasswordStore", ProfileSelections::BuildRedirectedInIncognito()) { DependsOn(AffiliationServiceFactory::GetInstance()); - DependsOn(WebDataServiceFactory::GetInstance()); } PasswordStoreFactory::~PasswordStoreFactory() = default; @@ -93,12 +91,7 @@ std::unique_ptr<AffiliatedMatchHelper> affiliated_match_helper = std::make_unique<AffiliatedMatchHelper>(affiliation_service); - if (!ps->Init(profile->GetPrefs(), std::move(affiliated_match_helper))) { - // TODO(crbug.com/479725): Remove the LOG once this error is visible in the - // UI. - LOG(WARNING) << "Could not initialize password store."; - return nullptr; - } + ps->Init(profile->GetPrefs(), std::move(affiliated_match_helper)); auto network_context_getter = base::BindRepeating( [](Profile* profile) -> network::mojom::NetworkContext* {
diff --git a/chrome/browser/preloading/prerender/prerender_manager.cc b/chrome/browser/preloading/prerender/prerender_manager.cc index 6e7f9b9a0..b3116bd 100644 --- a/chrome/browser/preloading/prerender/prerender_manager.cc +++ b/chrome/browser/preloading/prerender/prerender_manager.cc
@@ -100,6 +100,14 @@ } } +content::PreloadingFailureReason ToPreloadingFailureReason( + PrerenderPredictionStatus status) { + return static_cast<content::PreloadingFailureReason>( + static_cast<int>(status) + + static_cast<int>(content::PreloadingFailureReason:: + kPreloadingFailureReasonContentEnd)); +} + } // namespace PrerenderManager::~PrerenderManager() = default; @@ -111,8 +119,7 @@ std::unique_ptr<content::PrerenderHandle> search_prerender_handle, base::WeakPtr<content::PreloadingAttempt> preloading_attempt) : search_prerender_handle_(std::move(search_prerender_handle)), - prerendered_search_terms_(search_terms), - preloading_attempt_(preloading_attempt) { + prerendered_search_terms_(search_terms) { expiry_timer_.Start(FROM_HERE, GetSearchPrerenderExpiryDuration(), base::BindOnce(&SearchPrerenderTask::OnTimerTriggered, base::Unretained(this))); @@ -131,21 +138,13 @@ prediction_status_); } - content::PreloadingFailureReason ToPreloadingFailureReason( - PrerenderPredictionStatus status) { - return static_cast<content::PreloadingFailureReason>( - static_cast<int>(status) + - static_cast<int>(content::PreloadingFailureReason:: - kPreloadingFailureReasonContentEnd)); - } - void SetFailureReason(PrerenderPredictionStatus status) { - if (!preloading_attempt_) + if (!search_prerender_handle_) return; switch (status) { case PrerenderPredictionStatus::kNotStarted: case PrerenderPredictionStatus::kCancelled: - preloading_attempt_->SetFailureReason( + search_prerender_handle_->SetPreloadingAttemptFailureReason( ToPreloadingFailureReason(status)); return; case PrerenderPredictionStatus::kUnused: @@ -286,9 +285,6 @@ // Stores the search term that `search_prerender_handle_` is prerendering. const std::u16string prerendered_search_terms_; - - // Stores the PreloadingAttempt corresponding to Prerender to log metrics. - base::WeakPtr<content::PreloadingAttempt> preloading_attempt_; }; void PrerenderManager::DidStartNavigation( @@ -356,6 +352,10 @@ base::UmaHistogramEnumeration( internal::kHistogramPrerenderPredictionStatusDirectUrlInput, PrerenderPredictionStatus::kCancelled); + // Mark the previous prerender as failure as we can't keep multiple DUI + // prerenders active at the same time. + direct_url_input_prerender_handle_->SetPreloadingAttemptFailureReason( + ToPreloadingFailureReason(PrerenderPredictionStatus::kCancelled)); direct_url_input_prerender_handle_.reset(); } direct_url_input_prerender_handle_ = web_contents()->StartPrerendering( @@ -506,6 +506,9 @@ opened_url ? PrerenderPredictionStatus::kHitFinished : PrerenderPredictionStatus::kUnused); + // We don't set the PreloadingFailureReason for wrong predictions, as this + // is not a prerender failure rather it is an in accurate triggering for DUI + // predictor as the user didn't end up navigating to the predicted URL. direct_url_input_prerender_handle_.reset(); } @@ -584,6 +587,8 @@ /*preloading_attempt=*/attempt.get(), std::move(url_match_predicate)); if (prerender_handle) { + DCHECK(!search_prerender_task_) + << "SearchPrerenderTask should be reset before setting a new one."; search_prerender_task_ = std::make_unique<SearchPrerenderTask>( search_terms, std::move(prerender_handle), attempt); }
diff --git a/chrome/browser/preloading/prerender/prerender_manager_unittest.cc b/chrome/browser/preloading/prerender/prerender_manager_unittest.cc index b19eccd..5e5fd9c7 100644 --- a/chrome/browser/preloading/prerender/prerender_manager_unittest.cc +++ b/chrome/browser/preloading/prerender/prerender_manager_unittest.cc
@@ -5,12 +5,14 @@ #include <string> #include "base/test/scoped_feature_list.h" +#include "chrome/browser/preloading/chrome_preloading.h" #include "chrome/browser/preloading/prerender/prerender_manager.h" #include "chrome/browser/preloading/prerender/prerender_utils.h" #include "chrome/common/chrome_features.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" +#include "content/public/test/preloading_test_util.h" #include "content/public/test/prerender_test_util.h" #include "content/public/test/web_contents_tester.h" #include "net/test/embedded_test_server/embedded_test_server.h" @@ -84,6 +86,14 @@ return prerender_helper_; } + content::PreloadingFailureReason ToPreloadingFailureReason( + PrerenderPredictionStatus status) { + return static_cast<content::PreloadingFailureReason>( + static_cast<int>(status) + + static_cast<int>(content::PreloadingFailureReason:: + kPreloadingFailureReasonContentEnd)); + } + private: content::test::PrerenderTestHelper prerender_helper_; base::test::ScopedFeatureList scoped_feature_list_; @@ -177,4 +187,67 @@ EXPECT_FALSE(prerender_manager()->HasSearchResultPagePrerendered()); } +TEST_F(PrerenderManagerTest, StartCleanPrerenderDirectUrlInput) { + GURL prerendering_url = GetUrl("/foo"); + content::test::PrerenderHostRegistryObserver registry_observer( + *GetActiveWebContents()); + + auto* preloading_data = content::PreloadingData::GetOrCreateForWebContents( + GetActiveWebContents()); + content::PreloadingURLMatchCallback same_url_matcher = + content::PreloadingData::GetSameURLMatcher(prerendering_url); + content::PreloadingAttempt* preloading_attempt = + preloading_data->AddPreloadingAttempt( + ToPreloadingPredictor( + ChromePreloadingPredictor::kOmniboxDirectURLInput), + content::PreloadingType::kPrerender, same_url_matcher); + + prerender_manager()->StartPrerenderDirectUrlInput(prerendering_url, + *preloading_attempt); + registry_observer.WaitForTrigger(prerendering_url); + int prerender_host_id = prerender_helper().GetHostForUrl(prerendering_url); + EXPECT_NE(prerender_host_id, content::RenderFrameHost::kNoFrameTreeNodeId); +} + +// Test that the PreloadingTriggeringOutcome is set to kFailure when the DUI +// predictor suggests a different URL. +TEST_F(PrerenderManagerTest, StartNewPrerenderDirectUrlInput) { + GURL prerendering_url = GetUrl("/foo"); + content::test::PrerenderHostRegistryObserver registry_observer( + *GetActiveWebContents()); + + auto* preloading_data = content::PreloadingData::GetOrCreateForWebContents( + GetActiveWebContents()); + content::PreloadingURLMatchCallback same_url_matcher = + content::PreloadingData::GetSameURLMatcher(prerendering_url); + content::PreloadingAttempt* preloading_attempt = + preloading_data->AddPreloadingAttempt( + ToPreloadingPredictor( + ChromePreloadingPredictor::kOmniboxDirectURLInput), + content::PreloadingType::kPrerender, same_url_matcher); + + prerender_manager()->StartPrerenderDirectUrlInput(prerendering_url, + *preloading_attempt); + registry_observer.WaitForTrigger(prerendering_url); + int prerender_host_id = prerender_helper().GetHostForUrl(prerendering_url); + EXPECT_NE(prerender_host_id, content::RenderFrameHost::kNoFrameTreeNodeId); + content::test::PrerenderHostObserver host_observer(*GetActiveWebContents(), + prerender_host_id); + GURL prerendering_url2 = GetUrl("/bar"); + content::PreloadingURLMatchCallback same_url_matcher2 = + content::PreloadingData::GetSameURLMatcher(prerendering_url); + content::PreloadingAttempt* preloading_attempt2 = + preloading_data->AddPreloadingAttempt( + ToPreloadingPredictor( + ChromePreloadingPredictor::kOmniboxDirectURLInput), + content::PreloadingType::kPrerender, same_url_matcher); + prerender_manager()->StartPrerenderDirectUrlInput(prerendering_url2, + *preloading_attempt2); + host_observer.WaitForDestroyed(); + registry_observer.WaitForTrigger(prerendering_url2); + EXPECT_EQ(ToPreloadingFailureReason(PrerenderPredictionStatus::kCancelled), + content::test::PreloadingAttemptAccessor(preloading_attempt) + .GetFailureReason()); +} + } // namespace
diff --git a/chrome/browser/preloading/prerender/prerender_omnibox_ui_browsertest.cc b/chrome/browser/preloading/prerender/prerender_omnibox_ui_browsertest.cc index 64d5a4a..2964b75 100644 --- a/chrome/browser/preloading/prerender/prerender_omnibox_ui_browsertest.cc +++ b/chrome/browser/preloading/prerender/prerender_omnibox_ui_browsertest.cc
@@ -337,8 +337,8 @@ ukm_source_id, content::PreloadingType::kPrerender, content::PreloadingEligibility::kEligible, content::PreloadingHoldbackStatus::kAllowed, - content::PreloadingTriggeringOutcome::kRunning, - content::PreloadingFailureReason::kUnspecified, + content::PreloadingTriggeringOutcome::kFailure, + ToPreloadingFailureReason(PrerenderPredictionStatus::kCancelled), /*accurate=*/false), ukm_entry_builder().BuildEntry( ukm_source_id, content::PreloadingType::kPrerender, @@ -367,6 +367,66 @@ PrerenderPredictionStatus::kNotStarted, 1); } +// This test starts url prerendering by +// AutocompleteActionPredictor, and navigates to a different URL. +IN_PROC_BROWSER_TEST_F(PrerenderOmniboxUIBrowserTest, + AutocompleteActionPredictorWrongPrediction) { + base::HistogramTester histogram_tester; + Observe(GetActiveWebContents()); + const GURL kInitialUrl = embedded_test_server()->GetURL("/empty.html"); + ASSERT_TRUE(GetActiveWebContents()); + ASSERT_TRUE(content::NavigateToURL(GetActiveWebContents(), kInitialUrl)); + + // Attempt to prerender a direct URL input. + ASSERT_TRUE(GetAutocompleteActionPredictor()); + WaitForAutocompleteActionPredictorInitialization(); + const GURL kPrerenderingUrl = + embedded_test_server()->GetURL("/empty.html?prerender"); + content::test::PrerenderHostObserver old_prerender_observer( + *GetActiveWebContents(), kPrerenderingUrl); + const GURL kNewUrl = embedded_test_server()->GetURL("/empty.html?newUrl"); + GetAutocompleteActionPredictor()->StartPrerendering( + kPrerenderingUrl, *GetActiveWebContents(), gfx::Size(50, 50)); + prerender_helper().WaitForPrerenderLoadCompletion(*GetActiveWebContents(), + kPrerenderingUrl); + + ASSERT_TRUE(content::NavigateToURL(GetActiveWebContents(), kNewUrl)); + old_prerender_observer.WaitForDestroyed(); + + EXPECT_FALSE(IsPrerenderingNavigation()); + EXPECT_EQ(GetActiveWebContents()->GetLastCommittedURL(), kNewUrl); + + { + ukm::SourceId ukm_source_id = + GetActiveWebContents()->GetPrimaryMainFrame()->GetPageUkmSourceId(); + auto ukm_entries = test_ukm_recorder()->GetEntries( + Preloading_Attempt::kEntryName, + content::test::kPreloadingAttemptUkmMetrics); + EXPECT_EQ(ukm_entries.size(), 1u); + + std::vector<UkmEntry> expected_entries = { + ukm_entry_builder().BuildEntry( + ukm_source_id, content::PreloadingType::kPrerender, + content::PreloadingEligibility::kEligible, + content::PreloadingHoldbackStatus::kAllowed, + content::PreloadingTriggeringOutcome::kReady, + content::PreloadingFailureReason::kUnspecified, + /*accurate=*/false), + }; + EXPECT_THAT(ukm_entries, + testing::UnorderedElementsAreArray(expected_entries)) + << content::test::ActualVsExpectedUkmEntriesToString(ukm_entries, + expected_entries); + } + + // Prerender was attempted once and was cancelled. + histogram_tester.ExpectBucketCount( + internal::kHistogramPrerenderPredictionStatusDirectUrlInput, + PrerenderPredictionStatus::kUnused, 1); + histogram_tester.ExpectTotalCount( + internal::kHistogramPrerenderPredictionStatusDirectUrlInput, 1); +} + // This test starts same url prerendering twice by AutocompleteActionPredictor, // and checks that the second one will not trigger cancellation mechanism. IN_PROC_BROWSER_TEST_F(PrerenderOmniboxUIBrowserTest, @@ -967,6 +1027,60 @@ prerender_helper().WaitForRequest(expected_reload_url, 1); } +// Tests that prerendering the wrong URL doesn't lead to activation. +IN_PROC_BROWSER_TEST_F(PrerenderOmniboxSearchSuggestionUIBrowserTest, + WrongPrediction) { + base::HistogramTester histogram_tester; + AddNewSuggestionRule("prerender22", {"prerender222", "prerender223"}); + const GURL kInitialUrl = embedded_test_server()->GetURL("/empty.html"); + ASSERT_TRUE(GetActiveWebContents()); + ASSERT_TRUE(content::NavigateToURL(GetActiveWebContents(), kInitialUrl)); + + Observe(GetActiveWebContents()); + std::string search_query_1 = "prerender2"; + GURL expected_prerender_url = + GetSearchUrl(search_query_1, "prerender222", /*is_prerender=*/true); + + // Trigger an omnibox suggest that has a prerender hint. + int host_id = + InputSearchQueryAndWaitForTrigger(search_query_1, expected_prerender_url); + ASSERT_NE(host_id, content::RenderFrameHost::kNoFrameTreeNodeId); + prerender_helper().WaitForPrerenderLoadCompletion(*GetActiveWebContents(), + expected_prerender_url); + + const GURL kNewUrl = embedded_test_server()->GetURL("/empty.html?newUrl"); + ASSERT_TRUE(content::NavigateToURL(GetActiveWebContents(), kNewUrl)); + EXPECT_FALSE(IsPrerenderingNavigation()); + base::RunLoop().RunUntilIdle(); + + { + ukm::SourceId ukm_source_id = + GetActiveWebContents()->GetPrimaryMainFrame()->GetPageUkmSourceId(); + auto ukm_entries = test_ukm_recorder()->GetEntries( + Preloading_Attempt::kEntryName, + content::test::kPreloadingAttemptUkmMetrics); + EXPECT_EQ(ukm_entries.size(), 1u); + + std::vector<UkmEntry> expected_entries = { + attempt_entry_builder().BuildEntry( + ukm_source_id, content::PreloadingType::kPrerender, + content::PreloadingEligibility::kEligible, + content::PreloadingHoldbackStatus::kAllowed, + content::PreloadingTriggeringOutcome::kReady, + content::PreloadingFailureReason::kUnspecified, + /*accurate=*/false), + }; + EXPECT_THAT(ukm_entries, + testing::UnorderedElementsAreArray(expected_entries)) + << content::test::ActualVsExpectedUkmEntriesToString(ukm_entries, + expected_entries); + } + + histogram_tester.ExpectUniqueSample( + internal::kHistogramPrerenderPredictionStatusDefaultSearchEngine, + PrerenderPredictionStatus::kUnused, 1); +} + // Tests that prerender maintain the previous prerendered page if the new // prerendering aims to load a same url to the prerendered page. IN_PROC_BROWSER_TEST_F(PrerenderOmniboxSearchSuggestionUIBrowserTest,
diff --git a/chrome/browser/printing/print_view_manager_common.cc b/chrome/browser/printing/print_view_manager_common.cc index 06ebb78a..057d87b 100644 --- a/chrome/browser/printing/print_view_manager_common.cc +++ b/chrome/browser/printing/print_view_manager_common.cc
@@ -4,14 +4,12 @@ #include "chrome/browser/printing/print_view_manager_common.h" -#include "base/bind.h" #include "content/public/browser/render_frame_host.h" #include "extensions/buildflags/buildflags.h" #include "pdf/buildflags.h" #include "printing/buildflags/buildflags.h" #if BUILDFLAG(ENABLE_EXTENSIONS) -#include "components/guest_view/browser/guest_view_manager.h" #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h" #endif // BUILDFLAG(ENABLE_EXTENSIONS) @@ -29,28 +27,14 @@ namespace { -#if BUILDFLAG(ENABLE_EXTENSIONS) -// Stores `guest_contents` in `result` and returns true if `guest_contents` is a -// full-page `MimeHandlerViewGuest`. -bool StoreFullPagePlugin(content::WebContents** result, - content::WebContents* guest_contents) { - auto* guest_view = - extensions::MimeHandlerViewGuest::FromWebContents(guest_contents); - if (guest_view && guest_view->is_full_page_plugin()) { - *result = guest_contents; - return true; - } - return false; -} -#endif // BUILDFLAG(ENABLE_EXTENSIONS) - // Pick the right RenderFrameHost based on the WebContents. content::RenderFrameHost* GetRenderFrameHostToUse( content::WebContents* contents) { #if BUILDFLAG(ENABLE_PDF) // Pick the plugin frame if `contents` is a PDF viewer guest. - content::RenderFrameHost* pdf_rfh = - pdf_frame_util::FindPdfChildFrame(contents->GetPrimaryMainFrame()); + content::RenderFrameHost* full_page_plugin = GetFullPagePlugin(contents); + content::RenderFrameHost* pdf_rfh = pdf_frame_util::FindPdfChildFrame( + full_page_plugin ? full_page_plugin : contents->GetPrimaryMainFrame()); if (pdf_rfh) return pdf_rfh; #endif @@ -70,15 +54,13 @@ using PrintViewManagerImpl = PrintViewManagerBasic; #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) - content::WebContents* contents_to_use = GetWebContentsToUse(contents); - auto* print_view_manager = - PrintViewManagerImpl::FromWebContents(contents_to_use); - if (!print_view_manager) + content::RenderFrameHost* rfh_to_use = GetRenderFrameHostToUse(contents); + if (!rfh_to_use) return; - content::RenderFrameHost* rfh_to_use = - GetRenderFrameHostToUse(contents_to_use); - if (!rfh_to_use) + auto* print_view_manager = PrintViewManagerImpl::FromWebContents( + content::WebContents::FromRenderFrameHost(rfh_to_use)); + if (!print_view_manager) return; #if BUILDFLAG(ENABLE_PRINT_PREVIEW) @@ -98,15 +80,13 @@ void StartBasicPrint(content::WebContents* contents) { #if BUILDFLAG(ENABLE_PRINT_PREVIEW) - content::WebContents* contents_to_use = GetWebContentsToUse(contents); - PrintViewManager* print_view_manager = - PrintViewManager::FromWebContents(contents_to_use); - if (!print_view_manager) + content::RenderFrameHost* rfh_to_use = GetRenderFrameHostToUse(contents); + if (!rfh_to_use) return; - content::RenderFrameHost* rfh_to_use = - GetRenderFrameHostToUse(contents_to_use); - if (!rfh_to_use) + PrintViewManager* print_view_manager = PrintViewManager::FromWebContents( + content::WebContents::FromRenderFrameHost(rfh_to_use)); + if (!print_view_manager) return; print_view_manager->BasicPrint(rfh_to_use); @@ -120,17 +100,22 @@ : contents->GetPrimaryMainFrame(); } -content::WebContents* GetWebContentsToUse(content::WebContents* contents) { +content::RenderFrameHost* GetFullPagePlugin(content::WebContents* contents) { + content::RenderFrameHost* full_page_plugin = nullptr; #if BUILDFLAG(ENABLE_EXTENSIONS) - guest_view::GuestViewManager* guest_view_manager = - guest_view::GuestViewManager::FromBrowserContext( - contents->GetBrowserContext()); - if (guest_view_manager) { - guest_view_manager->ForEachGuest( - contents, base::BindRepeating(&StoreFullPagePlugin, &contents)); - } + contents->ForEachRenderFrameHostWithAction( + [&full_page_plugin](content::RenderFrameHost* rfh) { + auto* guest_view = + extensions::MimeHandlerViewGuest::FromRenderFrameHost(rfh); + if (guest_view && guest_view->is_full_page_plugin()) { + DCHECK_EQ(guest_view->GetGuestMainFrame(), rfh); + full_page_plugin = rfh; + return content::RenderFrameHost::FrameIterationAction::kStop; + } + return content::RenderFrameHost::FrameIterationAction::kContinue; + }); #endif // BUILDFLAG(ENABLE_EXTENSIONS) - return contents; + return full_page_plugin; } } // namespace printing
diff --git a/chrome/browser/printing/print_view_manager_common.h b/chrome/browser/printing/print_view_manager_common.h index c8ba345a..cc7b2778c 100644 --- a/chrome/browser/printing/print_view_manager_common.h +++ b/chrome/browser/printing/print_view_manager_common.h
@@ -33,8 +33,8 @@ content::RenderFrameHost* GetFrameToPrint(content::WebContents* contents); // If we have a single full-page embedded mime handler view guest, print the -// guest's WebContents instead. -content::WebContents* GetWebContentsToUse(content::WebContents* contents); +// guest view instead. +content::RenderFrameHost* GetFullPagePlugin(content::WebContents* contents); } // namespace printing
diff --git a/chrome/browser/resources/chromeos/accessibility/select_to_speak/prefs_manager.js b/chrome/browser/resources/chromeos/accessibility/select_to_speak/prefs_manager.js index 47e3fcc..4134525 100644 --- a/chrome/browser/resources/chromeos/accessibility/select_to_speak/prefs_manager.js +++ b/chrome/browser/resources/chromeos/accessibility/select_to_speak/prefs_manager.js
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import {SelectToSpeakConstants} from './select_to_speak_constants.js'; + /** * Manages getting and storing user preferences. */ @@ -403,20 +405,29 @@ * Generates the basic speech options for Select-to-Speak based on user * preferences. Call for each chrome.tts.speak. * @param {boolean} enhancedVoicesFlag whether enhanced voices are enabled. + * @param {?SelectToSpeakConstants.VoiceSwitchingData} voiceSwitchingData * @return {!chrome.tts.TtsOptions} options The TTS options. */ - getSpeechOptions(enhancedVoicesFlag) { + getSpeechOptions(enhancedVoicesFlag, voiceSwitchingData) { const options = /** @type {!chrome.tts.TtsOptions} */ ({}); + const data = voiceSwitchingData || {}; const useEnhancedVoices = enhancedVoicesFlag && this.enhancedNetworkVoicesEnabled_ && navigator.onLine; if (useEnhancedVoices) { options['voiceName'] = this.enhancedVoiceName_; } else { - const localVoice = this.getLocalVoice(); + const useVoiceSwitching = data.useVoiceSwitching; + const language = data.language; + // If `useVoiceSwitching` is true, then we should omit `voiceName` from + // options and let the TTS engine pick the right voice for the language. + const localVoice = useVoiceSwitching ? undefined : this.getLocalVoice(); if (localVoice !== undefined) { options['voiceName'] = localVoice; } + if (language !== undefined) { + options['lang'] = language; + } } return options; }
diff --git a/chrome/browser/resources/chromeos/accessibility/select_to_speak/select_to_speak.js b/chrome/browser/resources/chromeos/accessibility/select_to_speak/select_to_speak.js index ef328539..ad47ce4 100644 --- a/chrome/browser/resources/chromeos/accessibility/select_to_speak/select_to_speak.js +++ b/chrome/browser/resources/chromeos/accessibility/select_to_speak/select_to_speak.js
@@ -188,13 +188,6 @@ init_() { chrome.automation.getDesktop(desktop => { this.desktop_ = desktop; - - // After the user selects a region of the screen, we do a hit test at - // the center of that box using the automation API. The result of the - // hit test is a MOUSE_RELEASED accessibility event. - desktop.addEventListener( - EventType.MOUSE_RELEASED, evt => this.onAutomationHitTest_(evt), - true); }); this.prefsManager_.initPreferences(); @@ -260,15 +253,14 @@ * Called in response to our hit test after the mouse is released, * when the user is in a mode where select-to-speak is capturing * mouse events (for example holding down Search). - * @param {!AutomationEvent} evt The automation event. + * @param {!AutomationNode} root The node returned by the hit test. * @private */ - onAutomationHitTest_(evt) { + onAutomationHitTest_(root) { // Walk up to the nearest window, web area, toolbar, or dialog that the // hit node is contained inside. Only speak objects within that // container. In the future we might include other container-like // roles here. - var root = evt.target; // TODO: Use AutomationPredicate.root instead? while (root.parent && root.role !== RoleType.WINDOW && root.role !== RoleType.ROOT_WEB_AREA && @@ -736,15 +728,14 @@ // Fire a hit test event on click to warm up the cache, and cancel // if speaking. this.cancelIfSpeaking_(false /* don't clear the focus ring */); - this.desktop_.hitTest(x, y, EventType.MOUSE_PRESSED); + this.desktop_.hitTestWithReply(x, y, unused => {}); } else { this.onStateChanged_(SelectToSpeakState.INACTIVE); // Do a hit test at the center of the area the user dragged over. // This will give us some context when searching the accessibility - // tree. The hit test will result in a EventType.MOUSE_RELEASED - // event being fired on the result of that hit test, which will - // trigger onAutomationHitTest_. - this.desktop_.hitTest(x, y, EventType.MOUSE_RELEASED); + // tree. + this.desktop_.hitTestWithReply( + x, y, node => this.onAutomationHitTest_(node)); } }, // onSelectionChanged: Mouse selection rect changed. @@ -947,7 +938,7 @@ this.prepareForSpeech_(true /* clearFocusRing */); this.maybeShowEnhancedVoicesDialog_(() => { const options = - this.prefsManager_.getSpeechOptions(this.enhancedVoicesFlag_); + this.prefsManager_.getSpeechOptions(this.enhancedVoicesFlag_, null); const fallbackVoiceName = this.prefsManager_.getLocalVoice(); // Without nodes to anchor on, navigate is not supported. @@ -1130,12 +1121,18 @@ return; } const options = /** @type {!chrome.tts.TtsOptions} */ ({}); - // Copy options so we can add lang below - Object.assign( - options, this.prefsManager_.getSpeechOptions(this.enhancedVoicesFlag_)); + let language; + let useVoiceSwitching = false; if (this.shouldUseVoiceSwitching_() && nodeGroup.detectedLanguage) { - options.lang = nodeGroup.detectedLanguage; + language = nodeGroup.detectedLanguage; + useVoiceSwitching = true; } + + Object.assign( + options, + this.prefsManager_.getSpeechOptions( + this.enhancedVoicesFlag_, {language, useVoiceSwitching})); + if (this.shouldShowNavigationControls_()) { options.rate = this.getSpeechRate_(); // Log speech rate multiple applied by Select-to-speak.
diff --git a/chrome/browser/resources/chromeos/accessibility/select_to_speak/select_to_speak_constants.js b/chrome/browser/resources/chromeos/accessibility/select_to_speak/select_to_speak_constants.js index bf6eb005..f7262f5 100644 --- a/chrome/browser/resources/chromeos/accessibility/select_to_speak/select_to_speak_constants.js +++ b/chrome/browser/resources/chromeos/accessibility/select_to_speak/select_to_speak_constants.js
@@ -16,6 +16,14 @@ SelectToSpeakConstants.READ_SELECTION_KEY_CODE = KeyCode.S; /** + * @typedef {{ + * language: (string|undefined), + * useVoiceSwitching: boolean, + * }} + */ +SelectToSpeakConstants.VoiceSwitchingData; + +/** * How often (in ms) to check that the currently spoken node is * still valid and in the same position. Decreasing this will make * STS seem more reactive to page changes but decreasing it too much
diff --git a/chrome/browser/resources/chromeos/accessibility/select_to_speak/select_to_speak_mouse_selection_test.js b/chrome/browser/resources/chromeos/accessibility/select_to_speak/select_to_speak_mouse_selection_test.js index 3b450c6..6e392b90f 100644 --- a/chrome/browser/resources/chromeos/accessibility/select_to_speak/select_to_speak_mouse_selection_test.js +++ b/chrome/browser/resources/chromeos/accessibility/select_to_speak/select_to_speak_mouse_selection_test.js
@@ -259,3 +259,46 @@ }); }); }); + +AX_TEST_F( + 'SelectToSpeakMouseSelectionTest', 'VoiceSwitching', async function() { + selectToSpeak.shouldUseVoiceSwitching_ = () => true; + const root = await this.runWithLoadedTree( + 'data:text/html;charset=utf-8,<div>' + + '<span lang="fr-FR">The first paragraph</span>' + + '<span lang="en-US">The second paragraph</span></div>'); + + assertFalse(this.mockTts.currentlySpeaking()); + assertEquals(this.mockTts.pendingUtterances().length, 0); + this.mockTts.setOnSpeechCallbacks([ + this.newCallback(function(utterance) { + const options = this.mockTts.getOptions(); + assertEquals('fr-FR', options.lang); + assertEquals(undefined, options.voiceName); + this.assertEqualsCollapseWhitespace( + this.mockTts.pendingUtterances()[0], 'The first paragraph'); + this.mockTts.finishPendingUtterance(); + }), + this.newCallback(function(utterance) { + const options = this.mockTts.getOptions(); + assertEquals('en-US', options.lang); + assertEquals(undefined, options.voiceName); + this.assertEqualsCollapseWhitespace( + this.mockTts.pendingUtterances()[0], 'The second paragraph'); + }), + ]); + + const firstNode = this.findTextNode(root, 'The first paragraph'); + assertNotNullNorUndefined(firstNode); + const downEvent = { + screenX: firstNode.location.left + 1, + screenY: firstNode.location.top + 1, + }; + const lastNode = this.findTextNode(root, 'The second paragraph'); + assertNotNullNorUndefined(lastNode); + const upEvent = { + screenX: lastNode.location.left + lastNode.location.width, + screenY: lastNode.location.top + lastNode.location.height, + }; + this.triggerReadMouseSelectedText(downEvent, upEvent); + });
diff --git a/chrome/browser/resources/chromeos/accessibility/select_to_speak/select_to_speak_options.js b/chrome/browser/resources/chromeos/accessibility/select_to_speak/select_to_speak_options.js index cdc236e..dc4a48d 100644 --- a/chrome/browser/resources/chromeos/accessibility/select_to_speak/select_to_speak_options.js +++ b/chrome/browser/resources/chromeos/accessibility/select_to_speak/select_to_speak_options.js
@@ -75,6 +75,10 @@ chrome.accessibilityPrivate.isFeatureEnabled( AccessibilityFeature.SELECT_TO_SPEAK_VOICE_SWITCHING, (enabled) => { + // TODO(crbug.com/950391): Since voice switching only happens when + // enhanced network voices aren't being used, check with UX if we + // should hide or disable this option when enhanced network voices are + // disabled. const option = document.getElementById('voiceSwitchingOption'); enabled ? this.showElement(option) : this.hideElement(option); });
diff --git a/chrome/browser/resources/chromeos/login/BUILD.gn b/chrome/browser/resources/chromeos/login/BUILD.gn index 15a863e..a329a40f 100644 --- a/chrome/browser/resources/chromeos/login/BUILD.gn +++ b/chrome/browser/resources/chromeos/login/BUILD.gn
@@ -224,7 +224,6 @@ "components/oobe_select.m.js", "components/oobe_types.m.js", "components/test_util.m.js", - "components/throbber_notice.m.js", "components/web_view_helper.m.js", "components/web_view_loader.m.js", "screens/common/app_launch_splash.m.js", @@ -233,7 +232,6 @@ "screens/common/guest_tos.m.js", "screens/common/hw_data_collection.m.js", "screens/common/multidevice_setup.m.js", - "screens/common/os_trial.m.js", "screens/common/recommend_apps.m.js", "screens/common/signin_fatal_error.m.js", "screens/common/smart_privacy_protection.m.js", @@ -272,6 +270,7 @@ "components/oobe_i18n_dropdown.js", "components/progress_list_item.js", "components/security_token_pin.js", + "components/throbber_notice.js", "screens/common/adb_sideloading.js", "screens/common/app_downloading.js", "screens/common/arc_terms_of_service.js", @@ -290,6 +289,7 @@ "screens/common/oobe_reset.js", "screens/common/oobe_eula.js", "screens/common/os_install.js", + "screens/common/os_trial.js", "screens/common/parental_handoff.js", "screens/common/pin_setup.js", "screens/common/saml_confirm_password.js",
diff --git a/chrome/browser/resources/chromeos/login/components/BUILD.gn b/chrome/browser/resources/chromeos/login/components/BUILD.gn index 12134b0..bf5db0e 100644 --- a/chrome/browser/resources/chromeos/login/components/BUILD.gn +++ b/chrome/browser/resources/chromeos/login/components/BUILD.gn
@@ -42,7 +42,7 @@ ":progress_list_item", ":security_token_pin", ":test_util.m", - ":throbber_notice.m", + ":throbber_notice", ":web_view_helper.m", ":web_view_loader.m", ] @@ -64,7 +64,6 @@ ":oobe_icons_module", ":oobe_network_icons_module", ":oobe_slide_module", - ":throbber_notice_module", ] + [ ":modulize" ] } @@ -248,10 +247,10 @@ extra_deps = [ ":web_components" ] } -js_library("throbber_notice.m") { - sources = [ "$root_gen_dir/chrome/browser/resources/chromeos/login/components/throbber_notice.m.js" ] +js_library("throbber_notice") { + sources = [ "$root_gen_dir/chrome/browser/resources/chromeos/login/components/throbber_notice.js" ] deps = [ "./behaviors:oobe_i18n_behavior.m" ] - extra_deps = [ ":throbber_notice_module" ] + extra_deps = [ ":web_components" ] } js_library("test_util.m") { @@ -320,15 +319,6 @@ namespace_rewrites = oobe_namespace_rewrites } -polymer_modulizer("throbber_notice") { - js_file = "throbber_notice.js" - html_file = "throbber_notice.html" - html_type = "dom-module" - auto_imports = oobe_auto_imports - migrated_imports = oobe_migrated_imports - namespace_rewrites = oobe_namespace_rewrites -} - js_modulizer("modulize") { input_files = [ "display_manager_types.js", @@ -355,5 +345,6 @@ "oobe_i18n_dropdown.js", "progress_list_item.js", "security_token_pin.js", + "throbber_notice.js", ] }
diff --git a/chrome/browser/resources/chromeos/login/components/throbber_notice.html b/chrome/browser/resources/chromeos/login/components/throbber_notice.html index ce74202..fcec9a9 100644 --- a/chrome/browser/resources/chromeos/login/components/throbber_notice.html +++ b/chrome/browser/resources/chromeos/login/components/throbber_notice.html
@@ -4,44 +4,32 @@ found in the LICENSE file. --> -<link rel="import" href="chrome://resources/html/polymer.html"> - -<link rel="import" href="chrome://resources/polymer/v1_0/paper-spinner/paper-spinner-lite.html"> -<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html"> -<link rel="import" href="chrome://resources/cr_elements/chromeos/cros_color_overrides.css.html"> - -<link rel="import" href="./behaviors/oobe_i18n_behavior.html"> - <!-- TODO(http://crbug.com/1172980): Delete once oobe-loading-dialog replaces throbber-notice --> -<dom-module id="throbber-notice"> - <template> - <style include="cros-color-overrides"> - :host { - align-items: center; - display: flex; - flex-direction: column; - justify-content: center; - min-height: 0; - } +<style include="cros-color-overrides"> + :host { + align-items: center; + display: flex; + flex-direction: column; + justify-content: center; + min-height: 0; + } - paper-spinner-lite { - height: 38px; - margin-bottom: 28px; - width: 38px; - } + paper-spinner-lite { + height: 38px; + margin-bottom: 28px; + width: 38px; + } - #comment { - @apply --oobe-default-font; - color: var(--cros-text-color-secondary); - } - </style> - <paper-spinner-lite dir="ltr" active></paper-spinner-lite> - <div id="comment" aria-live="polite" - aria-label$="[[getAriaLabel(locale, textKey)]]"> - <template is="dom-if" if="[[textKey]]"> - [[i18nDynamic(locale, textKey)]] - </template> - </div> + #comment { + @apply --oobe-default-font; + color: var(--cros-text-color-secondary); + } +</style> +<paper-spinner-lite dir="ltr" active></paper-spinner-lite> +<div id="comment" aria-live="polite" + aria-label$="[[getAriaLabel(locale, textKey)]]"> + <template is="dom-if" if="[[textKey]]"> + [[i18nDynamic(locale, textKey)]] </template> - <script src="throbber_notice.js"></script> -</dom-module> +</div> +
diff --git a/chrome/browser/resources/chromeos/login/components/throbber_notice.js b/chrome/browser/resources/chromeos/login/components/throbber_notice.js index 806362f..e86c805 100644 --- a/chrome/browser/resources/chromeos/login/components/throbber_notice.js +++ b/chrome/browser/resources/chromeos/login/components/throbber_notice.js
@@ -2,32 +2,37 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -/* #js_imports_placeholder */ +import '//resources/polymer/v3_0/paper-spinner/paper-spinner-lite.js'; +import '//resources/polymer/v3_0/paper-styles/color.js'; +import '//resources/cr_elements/chromeos/cros_color_overrides.css.js'; + +import {html, mixinBehaviors, PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +import {OobeI18nBehavior, OobeI18nBehaviorInterface} from './behaviors/oobe_i18n_behavior.m.js'; + /** * @constructor * @extends {PolymerElement} * @implements {OobeI18nBehaviorInterface} */ -const ThrobberNoticeBase = Polymer.mixinBehaviors([OobeI18nBehavior], - Polymer.Element); +const ThrobberNoticeBase = mixinBehaviors([OobeI18nBehavior], PolymerElement); +/** @polymer */ class ThrobberNotice extends ThrobberNoticeBase { static get is() { return 'throbber-notice'; } - /* #html_template_placeholder */ + static get template() { + return html`{__html_template__}`; + } static get properties() { return {textKey: String}; } - constructor() { - super(); - } - /** * Returns the a11y message to be shown on this throbber, if the textkey is set. * @param {string} locale
diff --git a/chrome/browser/resources/chromeos/login/oobe_auto_imports.gni b/chrome/browser/resources/chromeos/login/oobe_auto_imports.gni index 0e8a8a63..9e0c2b9 100644 --- a/chrome/browser/resources/chromeos/login/oobe_auto_imports.gni +++ b/chrome/browser/resources/chromeos/login/oobe_auto_imports.gni
@@ -122,6 +122,7 @@ "chrome/browser/resources/chromeos/login/components/oobe_i18n_dropdown.html", "chrome/browser/resources/chromeos/login/components/progress_list_item.html", "chrome/browser/resources/chromeos/login/components/security_token_pin.html", + "chrome/browser/resources/chromeos/login/components/throbber_notice.html", "chrome/browser/resources/chromeos/login/screens/common/offline_ad_login.html", "ash/webui/common/resources/quick_unlock/lock_screen_constants.html", "ash/webui/common/resources/quick_unlock/pin_keyboard.html",
diff --git a/chrome/browser/resources/chromeos/login/screens.js b/chrome/browser/resources/chromeos/login/screens.js index 10963abc..0186a8b0 100644 --- a/chrome/browser/resources/chromeos/login/screens.js +++ b/chrome/browser/resources/chromeos/login/screens.js
@@ -30,7 +30,7 @@ import './screens/common/oobe_eula.js'; import './screens/common/oobe_reset.js'; import './screens/common/os_install.js'; -import './screens/common/os_trial.m.js'; +import './screens/common/os_trial.js'; import './screens/common/parental_handoff.js'; import './screens/common/pin_setup.js'; import './screens/common/recommend_apps.m.js';
diff --git a/chrome/browser/resources/chromeos/login/screens/common/BUILD.gn b/chrome/browser/resources/chromeos/login/screens/common/BUILD.gn index 2dcf412..2e02002 100644 --- a/chrome/browser/resources/chromeos/login/screens/common/BUILD.gn +++ b/chrome/browser/resources/chromeos/login/screens/common/BUILD.gn
@@ -19,7 +19,6 @@ ":guest_tos_module", ":hw_data_collection_module", ":multidevice_setup_module", - ":os_trial_module", ":recommend_apps_module", ":signin_fatal_error_module", ":smart_privacy_protection_module", @@ -69,7 +68,7 @@ ":oobe_eula", ":oobe_reset", ":os_install", - ":os_trial.m", + ":os_trial", ":parental_handoff", ":pin_setup", ":recommend_apps.m", @@ -482,8 +481,8 @@ extra_deps = [ ":web_components" ] } -js_library("os_trial.m") { - sources = [ "$root_gen_dir/chrome/browser/resources/chromeos/login/screens/common/os_trial.m.js" ] +js_library("os_trial") { + sources = [ "$root_gen_dir/chrome/browser/resources/chromeos/login/screens/common/os_trial.js" ] deps = [ "../../components/behaviors:login_screen_behavior.m", "../../components/behaviors:oobe_dialog_host_behavior.m", @@ -500,7 +499,7 @@ "//ui/webui/resources/cr_elements/cr_toggle/cr_toggle_externs.js", ] - extra_deps = [ ":os_trial_module" ] + extra_deps = [ ":web_components" ] } js_library("pin_setup") { @@ -723,15 +722,6 @@ namespace_rewrites = oobe_namespace_rewrites } -polymer_modulizer("os_trial") { - js_file = "os_trial.js" - html_file = "os_trial.html" - html_type = "dom-module" - auto_imports = oobe_auto_imports - migrated_imports = oobe_migrated_imports - namespace_rewrites = oobe_namespace_rewrites -} - polymer_modulizer("recommend_apps") { js_file = "recommend_apps.js" html_file = "recommend_apps.html" @@ -797,6 +787,7 @@ "oobe_eula.js", "oobe_reset.js", "os_install.js", + "os_trial.js", "parental_handoff.js", "pin_setup.js", "saml_confirm_password.js",
diff --git a/chrome/browser/resources/chromeos/login/screens/common/gaia_signin.js b/chrome/browser/resources/chromeos/login/screens/common/gaia_signin.js index 5c7a4c5..28c305dc 100644 --- a/chrome/browser/resources/chromeos/login/screens/common/gaia_signin.js +++ b/chrome/browser/resources/chromeos/login/screens/common/gaia_signin.js
@@ -19,7 +19,7 @@ import '../../components/common_styles/oobe_dialog_host_styles.m.js'; import '../../components/dialogs/oobe_adaptive_dialog.m.js'; import '../../components/dialogs/oobe_loading_dialog.m.js'; -import '../../components/throbber_notice.m.js'; +import '../../components/throbber_notice.js'; import {assert} from '//resources/js/assert.js'; import {afterNextRender, html, mixinBehaviors, PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/chromeos/login/screens/common/os_trial.html b/chrome/browser/resources/chromeos/login/screens/common/os_trial.html index d384e54..d31762b 100644 --- a/chrome/browser/resources/chromeos/login/screens/common/os_trial.html +++ b/chrome/browser/resources/chromeos/login/screens/common/os_trial.html
@@ -1,80 +1,61 @@ -<link rel="import" href="chrome://resources/html/polymer.html"> -<link rel="import" href="chrome://resources/cr_elements/cr_shared_vars.css.html"> -<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> +<style include="oobe-dialog-host-styles cr-card-radio-group-styles"> + @media screen and (max-width: 920px) { + :host { + --radio-button-height: 155px; + } + } +</style> -<link rel="import" href="../../components/oobe_icons.html"> -<link rel="import" href="../../components/behaviors/login_screen_behavior.html"> -<link rel="import" href="../../components/behaviors/oobe_dialog_host_behavior.html"> -<link rel="import" href="../../components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="../../components/common_styles/common_styles.html"> -<link rel="import" href="../../components/common_styles/cr_card_radio_group_styles.html"> -<link rel="import" href="../../components/common_styles/oobe_dialog_host_styles.html"> -<link rel="import" href="../../components/dialogs/oobe_adaptive_dialog.html"> -<link rel="import" href="../../components/hd_iron_icon.html"> +<oobe-adaptive-dialog id="osTrialDialog" role="dialog" + aria-label$="[[i18nDynamic(locale, 'osTrialTitle')]]"> + <iron-icon slot="icon" icon="oobe-32:googleg"></iron-icon> + <h1 slot="title">[[i18nDynamic(locale, 'osTrialTitle')]]</h1> + <span inner-h-t-m-l="[[i18nAdvancedDynamic(locale, 'osTrialSubtitle')]]" + slot="subtitle"></span> -<dom-module id="os-trial-element"> - <template> - <style include="oobe-dialog-host-styles cr-card-radio-group-styles"> - @media screen and (max-width: 920px) { - :host { - --radio-button-height: 155px; - } - } - </style> - - <oobe-adaptive-dialog id="osTrialDialog" role="dialog" - aria-label$="[[i18nDynamic(locale, 'osTrialTitle')]]"> - <iron-icon slot="icon" icon="oobe-32:googleg"></iron-icon> - <h1 slot="title">[[i18nDynamic(locale, 'osTrialTitle')]]</h1> - <span inner-h-t-m-l="[[i18nAdvancedDynamic(locale, 'osTrialSubtitle')]]" - slot="subtitle"></span> - - <div slot="content" class="layout vertical landscape-vertical-centered"> - <cr-radio-group selected="{{selectedTrialOption}}"> - <cr-card-radio-button id="installButton" class="flex" name="install"> - <div class="card-container"> - <hd-iron-icon class="card-icon" - icon1x="oobe-24:os-trial-install" - icon2x="oobe-48:os-trial-install"> - </hd-iron-icon> - <div class="card-content"> - <div class="card-label"> - [[i18nDynamic(locale, 'osTrialInstallTitle')]] - </div> - <div class="card-text"> - [[i18nDynamic(locale, 'osTrialInstallSubtitle')]] - </div> - </div> + <div slot="content" class="layout vertical landscape-vertical-centered"> + <cr-radio-group selected="{{selectedTrialOption}}"> + <cr-card-radio-button id="installButton" class="flex" name="install"> + <div class="card-container"> + <hd-iron-icon class="card-icon" + icon1x="oobe-24:os-trial-install" + icon2x="oobe-48:os-trial-install"> + </hd-iron-icon> + <div class="card-content"> + <div class="card-label"> + [[i18nDynamic(locale, 'osTrialInstallTitle')]] </div> - </cr-card-radio-button> - <cr-card-radio-button id="tryButton" class="flex" name="try"> - <div class="card-container"> - <hd-iron-icon class="card-icon" icon1x="oobe-24:os-trial-try" - icon2x="oobe-48:os-trial-try"> - </hd-iron-icon> - <div class="card-content"> - <div class="card-label"> - [[i18nDynamic(locale, 'osTrialTryTitle')]] - </div> - <div class="card-text"> - [[i18nDynamic(locale, 'osTrialTrySubtitle')]] - </div> - </div> + <div class="card-text"> + [[i18nDynamic(locale, 'osTrialInstallSubtitle')]] </div> - </cr-card-radio-button> - </cr-radio-group> + </div> </div> - </div> - <div slot="back-navigation"> - <oobe-back-button id="backButton" - on-click="onBackButtonClick_"></oobe-back-button> - </div> - <div slot="bottom-buttons"> - <oobe-next-button - class="focus-on-show" id="nextButton" - inverse on-click="onNextButtonClick_"></oobe-next-button> - </div> - </oobe-adaptive-dialog> - </template> - <script src="os_trial.js"></script> -</dom-module> + </cr-card-radio-button> + <cr-card-radio-button id="tryButton" class="flex" name="try"> + <div class="card-container"> + <hd-iron-icon class="card-icon" icon1x="oobe-24:os-trial-try" + icon2x="oobe-48:os-trial-try"> + </hd-iron-icon> + <div class="card-content"> + <div class="card-label"> + [[i18nDynamic(locale, 'osTrialTryTitle')]] + </div> + <div class="card-text"> + [[i18nDynamic(locale, 'osTrialTrySubtitle')]] + </div> + </div> + </div> + </cr-card-radio-button> + </cr-radio-group> + </div> + </div> + <div slot="back-navigation"> + <oobe-back-button id="backButton" + on-click="onBackButtonClick_"></oobe-back-button> + </div> + <div slot="bottom-buttons"> + <oobe-next-button + class="focus-on-show" id="nextButton" + inverse on-click="onNextButtonClick_"></oobe-next-button> + </div> +</oobe-adaptive-dialog>
diff --git a/chrome/browser/resources/chromeos/login/screens/common/os_trial.js b/chrome/browser/resources/chromeos/login/screens/common/os_trial.js index 0279f3c..6bd4d75 100644 --- a/chrome/browser/resources/chromeos/login/screens/common/os_trial.js +++ b/chrome/browser/resources/chromeos/login/screens/common/os_trial.js
@@ -6,7 +6,25 @@ * @fileoverview Polymer element for OS trial screen. */ -/* #js_imports_placeholder */ +import '//resources/cr_elements/cr_radio_button/cr_radio_button.js'; +import '//resources/cr_elements/cr_radio_group/cr_radio_group.js'; +import '//resources/cr_elements/cr_shared_vars.css.js'; +import '//resources/polymer/v3_0/iron-icon/iron-icon.js'; +import '../../components/oobe_icons.m.js'; +import '../../components/common_styles/common_styles.m.js'; +import '../../components/common_styles/cr_card_radio_group_styles.m.js'; +import '../../components/common_styles/oobe_dialog_host_styles.m.js'; +import '../../components/dialogs/oobe_adaptive_dialog.m.js'; +import '../../components/hd_iron_icon.js'; +import '../../components/buttons/oobe_next_button.m.js'; +import '../../components/buttons/oobe_back_button.m.js'; + +import {html, mixinBehaviors, PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +import {LoginScreenBehavior, LoginScreenBehaviorInterface} from '../../components/behaviors/login_screen_behavior.m.js'; +import {OobeDialogHostBehavior} from '../../components/behaviors/oobe_dialog_host_behavior.m.js'; +import {OobeI18nBehavior, OobeI18nBehaviorInterface} from '../../components/behaviors/oobe_i18n_behavior.m.js'; + /** * Trial option for setting up the device. @@ -23,9 +41,9 @@ * @implements {LoginScreenBehaviorInterface} * @implements {OobeI18nBehaviorInterface} */ -const OsTrialScreenElementBase = Polymer.mixinBehaviors( +const OsTrialScreenElementBase = mixinBehaviors( [OobeI18nBehavior, OobeDialogHostBehavior, LoginScreenBehavior], - Polymer.Element); + PolymerElement); /** * @polymer @@ -35,7 +53,10 @@ return 'os-trial-element'; } - /* #html_template_placeholder */ + static get template() { + return html`{__html_template__}`; + } + static get properties() { return { /**
diff --git a/chrome/browser/resources/feedback/js/sys_info.ts b/chrome/browser/resources/feedback/js/sys_info.ts index ac7c4dc..9da8a87 100644 --- a/chrome/browser/resources/feedback/js/sys_info.ts +++ b/chrome/browser/resources/feedback/js/sys_info.ts
@@ -19,6 +19,39 @@ */ const STANDARD_DELAY_MS: number = 32; +/** + * The total count of rows that have an Expand/Collapse button. This is needed + * to calculate the aria-pressed state of the global Expand All/Collapse All + * buttons. + */ +let multilineRowsCount = 0; + +/** + * Running count of rows that have been expanded to display all lines. This is + * needed to calculate the aria-pressed state of the global Expand All/Collapse + * All buttons. + */ +let expandedRowsCount = 0; + +function updateGlobalExpandButtonStates() { + const hasExpanded = expandedRowsCount > 0; + const hasCollapsed = multilineRowsCount - expandedRowsCount > 0; + + if (hasExpanded && hasCollapsed) { + $('expandAllBtn').ariaPressed = 'mixed'; + $('collapseAllBtn').ariaPressed = 'mixed'; + } else if (hasExpanded && !hasCollapsed) { + $('expandAllBtn').ariaPressed = 'true'; + $('collapseAllBtn').ariaPressed = 'false'; + } else if (!hasExpanded && hasCollapsed) { + $('expandAllBtn').ariaPressed = 'false'; + $('collapseAllBtn').ariaPressed = 'true'; + } else { + $('expandAllBtn').ariaPressed = 'false'; + $('collapseAllBtn').ariaPressed = 'false'; + } +} + function getValueDivForButton(button: HTMLElement) { return $(button.id.substr(0, button.id.length - 4)); } @@ -56,6 +89,7 @@ // Hide the spinner container. (valueCell.firstChild as HTMLElement).hidden = true; }, STANDARD_DELAY_MS * delayFactor); + expandedRowsCount++; } /** @@ -69,6 +103,7 @@ // Don't have screen readers announce the empty cell. const valueCell = valueDiv.parentNode as HTMLElement; valueCell.setAttribute('aria-hidden', 'true'); + expandedRowsCount--; } /** @@ -82,6 +117,8 @@ } else { collapse(button, valueDiv); } + + updateGlobalExpandButtonStates(); } /** @@ -99,6 +136,8 @@ collapse(button, valueDivs[i]!); } } + + updateGlobalExpandButtonStates(); } /** @@ -116,6 +155,8 @@ expand(button, valueDivs[i]!, i + 1); } } + + updateGlobalExpandButtonStates(); } function createNameCell(key: string): HTMLElement { @@ -142,6 +183,7 @@ button.onclick = changeCollapsedStatus; button.textContent = loadTimeData.getString('sysinfoPageExpandBtn'); buttonCell.appendChild(button); + multilineRowsCount++; } else { // Don't have screen reader read the empty cell. buttonCell.setAttribute('aria-hidden', 'true'); @@ -196,6 +238,7 @@ $('expandAllBtn').onclick = expandAll; $('spinner-container').hidden = true; + updateGlobalExpandButtonStates(); } /**
diff --git a/chrome/browser/sync/chrome_sync_client.cc b/chrome/browser/sync/chrome_sync_client.cc index 4f79125..882278f 100644 --- a/chrome/browser/sync/chrome_sync_client.cc +++ b/chrome/browser/sync/chrome_sync_client.cc
@@ -10,6 +10,7 @@ #include "base/bind.h" #include "base/feature_list.h" +#include "base/files/file_path.h" #include "base/path_service.h" #include "base/syslog_logging.h" #include "build/build_config.h" @@ -158,12 +159,14 @@ namespace { #if !BUILDFLAG(IS_ANDROID) -const base::FilePath::CharType kTrustedVaultFilename[] = +constexpr base::FilePath::CharType kTrustedVaultFilename[] = + FILE_PATH_LITERAL("trusted_vault.pb"); +constexpr base::FilePath::CharType kDeprecatedTrustedVaultFilename[] = FILE_PATH_LITERAL("Trusted Vault"); #endif // !BUILDFLAG(IS_ANDROID) #if BUILDFLAG(IS_WIN) -const base::FilePath::CharType kLoopbackServerBackendFilename[] = +constexpr base::FilePath::CharType kLoopbackServerBackendFilename[] = FILE_PATH_LITERAL("profile.pb"); #endif // BUILDFLAG(IS_WIN) @@ -267,7 +270,9 @@ #else trusted_vault_client_ = std::make_unique<syncer::StandaloneTrustedVaultClient>( - profile_->GetPath().Append(kTrustedVaultFilename), identity_manager, + profile_->GetPath().Append(kTrustedVaultFilename), + profile_->GetPath().Append(kDeprecatedTrustedVaultFilename), + identity_manager, profile_->GetDefaultStoragePartition() ->GetURLLoaderFactoryForBrowserProcess()); #endif // BUILDFLAG(IS_ANDROID)
diff --git a/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc b/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc index 73ff086..308431cf 100644 --- a/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc +++ b/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc
@@ -81,7 +81,9 @@ ScopedJavaLocalRef<jstring> label; ScopedJavaLocalRef<jstring> secondary_label; if (base::FeatureList::IsEnabled( - features::kAutofillEnableVirtualCardMetadata)) { + features::kAutofillEnableVirtualCardMetadata) && + base::FeatureList::IsEnabled( + features::kAutofillEnableCardProductName)) { label = base::android::ConvertUTF16ToJavaString( env, controller_->GetSuggestionMainTextAt(i)); secondary_label = base::android::ConvertUTF16ToJavaString(
diff --git a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/adaptive/AdaptiveToolbarFeatures.java b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/adaptive/AdaptiveToolbarFeatures.java index 8e5e930..12df328 100644 --- a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/adaptive/AdaptiveToolbarFeatures.java +++ b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/adaptive/AdaptiveToolbarFeatures.java
@@ -160,12 +160,16 @@ } public static boolean isPriceTrackingPageActionEnabled() { - return ChromeFeatureList.isEnabled(ChromeFeatureList.CONTEXTUAL_PAGE_ACTION_PRICE_TRACKING) + return ChromeFeatureList.isEnabled(ChromeFeatureList.CONTEXTUAL_PAGE_ACTIONS) + && ChromeFeatureList.isEnabled( + ChromeFeatureList.CONTEXTUAL_PAGE_ACTION_PRICE_TRACKING) && ChromeFeatureList.isEnabled(ChromeFeatureList.SHOPPING_LIST); } public static boolean isReaderModePageActionEnabled() { - return ChromeFeatureList.isEnabled(ChromeFeatureList.CONTEXTUAL_PAGE_ACTION_READER_MODE); + return ChromeFeatureList.isEnabled(ChromeFeatureList.CONTEXTUAL_PAGE_ACTIONS) + && ChromeFeatureList.isEnabled( + ChromeFeatureList.CONTEXTUAL_PAGE_ACTION_READER_MODE); } /**
diff --git a/chrome/browser/ui/app_list/search/os_settings_provider.cc b/chrome/browser/ui/app_list/search/os_settings_provider.cc index ca6a334c..8f54ddca 100644 --- a/chrome/browser/ui/app_list/search/os_settings_provider.cc +++ b/chrome/browser/ui/app_list/search/os_settings_provider.cc
@@ -19,7 +19,6 @@ #include "chrome/browser/ui/app_list/search/search_tags_util.h" #include "chrome/browser/ui/settings_window_manager_chromeos.h" #include "chrome/browser/ui/webui/settings/ash/hierarchy.h" -#include "chrome/browser/ui/webui/settings/ash/os_settings_manager.h" #include "chrome/browser/ui/webui/settings/ash/search/search_handler.h" #include "chrome/browser/web_applications/web_app_id_constants.h" #include "components/services/app_service/public/cpp/app_registry_cache.h" @@ -162,15 +161,13 @@ OsSettingsProvider::OsSettingsProvider( Profile* profile, - ash::settings::OsSettingsManager* settings_manager) - : profile_(profile), settings_manager_(settings_manager) { + ash::settings::SearchHandler* search_handler, + const ash::settings::Hierarchy* hierarchy) + : profile_(profile), + search_handler_(search_handler), + hierarchy_(hierarchy) { DCHECK(profile_); - if (settings_manager_) { - search_handler_ = settings_manager_->search_handler(); - hierarchy_ = settings_manager_->hierarchy(); - } - // |search_handler_| can be nullptr in the case that the new OS settings // search chrome flag is disabled. If it is, we should effectively disable the // search provider.
diff --git a/chrome/browser/ui/app_list/search/os_settings_provider.h b/chrome/browser/ui/app_list/search/os_settings_provider.h index e2f171f..cd7a649 100644 --- a/chrome/browser/ui/app_list/search/os_settings_provider.h +++ b/chrome/browser/ui/app_list/search/os_settings_provider.h
@@ -22,7 +22,6 @@ namespace ash::settings { class Hierarchy; -class OsSettingsManager; class SearchHandler; } // namespace ash::settings @@ -60,7 +59,8 @@ public ash::settings::mojom::SearchResultsObserver { public: OsSettingsProvider(Profile* profile, - ash::settings::OsSettingsManager* settings_manager); + ash::settings::SearchHandler* search_handler, + const ash::settings::Hierarchy* hierarchy); ~OsSettingsProvider() override; OsSettingsProvider(const OsSettingsProvider&) = delete; @@ -117,7 +117,6 @@ float min_score_for_alternates_ = 0.4f; Profile* const profile_; - ash::settings::OsSettingsManager* const settings_manager_; ash::settings::SearchHandler* search_handler_; const ash::settings::Hierarchy* hierarchy_; apps::AppServiceProxy* app_service_proxy_;
diff --git a/chrome/browser/ui/app_list/search/search_controller_factory.cc b/chrome/browser/ui/app_list/search/search_controller_factory.cc index ad286049..5487a99 100644 --- a/chrome/browser/ui/app_list/search/search_controller_factory.cc +++ b/chrome/browser/ui/app_list/search/search_controller_factory.cc
@@ -40,6 +40,7 @@ #include "chrome/browser/ui/app_list/search/search_controller_impl.h" #include "chrome/browser/ui/app_list/search/search_controller_impl_new.h" #include "chrome/browser/ui/app_list/search/search_features.h" +#include "chrome/browser/ui/webui/settings/ash/os_settings_manager.h" #include "chrome/browser/ui/webui/settings/ash/os_settings_manager_factory.h" #include "components/session_manager/core/session_manager.h" @@ -167,11 +168,14 @@ } size_t os_settings_search_group_id = controller->AddGroup(kGenericMaxResults); + auto* os_settings_manager = + ash::settings::OsSettingsManagerFactory::GetForProfile(profile); controller->AddProvider( os_settings_search_group_id, std::make_unique<OsSettingsProvider>( profile, - ash::settings::OsSettingsManagerFactory::GetForProfile(profile))); + os_settings_manager ? os_settings_manager->search_handler() : nullptr, + os_settings_manager ? os_settings_manager->hierarchy() : nullptr)); if (ash::features::IsProductivityLauncherEnabled() && base::GetFieldTrialParamByFeatureAsBool(
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc index cd48375..0182d4ae 100644 --- a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc +++ b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc
@@ -502,7 +502,7 @@ requesting_frame->GetBrowserContext() ->GetPermissionController() ->GetPermissionStatusForCurrentDocument( - blink::PermissionType::WINDOW_PLACEMENT, + blink::PermissionType::WINDOW_MANAGEMENT, requesting_frame) != blink::mojom::PermissionStatus::GRANTED) { display_id = display::kInvalidDisplayId;
diff --git a/chrome/browser/ui/performance_controls/tab_discard_tab_helper.cc b/chrome/browser/ui/performance_controls/tab_discard_tab_helper.cc index 1a7e6bf5..550dab1 100644 --- a/chrome/browser/ui/performance_controls/tab_discard_tab_helper.cc +++ b/chrome/browser/ui/performance_controls/tab_discard_tab_helper.cc
@@ -29,6 +29,14 @@ was_animated_ = true; } +void TabDiscardTabHelper::SetChipHasBeenHidden() { + was_chip_hidden_ = true; +} + +bool TabDiscardTabHelper::HasChipBeenHidden() { + return was_chip_hidden_; +} + uint64_t TabDiscardTabHelper::GetMemorySavingsInBytes() const { auto* pre_discard_resource_usage = performance_manager::user_tuning::UserPerformanceTuningManager:: @@ -55,6 +63,7 @@ } was_discarded_ = navigation_handle->ExistingDocumentWasDiscarded(); was_animated_ = false; + was_chip_hidden_ = false; } WEB_CONTENTS_USER_DATA_KEY_IMPL(TabDiscardTabHelper);
diff --git a/chrome/browser/ui/performance_controls/tab_discard_tab_helper.h b/chrome/browser/ui/performance_controls/tab_discard_tab_helper.h index 106e43e..87fccdc 100644 --- a/chrome/browser/ui/performance_controls/tab_discard_tab_helper.h +++ b/chrome/browser/ui/performance_controls/tab_discard_tab_helper.h
@@ -32,6 +32,17 @@ // Indicates that the chip has been animated for the current discard. void SetWasAnimated(); + // Indicates that the tab associated with this helper has been navigated + // away from. + // Note: "Hidden" means that the user has navigated away from the tab + // associated with this helper and thus this tab helper's state shouldn't + // be shown to user while another tab is active. + void SetChipHasBeenHidden(); + + // Returns whether the tab associated with this helper has been navigated + // away from and to another tab. + bool HasChipBeenHidden(); + // Returns the memory savings (in bytes) of the previously discarded tab. uint64_t GetMemorySavingsInBytes() const; @@ -44,6 +55,7 @@ explicit TabDiscardTabHelper(content::WebContents* contents); bool was_discarded_ = false; bool was_animated_ = false; + bool was_chip_hidden_ = false; WEB_CONTENTS_USER_DATA_KEY_DECL(); };
diff --git a/chrome/browser/ui/startup/web_app_startup_utils.cc b/chrome/browser/ui/startup/web_app_startup_utils.cc index 503a28f..21b6d176 100644 --- a/chrome/browser/ui/startup/web_app_startup_utils.cc +++ b/chrome/browser/ui/startup/web_app_startup_utils.cc
@@ -40,6 +40,7 @@ #include "chrome/browser/web_applications/os_integration/os_integration_manager.h" #include "chrome/browser/web_applications/os_integration/web_app_file_handler_manager.h" #include "chrome/browser/web_applications/web_app.h" +#include "chrome/browser/web_applications/web_app_command_scheduler.h" #include "chrome/browser/web_applications/web_app_id.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/browser/web_applications/web_app_registrar.h" @@ -308,8 +309,10 @@ allowed, std::move(persist_callback)); } else { DCHECK(!file_launch_infos_.empty()); - PersistFileHandlersUserChoice(profile_, app_id_, allowed, - std::move(persist_callback)); + WebAppProvider::GetForWebApps(profile_) + ->scheduler() + .PersistFileHandlersUserChoice(app_id_, allowed, + std::move(persist_callback)); } } else { std::move(persist_callback).Run();
diff --git a/chrome/browser/ui/views/commerce/price_tracking_view.cc b/chrome/browser/ui/views/commerce/price_tracking_view.cc index 1393802..c88dae40 100644 --- a/chrome/browser/ui/views/commerce/price_tracking_view.cc +++ b/chrome/browser/ui/views/commerce/price_tracking_view.cc
@@ -66,9 +66,12 @@ title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); title_label->SetFocusBehavior(View::FocusBehavior::ACCESSIBLE_ONLY); // Body label + int body_string_id = IDS_BOOKMARK_STAR_DIALOG_TRACK_PRICE_DESCRIPTION; + if (profile_ && commerce::IsEmailDisabledByUser(profile_->GetPrefs())) { + body_string_id = IDS_BOOKMARK_STAR_DIALOG_TRACK_PRICE_DESCRIPTION_EMAIL_OFF; + } body_label_ = text_container->AddChildView(std::make_unique<views::Label>( - l10n_util::GetStringUTF16( - IDS_BOOKMARK_STAR_DIALOG_TRACK_PRICE_DESCRIPTION), + l10n_util::GetStringUTF16(body_string_id), views::style::CONTEXT_DIALOG_BODY_TEXT, views::style::STYLE_SECONDARY)); body_label_->SetProperty(views::kMarginsKey, gfx::Insets::TLBR(kLableSpacing, 0, 0, 0));
diff --git a/chrome/browser/ui/views/commerce/price_tracking_view_unittest.cc b/chrome/browser/ui/views/commerce/price_tracking_view_unittest.cc index 41607cca..7532d5d 100644 --- a/chrome/browser/ui/views/commerce/price_tracking_view_unittest.cc +++ b/chrome/browser/ui/views/commerce/price_tracking_view_unittest.cc
@@ -14,6 +14,7 @@ #include "components/bookmarks/browser/bookmark_utils.h" #include "components/bookmarks/test/bookmark_test_helpers.h" #include "components/commerce/core/mock_shopping_service.h" +#include "components/commerce/core/pref_names.h" #include "components/commerce/core/test_utils.h" #include "components/prefs/pref_service.h" #include "components/strings/grit/components_strings.h" @@ -221,3 +222,23 @@ "Commerce.PriceTracking.BookmarkDialogPriceTrackViewUntrackedPrice"), 1); } + +TEST_F(PriceTrackingViewTest, EmailTurnedOff) { + profile()->GetPrefs()->SetBoolean(commerce::kPriceEmailNotificationsEnabled, + false); + const bool enabled = false; + CreateViewAndShow(enabled); + VerifyToggleState(enabled); + VerifyBodyMessage(l10n_util::GetStringUTF16( + IDS_BOOKMARK_STAR_DIALOG_TRACK_PRICE_DESCRIPTION_EMAIL_OFF)); +} + +TEST_F(PriceTrackingViewTest, EmailTurnedOn) { + profile()->GetPrefs()->SetBoolean(commerce::kPriceEmailNotificationsEnabled, + true); + const bool enabled = false; + CreateViewAndShow(enabled); + VerifyToggleState(enabled); + VerifyBodyMessage(l10n_util::GetStringUTF16( + IDS_BOOKMARK_STAR_DIALOG_TRACK_PRICE_DESCRIPTION)); +}
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index c3264c2..42d6a950 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -2188,7 +2188,7 @@ ->GetBrowserContext() ->GetPermissionController() ->GetPermissionResultForOriginWithoutContext( - blink::PermissionType::WINDOW_PLACEMENT, url) + blink::PermissionType::WINDOW_MANAGEMENT, url) .status; window_management_permission_granted_ = @@ -2230,14 +2230,14 @@ UpdateWindowManagementPermission( controller ->GetPermissionResultForOriginWithoutContext( - blink::PermissionType::WINDOW_PLACEMENT, url) + blink::PermissionType::WINDOW_MANAGEMENT, url) .status); // It is safe to bind base::Unretained(this) because WebContents is // owned by BrowserView. window_management_subscription_id_ = controller->SubscribePermissionStatusChange( - blink::PermissionType::WINDOW_PLACEMENT, rfh->GetProcess(), url, + blink::PermissionType::WINDOW_MANAGEMENT, rfh->GetProcess(), url, base::BindRepeating(&BrowserView::UpdateWindowManagementPermission, base::Unretained(this))); }
diff --git a/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view.cc b/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view.cc index 71bf173..30994aa4 100644 --- a/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view.cc +++ b/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view.cc
@@ -12,6 +12,8 @@ #include "chrome/browser/ui/browser_element_identifiers.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/performance_controls/tab_discard_tab_helper.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" +#include "chrome/browser/ui/tabs/tab_strip_model_observer.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/toolbar_button_provider.h" #include "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h" @@ -66,9 +68,12 @@ SetUpForInOutAnimation(kChipAnimationDuration); SetPaintLabelOverSolidBackground(true); SetProperty(views::kElementIdentifierKey, kHighEfficiencyChipElementId); + browser_->tab_strip_model()->AddObserver(this); } -HighEfficiencyChipView::~HighEfficiencyChipView() = default; +HighEfficiencyChipView::~HighEfficiencyChipView() { + browser_->tab_strip_model()->RemoveObserver(this); +} void HighEfficiencyChipView::OnBubbleShown() { PauseAnimation(); @@ -79,6 +84,22 @@ bubble_ = nullptr; } +void HighEfficiencyChipView::OnTabStripModelChanged( + TabStripModel* tab_strip_model, + const TabStripModelChange& change, + const TabStripSelectionChange& selection) { + content::WebContents* const web_contents = selection.old_contents; + if (!web_contents) { + return; + } + + if (selection.active_tab_changed()) { + TabDiscardTabHelper* const tab_helper = + TabDiscardTabHelper::FromWebContents(web_contents); + tab_helper->SetChipHasBeenHidden(); + } +} + void HighEfficiencyChipView::UpdateImpl() { content::WebContents* const web_contents = GetWebContents(); if (!web_contents) { @@ -100,6 +121,8 @@ pref_service->SetInteger(prefs::kHighEfficiencyChipExpandedCount, times_rendered + 1); } + } else if (tab_helper->HasChipBeenHidden()) { + ResetSlideAnimation(false); } if (performance_manager::features::kHighEfficiencyModeDefaultState.Get()) {
diff --git a/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view.h b/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view.h index 7f77ebc6..9aae957 100644 --- a/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view.h +++ b/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view.h
@@ -7,6 +7,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/performance_controls/high_efficiency_bubble_observer.h" +#include "chrome/browser/ui/tabs/tab_strip_model_observer.h" #include "chrome/browser/ui/views/page_action/page_action_icon_view.h" #include "components/prefs/pref_change_registrar.h" #include "ui/base/metadata/metadata_header_macros.h" @@ -15,7 +16,8 @@ // Represents the high efficiency page action chip that appears on previously // discarded tabs. class HighEfficiencyChipView : public PageActionIconView, - public HighEfficiencyBubbleObserver { + public HighEfficiencyBubbleObserver, + public TabStripModelObserver { public: METADATA_HEADER(HighEfficiencyChipView); HighEfficiencyChipView( @@ -31,6 +33,12 @@ void OnBubbleShown() override; void OnBubbleHidden() override; + // TabStripModelObserver: + void OnTabStripModelChanged( + TabStripModel* tab_strip_model, + const TabStripModelChange& change, + const TabStripSelectionChange& selection) override; + protected: // PageActionIconView: void UpdateImpl() override;
diff --git a/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view_browsertest.cc b/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view_browsertest.cc index 31e2d57e..b72ac1bc 100644 --- a/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view_browsertest.cc +++ b/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view_browsertest.cc
@@ -65,7 +65,7 @@ return promo_controller; } - PageActionIconView* GetPageActionIconView() { + PageActionIconView* GetHighEfficiencyChipView() { BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); return browser_view->GetLocationBarView() @@ -73,9 +73,10 @@ ->GetIconView(PageActionIconType::kHighEfficiency); } - void PressButton(views::Button* button) { + void ClickHighEfficiencyChip() { views::test::InteractionTestUtilSimulatorViews::PressButton( - button, ui::test::InteractionTestUtil::InputType::kMouse); + GetHighEfficiencyChipView(), + ui::test::InteractionTestUtil::InputType::kMouse); } void SetTabDiscardState(bool is_discarded) { @@ -100,8 +101,31 @@ waiter.WaitIfNeededAndGet(); } + user_education::HelpBubbleView* GetHelpBubbleView() { + return GetFeaturePromoController() + ->promo_bubble_for_testing() + ->AsA<user_education::HelpBubbleViews>() + ->bubble_view(); + } + + void ClickIPHCancelButton() { + views::test::WidgetDestroyedWaiter waiter(GetHelpBubbleView()->GetWidget()); + views::test::InteractionTestUtilSimulatorViews::PressButton( + GetHelpBubbleView()->GetDefaultButtonForTesting(), + ui::test::InteractionTestUtil::InputType::kMouse); + waiter.Wait(); + } + + void ClickIPHSettingsButton() { + views::test::WidgetDestroyedWaiter waiter(GetHelpBubbleView()->GetWidget()); + views::test::InteractionTestUtilSimulatorViews::PressButton( + GetHelpBubbleView()->GetNonDefaultButtonForTesting(0), + ui::test::InteractionTestUtil::InputType::kMouse); + waiter.Wait(); + } + views::InkDropState GetInkDropState() { - return views::InkDrop::Get(GetPageActionIconView()) + return views::InkDrop::Get(GetHighEfficiencyChipView()) ->GetInkDrop() ->GetTargetInkDropState(); } @@ -111,17 +135,13 @@ }; IN_PROC_BROWSER_TEST_F(HighEfficiencyChipViewBrowserTest, - PromoCustomActionClicked) { + NavigatesOnIPHSettingsLinkClicked) { auto lock = BrowserFeaturePromoController::BlockActiveWindowCheckForTesting(); - auto* const promo_controller = GetFeaturePromoController(); EXPECT_FALSE(GetFeaturePromoController()->IsPromoActive( feature_engagement::kIPHHighEfficiencyInfoModeFeature)); SetTabDiscardState(true); - PageActionIconView* icon = GetPageActionIconView(); - EXPECT_TRUE(icon->GetVisible()); - WaitForIPHToShow(); EXPECT_TRUE(GetFeaturePromoController()->IsPromoActive( @@ -129,11 +149,7 @@ content::TestNavigationObserver navigation_observer( browser()->tab_strip_model()->GetWebContentsAt(0)); - auto* promo_bubble = promo_controller->promo_bubble_for_testing() - ->AsA<user_education::HelpBubbleViews>() - ->bubble_view(); - auto* custom_action_button = promo_bubble->GetNonDefaultButtonForTesting(0); - PressButton(custom_action_button); + ClickIPHSettingsButton(); navigation_observer.Wait(); GURL expected(chrome::kChromeUIPerformanceSettingsURL); @@ -141,56 +157,43 @@ } IN_PROC_BROWSER_TEST_F(HighEfficiencyChipViewBrowserTest, - PromoDismissesOnChipClick) { + PromoDismissesOnCancelClick) { auto lock = BrowserFeaturePromoController::BlockActiveWindowCheckForTesting(); SetTabDiscardState(true); - PageActionIconView* icon = GetPageActionIconView(); WaitForIPHToShow(); EXPECT_TRUE(GetFeaturePromoController()->IsPromoActive( feature_engagement::kIPHHighEfficiencyInfoModeFeature)); - PressButton(icon); + ClickHighEfficiencyChip(); // Expect the bubble to be open and the promo to be closed. EXPECT_FALSE(GetFeaturePromoController()->IsPromoActive( feature_engagement::kIPHHighEfficiencyInfoModeFeature)); - EXPECT_NE(icon->GetBubble(), nullptr); + EXPECT_NE(GetHighEfficiencyChipView()->GetBubble(), nullptr); } IN_PROC_BROWSER_TEST_F(HighEfficiencyChipViewBrowserTest, ShowAndHideInkDropWithPromo) { auto lock = BrowserFeaturePromoController::BlockActiveWindowCheckForTesting(); - auto* const promo_controller = GetFeaturePromoController(); EXPECT_FALSE(GetFeaturePromoController()->IsPromoActive( feature_engagement::kIPHHighEfficiencyInfoModeFeature)); SetTabDiscardState(true); - PageActionIconView* icon = GetPageActionIconView(); - EXPECT_TRUE(icon->GetVisible()); - WaitForIPHToShow(); EXPECT_TRUE(GetFeaturePromoController()->IsPromoActive( feature_engagement::kIPHHighEfficiencyInfoModeFeature)); - EXPECT_EQ(GetInkDropState(), views::InkDropState::ACTIVATED); - auto* promo_bubble = promo_controller->promo_bubble_for_testing() - ->AsA<user_education::HelpBubbleViews>() - ->bubble_view(); + ClickIPHCancelButton(); - views::test::WidgetDestroyedWaiter waiter(promo_bubble->GetWidget()); - auto* default_action_button = promo_bubble->GetDefaultButtonForTesting(); - PressButton(default_action_button); - waiter.Wait(); - - EXPECT_FALSE(browser()->window()->IsFeaturePromoActive( + EXPECT_FALSE(GetFeaturePromoController()->IsPromoActive( feature_engagement::kIPHHighEfficiencyInfoModeFeature)); - views::InkDropState current_state = GetInkDropState(); + // The deactivated state is HIDDEN on Mac but DEACTIVATED on Linux. EXPECT_TRUE(current_state == views::InkDropState::HIDDEN || current_state == views::InkDropState::DEACTIVATED); }
diff --git a/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view_unittest.cc b/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view_unittest.cc index d4034aa..75d5b29 100644 --- a/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view_unittest.cc +++ b/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view_unittest.cc
@@ -70,9 +70,9 @@ environment_.TearDown(); } - void SetTabDiscardState(bool is_discarded) { + void SetTabDiscardState(int tab_index, bool is_discarded) { TabDiscardTabHelper* tab_helper = TabDiscardTabHelper::FromWebContents( - browser()->tab_strip_model()->GetWebContentsAt(0)); + browser()->tab_strip_model()->GetWebContentsAt(tab_index)); std::unique_ptr<DiscardMockNavigationHandle> navigation_handle = std::make_unique<DiscardMockNavigationHandle>(); navigation_handle.get()->SetWasDiscarded(is_discarded); @@ -125,7 +125,7 @@ // updated it should be visible. TEST_F(HighEfficiencyChipViewTest, ShouldShowForDiscardedPage) { SetHighEfficiencyModeEnabled(true); - SetTabDiscardState(true); + SetTabDiscardState(0, true); PageActionIconView* view = GetPageActionIconView(); @@ -136,7 +136,7 @@ // enabled, we don't show the chip. TEST_F(HighEfficiencyChipViewTest, ShouldNotShowWhenPrefIsFalse) { SetHighEfficiencyModeEnabled(false); - SetTabDiscardState(true); + SetTabDiscardState(0, true); PageActionIconView* view = GetPageActionIconView(); @@ -147,7 +147,7 @@ // visible. TEST_F(HighEfficiencyChipViewTest, ShouldNotShowForRegularPage) { SetHighEfficiencyModeEnabled(true); - SetTabDiscardState(false); + SetTabDiscardState(0, false); PageActionIconView* view = GetPageActionIconView(); EXPECT_FALSE(view->GetVisible()); @@ -156,7 +156,7 @@ // When the page action chip is clicked, the dialog should open. TEST_F(HighEfficiencyChipViewTest, ShouldOpenDialogOnClick) { SetHighEfficiencyModeEnabled(true); - SetTabDiscardState(true); + SetTabDiscardState(0, true); PageActionIconView* view = GetPageActionIconView(); EXPECT_EQ(view->GetBubble(), nullptr); @@ -171,7 +171,7 @@ // When the dialog is closed, UMA metrics should be logged. TEST_F(HighEfficiencyChipViewTest, ShouldLogMetricsOnDialogDismiss) { - SetTabDiscardState(true); + SetTabDiscardState(0, true); PageActionIconView* view = GetPageActionIconView(); EXPECT_EQ(view->GetBubble(), nullptr); @@ -191,7 +191,7 @@ // When the dialog is closed, the ink drop should hide. TEST_F(HighEfficiencyChipViewTest, ShouldShowAndHideInkDrop) { - SetTabDiscardState(true); + SetTabDiscardState(0, true); PageActionIconView* view = GetPageActionIconView(); EXPECT_EQ(GetInkDropState(), views::InkDropState::HIDDEN); @@ -213,7 +213,7 @@ // A link should be rendered within the dialog. TEST_F(HighEfficiencyChipViewTest, ShouldRenderLinkInDialog) { - SetTabDiscardState(true); + SetTabDiscardState(0, true); PageActionIconView* view = GetPageActionIconView(); @@ -231,7 +231,7 @@ // The memory savings should be rendered within the dialog. TEST_F(HighEfficiencyChipViewTest, ShouldRenderMemorySavingsInDialog) { - SetTabDiscardState(true); + SetTabDiscardState(0, true); PageActionIconView* view = GetPageActionIconView(); @@ -252,12 +252,37 @@ SetHighEfficiencyModeEnabled(true); // Open the tab 3 times with the label being visible. for (int i = 0; i < 3; i++) { - SetTabDiscardState(true); + SetTabDiscardState(0, true); EXPECT_TRUE(GetPageActionIconView()->ShouldShowLabel()); - SetTabDiscardState(false); + SetTabDiscardState(0, false); } // On the 4th time, the label should be hidden. - SetTabDiscardState(true); + SetTabDiscardState(0, true); + EXPECT_FALSE(GetPageActionIconView()->ShouldShowLabel()); +} + +// When a chip is expaneded with the label, if we navigate to another tab +// and come back, the chip should be collapsed with the label hidden. +TEST_F(HighEfficiencyChipViewTest, ShouldCollapseChipAfterNavigatingTabs) { + SetHighEfficiencyModeEnabled(true); + TabStripModel* tab_strip_model = browser()->tab_strip_model(); + AddTab(browser(), GURL("http://foo")); + EXPECT_EQ(2, tab_strip_model->GetTabCount()); + + SetTabDiscardState(0, true); + EXPECT_TRUE(GetPageActionIconView()->ShouldShowLabel()); + + tab_strip_model->SelectNextTab(); + PageActionIconView* view = GetPageActionIconView(); + EXPECT_FALSE(view->GetVisible()); + + SetTabDiscardState(1, true); + EXPECT_TRUE(GetPageActionIconView()->ShouldShowLabel()); + + tab_strip_model->SelectPreviousTab(); + EXPECT_FALSE(GetPageActionIconView()->ShouldShowLabel()); + + tab_strip_model->SelectNextTab(); EXPECT_FALSE(GetPageActionIconView()->ShouldShowLabel()); }
diff --git a/chrome/browser/ui/web_applications/sub_apps_service_impl.cc b/chrome/browser/ui/web_applications/sub_apps_service_impl.cc index a02b475..4e448a9e7 100644 --- a/chrome/browser/ui/web_applications/sub_apps_service_impl.cc +++ b/chrome/browser/ui/web_applications/sub_apps_service_impl.cc
@@ -15,6 +15,7 @@ #include "chrome/browser/web_applications/web_app_command_manager.h" #include "chrome/browser/web_applications/web_app_data_retriever.h" #include "chrome/browser/web_applications/web_app_helpers.h" +#include "chrome/browser/web_applications/web_app_id.h" #include "chrome/browser/web_applications/web_app_install_finalizer.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/browser/web_applications/web_app_registrar.h" @@ -31,6 +32,8 @@ using blink::mojom::SubAppsServiceAddResult; using blink::mojom::SubAppsServiceAddResultCode; using blink::mojom::SubAppsServiceAddResultPtr; +using blink::mojom::SubAppsServiceListInfo; +using blink::mojom::SubAppsServiceListInfoPtr; using blink::mojom::SubAppsServiceListResult; using blink::mojom::SubAppsServiceResult; @@ -181,8 +184,9 @@ const AppId* parent_app_id = GetAppId(render_frame_host()); if (!parent_app_id) { return std::move(result_callback) - .Run(SubAppsServiceListResult::New(SubAppsServiceResult::kFailure, - std::vector<UnhashedAppId>())); + .Run(SubAppsServiceListResult::New( + SubAppsServiceResult::kFailure, + std::vector<SubAppsServiceListInfoPtr>())); } WebAppProvider* provider = GetWebAppProvider(render_frame_host()); if (!provider->on_registry_ready().is_signaled()) { @@ -195,16 +199,18 @@ WebAppRegistrar& registrar = provider->registrar(); - std::vector<UnhashedAppId> sub_app_ids; + std::vector<SubAppsServiceListInfoPtr> sub_apps; for (const AppId& web_app_id : registrar.GetAllSubAppIds(*parent_app_id)) { const WebApp* web_app = registrar.GetAppById(web_app_id); - sub_app_ids.push_back( - GenerateAppIdUnhashed(web_app->manifest_id(), web_app->start_url())); + UnhashedAppId sub_app_id = + GenerateAppIdUnhashed(web_app->manifest_id(), web_app->start_url()); + sub_apps.push_back( + SubAppsServiceListInfo::New(sub_app_id, web_app->untranslated_name())); } std::move(result_callback) .Run(SubAppsServiceListResult::New(SubAppsServiceResult::kSuccess, - std::move(sub_app_ids))); + std::move(sub_apps))); } void SubAppsServiceImpl::Remove(const UnhashedAppId& unhashed_app_id,
diff --git a/chrome/browser/ui/web_applications/sub_apps_service_impl_browsertest.cc b/chrome/browser/ui/web_applications/sub_apps_service_impl_browsertest.cc index a6d9ce87..2cc3faa 100644 --- a/chrome/browser/ui/web_applications/sub_apps_service_impl_browsertest.cc +++ b/chrome/browser/ui/web_applications/sub_apps_service_impl_browsertest.cc
@@ -38,6 +38,8 @@ using blink::mojom::SubAppsServiceAddInfo; using blink::mojom::SubAppsServiceAddInfoPtr; using blink::mojom::SubAppsServiceAddResultCode; +using blink::mojom::SubAppsServiceListInfo; +using blink::mojom::SubAppsServiceListInfoPtr; using blink::mojom::SubAppsServiceListResultPtr; using blink::mojom::SubAppsServiceResult; @@ -50,10 +52,13 @@ constexpr const char kDifferentDomain[] = "www.different-domain.com"; constexpr const char kParentAppPath[] = "/web_apps/basic.html"; constexpr const char kSubAppPath[] = "/web_apps/standalone/basic.html"; +constexpr const char kSubAppName[] = "Site A"; constexpr const char kSubAppPathMinimalUi[] = "/web_apps/standalone/basic.html?manifest=manifest_minimal_ui.json"; constexpr const char kSubAppPath2[] = "/web_apps/minimal_ui/basic.html"; +constexpr const char kSubAppName2[] = "Site B"; constexpr const char kSubAppPath3[] = "/web_apps/site_d/basic.html"; +constexpr const char kSubAppName3[] = "Site D"; constexpr const char kSubAppPathInvalid[] = "/invalid/sub/app/path.html"; } // namespace @@ -760,7 +765,7 @@ // Empty list before adding any sub-apps. SubAppsServiceListResultPtr result = CallList(); EXPECT_EQ(SubAppsServiceResult::kSuccess, result->code); - EXPECT_EQ(std::vector<std::string>{}, result->sub_app_ids); + EXPECT_EQ(std::vector<SubAppsServiceListInfoPtr>{}, result->sub_apps); UnhashedAppId unhashed_sub_app_id_1 = GenerateAppIdUnhashed(/*manifest_id=*/absl::nullopt, GetURL(kSubAppPath)); @@ -779,16 +784,27 @@ SubAppsServiceAddResultCode::kSuccessNewInstall), CallAdd({{unhashed_sub_app_id_3, GetURL(kSubAppPath3)}})); + // We need to use a set for comparison because the ordering changes between + // invocations (due to embedded test server using a random port each time). + base::flat_set<SubAppsServiceListInfoPtr> expected_set; + expected_set.emplace( + SubAppsServiceListInfo::New(unhashed_sub_app_id_1, kSubAppName)); + expected_set.emplace( + SubAppsServiceListInfo::New(unhashed_sub_app_id_2, kSubAppName2)); + expected_set.emplace( + SubAppsServiceListInfo::New(unhashed_sub_app_id_3, kSubAppName3)); + result = CallList(); // We see all three sub-apps now. We need to use UnorderedElementsAre because // the ordering changes between invocations (due to embedded test server using // a random port each time). EXPECT_EQ(SubAppsServiceResult::kSuccess, result->code); - EXPECT_THAT(result->sub_app_ids, - testing::UnorderedElementsAre(GetURL(kSubAppPath).spec(), - GetURL(kSubAppPath2).spec(), - GetURL(kSubAppPath3).spec())); + base::flat_set<SubAppsServiceListInfoPtr> actual_set( + std::make_move_iterator(result->sub_apps.begin()), + std::make_move_iterator(result->sub_apps.end())); + // We see all three sub-apps now. + EXPECT_EQ(expected_set, actual_set); } // Verify that the list call doesn't return a non-sub-apps installed app. @@ -804,14 +820,19 @@ UnhashedAppId unhashed_sub_app_id_2 = GenerateAppIdUnhashed( /*manifest_id=*/absl::nullopt, GetURL(kSubAppPath2)); // Sub-app install. - EXPECT_EQ(AddResultMojo(unhashed_sub_app_id_2, - SubAppsServiceAddResultCode::kSuccessNewInstall), + EXPECT_EQ(AddResultMojo( + unhashed_sub_app_id_2, + blink::mojom::SubAppsServiceAddResultCode::kSuccessNewInstall), CallAdd({{unhashed_sub_app_id_2, GetURL(kSubAppPath2)}})); + + std::vector<SubAppsServiceListInfoPtr> expected_result; + expected_result.emplace_back( + SubAppsServiceListInfo::New(unhashed_sub_app_id_2, kSubAppName2)); + // Should only see the sub-app one here, not the standalone. SubAppsServiceListResultPtr result = CallList(); EXPECT_EQ(SubAppsServiceResult::kSuccess, result->code); - EXPECT_EQ(std::vector<std::string>{GetURL(kSubAppPath2).spec()}, - result->sub_app_ids); + EXPECT_EQ(expected_result, result->sub_apps); } // List call returns failure if the parent app isn't installed. @@ -822,7 +843,7 @@ SubAppsServiceListResultPtr result = CallList(); EXPECT_EQ(SubAppsServiceResult::kFailure, result->code); - EXPECT_EQ(std::vector<std::string>(), result->sub_app_ids); + EXPECT_EQ(std::vector<SubAppsServiceListInfoPtr>{}, result->sub_apps); } // Remove works with one app.
diff --git a/chrome/browser/ui/webui/access_code_cast/access_code_cast_dialog.cc b/chrome/browser/ui/webui/access_code_cast/access_code_cast_dialog.cc index ad1465e..0812de7 100644 --- a/chrome/browser/ui/webui/access_code_cast/access_code_cast_dialog.cc +++ b/chrome/browser/ui/webui/access_code_cast/access_code_cast_dialog.cc
@@ -39,11 +39,15 @@ // The corner radius for system dialogs. constexpr int kSystemDialogCornerRadiusDp = 12; -// The default width, height without footnote, height with footnote for the dialog container. +// The default width, height without footnote, height with footnote for the +// dialog container. const int kDialogWidthDefault = 448; const int kDialogHeightDefault = 295; const int kDialogHeightFootnote = 330; +// static +bool AccessCodeCastDialog::block_widget_activation_changed_for_test_ = false; + AccessCodeCastDialog::AccessCodeCastDialog( const CastModeSet& cast_mode_set, std::unique_ptr<MediaRouteStarter> media_route_starter) @@ -151,6 +155,8 @@ // views::WidgetObserver: void AccessCodeCastDialog::OnWidgetActivationChanged(views::Widget* widget, bool active) { + if (block_widget_activation_changed_for_test_) + return; DCHECK(dialog_widget_) << "dialog_widget_ must be set exactly once during dialog setup"; // Close the dialog only if it is no longer active and it isn't already @@ -183,7 +189,7 @@ base::TimeDelta duration_pref = GetAccessCodeDeviceDurationPref(context_); bool rememberDevices = duration_pref != base::Seconds(0); size->SetSize(kDialogWidthDefault, - rememberDevices ? kDialogHeightFootnote : kDialogHeightDefault); + rememberDevices ? kDialogHeightFootnote : kDialogHeightDefault); } std::string AccessCodeCastDialog::GetDialogArgs() const {
diff --git a/chrome/browser/ui/webui/access_code_cast/access_code_cast_dialog.h b/chrome/browser/ui/webui/access_code_cast/access_code_cast_dialog.h index d2e5c0a..569d68d 100644 --- a/chrome/browser/ui/webui/access_code_cast/access_code_cast_dialog.h +++ b/chrome/browser/ui/webui/access_code_cast/access_code_cast_dialog.h
@@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_UI_WEBUI_ACCESS_CODE_CAST_ACCESS_CODE_CAST_DIALOG_H_ #define CHROME_BROWSER_UI_WEBUI_ACCESS_CODE_CAST_ACCESS_CODE_CAST_DIALOG_H_ +#include "base/check_is_test.h" #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" #include "base/time/time.h" @@ -60,6 +61,13 @@ // views::WidgetObserver: void OnWidgetActivationChanged(views::Widget* widget, bool active) override; + // Blocks the widget automatically closing + // when focus changes. This is to counter flaky tests. + static void ShouldBlockWidgetActivationChangedForTest(bool should_block) { + CHECK_IS_TEST(); + block_widget_activation_changed_for_test_ = should_block; + } + base::WeakPtr<AccessCodeCastDialog> GetWeakPtr(); protected: @@ -116,6 +124,8 @@ base::Time dialog_creation_timestamp_; bool closing_dialog_ = false; + static bool block_widget_activation_changed_for_test_; + base::WeakPtrFactory<AccessCodeCastDialog> weak_ptr_factory_{this}; };
diff --git a/chrome/browser/ui/webui/access_code_cast/access_code_cast_handler_browsertest.cc b/chrome/browser/ui/webui/access_code_cast/access_code_cast_handler_browsertest.cc index fd8aed5..d3cbf34 100644 --- a/chrome/browser/ui/webui/access_code_cast/access_code_cast_handler_browsertest.cc +++ b/chrome/browser/ui/webui/access_code_cast/access_code_cast_handler_browsertest.cc
@@ -21,12 +21,6 @@ // surface a server error. IN_PROC_BROWSER_TEST_F(AccessCodeCastHandlerBrowserTest, ExpectNetworkErrorWhenNoNetwork) { -#if BUILDFLAG(IS_WIN) - // TODO(b/235896651): This test sometimes timesout on win10. - if (base::win::GetVersion() >= base::win::Version::WIN10) - GTEST_SKIP() << "This test is flaky on win10"; -#endif - EnableAccessCodeCasting(); // This tests that if the network is not present (we are not connected to the @@ -51,12 +45,6 @@ IN_PROC_BROWSER_TEST_F(AccessCodeCastHandlerBrowserTest, ReturnSuccessfulResponse) { -#if BUILDFLAG(IS_WIN) - // TODO(b/235896651): This test sometimes timesout on win10. - if (base::win::GetVersion() >= base::win::Version::WIN10) - GTEST_SKIP() << "This test is flaky on win10"; -#endif - const char kEndpointResponseSuccess[] = R"({ "device": { @@ -104,12 +92,6 @@ IN_PROC_BROWSER_TEST_F(AccessCodeCastHandlerBrowserTest, ExpectProfileSynErrorWhenNoSync) { -#if BUILDFLAG(IS_WIN) - // TODO(b/235896651): This test sometimes timesout on win10. - if (base::win::GetVersion() >= base::win::Version::WIN10) - GTEST_SKIP() << "This test is flaky on win10"; -#endif - EnableAccessCodeCasting(); // This tests that an account that does not have Sync enabled will throw a
diff --git a/chrome/browser/web_applications/BUILD.gn b/chrome/browser/web_applications/BUILD.gn index bef9088e..398dfc5 100644 --- a/chrome/browser/web_applications/BUILD.gn +++ b/chrome/browser/web_applications/BUILD.gn
@@ -28,6 +28,8 @@ "commands/run_on_os_login_command.h", "commands/sub_app_install_command.cc", "commands/sub_app_install_command.h", + "commands/update_file_handler_command.cc", + "commands/update_file_handler_command.h", "commands/web_app_command.cc", "commands/web_app_command.h", "commands/web_app_uninstall_command.cc", @@ -550,6 +552,7 @@ "commands/install_isolated_app_command_unittest.cc", "commands/run_on_os_login_command_unittest.cc", "commands/sub_app_install_command_unittest.cc", + "commands/update_file_handler_command_unittest.cc", "commands/web_app_uninstall_command_unittest.cc", "daily_metrics_helper_unittest.cc", "external_install_options_unittest.cc",
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 3a1923a..c6beea5 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
@@ -58,6 +58,7 @@ #include "chrome/browser/web_applications/web_app.h" #include "chrome/browser/web_applications/web_app_chromeos_data.h" #include "chrome/browser/web_applications/web_app_command_manager.h" +#include "chrome/browser/web_applications/web_app_command_scheduler.h" #include "chrome/browser/web_applications/web_app_constants.h" #include "chrome/browser/web_applications/web_app_helpers.h" #include "chrome/browser/web_applications/web_app_install_finalizer.h" @@ -1166,9 +1167,8 @@ if (permission->permission_type == apps::PermissionType::kFileHandling) { if (permission->value && absl::holds_alternative<bool>(permission->value->value)) { - PersistFileHandlersUserChoice(profile_, app_id, - absl::get<bool>(permission->value->value), - base::DoNothing()); + provider_->scheduler().PersistFileHandlersUserChoice( + app_id, absl::get<bool>(permission->value->value), base::DoNothing()); } return; } @@ -1922,8 +1922,8 @@ bool allowed, bool remember_user_choice) { if (remember_user_choice) { - PersistFileHandlersUserChoice(profile(), app_id, allowed, - base::DoNothing()); + provider_->scheduler().PersistFileHandlersUserChoice(app_id, allowed, + base::DoNothing()); } if (!allowed) {
diff --git a/chrome/browser/web_applications/commands/update_file_handler_command.cc b/chrome/browser/web_applications/commands/update_file_handler_command.cc new file mode 100644 index 0000000..80a3e5c --- /dev/null +++ b/chrome/browser/web_applications/commands/update_file_handler_command.cc
@@ -0,0 +1,159 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/web_applications/commands/update_file_handler_command.h" + +#include <memory> +#include <utility> + +#include "base/callback.h" +#include "base/memory/ptr_util.h" +#include "base/memory/weak_ptr.h" +#include "chrome/browser/web_applications/locks/app_lock.h" +#include "chrome/browser/web_applications/os_integration/os_integration_manager.h" +#include "chrome/browser/web_applications/web_app_constants.h" +#include "chrome/browser/web_applications/web_app_id.h" +#include "chrome/browser/web_applications/web_app_registrar.h" +#include "chrome/browser/web_applications/web_app_sync_bridge.h" + +namespace web_app { + +// static +std::unique_ptr<UpdateFileHandlerCommand> +UpdateFileHandlerCommand::CreateForPersistUserChoice( + const AppId& app_id, + bool allowed, + base::OnceClosure callback, + WebAppRegistrar* registrar, + WebAppSyncBridge* sync_bridge, + OsIntegrationManager* os_integration_manager) { + return base::WrapUnique(new UpdateFileHandlerCommand( + app_id, allowed, std::move(callback), registrar, sync_bridge, + os_integration_manager)); +} + +// static +std::unique_ptr<UpdateFileHandlerCommand> +UpdateFileHandlerCommand::CreateForUpdate( + const AppId& app_id, + base::OnceClosure callback, + WebAppRegistrar* registrar, + WebAppSyncBridge* sync_bridge, + OsIntegrationManager* os_integration_manager) { + return base::WrapUnique(new UpdateFileHandlerCommand( + app_id, /*user_choice_to_remember=*/absl::nullopt, std::move(callback), + registrar, sync_bridge, os_integration_manager)); +} + +UpdateFileHandlerCommand::UpdateFileHandlerCommand( + const AppId& app_id, + absl::optional<bool> user_choice_to_remember, + base::OnceClosure callback, + WebAppRegistrar* registrar, + WebAppSyncBridge* sync_bridge, + OsIntegrationManager* os_integration_manager) + : lock_(std::make_unique<AppLock, base::flat_set<AppId>>({app_id})), + app_id_(app_id), + user_choice_to_remember_(std::move(user_choice_to_remember)), + callback_(std::move(callback)), + registrar_(registrar), + sync_bridge_(sync_bridge), + os_integration_manager_(os_integration_manager) { + debug_info_.Set("name", "UpdateFileHandlerCommand"); + debug_info_.Set("app_id", app_id_); + if (user_choice_to_remember_) + debug_info_.Set("user_choice_to_remember", + user_choice_to_remember_.value() ? "allow" : "disallow"); +} + +UpdateFileHandlerCommand::~UpdateFileHandlerCommand() = default; + +void UpdateFileHandlerCommand::Start() { + debug_info_.Set("was_update_required", false); + + if (!registrar_->IsLocallyInstalled(app_id_)) { + ReportResultAndDestroy(CommandResult::kFailure); + return; + } + + if (user_choice_to_remember_) { + sync_bridge_->SetAppFileHandlerApprovalState( + app_id_, user_choice_to_remember_.value() + ? ApiApprovalState::kAllowed + : ApiApprovalState::kDisallowed); + } + + // File handling could have been disabled via origin trial as well as user + // choice, so check both here. + bool file_handling_enabled = + os_integration_manager_->IsFileHandlingAPIAvailable(app_id_) && + !registrar_->IsAppFileHandlerPermissionBlocked(app_id_); + + // This checks whether the current enabled state matches what we expect + // to be registered with the OS. If so, no need to do any update. + if (file_handling_enabled == + registrar_->ExpectThatFileHandlersAreRegisteredWithOs(app_id_)) { + ReportResultAndDestroy(CommandResult::kSuccess); + return; + } + + FileHandlerUpdateAction action = file_handling_enabled + ? FileHandlerUpdateAction::kUpdate + : FileHandlerUpdateAction::kRemove; + + debug_info_.Set("was_update_required", true); + +#if BUILDFLAG(IS_MAC) + // On Mac, the file handlers are encoded in the app shortcut. First + // unregister the file handlers (verifying that it finishes + // synchronously), then update the shortcut. + Result unregister_file_handlers_result = Result::kError; + os_integration_manager_->UpdateFileHandlers( + app_id_, action, + base::BindOnce([](Result* result_out, + Result actual_result) { *result_out = actual_result; }, + &unregister_file_handlers_result)); + DCHECK_EQ(Result::kOk, unregister_file_handlers_result); + + // TODO(https://crbug.com/1374916): get result from UpdateShortcuts. + os_integration_manager_->UpdateShortcuts( + app_id_, /*old_name=*/{}, + base::BindOnce(&UpdateFileHandlerCommand::OnFileHandlerUpdated, + weak_factory_.GetWeakPtr(), file_handling_enabled, + Result::kOk)); +#else + + os_integration_manager_->UpdateFileHandlers( + app_id_, action, + base::BindOnce(&UpdateFileHandlerCommand::OnFileHandlerUpdated, + weak_factory_.GetWeakPtr(), file_handling_enabled)); +#endif +} + +Lock& UpdateFileHandlerCommand::lock() const { + return *lock_; +} + +base::Value UpdateFileHandlerCommand::ToDebugValue() const { + return base::Value(debug_info_.Clone()); +} + +void UpdateFileHandlerCommand::OnFileHandlerUpdated(bool file_handling_enabled, + Result result) { + DCHECK_EQ(file_handling_enabled, + registrar_->ExpectThatFileHandlersAreRegisteredWithOs(app_id_)); + ReportResultAndDestroy(result == Result::kOk ? CommandResult::kSuccess + : CommandResult::kFailure); +} + +void UpdateFileHandlerCommand::ReportResultAndDestroy(CommandResult result) { + DCHECK(!callback_.is_null()); + SignalCompletionAndSelfDestruct(result, base::BindOnce(std::move(callback_))); +} + +void UpdateFileHandlerCommand::OnShutdown() { + ReportResultAndDestroy(CommandResult::kShutdown); +} + +} // namespace web_app
diff --git a/chrome/browser/web_applications/commands/update_file_handler_command.h b/chrome/browser/web_applications/commands/update_file_handler_command.h new file mode 100644 index 0000000..ef6039a7 --- /dev/null +++ b/chrome/browser/web_applications/commands/update_file_handler_command.h
@@ -0,0 +1,93 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_WEB_APPLICATIONS_COMMANDS_UPDATE_FILE_HANDLER_COMMAND_H_ +#define CHROME_BROWSER_WEB_APPLICATIONS_COMMANDS_UPDATE_FILE_HANDLER_COMMAND_H_ + +#include <memory> + +#include "base/functional/callback.h" +#include "base/memory/raw_ptr.h" +#include "chrome/browser/web_applications/commands/web_app_command.h" +#include "chrome/browser/web_applications/web_app_id.h" +#include "third_party/abseil-cpp/absl/types/optional.h" + +namespace web_app { + +class AppLock; +class Lock; +class WebAppRegistrar; +class WebAppSyncBridge; +class OsIntegrationManager; +enum class Result; + +// UpdateFileHandlerCommand updates file handler registration to match with the +// app's setting or user choice. +class UpdateFileHandlerCommand : public WebAppCommand { + public: + // Updates the File Handling API approval state for the given app. If + // necessary, it also updates the registration with the OS. + static std::unique_ptr<UpdateFileHandlerCommand> CreateForPersistUserChoice( + const AppId& app_id, + bool allowed, + base::OnceClosure callback, + WebAppRegistrar* registrar, + WebAppSyncBridge* sync_bridge, + OsIntegrationManager* os_integration_manager); + + // Updates the file handler registration with the OS to match the app's + // settings. Note that this tries to avoid extra work by no-oping if the + // current OS state matches what is calculated to be the desired stated. For + // example, if Chromium has already registered file handlers with the OS, and + // finds that file handlers *should* be registered with the OS, this function + // will no-op. This will not account for what the current file handlers + // actually are. The actual set of file handlers can only change on app + // update, and that path must go through + // `OsIntegrationManager::UpdateOsHooks()`, which always clobbers and renews + // the entire set of OS-registered file handlers (and other OS hooks). + static std::unique_ptr<UpdateFileHandlerCommand> CreateForUpdate( + const AppId& app_id, + base::OnceClosure callback, + WebAppRegistrar* registrar, + WebAppSyncBridge* sync_bridge, + OsIntegrationManager* os_integration_manager); + ~UpdateFileHandlerCommand() override; + + void Start() override; + + Lock& lock() const override; + + base::Value ToDebugValue() const override; + + void OnSyncSourceRemoved() override {} + void OnShutdown() override; + + private: + UpdateFileHandlerCommand(const AppId& app_id, + absl::optional<bool> user_choice_to_remember, + base::OnceClosure callback, + WebAppRegistrar* registrar, + WebAppSyncBridge* sync_bridge, + OsIntegrationManager* os_integration_manager); + void OnFileHandlerUpdated(bool file_handling_enabled, Result result); + void ReportResultAndDestroy(CommandResult result); + + std::unique_ptr<AppLock> lock_; + + const AppId app_id_; + absl::optional<bool> user_choice_to_remember_; + base::OnceClosure callback_; + + raw_ptr<WebAppRegistrar> registrar_; + raw_ptr<WebAppSyncBridge> sync_bridge_; + raw_ptr<OsIntegrationManager> os_integration_manager_; + + base::Value::Dict debug_info_; + + base::WeakPtrFactory<UpdateFileHandlerCommand> weak_factory_{this}; +}; + +} // namespace web_app + +#endif // CHROME_BROWSER_WEB_APPLICATIONS_COMMANDS_UPDATE_FILE_HANDLER_COMMAND_H_
diff --git a/chrome/browser/web_applications/commands/update_file_handler_command_unittest.cc b/chrome/browser/web_applications/commands/update_file_handler_command_unittest.cc new file mode 100644 index 0000000..bb18b4e --- /dev/null +++ b/chrome/browser/web_applications/commands/update_file_handler_command_unittest.cc
@@ -0,0 +1,120 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/test/scoped_feature_list.h" +#include "chrome/browser/web_applications/test/fake_web_app_provider.h" +#include "chrome/browser/web_applications/test/web_app_install_test_utils.h" +#include "chrome/browser/web_applications/test/web_app_test.h" +#include "chrome/browser/web_applications/web_app_command_scheduler.h" +#include "chrome/browser/web_applications/web_app_constants.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/common/features.h" +#include "url/gurl.h" + +namespace web_app { +namespace { + +class UpdateFileHandlerCommandTest : public WebAppTest { + public: + const char* kTestAppName = "test app"; + const GURL kTestAppUrl = GURL("https://example.com"); + + UpdateFileHandlerCommandTest() { + scoped_feature_list_.InitAndEnableFeature( + blink::features::kFileHandlingAPI); + } + + ~UpdateFileHandlerCommandTest() override = default; + + void SetUp() override { + WebAppTest::SetUp(); + provider_ = FakeWebAppProvider::Get(profile()); + test::AwaitStartWebAppProviderAndSubsystems(profile()); + } + + WebAppProvider* provider() { return provider_; } + + void EnableFileHandlingAPI() { + scoped_feature_list_.Reset(); + scoped_feature_list_.InitAndEnableFeature( + blink::features::kFileHandlingAPI); + } + + void DisableFileHandlingAPI() { + scoped_feature_list_.Reset(); + scoped_feature_list_.InitAndDisableFeature( + blink::features::kFileHandlingAPI); + } + + private: + raw_ptr<FakeWebAppProvider> provider_; + base::test::ScopedFeatureList scoped_feature_list_; +}; + +TEST_F(UpdateFileHandlerCommandTest, UserChoiceAllowPersisted) { + const AppId app_id = + test::InstallDummyWebApp(profile(), kTestAppName, kTestAppUrl); + EXPECT_EQ(provider()->registrar().GetAppFileHandlerApprovalState(app_id), + ApiApprovalState::kRequiresPrompt); + + base::RunLoop run_loop; + provider()->scheduler().PersistFileHandlersUserChoice( + app_id, /*allowed=*/true, run_loop.QuitClosure()); + run_loop.Run(); + + EXPECT_EQ(provider()->registrar().GetAppFileHandlerApprovalState(app_id), + ApiApprovalState::kAllowed); + EXPECT_TRUE(provider()->registrar().ExpectThatFileHandlersAreRegisteredWithOs( + app_id)); +} + +TEST_F(UpdateFileHandlerCommandTest, UserChoiceDisallowPersisted) { + const AppId app_id = + test::InstallDummyWebApp(profile(), kTestAppName, kTestAppUrl); + EXPECT_EQ(provider()->registrar().GetAppFileHandlerApprovalState(app_id), + ApiApprovalState::kRequiresPrompt); + + base::RunLoop run_loop; + provider()->scheduler().PersistFileHandlersUserChoice( + app_id, /*allowed=*/false, run_loop.QuitClosure()); + run_loop.Run(); + + EXPECT_EQ(provider()->registrar().GetAppFileHandlerApprovalState(app_id), + ApiApprovalState::kDisallowed); + EXPECT_FALSE( + provider()->registrar().ExpectThatFileHandlersAreRegisteredWithOs( + app_id)); +} + +TEST_F(UpdateFileHandlerCommandTest, UpdateFileHandler) { + const AppId app_id = + test::InstallDummyWebApp(profile(), kTestAppName, kTestAppUrl); + EXPECT_EQ(provider()->registrar().GetAppFileHandlerApprovalState(app_id), + ApiApprovalState::kRequiresPrompt); + + DisableFileHandlingAPI(); + + base::RunLoop run_loop; + provider()->scheduler().UpdateFileHandlerOsIntegration( + app_id, run_loop.QuitClosure()); + run_loop.Run(); + + EXPECT_EQ(provider()->registrar().GetAppFileHandlerApprovalState(app_id), + ApiApprovalState::kRequiresPrompt); + EXPECT_FALSE( + provider()->registrar().ExpectThatFileHandlersAreRegisteredWithOs( + app_id)); + + EnableFileHandlingAPI(); + + base::RunLoop run_loop_2; + provider()->scheduler().UpdateFileHandlerOsIntegration( + app_id, run_loop_2.QuitClosure()); + run_loop_2.Run(); + EXPECT_TRUE(provider()->registrar().ExpectThatFileHandlersAreRegisteredWithOs( + app_id)); +} + +} // namespace +} // namespace web_app
diff --git a/chrome/browser/web_applications/os_integration/web_app_file_handler_manager.cc b/chrome/browser/web_applications/os_integration/web_app_file_handler_manager.cc index b1eb3b6..ade6e6f1 100644 --- a/chrome/browser/web_applications/os_integration/web_app_file_handler_manager.cc +++ b/chrome/browser/web_applications/os_integration/web_app_file_handler_manager.cc
@@ -21,6 +21,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/web_applications/os_integration/web_app_file_handler_registration.h" #include "chrome/browser/web_applications/web_app.h" +#include "chrome/browser/web_applications/web_app_command_scheduler.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/browser/web_applications/web_app_registrar.h" #include "chrome/browser/web_applications/web_app_registry_update.h" @@ -275,9 +276,9 @@ void WebAppFileHandlerManager::SyncOsIntegrationState() { if (GetRegistrar()) { for (AppId& id : GetRegistrar()->GetAppIds()) { - UpdateFileHandlerOsIntegration( - WebAppProvider::GetForLocalAppsUnchecked(profile_), id, - base::DoNothing()); + WebAppProvider::GetForLocalAppsUnchecked(profile_) + ->scheduler() + .UpdateFileHandlerOsIntegration(id, base::DoNothing()); } } }
diff --git a/chrome/browser/web_applications/test/fake_web_app_provider.cc b/chrome/browser/web_applications/test/fake_web_app_provider.cc index 7275e351..1089120 100644 --- a/chrome/browser/web_applications/test/fake_web_app_provider.cc +++ b/chrome/browser/web_applications/test/fake_web_app_provider.cc
@@ -25,6 +25,7 @@ #include "chrome/browser/web_applications/test/fake_web_app_ui_manager.h" #include "chrome/browser/web_applications/test/test_file_utils.h" #include "chrome/browser/web_applications/web_app_command_manager.h" +#include "chrome/browser/web_applications/web_app_command_scheduler.h" #include "chrome/browser/web_applications/web_app_database_factory.h" #include "chrome/browser/web_applications/web_app_icon_manager.h" #include "chrome/browser/web_applications/web_app_install_finalizer.h" @@ -235,6 +236,8 @@ } void FakeWebAppProvider::Shutdown() { + if (command_scheduler_) + command_scheduler_->Shutdown(); if (command_manager_) command_manager_->Shutdown(); if (ui_manager_)
diff --git a/chrome/browser/web_applications/web_app_command_scheduler.cc b/chrome/browser/web_applications/web_app_command_scheduler.cc index 4666442..898fd2c 100644 --- a/chrome/browser/web_applications/web_app_command_scheduler.cc +++ b/chrome/browser/web_applications/web_app_command_scheduler.cc
@@ -4,10 +4,11 @@ #include <memory> -#include "chrome/browser/web_applications/web_app_command_scheduler.h" - +#include "base/functional/bind.h" #include "chrome/browser/web_applications/commands/fetch_manifest_and_install_command.h" +#include "chrome/browser/web_applications/commands/update_file_handler_command.h" #include "chrome/browser/web_applications/web_app_command_manager.h" +#include "chrome/browser/web_applications/web_app_command_scheduler.h" #include "chrome/browser/web_applications/web_app_data_retriever.h" #include "chrome/browser/web_applications/web_app_provider.h" @@ -25,6 +26,9 @@ WebAppInstallDialogCallback dialog_callback, OnceInstallCallback callback, bool use_fallback) { + if (is_in_shutdown_) + return; + if (!provider_->is_registry_ready()) { provider_->on_registry_ready().Post( FROM_HERE, @@ -43,4 +47,51 @@ std::make_unique<WebAppDataRetriever>())); } +void WebAppCommandScheduler::PersistFileHandlersUserChoice( + const AppId& app_id, + bool allowed, + base::OnceClosure callback) { + if (is_in_shutdown_) + return; + + if (!provider_->is_registry_ready()) { + provider_->on_registry_ready().Post( + FROM_HERE, + base::BindOnce(&WebAppCommandScheduler::PersistFileHandlersUserChoice, + weak_ptr_factory_.GetWeakPtr(), app_id, allowed, + std::move(callback))); + return; + } + + provider_->command_manager().ScheduleCommand( + UpdateFileHandlerCommand::CreateForPersistUserChoice( + app_id, allowed, std::move(callback), &provider_->registrar(), + &provider_->sync_bridge(), &provider_->os_integration_manager())); +} + +void WebAppCommandScheduler::UpdateFileHandlerOsIntegration( + const AppId& app_id, + base::OnceClosure callback) { + if (is_in_shutdown_) + return; + + if (!provider_->is_registry_ready()) { + provider_->on_registry_ready().Post( + FROM_HERE, + base::BindOnce(&WebAppCommandScheduler::UpdateFileHandlerOsIntegration, + weak_ptr_factory_.GetWeakPtr(), app_id, + std::move(callback))); + return; + } + + provider_->command_manager().ScheduleCommand( + UpdateFileHandlerCommand::CreateForUpdate( + app_id, std::move(callback), &provider_->registrar(), + &provider_->sync_bridge(), &provider_->os_integration_manager())); +} + +void WebAppCommandScheduler::Shutdown() { + is_in_shutdown_ = true; +} + } // namespace web_app
diff --git a/chrome/browser/web_applications/web_app_command_scheduler.h b/chrome/browser/web_applications/web_app_command_scheduler.h index 811c4ad2..543515a 100644 --- a/chrome/browser/web_applications/web_app_command_scheduler.h +++ b/chrome/browser/web_applications/web_app_command_scheduler.h
@@ -27,6 +27,8 @@ explicit WebAppCommandScheduler(WebAppProvider* provider); ~WebAppCommandScheduler(); + void Shutdown(); + // User initiated install that uses current `WebContents` to fetch manifest // and install the web app. void FetchManifestAndInstall(webapps::WebappInstallSource install_surface, @@ -36,11 +38,19 @@ OnceInstallCallback callback, bool use_fallback); + void PersistFileHandlersUserChoice(const AppId& app_id, + bool allowed, + base::OnceClosure callback); + + void UpdateFileHandlerOsIntegration(const AppId& app_id, + base::OnceClosure callback); + // TODO(https://crbug.com/1298130): expose all commands for web app // operations. private: raw_ptr<WebAppProvider> provider_; + bool is_in_shutdown_ = false; base::WeakPtrFactory<WebAppCommandScheduler> weak_ptr_factory_{this}; };
diff --git a/chrome/browser/web_applications/web_app_command_scheduler_unittest.cc b/chrome/browser/web_applications/web_app_command_scheduler_unittest.cc index 6f422e1..b50a88fea 100644 --- a/chrome/browser/web_applications/web_app_command_scheduler_unittest.cc +++ b/chrome/browser/web_applications/web_app_command_scheduler_unittest.cc
@@ -25,6 +25,12 @@ FakeWebAppProvider* provider() { return provider_; } + void WaitForProviderReady() { + base::RunLoop run_loop; + provider()->on_registry_ready().Post(FROM_HERE, run_loop.QuitClosure()); + run_loop.Run(); + } + private: FakeWebAppProvider* provider_; }; @@ -40,9 +46,7 @@ provider()->StartWithSubsystems(); EXPECT_EQ(provider()->command_manager().GetCommandCountForTesting(), 0u); - base::RunLoop run_loop; - provider()->on_registry_ready().Post(FROM_HERE, run_loop.QuitClosure()); - run_loop.Run(); + WaitForProviderReady(); EXPECT_EQ(provider()->command_manager().GetCommandCountForTesting(), 1u); base::Value::Dict log = provider()->command_manager().ToDebugValue().TakeDict(); @@ -54,5 +58,63 @@ "FetchManifestAndInstallCommand"); } +TEST_F(WebAppCommandSchedulerTest, PersistFileHandlersUserChoice) { + EXPECT_FALSE(provider()->is_registry_ready()); + provider()->scheduler().PersistFileHandlersUserChoice( + "app id", /*allowed=*/true, base::DoNothing()); + + provider()->StartWithSubsystems(); + EXPECT_EQ(provider()->command_manager().GetCommandCountForTesting(), 0u); + + WaitForProviderReady(); + EXPECT_EQ(provider()->command_manager().GetCommandCountForTesting(), 1u); + base::Value::Dict log = + provider()->command_manager().ToDebugValue().TakeDict(); + base::Value::List* command_queue = log.FindList("command_queue"); + + EXPECT_EQ(command_queue->size(), 1u); + + base::Value::Dict* command_log = + command_queue->front().GetDict().FindDict("value"); + EXPECT_EQ(*command_log->FindString("name"), "UpdateFileHandlerCommand"); + EXPECT_EQ(*command_log->FindString("user_choice_to_remember"), "allow"); + provider()->command_manager().AwaitAllCommandsCompleteForTesting(); + + provider()->Shutdown(); + // commands don't get scheduled after shutdown. + provider()->scheduler().PersistFileHandlersUserChoice( + "app id", /*allowed=*/true, base::DoNothing()); + EXPECT_EQ(provider()->command_manager().GetCommandCountForTesting(), 0u); +} + +TEST_F(WebAppCommandSchedulerTest, UpdateFileHandlerOsIntegration) { + EXPECT_FALSE(provider()->is_registry_ready()); + provider()->scheduler().UpdateFileHandlerOsIntegration("app id", + base::DoNothing()); + + provider()->StartWithSubsystems(); + EXPECT_EQ(provider()->command_manager().GetCommandCountForTesting(), 0u); + + WaitForProviderReady(); + EXPECT_EQ(provider()->command_manager().GetCommandCountForTesting(), 1u); + base::Value::Dict log = + provider()->command_manager().ToDebugValue().TakeDict(); + base::Value::List* command_queue = log.FindList("command_queue"); + + EXPECT_EQ(command_queue->size(), 1u); + + base::Value::Dict* command_log = + command_queue->front().GetDict().FindDict("value"); + EXPECT_EQ(*command_log->FindString("name"), "UpdateFileHandlerCommand"); + EXPECT_EQ(command_log->FindString("user_choice_to_remember"), nullptr); + provider()->command_manager().AwaitAllCommandsCompleteForTesting(); + + provider()->Shutdown(); + // commands don't get scheduled after shutdown. + provider()->scheduler().PersistFileHandlersUserChoice( + "app id", /*allowed=*/true, base::DoNothing()); + EXPECT_EQ(provider()->command_manager().GetCommandCountForTesting(), 0u); +} + } // namespace } // namespace web_app
diff --git a/chrome/browser/web_applications/web_app_provider.cc b/chrome/browser/web_applications/web_app_provider.cc index 856b2fb..f02c3c3 100644 --- a/chrome/browser/web_applications/web_app_provider.cc +++ b/chrome/browser/web_applications/web_app_provider.cc
@@ -217,6 +217,7 @@ } void WebAppProvider::Shutdown() { + command_scheduler_->Shutdown(); command_manager_->Shutdown(); ui_manager_->Shutdown(); externally_managed_app_manager_->Shutdown();
diff --git a/chrome/browser/web_applications/web_app_utils.cc b/chrome/browser/web_applications/web_app_utils.cc index 298f833..7b802a4b 100644 --- a/chrome/browser/web_applications/web_app_utils.cc +++ b/chrome/browser/web_applications/web_app_utils.cc
@@ -472,63 +472,6 @@ std::move(update_finished_callback)); } -void PersistFileHandlersUserChoice(Profile* profile, - const AppId& app_id, - bool allowed, - base::OnceClosure update_finished_callback) { - WebAppProvider* const provider = WebAppProvider::GetForWebApps(profile); - DCHECK(provider); - provider->sync_bridge().SetAppFileHandlerApprovalState( - app_id, - allowed ? ApiApprovalState::kAllowed : ApiApprovalState::kDisallowed); - - UpdateFileHandlerOsIntegration(provider, app_id, - std::move(update_finished_callback)); -} - -void UpdateFileHandlerOsIntegration( - WebAppProvider* provider, - const AppId& app_id, - base::OnceClosure update_finished_callback) { - bool enabled = - provider->os_integration_manager().IsFileHandlingAPIAvailable(app_id) && - !provider->registrar().IsAppFileHandlerPermissionBlocked(app_id); - - if (enabled == - provider->registrar().ExpectThatFileHandlersAreRegisteredWithOs(app_id)) { - std::move(update_finished_callback).Run(); - return; - } - - FileHandlerUpdateAction action = enabled ? FileHandlerUpdateAction::kUpdate - : FileHandlerUpdateAction::kRemove; - -#if BUILDFLAG(IS_MAC) - // On Mac, the file handlers are encoded in the app shortcut. First - // unregister the file handlers (verifying that it finishes synchronously), - // then update the shortcut. - Result unregister_file_handlers_result = Result::kError; - provider->os_integration_manager().UpdateFileHandlers( - app_id, action, - base::BindOnce([](Result* result_out, - Result actual_result) { *result_out = actual_result; }, - &unregister_file_handlers_result)); - DCHECK_EQ(Result::kOk, unregister_file_handlers_result); - provider->os_integration_manager().UpdateShortcuts( - app_id, /*old_name=*/{}, std::move(update_finished_callback)); -#else - provider->os_integration_manager().UpdateFileHandlers( - app_id, action, - base::BindOnce([](base::OnceClosure closure, - Result ignored) { std::move(closure).Run(); }, - std::move(update_finished_callback))); -#endif - - DCHECK_EQ( - enabled, - provider->registrar().ExpectThatFileHandlersAreRegisteredWithOs(app_id)); -} - bool HasAnySpecifiedSourcesAndNoOtherSources(WebAppSources sources, WebAppSources specified_sources) { bool has_any_specified_sources = (sources & specified_sources).any();
diff --git a/chrome/browser/web_applications/web_app_utils.h b/chrome/browser/web_applications/web_app_utils.h index f80fec6..ed8c31a 100644 --- a/chrome/browser/web_applications/web_app_utils.h +++ b/chrome/browser/web_applications/web_app_utils.h
@@ -129,26 +129,6 @@ bool allowed, base::OnceClosure update_finished_callback); -// Updates the File Handling API approval state for the given app. If -// necessary, it also updates the registration with the OS. -void PersistFileHandlersUserChoice(Profile* profile, - const AppId& app_id, - bool allowed, - base::OnceClosure update_finished_callback); - -// Updates the file handler registration with the OS to match the app's -// settings. Note that this tries to avoid extra work by no-oping if the current -// OS state matches what is calculated to be the desired stated. For example, if -// Chromium has already registered file handlers with the OS, and finds that -// file handlers *should* be registered with the OS, this function will no-op. -// This will not account for what the current file handlers actually are. The -// actual set of file handlers can only change on app update, and that path must -// go through `OsIntegrationManager::UpdateOsHooks()`, which always clobbers and -// renews the entire set of OS-registered file handlers (and other OS hooks). -void UpdateFileHandlerOsIntegration(WebAppProvider* provider, - const AppId& app_id, - base::OnceClosure update_finished_callback); - // Check if only |specified_sources| exist in the |sources| bool HasAnySpecifiedSourcesAndNoOtherSources(WebAppSources sources, WebAppSources specified_sources);
diff --git a/chrome/browser/webauthn/android/cable_module_android.cc b/chrome/browser/webauthn/android/cable_module_android.cc index 6f765bc..1e967400 100644 --- a/chrome/browser/webauthn/android/cable_module_android.cc +++ b/chrome/browser/webauthn/android/cable_module_android.cc
@@ -9,6 +9,8 @@ #include "base/bind.h" #include "base/logging.h" #include "base/no_destructor.h" +#include "base/task/task_traits.h" +#include "base/task/thread_pool.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/gcm/instance_id/instance_id_profile_service_factory.h" #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" @@ -65,6 +67,7 @@ void Register() { DCHECK(!linking_registration_); DCHECK(!sync_registration_); + DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); instance_id::InstanceIDDriver* const driver = instance_id::InstanceIDProfileServiceFactory::GetForProfile( @@ -82,6 +85,12 @@ base::Unretained(this)), base::BindRepeating(&RegistrationState::OnEvent, base::Unretained(this))); + base::ThreadPool::PostTaskAndReplyWithResult( + FROM_HERE, {base::TaskPriority::BEST_EFFORT}, + base::BindOnce( + &RegistrationState::GetCanDeviceSupportCableOnBackgroundSequence), + base::BindOnce(&RegistrationState::OnDeviceSupportResult, + base::Unretained(this))); PrefService* const local_state = g_browser_process->local_state(); std::string secret_base64 = local_state->GetString(kRootSecretPrefName); @@ -100,6 +109,14 @@ crypto::RandBytes(secret_); local_state->SetString(kRootSecretPrefName, base::Base64Encode(secret_)); } + + base::ThreadPool::PostTaskAndReplyWithResult( + FROM_HERE, {base::TaskPriority::BEST_EFFORT}, + base::BindOnce( + &RegistrationState::CalculateIdentityKeyOnBackgroundSequence, + secret_), + base::BindOnce(&RegistrationState::OnIdentityKeyReady, + base::Unretained(this))); } bool is_registered_for_linking() const { @@ -118,9 +135,17 @@ // have_data_for_sync returns true if this object has loaded enough state to // put information into sync's DeviceInfo. bool have_data_for_sync() const { - return sync_registration_ != nullptr && sync_registration_->contact_id(); + return device_supports_cable_.has_value() && identity_key_ && + sync_registration_ != nullptr && sync_registration_->contact_id(); } + const EC_KEY* identity_key() const { + DCHECK(identity_key_); + return identity_key_.get(); + } + + bool device_supports_cable() const { return *device_supports_cable_; } + void SignalSyncWhenReady() { if (sync_registration_ && !sync_registration_->contact_id()) { sync_registration_->PrepareContactID(); @@ -201,10 +226,52 @@ ->RefreshLocalDeviceInfo(); } + static bool GetCanDeviceSupportCableOnBackgroundSequence() { + // This runs on a worker thread because this Java function can take a + // little while and it shouldn't block the UI thread. + return Java_CableAuthenticatorModuleProvider_canDeviceSupportCable( + base::android::AttachCurrentThread()); + } + + // OnCanDeviceSupportCable is run with the result of `TestDeviceSupport`. + void OnDeviceSupportResult(bool result) { + DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); + + device_supports_cable_ = result; + MaybeSignalSync(); + } + + static bssl::UniquePtr<EC_KEY> CalculateIdentityKeyOnBackgroundSequence( + std::array<uint8_t, 32> secret) { + // This runs on a worker thread because the scalar multiplication takes a + // few milliseconds on slower devices. + return device::cablev2::IdentityKey(secret); + } + + // OnIdentityKeyReady is run with the result of `CalculateIdentityKey`. + void OnIdentityKeyReady(bssl::UniquePtr<EC_KEY> identity_key) { + DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); + + identity_key_ = std::move(identity_key); + MaybeSignalSync(); + } + std::unique_ptr<Registration> linking_registration_; std::unique_ptr<Registration> sync_registration_; std::array<uint8_t, 32> secret_; + // identity_key_ is a public/private P-256 key that is calculated from + // `secret_`. It's cached because it takes some time to compute. + bssl::UniquePtr<EC_KEY> identity_key_; std::unique_ptr<Registration::Event> pending_event_; + // device_supports_cable_ caches the result of a Java function that checks + // some prerequisites: that the device has Bluetooth and a screenlock. If + // this value is |nullopt| then its value has not yet been determined. + // + // The presence of a screen lock could change but, because of this caching, + // Clank won't notice in this context until the process restarts. Users can + // always use a QR code if pre-linking hasn't worked by the time they need + // it. + absl::optional<bool> device_supports_cable_; bool signal_sync_when_ready_ = false; }; @@ -229,11 +296,6 @@ GetSyncDataIfRegistered() { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - if (!Java_CableAuthenticatorModuleProvider_canDeviceSupportCable( - base::android::AttachCurrentThread())) { - return absl::nullopt; - } - RegistrationState* state = GetRegistrationState(); if (!state->have_data_for_sync()) { // Not yet ready to provide sync data. When the data is ready, @@ -243,6 +305,10 @@ return absl::nullopt; } + if (!state->device_supports_cable()) { + return absl::nullopt; + } + syncer::DeviceInfo::PhoneAsASecurityKeyInfo paask_info; paask_info.tunnel_server_domain = device::cablev2::kTunnelServer.value(); paask_info.contact_id = *state->sync_registration()->contact_id(); @@ -257,11 +323,9 @@ state->secret(), pairing_id_bytes, device::cablev2::DerivedValueType::kPairedSecret); - bssl::UniquePtr<EC_KEY> identity_key = - device::cablev2::IdentityKey(state->secret()); CHECK_EQ(paask_info.peer_public_key_x962.size(), - EC_POINT_point2oct(EC_KEY_get0_group(identity_key.get()), - EC_KEY_get0_public_key(identity_key.get()), + EC_POINT_point2oct(EC_KEY_get0_group(state->identity_key()), + EC_KEY_get0_public_key(state->identity_key()), POINT_CONVERSION_UNCOMPRESSED, paask_info.peer_public_key_x962.data(), paask_info.peer_public_key_x962.size(),
diff --git a/chrome/browser/webauthn/android/java/src/org/chromium/chrome/browser/webauthn/CableAuthenticatorModuleProvider.java b/chrome/browser/webauthn/android/java/src/org/chromium/chrome/browser/webauthn/CableAuthenticatorModuleProvider.java index ef85083..b403cf1 100644 --- a/chrome/browser/webauthn/android/java/src/org/chromium/chrome/browser/webauthn/CableAuthenticatorModuleProvider.java +++ b/chrome/browser/webauthn/android/java/src/org/chromium/chrome/browser/webauthn/CableAuthenticatorModuleProvider.java
@@ -240,6 +240,8 @@ @CalledByNative public static boolean canDeviceSupportCable() { + // This function will be run on a background thread. + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N || BluetoothAdapter.getDefaultAdapter() == null) { return false;
diff --git a/chrome/build/mac-arm.pgo.txt b/chrome/build/mac-arm.pgo.txt index 8b3b6f5..b5969ef 100644 --- a/chrome/build/mac-arm.pgo.txt +++ b/chrome/build/mac-arm.pgo.txt
@@ -1 +1 @@ -chrome-mac-arm-main-1665985864-937c3c86d92922a94271c72d52176bdd881cefb5.profdata +chrome-mac-arm-main-1666007719-47e97c1e75e387a8447bcfb937bae7bd211b1b3f.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index 82cac0b..66f7c10b2 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1665997179-09e6e266b6d017e2de27fc6a235d326d9ad73de3.profdata +chrome-win32-main-1666018656-15324d08013017a89031e80a4c773579d86a24ff.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index ef68b8f7..2a50f6e 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1666007719-286f3fd308ca497ffb907c02f66a1c5640356c65.profdata +chrome-win64-main-1666018656-3c6bc066b8ef3b48471b174136b5048e01638286.profdata
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 3343cb49..21ff941 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -8742,6 +8742,7 @@ "//chrome/browser/ui/tabs:tab_enums", "//chrome/browser/ui/views", "//components/app_constants", + "//components/commerce/core:pref_names", "//components/commerce/core:shopping_service_test_support", "//components/constrained_window", "//components/global_media_controls",
diff --git a/chrome/test/data/extensions/api_test/webrequest/test_types/test_types.js b/chrome/test/data/extensions/api_test/webrequest/test_types/test_types.js index 55206be..39b3a88 100644 --- a/chrome/test/data/extensions/api_test/webrequest/test_types/test_types.js +++ b/chrome/test/data/extensions/api_test/webrequest/test_types/test_types.js
@@ -77,10 +77,9 @@ type: 'stylesheet', url: getStyleURL(), frameUrl: 'unknown frame URL', - // tabId 0 = tab opened by test runner; - // tabId 1 = this tab. - tabId: 1, - initiator: getDomain(initiators.WEB_INITIATED) + tabId: -1, + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, } }, { label: 'onBeforeSendHeaders', @@ -88,8 +87,9 @@ details: { type: 'stylesheet', url: getStyleURL(), - tabId: 1, - initiator: getDomain(initiators.WEB_INITIATED) + tabId: -1, + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }, { label: 'onSendHeaders', @@ -97,8 +97,9 @@ details: { type: 'stylesheet', url: getStyleURL(), - tabId: 1, - initiator: getDomain(initiators.WEB_INITIATED) + tabId: -1, + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }, { label: 'onHeadersReceived', @@ -106,10 +107,11 @@ details: { type: 'stylesheet', url: getStyleURL(), - tabId: 1, + tabId: -1, statusLine: 'HTTP/1.1 200 OK', statusCode: 200, - initiator: getDomain(initiators.WEB_INITIATED) + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }, { label: 'onResponseStarted', @@ -117,12 +119,13 @@ details: { type: 'stylesheet', url: getStyleURL(), - tabId: 1, + tabId: -1, ip: '127.0.0.1', fromCache: false, statusLine: 'HTTP/1.1 200 OK', statusCode: 200, - initiator: getDomain(initiators.WEB_INITIATED) + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }, { label: 'onCompleted', @@ -130,12 +133,13 @@ details: { type: 'stylesheet', url: getStyleURL(), - tabId: 1, + tabId: -1, ip: '127.0.0.1', fromCache: false, statusLine: 'HTTP/1.1 200 OK', statusCode: 200, - initiator: getDomain(initiators.WEB_INITIATED) + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }], [['onBeforeRequest', 'onBeforeSendHeaders', 'onSendHeaders', @@ -164,10 +168,11 @@ frameUrl: 'unknown frame URL', frameId: 1, parentFrameId: 0, - // tabId 0 = tab opened by test runner; - // tabId 1 = this tab. - tabId: 1, + tabId: -1, initiator: "null", + documentId: 2, + parentDocumentId: 1, + frameType: "sub_frame", } }, { label: 'onBeforeSendHeaders', @@ -177,8 +182,11 @@ url: getScriptURL(), frameId: 1, parentFrameId: 0, - tabId: 1, + tabId: -1, initiator: "null", + documentId: 2, + parentDocumentId: 1, + frameType: "sub_frame", }, }, { label: 'onSendHeaders', @@ -188,8 +196,11 @@ url: getScriptURL(), frameId: 1, parentFrameId: 0, - tabId: 1, + tabId: -1, initiator: "null", + documentId: 2, + parentDocumentId: 1, + frameType: "sub_frame", }, }, { label: 'onHeadersReceived', @@ -199,10 +210,13 @@ url: getScriptURL(), frameId: 1, parentFrameId: 0, - tabId: 1, + tabId: -1, statusLine: 'HTTP/1.1 200 OK', statusCode: 200, initiator: "null", + documentId: 2, + parentDocumentId: 1, + frameType: "sub_frame", }, }, { label: 'onResponseStarted', @@ -212,12 +226,15 @@ url: getScriptURL(), frameId: 1, parentFrameId: 0, - tabId: 1, + tabId: -1, ip: '127.0.0.1', fromCache: false, statusLine: 'HTTP/1.1 200 OK', statusCode: 200, initiator: "null", + documentId: 2, + parentDocumentId: 1, + frameType: "sub_frame", }, }, { label: 'onCompleted', @@ -227,12 +244,15 @@ url: getScriptURL(), frameId: 1, parentFrameId: 0, - tabId: 1, + tabId: -1, ip: '127.0.0.1', fromCache: false, statusLine: 'HTTP/1.1 200 OK', statusCode: 200, initiator: "null", + documentId: 2, + parentDocumentId: 1, + frameType: "sub_frame", }, }], [['onBeforeRequest', 'onBeforeSendHeaders', 'onSendHeaders', @@ -244,6 +264,10 @@ document.body.appendChild(frame); }, + // TODO(crbug.com/1374025): This test fails with an error in the call to + // the FontFace constructor: + // SyntaxError: Failed to set 'normal' as a property value. + /* function typeFont() { expect([ { label: 'onBeforeRequest', @@ -252,8 +276,6 @@ type: 'font', url: getFontURL(), frameUrl: 'unknown frame URL', - // tabId 0 = tab opened by test runner; - // tabId 1 = this tab. tabId: 1, initiator: getDomain(initiators.WEB_INITIATED) } @@ -367,6 +389,7 @@ 'url(' + getFontURL() + ')').load(); }); }, + */ function typeWorker() { expect([ @@ -376,10 +399,9 @@ type: 'script', url: getWorkerURL(), frameUrl: 'unknown frame URL', - // tabId 0 = tab opened by test runner; - // tabId 1 = this tab. - tabId: 1, - initiator: getDomain(initiators.WEB_INITIATED) + tabId: -1, + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, } }, { label: 'onBeforeSendHeaders', @@ -387,8 +409,9 @@ details: { type: 'script', url: getWorkerURL(), - tabId: 1, - initiator: getDomain(initiators.WEB_INITIATED) + tabId: -1, + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }, { label: 'onSendHeaders', @@ -396,8 +419,9 @@ details: { type: 'script', url: getWorkerURL(), - tabId: 1, - initiator: getDomain(initiators.WEB_INITIATED) + tabId: -1, + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }, { label: 'onHeadersReceived', @@ -405,10 +429,11 @@ details: { type: 'script', url: getWorkerURL(), - tabId: 1, + tabId: -1, statusLine: 'HTTP/1.1 200 OK', statusCode: 200, - initiator: getDomain(initiators.WEB_INITIATED) + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }, { label: 'onResponseStarted', @@ -416,12 +441,13 @@ details: { type: 'script', url: getWorkerURL(), - tabId: 1, + tabId: -1, ip: '127.0.0.1', fromCache: false, statusLine: 'HTTP/1.1 200 OK', statusCode: 200, - initiator: getDomain(initiators.WEB_INITIATED) + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }, { label: 'onCompleted', @@ -429,12 +455,13 @@ details: { type: 'script', url: getWorkerURL(), - tabId: 1, + tabId: -1, ip: '127.0.0.1', fromCache: false, statusLine: 'HTTP/1.1 200 OK', statusCode: 200, - initiator: getDomain(initiators.WEB_INITIATED) + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }], [['onBeforeRequest', 'onBeforeSendHeaders', 'onSendHeaders', @@ -460,10 +487,9 @@ type: 'script', url: getSharedWorkerURL(), frameUrl: 'unknown frame URL', - // tabId 0 = tab opened by test runner; - // tabId 1 = this tab. - tabId: 1, - initiator: getDomain(initiators.WEB_INITIATED) + tabId: -1, + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, } }, { label: 'onBeforeSendHeaders', @@ -471,8 +497,9 @@ details: { type: 'script', url: getSharedWorkerURL(), - tabId: 1, - initiator: getDomain(initiators.WEB_INITIATED) + tabId: -1, + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }, { label: 'onSendHeaders', @@ -480,8 +507,9 @@ details: { type: 'script', url: getSharedWorkerURL(), - tabId: 1, - initiator: getDomain(initiators.WEB_INITIATED) + tabId: -1, + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }, { label: 'onHeadersReceived', @@ -489,10 +517,11 @@ details: { type: 'script', url: getSharedWorkerURL(), - tabId: 1, + tabId: -1, statusLine: 'HTTP/1.1 200 OK', statusCode: 200, - initiator: getDomain(initiators.WEB_INITIATED) + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }, { label: 'onResponseStarted', @@ -500,12 +529,13 @@ details: { type: 'script', url: getSharedWorkerURL(), - tabId: 1, + tabId: -1, ip: '127.0.0.1', fromCache: false, statusLine: 'HTTP/1.1 200 OK', statusCode: 200, - initiator: getDomain(initiators.WEB_INITIATED) + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }, { label: 'onCompleted', @@ -513,12 +543,13 @@ details: { type: 'script', url: getSharedWorkerURL(), - tabId: 1, + tabId: -1, ip: '127.0.0.1', fromCache: false, statusLine: 'HTTP/1.1 200 OK', statusCode: 200, - initiator: getDomain(initiators.WEB_INITIATED) + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }], [['onBeforeRequest', 'onBeforeSendHeaders', 'onSendHeaders', @@ -541,8 +572,9 @@ url: getPingURL(), frameUrl: 'unknown frame URL', frameId: 0, - tabId: 1, - initiator: getDomain(initiators.WEB_INITIATED) + tabId: -1, + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, } }, { label: 'onBeforeSendHeaders', @@ -552,8 +584,9 @@ method: 'POST', url: getPingURL(), frameId: 0, - tabId: 1, - initiator: getDomain(initiators.WEB_INITIATED) + tabId: -1, + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }, { label: 'onSendHeaders', @@ -563,8 +596,9 @@ method: 'POST', url: getPingURL(), frameId: 0, - tabId: 1, - initiator: getDomain(initiators.WEB_INITIATED) + tabId: -1, + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }, { label: 'onHeadersReceived', @@ -574,10 +608,11 @@ method: 'POST', url: getPingURL(), frameId: 0, - tabId: 1, + tabId: -1, statusLine: 'HTTP/1.1 200 OK', statusCode: 200, - initiator: getDomain(initiators.WEB_INITIATED) + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }, { label: 'onResponseStarted', @@ -587,12 +622,13 @@ method: 'POST', url: getPingURL(), frameId: 0, - tabId: 1, + tabId: -1, ip: '127.0.0.1', fromCache: false, statusLine: 'HTTP/1.1 200 OK', statusCode: 200, - initiator: getDomain(initiators.WEB_INITIATED) + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }, { label: 'onCompleted', @@ -602,12 +638,13 @@ method: 'POST', url: getPingURL(), frameId: 0, - tabId: 1, + tabId: -1, ip: '127.0.0.1', fromCache: false, statusLine: 'HTTP/1.1 200 OK', statusCode: 200, - initiator: getDomain(initiators.WEB_INITIATED) + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }], [['onBeforeRequest', 'onBeforeSendHeaders', 'onSendHeaders', @@ -633,8 +670,9 @@ url: getBeaconURL(), frameUrl: 'unknown frame URL', frameId: 0, - tabId: 1, - initiator: getDomain(initiators.WEB_INITIATED) + tabId: -1, + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, } }, { label: 'onBeforeSendHeaders', @@ -644,8 +682,9 @@ method: 'POST', url: getBeaconURL(), frameId: 0, - tabId: 1, - initiator: getDomain(initiators.WEB_INITIATED) + tabId: -1, + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }, { label: 'onSendHeaders', @@ -655,8 +694,9 @@ method: 'POST', url: getBeaconURL(), frameId: 0, - tabId: 1, - initiator: getDomain(initiators.WEB_INITIATED) + tabId: -1, + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }, { label: 'onHeadersReceived', @@ -666,10 +706,11 @@ method: 'POST', url: getBeaconURL(), frameId: 0, - tabId: 1, + tabId: -1, statusLine: 'HTTP/1.1 200 OK', statusCode: 200, - initiator: getDomain(initiators.WEB_INITIATED) + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }, { label: 'onResponseStarted', @@ -679,12 +720,13 @@ method: 'POST', url: getBeaconURL(), frameId: 0, - tabId: 1, + tabId: -1, ip: '127.0.0.1', fromCache: false, statusLine: 'HTTP/1.1 200 OK', statusCode: 200, - initiator: getDomain(initiators.WEB_INITIATED) + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }, { label: 'onCompleted', @@ -694,12 +736,13 @@ method: 'POST', url: getBeaconURL(), frameId: 0, - tabId: 1, + tabId: -1, ip: '127.0.0.1', fromCache: false, statusLine: 'HTTP/1.1 200 OK', statusCode: 200, - initiator: getDomain(initiators.WEB_INITIATED) + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }], [['onBeforeRequest', 'onBeforeSendHeaders', 'onSendHeaders', @@ -712,6 +755,8 @@ }); }, + // TODO(crbug.com/1374025): This test is flaky. + /* function sendBeaconInFrameOnUnload() { expect([ { label: 'onBeforeRequest', @@ -721,10 +766,11 @@ method: 'POST', url: getSlowURL(), frameUrl: 'unknown frame URL', - frameId: 1, - parentFrameId: 0, - tabId: 1, - initiator: getDomain(initiators.WEB_INITIATED) + frameId: 0, + parentFrameId: -1, + tabId: -1, + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, } }, { label: 'onBeforeSendHeaders', @@ -733,10 +779,11 @@ type: 'ping', method: 'POST', url: getSlowURL(), - frameId: 1, - parentFrameId: 0, - tabId: 1, - initiator: getDomain(initiators.WEB_INITIATED) + frameId: 0, + parentFrameId: -1, + tabId: -1, + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }, { label: 'onSendHeaders', @@ -745,10 +792,11 @@ type: 'ping', method: 'POST', url: getSlowURL(), - frameId: 1, - parentFrameId: 0, - tabId: 1, - initiator: getDomain(initiators.WEB_INITIATED) + frameId: 0, + parentFrameId: -1, + tabId: -1, + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }, { label: 'onHeadersReceived', @@ -757,12 +805,13 @@ type: 'ping', method: 'POST', url: getSlowURL(), - frameId: 1, - parentFrameId: 0, - tabId: 1, + frameId: 0, + parentFrameId: -1, + tabId: -1, statusLine: 'HTTP/1.1 200 OK', statusCode: 200, - initiator: getDomain(initiators.WEB_INITIATED) + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }, { label: 'onResponseStarted', @@ -771,14 +820,15 @@ type: 'ping', method: 'POST', url: getSlowURL(), - frameId: 1, - parentFrameId: 0, - tabId: 1, + frameId: 0, + parentFrameId: -1, + tabId: -1, ip: '127.0.0.1', fromCache: false, statusLine: 'HTTP/1.1 200 OK', statusCode: 200, - initiator: getDomain(initiators.WEB_INITIATED) + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }, { label: 'onCompleted', @@ -787,14 +837,15 @@ type: 'ping', method: 'POST', url: getSlowURL(), - frameId: 1, - parentFrameId: 0, - tabId: 1, + frameId: 0, + parentFrameId: -1, + tabId: -1, ip: '127.0.0.1', fromCache: false, statusLine: 'HTTP/1.1 200 OK', statusCode: 200, - initiator: getDomain(initiators.WEB_INITIATED) + initiator: getDomain(initiators.WEB_INITIATED), + documentId: 1, }, }], [['onBeforeRequest', 'onBeforeSendHeaders', 'onSendHeaders', @@ -813,7 +864,7 @@ frame.remove(); }); }, - + */ function typeOther_cspreport() { expect([ { label: 'onBeforeRequest', @@ -825,8 +876,11 @@ frameUrl: 'unknown frame URL', frameId: 1, parentFrameId: 0, - tabId: 1, - initiator: getServerDomain(initiators.WEB_INITIATED) + tabId: -1, + initiator: getServerDomain(initiators.WEB_INITIATED), + documentId: 2, + parentDocumentId: 1, + frameType: "sub_frame", } }, { label: 'onBeforeSendHeaders', @@ -837,8 +891,11 @@ url: getCSPReportURL(), frameId: 1, parentFrameId: 0, - tabId: 1, - initiator: getServerDomain(initiators.WEB_INITIATED) + tabId: -1, + initiator: getServerDomain(initiators.WEB_INITIATED), + documentId: 2, + parentDocumentId: 1, + frameType: "sub_frame", }, }, { label: 'onSendHeaders', @@ -849,8 +906,11 @@ url: getCSPReportURL(), frameId: 1, parentFrameId: 0, - tabId: 1, - initiator: getServerDomain(initiators.WEB_INITIATED) + tabId: -1, + initiator: getServerDomain(initiators.WEB_INITIATED), + documentId: 2, + parentDocumentId: 1, + frameType: "sub_frame", }, }, { label: 'onHeadersReceived', @@ -861,10 +921,13 @@ url: getCSPReportURL(), frameId: 1, parentFrameId: 0, - tabId: 1, + tabId: -1, statusLine: 'HTTP/1.1 404 Not Found', statusCode: 404, - initiator: getServerDomain(initiators.WEB_INITIATED) + initiator: getServerDomain(initiators.WEB_INITIATED), + documentId: 2, + parentDocumentId: 1, + frameType: "sub_frame", }, }, { label: 'onResponseStarted', @@ -875,12 +938,15 @@ url: getCSPReportURL(), frameId: 1, parentFrameId: 0, - tabId: 1, + tabId: -1, ip: '127.0.0.1', fromCache: false, statusLine: 'HTTP/1.1 404 Not Found', statusCode: 404, - initiator: getServerDomain(initiators.WEB_INITIATED) + initiator: getServerDomain(initiators.WEB_INITIATED), + documentId: 2, + parentDocumentId: 1, + frameType: "sub_frame", }, }, { label: 'onCompleted', @@ -891,12 +957,15 @@ url: getCSPReportURL(), frameId: 1, parentFrameId: 0, - tabId: 1, + tabId: -1, ip: '127.0.0.1', fromCache: false, statusLine: 'HTTP/1.1 404 Not Found', statusCode: 404, - initiator: getServerDomain(initiators.WEB_INITIATED) + initiator: getServerDomain(initiators.WEB_INITIATED), + documentId: 2, + parentDocumentId: 1, + frameType: "sub_frame", }, }], [['onBeforeRequest', 'onBeforeSendHeaders', 'onSendHeaders',
diff --git a/chrome/test/data/extensions/api_test/webstore_inline_install/extension_with_host_permissions.crx b/chrome/test/data/extensions/api_test/webstore_inline_install/extension_with_host_permissions.crx new file mode 100644 index 0000000..9ed4442a --- /dev/null +++ b/chrome/test/data/extensions/api_test/webstore_inline_install/extension_with_host_permissions.crx Binary files differ
diff --git a/chrome/test/data/extensions/api_test/webstore_inline_install/extension_with_host_permissions.pem b/chrome/test/data/extensions/api_test/webstore_inline_install/extension_with_host_permissions.pem new file mode 100644 index 0000000..431c1e1 --- /dev/null +++ b/chrome/test/data/extensions/api_test/webstore_inline_install/extension_with_host_permissions.pem
@@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC5B4BHsdcYmcAZ +4fN7n7QVs/cmlQbrFnTpwJPysQNSalrwLkmIi4YXBGeyrYeefxs00gE5ihNr9b3E +0C3AhuS1gPNLiJKcStq7i3c/q7V1nbiO9lNB2+hRg0wT6tZf9KzbzjnjLO77gX7n +JlF71oM08leHCgSylGkJ7m9fJFswPFQ7LhH/WE4h5V8VlGQ4Nl6NLRxwL+d7FARj +uTfdnqv7cR/Y/HBpjDg2aS4kH9UfH/qczr2cphbvX2d/n1i2N/vrc9SrdVGi/vGc +PUYTqq0I8tb3FXt6zHDP5aGEtStFRMFqqap1ihLGjWid75gqLNSRyrexHUVvYfey +/nTRqeizAgMBAAECggEAKjds7G7GPgWuj/k+3aEFrMIADRyJlI/uIvtehkwfDunX +T9+vxWjYMl497sWrIN2tbnLP9rnrToGmR8ab+caNXmBKopxJn0FxAMOEdNGPuINA +/dV0D53GNvr3G8BEI2anHgvCp3O0H0xfkQvsIY5DJ4x3rgb6JWi5QpvVa2bXK3zk +7+xXvXbpmpj6v7Sda43WenDNdFOhplRehIuxqAYBZMPpiDlRFCZcfLHn495Cte85 +w+AmRWwBy+kFKXeNdQh68nCfnRIFLRH5w7+kSB9K2CDei0roSBGnmwozCXtaVKxH +Nc5M+Ofwza35PWal7U1xWDi2eoNS6qXzp19DciraaQKBgQDi8bImiDhBt8pJ15TO +091WKyOhE1Hn/iPejO7HbNZvS88CARrO4JcY7GuIzluNlnuSYFP8g2RNYVJ3ULJ1 +nnlLelyuWc+I/epJKMu5wjnktA3sPvoZNMQjQBmnlFJnRfy+z8Cn8LS9Fx1i1cy5 +Ct1Jp9hF6xGpDzGV/CaIayRdXwKBgQDQuAILyrID3NpuRe+bsHo2G0YkFMoJP038 +ocP7PWAsNACU072n8nZjBBlWI+1KLx8HKZAikmmjwTEp3tMFA+LqiEdXqjecQBXb ++H7iYs7O0CGQB7VsL8bxdayt2D1PQNvYlybwE6cHfHln6LNybSIg5L3SXM9okfXB +r2XEsOvhLQKBgDnsRHMPO4SSe0ADlQiBDLIMiqh2/OXAeLk5sUwXHFgFuk0hqQz6 +R7ZlyUB+ouFtcha3HViK1JPnbhvj7diVXRIFphgd9hlZ7W1Ey1KbHxmfVxpgLIc4 +b4MrviCGe82+EDdHYT278vV8K9TpCrqD6lz9SPb3e2dx6E8Gr3MMHZjzAoGBALg4 +wa2QweEA7VcJqXx8ntHk7trn8o+I7Ze/XFEEEj/RwnWaErsLGg05T/elDEs/Hh7f +Q5YQLufXnEI9p3m0vXOOx5GL7zudoO2f/rZoyerm78jF1Q7heLIk0D49L5glQiaA ++2BJqFLGPg5F6SVlSAtKenUTcAn3UrgazTN3iSsdAoGAZ/PUSEPNneqAyWtAdJvq +dBbjw7qCndq1z0tnzvdotoJLsFsRaichorj70jxOP/ubJoYgxuAVZh0oo6QKq8yM +jnziPeNrvzg4johKULsZvf4fCglcVURZ3Qnd7FtEgqF3NhTEj27dhmeXoCPXnhOQ +2GNLlTkkwQJ1O/+TeTUPMZk= +-----END PRIVATE KEY-----
diff --git a/chrome/test/data/extensions/api_test/webstore_inline_install/extension_with_host_permissions/manifest.json b/chrome/test/data/extensions/api_test/webstore_inline_install/extension_with_host_permissions/manifest.json new file mode 100644 index 0000000..9b379d7 --- /dev/null +++ b/chrome/test/data/extensions/api_test/webstore_inline_install/extension_with_host_permissions/manifest.json
@@ -0,0 +1,6 @@ +{ + "name": "Inline Install Test Extension", + "version": "0.1", + "manifest_version": 3, + "host_permissions": ["<all_urls>"] +}
diff --git a/chrome/test/data/webui/chromeos/diagnostics/touchscreen_tester_test.js b/chrome/test/data/webui/chromeos/diagnostics/touchscreen_tester_test.js index f870f7c7..60c73c3 100644 --- a/chrome/test/data/webui/chromeos/diagnostics/touchscreen_tester_test.js +++ b/chrome/test/data/webui/chromeos/diagnostics/touchscreen_tester_test.js
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import {DialogType, SCREEN_MAX_LENGTH} from 'chrome://diagnostics/touchscreen_tester.js'; import {flushTasks} from 'chrome://webui-test/polymer_test_util.js'; -import {assertEquals, assertTrue} from '../../chai_assert.js'; - -const SCREEN_MAX_LENGTH = 9999; +import {assertDeepEquals, assertEquals, assertTrue} from '../../chai_assert.js'; +import {MockController} from '../../mock_controller.js'; export function touchscreenTesterTestSuite() { /** @type {?TouchscreenTesterElement} */ @@ -32,17 +32,13 @@ return flushTasks(); } - test('openIntroDialog', async () => { - await initializeTouchscreenTester(); - const introDialog = touchscreenTesterElement.getDialog('intro-dialog'); - introDialog.showModal(); - await flushTasks(); - assertTrue(introDialog.open); - }); - - test('openCanvasDialog', async () => { - await initializeTouchscreenTester(); - const introDialog = touchscreenTesterElement.getDialog('intro-dialog'); + /** + * openTester is a helper function for some boilerplate code. It opens the + * intro dialog, clicks the start testing button and makes sure canvas dialog + * is open. The function then returns the canvas dialog. + */ + async function openTester() { + const introDialog = touchscreenTesterElement.getDialog(DialogType.INTRO); introDialog.showModal(); await flushTasks(); assertTrue(introDialog.open); @@ -52,11 +48,65 @@ await flushTasks(); assertFalse(introDialog.open); - const canvasDialog = touchscreenTesterElement.getDialog('canvas-dialog'); + const canvasDialog = touchscreenTesterElement.getDialog(DialogType.CANVAS); assertTrue(canvasDialog.open); + return canvasDialog; + } + + test('OpenIntroDialog', async () => { + await initializeTouchscreenTester(); + const introDialog = touchscreenTesterElement.getDialog(DialogType.INTRO); + introDialog.showModal(); + await flushTasks(); + assertTrue(introDialog.open); + }); + + test('OpenCanvasDialog', async () => { + await initializeTouchscreenTester(); + const canvasDialog = await openTester(); + const canvas = canvasDialog.querySelector('canvas'); assertEquals(canvas.width, SCREEN_MAX_LENGTH); assertEquals(canvas.height, SCREEN_MAX_LENGTH); }); + + test('OnDrawStart', async () => { + await initializeTouchscreenTester(); + await openTester(); + + // Mock drawTrailMark and drawTrail function. + const drawingProvider = touchscreenTesterElement.getDrawingProvider(); + const mockController = new MockController(); + const mockDrawTrailMark = + mockController.createFunctionMock(drawingProvider, 'drawTrailMark'); + const mockDrawTrail = + mockController.createFunctionMock(drawingProvider, 'drawTrail'); + + const expectedTouches = new Map(); + const touchStartEvents = [ + { + id: 1, + point: {x: 100, y: 150}, + pressure: 50, + }, + { + id: 2, + point: {x: 500, y: 550}, + pressure: 30, + }, + ]; + + for (const {id, point, pressure} of touchStartEvents) { + // Add expected function call signature. + mockDrawTrailMark.addExpectation(point.x, point.y); + mockDrawTrail.addExpectation( + point.x - 1, point.y, point.x, point.y, pressure); + expectedTouches.set(id, point); + touchscreenTesterElement.onDrawStart(id, point, pressure); + + assertDeepEquals(expectedTouches, touchscreenTesterElement.getTouches()); + mockController.verifyMocks(); + } + }); }
diff --git a/chrome/test/media_router/access_code_cast/access_code_cast_integration_browsertest.cc b/chrome/test/media_router/access_code_cast/access_code_cast_integration_browsertest.cc index ab432d3..75e4ad1f 100644 --- a/chrome/test/media_router/access_code_cast/access_code_cast_integration_browsertest.cc +++ b/chrome/test/media_router/access_code_cast/access_code_cast_integration_browsertest.cc
@@ -275,6 +275,7 @@ EXPECT_TRUE(VerifyUi()); content::WebContents* dialog_contents = observer.GetWebContents(); EXPECT_TRUE(content::WaitForLoadStop(dialog_contents)); + AccessCodeCastDialog::ShouldBlockWidgetActivationChangedForTest(true); return dialog_contents; }
diff --git a/chrome/utility/safe_browsing/mac/udif.cc b/chrome/utility/safe_browsing/mac/udif.cc index cc53379..c8bb13e 100644 --- a/chrome/utility/safe_browsing/mac/udif.cc +++ b/chrome/utility/safe_browsing/mac/udif.cc
@@ -465,14 +465,11 @@ } CFErrorRef error = nullptr; - base::ScopedCFTypeRef<CFDictionaryRef> plist( - base::mac::CFCast<CFDictionaryRef>( - CFPropertyListCreateWithData(kCFAllocatorDefault, - plist_data, - kCFPropertyListImmutable, - nullptr, - &error)), - base::scoped_policy::RETAIN); + base::ScopedCFTypeRef<CFPropertyListRef> plist( + CFPropertyListCreateWithData(kCFAllocatorDefault, plist_data, + kCFPropertyListImmutable, nullptr, &error)); + + CFDictionaryRef plist_dict = base::mac::CFCast<CFDictionaryRef>(plist.get()); base::ScopedCFTypeRef<CFErrorRef> error_ref(error); if (error) { base::ScopedCFTypeRef<CFStringRef> error_string( @@ -482,13 +479,13 @@ return false; } - if (!plist) { + if (!plist_dict) { DLOG(ERROR) << "Plist is not a dictionary"; return false; } auto* resource_fork = base::mac::GetValueFromDictionary<CFDictionaryRef>( - plist.get(), CFSTR("resource-fork")); + plist_dict, CFSTR("resource-fork")); if (!resource_fork) { DLOG(ERROR) << "No resource-fork entry in plist"; return false;
diff --git a/chromeos/ash/components/audio/audio_device_selection_test_base.h b/chromeos/ash/components/audio/audio_device_selection_test_base.h index 9d117597..1662904 100644 --- a/chromeos/ash/components/audio/audio_device_selection_test_base.h +++ b/chromeos/ash/components/audio/audio_device_selection_test_base.h
@@ -47,13 +47,15 @@ private: AudioNode NewNode(bool is_input, const std::string& type); + protected: + scoped_refptr<AudioDevicesPrefHandler> audio_pref_handler_; + private: // Test services std::unique_ptr<ActiveNodeObserver> active_node_observer_; base::test::SingleThreadTaskEnvironment task_environment_; CrasAudioHandler* cras_audio_handler_ = nullptr; // Not owned. FakeCrasAudioClient* fake_cras_audio_client_ = nullptr; // Not owned. - scoped_refptr<AudioDevicesPrefHandler> audio_pref_handler_; std::unique_ptr<TestingPrefServiceSimple> pref_service_; // Counters
diff --git a/chromeos/ash/components/audio/audio_device_selection_unittest.cc b/chromeos/ash/components/audio/audio_device_selection_unittest.cc index 1dec1d7..25e1392 100644 --- a/chromeos/ash/components/audio/audio_device_selection_unittest.cc +++ b/chromeos/ash/components/audio/audio_device_selection_unittest.cc
@@ -4,7 +4,9 @@ #include "chromeos/ash/components/audio/audio_device_selection_test_base.h" +#include "ash/constants/ash_features.h" #include "base/test/metrics/user_action_tester.h" +#include "base/test/scoped_feature_list.h" #include "testing/gtest/include/gtest/gtest.h" const char* kInputSwitched = "StatusArea_Audio_SwitchInputDevice"; @@ -99,5 +101,48 @@ } } +TEST_F(AudioDeviceSelectionTest, DevicePrefEviction) { + base::subtle::ScopedTimeClockOverrides time_override( + []() { + static int i = 0; + i++; + return base::Time::FromDoubleT(i); + }, + nullptr, nullptr); + + base::test::ScopedFeatureList features( + ash::features::kRobustAudioDeviceSelectLogic); + + std::vector<AudioNode> nodes; + for (int i = 0; i < 101; i++) { + nodes.push_back(NewInputNode("USB")); + } + + Plug(nodes[0]); + for (int i = 1; i < 101; i++) { + Plug(nodes[i]); + ASSERT_EQ(ActiveInputNodeId(), nodes[i].id) << " i = " << i; + ASSERT_NE(audio_pref_handler_->GetUserPriority(AudioDevice(nodes[i])), + kUserPriorityNone) + << " i = " << i; + Unplug(nodes[i]); + } + + // We store at most 100 devices in prefs. + EXPECT_NE(audio_pref_handler_->GetUserPriority(AudioDevice(nodes[0])), + kUserPriorityNone) + << "nodes[0] should be kept because it is connected"; + EXPECT_EQ(audio_pref_handler_->GetUserPriority(AudioDevice(nodes[1])), + kUserPriorityNone) + << "nodes[1] should be evicted because it is unplugged and the least " + "recently seen"; + for (int i = 2; i < 101; i++) { + EXPECT_NE(audio_pref_handler_->GetUserPriority(AudioDevice(nodes[i])), + kUserPriorityNone) + << "nodes[" << i + << "] should be kept because it is within the recent 100 seen devices"; + } +} + } // namespace } // namespace ash
diff --git a/chromeos/ash/components/audio/audio_devices_pref_handler.h b/chromeos/ash/components/audio/audio_devices_pref_handler.h index 3546a53..9e2f4896 100644 --- a/chromeos/ash/components/audio/audio_devices_pref_handler.h +++ b/chromeos/ash/components/audio/audio_devices_pref_handler.h
@@ -78,6 +78,12 @@ // Removes an audio preference observer. virtual void RemoveAudioPrefObserver(AudioPrefObserver* observer) = 0; + // Mark `connected_devices` as seen and drop the least recently seen devices + // if there are more than `keep_devices` stored in preferences. + virtual void DropLeastRecentlySeenDevices( + const std::vector<AudioDevice>& connected_devices, + size_t keep_devices) = 0; + protected: virtual ~AudioDevicesPrefHandler() {}
diff --git a/chromeos/ash/components/audio/audio_devices_pref_handler_impl.cc b/chromeos/ash/components/audio/audio_devices_pref_handler_impl.cc index 5b1dc183..239b22455 100644 --- a/chromeos/ash/components/audio/audio_devices_pref_handler_impl.cc +++ b/chromeos/ash/components/audio/audio_devices_pref_handler_impl.cc
@@ -7,12 +7,14 @@ #include <stdint.h> #include <algorithm> +#include <unordered_set> #include "ash/constants/ash_pref_names.h" #include "base/bind.h" #include "base/callback_helpers.h" #include "base/logging.h" #include "base/strings/string_number_conversions.h" +#include "base/time/time.h" #include "base/values.h" #include "chromeos/ash/components/audio/audio_device.h" #include "components/prefs/pref_registry_simple.h" @@ -287,6 +289,60 @@ } } +void AudioDevicesPrefHandlerImpl::DropLeastRecentlySeenDevices( + const std::vector<AudioDevice>& connected_devices, + size_t keep_devices) { + ScopedDictPrefUpdate last_seen_update(local_state_, + prefs::kAudioDevicesLastSeen); + base::Value::Dict& last_seen = last_seen_update.Get(); + + // Set timestamp of connected devices. + double time = base::Time::Now().ToDoubleT(); + for (AudioDevice device : connected_devices) { + last_seen.Set(GetDeviceIdString(device), time); + } + + // Order devices by last seen timestamp. + std::vector<std::string> recently_seen_ids; + for (auto device : last_seen) { + recently_seen_ids.push_back(device.first); + } + std::sort(recently_seen_ids.begin(), recently_seen_ids.end(), + [&](const std::string& i, const std::string& j) { + // More recent device first. + return last_seen.FindDouble(i).value_or(0) > + last_seen.FindDouble(j).value_or(0); + }); + + // Keep `keep_devices` recently seen devices. + while (recently_seen_ids.size() > keep_devices && + last_seen.FindDouble(recently_seen_ids.back()).value_or(0) != time) { + last_seen.Remove(recently_seen_ids.back()); + recently_seen_ids.pop_back(); + } + + // Remove preferences if not seen recently, keeping the most recent + // `keep_devices` devices. + // TODO(aaronyu): Consider also remove volume/mute/gain preferences. + for (base::Value::Dict& settings : + std::initializer_list<std::reference_wrapper<base::Value::Dict>>{ + input_device_user_priority_settings_, + output_device_user_priority_settings_}) { + std::vector<std::string> to_remove; + for (auto entry : settings) { + const std::string& id = entry.first; + if (last_seen.Find(id) == nullptr) { + to_remove.push_back(id); + } + } + for (const std::string& id : to_remove) { + settings.Remove(id); + } + } + SaveInputDevicesUserPriorityPref(); + SaveOutputDevicesUserPriorityPref(); +} + bool AudioDevicesPrefHandlerImpl::GetAudioOutputAllowedValue() const { return local_state_->GetBoolean(prefs::kAudioOutputAllowed); } @@ -487,8 +543,9 @@ registry->RegisterIntegerPref(prefs::kAudioMute, kPrefMuteOff); registry->RegisterDictionaryPref(prefs::kAudioInputDevicesUserPriority); - registry->RegisterDictionaryPref(prefs::kAudioOutputDevicesUserPriority); + + registry->RegisterDictionaryPref(prefs::kAudioDevicesLastSeen); } } // namespace ash
diff --git a/chromeos/ash/components/audio/audio_devices_pref_handler_impl.h b/chromeos/ash/components/audio/audio_devices_pref_handler_impl.h index f9a4040..ba5e5f3 100644 --- a/chromeos/ash/components/audio/audio_devices_pref_handler_impl.h +++ b/chromeos/ash/components/audio/audio_devices_pref_handler_impl.h
@@ -50,6 +50,10 @@ const AudioDevice* base) override; int GetUserPriority(const AudioDevice& device) override; + void DropLeastRecentlySeenDevices( + const std::vector<AudioDevice>& connected_devices, + size_t keep_devices) override; + bool GetNoiseCancellationState() override; void SetNoiseCancellationState(bool noise_cancellation_state) override;
diff --git a/chromeos/ash/components/audio/audio_devices_pref_handler_impl_unittest.cc b/chromeos/ash/components/audio/audio_devices_pref_handler_impl_unittest.cc index 4764828..27dc6ca 100644 --- a/chromeos/ash/components/audio/audio_devices_pref_handler_impl_unittest.cc +++ b/chromeos/ash/components/audio/audio_devices_pref_handler_impl_unittest.cc
@@ -10,6 +10,7 @@ #include "ash/constants/ash_pref_names.h" #include "base/memory/ref_counted.h" +#include "base/time/time_override.h" #include "chromeos/ash/components/audio/audio_device.h" #include "chromeos/ash/components/audio/audio_devices_pref_handler.h" #include "chromeos/ash/components/dbus/audio/audio_node.h" @@ -520,4 +521,52 @@ EXPECT_NE(kUserPriorityNone, GetUserPriority(device)); } +TEST_P(AudioDevicesPrefHandlerTest, DropLeastRecentlySeenDevices) { + base::subtle::ScopedTimeClockOverrides time_override( + []() { + static int i = 0; + i++; + return base::Time::FromDoubleT(i); + }, + nullptr, nullptr); + + AudioDevice d[3] = { + GetDeviceWithVersion(2), + GetSecondaryDeviceWithVersion(2), + GetDeviceWithSpecialCharactersWithVersion(2), + }; + + audio_pref_handler_->SetUserPriorityHigherThan(d[0], nullptr); + audio_pref_handler_->SetUserPriorityHigherThan(d[1], &d[0]); + audio_pref_handler_->SetUserPriorityHigherThan(d[2], &d[1]); + + // All devices should have priorities assigned. + ASSERT_NE(kUserPriorityNone, GetUserPriority(d[0])); + ASSERT_NE(kUserPriorityNone, GetUserPriority(d[1])); + ASSERT_NE(kUserPriorityNone, GetUserPriority(d[2])); + + audio_pref_handler_->DropLeastRecentlySeenDevices( + /*connected_devices=*/{d[0], d[1], d[2]}, 3); + // Keep 2 devices. Only the most recently seen d[0], d[2] should be left. + audio_pref_handler_->DropLeastRecentlySeenDevices( + /*connected_devices=*/{d[0], d[2]}, 2); + EXPECT_NE(kUserPriorityNone, GetUserPriority(d[0])); + EXPECT_EQ(kUserPriorityNone, GetUserPriority(d[1])); + EXPECT_NE(kUserPriorityNone, GetUserPriority(d[2])); + + // Request to keep 1 device. But connected devices are always kept. + audio_pref_handler_->DropLeastRecentlySeenDevices( + /*connected_devices=*/{d[0], d[2]}, 1); + EXPECT_NE(kUserPriorityNone, GetUserPriority(d[0])); + EXPECT_EQ(kUserPriorityNone, GetUserPriority(d[1])); + EXPECT_NE(kUserPriorityNone, GetUserPriority(d[2])); + + // Keep 1 devices. Only the most recently seen d[2] should be left. + audio_pref_handler_->DropLeastRecentlySeenDevices( + /*connected_devices=*/{d[2]}, 1); + EXPECT_EQ(kUserPriorityNone, GetUserPriority(d[0])); + EXPECT_EQ(kUserPriorityNone, GetUserPriority(d[1])); + EXPECT_NE(kUserPriorityNone, GetUserPriority(d[2])); +} + } // namespace ash
diff --git a/chromeos/ash/components/audio/audio_devices_pref_handler_stub.cc b/chromeos/ash/components/audio/audio_devices_pref_handler_stub.cc index d09d447a..4c063d5 100644 --- a/chromeos/ash/components/audio/audio_devices_pref_handler_stub.cc +++ b/chromeos/ash/components/audio/audio_devices_pref_handler_stub.cc
@@ -105,14 +105,17 @@ } } -int AudioDevicesPrefHandlerStub::GetUserPriority( - const AudioDevice& device) { +int AudioDevicesPrefHandlerStub::GetUserPriority(const AudioDevice& device) { if (user_priority_map_.find(device.stable_device_id) == user_priority_map_.end()) return kUserPriorityNone; return user_priority_map_[device.stable_device_id]; } +void AudioDevicesPrefHandlerStub::DropLeastRecentlySeenDevices( + const std::vector<AudioDevice>& connected_devices, + size_t keep_devices) {} + bool AudioDevicesPrefHandlerStub::GetNoiseCancellationState() { return noise_cancellation_state_; }
diff --git a/chromeos/ash/components/audio/audio_devices_pref_handler_stub.h b/chromeos/ash/components/audio/audio_devices_pref_handler_stub.h index 710b49d..a8792a5 100644 --- a/chromeos/ash/components/audio/audio_devices_pref_handler_stub.h +++ b/chromeos/ash/components/audio/audio_devices_pref_handler_stub.h
@@ -50,6 +50,9 @@ void SetUserPriorityHigherThan(const AudioDevice& target, const AudioDevice* base) override; int32_t GetUserPriority(const AudioDevice& device) override; + void DropLeastRecentlySeenDevices( + const std::vector<AudioDevice>& connected_devices, + size_t keep_devices) override; bool GetAudioOutputAllowedValue() const override; void AddAudioPrefObserver(AudioPrefObserver* observer) override; void RemoveAudioPrefObserver(AudioPrefObserver* observer) override;
diff --git a/chromeos/ash/components/audio/cras_audio_handler.cc b/chromeos/ash/components/audio/cras_audio_handler.cc index 1615ce5..5b75ae9d 100644 --- a/chromeos/ash/components/audio/cras_audio_handler.cc +++ b/chromeos/ash/components/audio/cras_audio_handler.cc
@@ -45,6 +45,9 @@ // Mixer matrix, [1, 0; 0, 1] const double kStereoToStereo[] = {1, 0, 0, 1}; +// Number of entries we're willing to store in preferences. +const int kMaxDeviceStoredInPref = 100; + CrasAudioHandler* g_cras_audio_handler = nullptr; bool IsSameAudioDevice(const AudioDevice& a, const AudioDevice& b) { @@ -1789,6 +1792,10 @@ } } + // Remove the least recently seen devices if there are too many devices. + audio_pref_handler_->DropLeastRecentlySeenDevices(devices, + kMaxDeviceStoredInPref); + audio_devices_.clear(); has_alternative_input_ = false; has_alternative_output_ = false;
diff --git a/chromeos/ash/components/network/managed_network_configuration_handler_impl.cc b/chromeos/ash/components/network/managed_network_configuration_handler_impl.cc index 87695ed..4a82d6c3 100644 --- a/chromeos/ash/components/network/managed_network_configuration_handler_impl.cc +++ b/chromeos/ash/components/network/managed_network_configuration_handler_impl.cc
@@ -1070,7 +1070,7 @@ void ManagedNetworkConfigurationHandlerImpl::OnPolicyAppliedToNetwork( base::OnceClosure callback, const std::string& service_path, - const std::string& guid) { + const std::string& guid) const { // When this is called, the policy has been fully applied and is reflected in // NetworkStateHandler, so it is safe to notify obserers. // Notifying observers is the last step of policy application to
diff --git a/chromeos/ash/components/network/managed_network_configuration_handler_impl.h b/chromeos/ash/components/network/managed_network_configuration_handler_impl.h index eb9c9a9..2e92265 100644 --- a/chromeos/ash/components/network/managed_network_configuration_handler_impl.h +++ b/chromeos/ash/components/network/managed_network_configuration_handler_impl.h
@@ -250,7 +250,7 @@ // identified by |service_path|. Notifies observers and calls |callback|. void OnPolicyAppliedToNetwork(base::OnceClosure callback, const std::string& service_path, - const std::string& guid); + const std::string& guid) const; // Helper method to append associated Device properties to |properties|. void GetDeviceStateProperties(const std::string& service_path,
diff --git a/chromeos/profiles/arm.afdo.newest.txt b/chromeos/profiles/arm.afdo.newest.txt index 5eee136..130ad2ce 100644 --- a/chromeos/profiles/arm.afdo.newest.txt +++ b/chromeos/profiles/arm.afdo.newest.txt
@@ -1 +1 @@ -chromeos-chrome-arm-none-108-5335.0-1665395930-benchmark-108.0.5359.0-r1-redacted.afdo.xz +chromeos-chrome-arm-none-108-5335.0-1665395930-benchmark-108.0.5359.6-r1-redacted.afdo.xz
diff --git a/chromeos/services/network_config/BUILD.gn b/chromeos/services/network_config/BUILD.gn index 4480746f..a84eec0 100644 --- a/chromeos/services/network_config/BUILD.gn +++ b/chromeos/services/network_config/BUILD.gn
@@ -30,6 +30,8 @@ } component("in_process_instance") { + output_name = "network_config_in_process_instance" + sources = [ "in_process_instance.cc", "in_process_instance.h",
diff --git a/chromeos/services/network_health/BUILD.gn b/chromeos/services/network_health/BUILD.gn index 82e9d254..a934c8f 100644 --- a/chromeos/services/network_health/BUILD.gn +++ b/chromeos/services/network_health/BUILD.gn
@@ -15,6 +15,29 @@ "//chromeos/services/network_config/public/cpp", "//chromeos/services/network_config/public/mojom", "//chromeos/services/network_health/public/mojom", + "//components/device_event_log", + "//mojo/public/cpp/bindings", + ] +} + +component("in_process_instance") { + output_name = "network_health_in_process_instance" + + sources = [ + "in_process_instance.cc", + "in_process_instance.h", + ] + + defines = [ "IS_IN_PROCESS_NETWORK_HEALTH_IMPL" ] + + public_deps = [ + "//chromeos/services/network_health/public/mojom", + "//mojo/public/cpp/bindings", + ] + + deps = [ + ":network_health", + "//chromeos/services/network_health/public/mojom", "//mojo/public/cpp/bindings", ] }
diff --git a/chromeos/services/network_health/in_process_instance.cc b/chromeos/services/network_health/in_process_instance.cc new file mode 100644 index 0000000..1e69455 --- /dev/null +++ b/chromeos/services/network_health/in_process_instance.cc
@@ -0,0 +1,17 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromeos/services/network_health/in_process_instance.h" + +#include "base/no_destructor.h" +#include "chromeos/services/network_health/network_health_service.h" + +namespace chromeos::network_health { + +NetworkHealthService* GetInProcessInstance() { + static base::NoDestructor<NetworkHealthService> instance; + return instance.get(); +} + +} // namespace chromeos::network_health
diff --git a/chromeos/services/network_health/in_process_instance.h b/chromeos/services/network_health/in_process_instance.h new file mode 100644 index 0000000..7cfc0d3 --- /dev/null +++ b/chromeos/services/network_health/in_process_instance.h
@@ -0,0 +1,19 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMEOS_SERVICES_NETWORK_HEALTH_IN_PROCESS_INSTANCE_H_ +#define CHROMEOS_SERVICES_NETWORK_HEALTH_IN_PROCESS_INSTANCE_H_ + +#include "base/component_export.h" + +namespace chromeos::network_health { + +class NetworkHealthService; + +COMPONENT_EXPORT(IN_PROCESS_NETWORK_HEALTH) +NetworkHealthService* GetInProcessInstance(); + +} // namespace chromeos::network_health + +#endif // CHROMEOS_SERVICES_NETWORK_HEALTH_IN_PROCESS_INSTANCE_H_
diff --git a/components/autofill/content/browser/bad_message.cc b/components/autofill/content/browser/bad_message.cc index 668219f..0edf4ed 100644 --- a/components/autofill/content/browser/bad_message.cc +++ b/components/autofill/content/browser/bad_message.cc
@@ -30,8 +30,8 @@ } // namespace bool CheckFrameNotPrerendering(content::RenderFrameHost* frame) { - if (frame->GetLifecycleState() == - content::RenderFrameHost::LifecycleState::kPrerendering) { + if (frame->IsInLifecycleState( + content::RenderFrameHost::LifecycleState::kPrerendering)) { ReceivedBadMessage(frame->GetProcess(), BadMessageReason::kPrerendering); return false; }
diff --git a/components/autofill/content/browser/content_autofill_driver.cc b/components/autofill/content/browser/content_autofill_driver.cc index 56dcf0a2..8fd440b 100644 --- a/components/autofill/content/browser/content_autofill_driver.cc +++ b/components/autofill/content/browser/content_autofill_driver.cc
@@ -103,8 +103,8 @@ } bool ContentAutofillDriver::IsPrerendering() const { - return render_frame_host_->GetLifecycleState() == - content::RenderFrameHost::LifecycleState::kPrerendering; + return render_frame_host_->IsInLifecycleState( + content::RenderFrameHost::LifecycleState::kPrerendering); } bool ContentAutofillDriver::CanShowAutofillUi() const { @@ -700,8 +700,7 @@ } ContentAutofillRouter& ContentAutofillDriver::autofill_router() { - DCHECK(content::RenderFrameHost::LifecycleState::kPrerendering != - render_frame_host_->GetLifecycleState()); + DCHECK(!IsPrerendering()); return *autofill_router_; }
diff --git a/components/autofill/core/browser/autofill_suggestion_generator.cc b/components/autofill/core/browser/autofill_suggestion_generator.cc index ffd99c9..0db59232 100644 --- a/components/autofill/core/browser/autofill_suggestion_generator.cc +++ b/components/autofill/core/browser/autofill_suggestion_generator.cc
@@ -382,6 +382,7 @@ if (!base::FeatureList::IsEnabled(features::kAutofillKeyboardAccessory) && base::FeatureList::IsEnabled( features::kAutofillEnableVirtualCardMetadata) && + base::FeatureList::IsEnabled(features::kAutofillEnableCardProductName) && type.GetStorableType() == CREDIT_CARD_NUMBER) { // For the Android dropdown, populate the card name (nickname/product // description/network) and the last 4 digits separately to allow them to
diff --git a/components/autofill/core/browser/autofill_suggestion_generator_unittest.cc b/components/autofill/core/browser/autofill_suggestion_generator_unittest.cc index ad6a545..0d2c4f8 100644 --- a/components/autofill/core/browser/autofill_suggestion_generator_unittest.cc +++ b/components/autofill/core/browser/autofill_suggestion_generator_unittest.cc
@@ -546,8 +546,10 @@ TEST_F(AutofillSuggestionGeneratorTest, CreateCreditCardSuggestion_PopupWithMetadata_VirtualCardNumberField) { base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitAndEnableFeature( - features::kAutofillEnableVirtualCardMetadata); + scoped_feature_list.InitWithFeatures( + /* enabled_features */ {features::kAutofillEnableVirtualCardMetadata, + features::kAutofillEnableCardProductName}, + /* disabled_features */ {}); // Create a server card. CreditCard server_card = test::GetMaskedServerCard(); @@ -644,8 +646,10 @@ TEST_F(AutofillSuggestionGeneratorTest, CreateCreditCardSuggestion_PopupWithMetadata_NonVirtualCardNumberField) { base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitAndEnableFeature( - features::kAutofillEnableVirtualCardMetadata); + scoped_feature_list.InitWithFeatures( + /* enabled_features */ {features::kAutofillEnableVirtualCardMetadata, + features::kAutofillEnableCardProductName}, + /* disabled_features */ {}); // Create a server card. CreditCard server_card = test::GetMaskedServerCard();
diff --git a/components/commerce/core/price_tracking_utils.cc b/components/commerce/core/price_tracking_utils.cc index 453525b7..7165a51 100644 --- a/components/commerce/core/price_tracking_utils.cc +++ b/components/commerce/core/price_tracking_utils.cc
@@ -266,4 +266,16 @@ } } +bool IsEmailDisabledByUser(PrefService* pref_service) { + if (pref_service) { + const PrefService::Preference* email_pref = + pref_service->FindPreference(kPriceEmailNotificationsEnabled); + if (email_pref && !email_pref->IsDefaultValue() && + !email_pref->GetValue()->GetBool()) { + return true; + } + } + return false; +} + } // namespace commerce
diff --git a/components/commerce/core/price_tracking_utils.h b/components/commerce/core/price_tracking_utils.h index 7fcb9dc..564fa23 100644 --- a/components/commerce/core/price_tracking_utils.h +++ b/components/commerce/core/price_tracking_utils.h
@@ -78,6 +78,10 @@ // a noop. void MaybeEnableEmailNotifications(PrefService* pref_service); +// Whether the email notification is explicitly disabled by the user. Return +// false if we are using the default preference value. +bool IsEmailDisabledByUser(PrefService* pref_service); + } // namespace commerce #endif // COMPONENTS_COMMERCE_CORE_PRICE_TRACKING_UTILS_H_
diff --git a/components/password_manager/core/browser/credential_manager_impl_unittest.cc b/components/password_manager/core/browser/credential_manager_impl_unittest.cc index fb197a26..03ac16e4 100644 --- a/components/password_manager/core/browser/credential_manager_impl_unittest.cc +++ b/components/password_manager/core/browser/credential_manager_impl_unittest.cc
@@ -249,8 +249,8 @@ if (base::FeatureList::IsEnabled( features::kEnablePasswordsAccountStorage)) { account_store_ = new TestPasswordStore(IsAccountStore(true)); - ASSERT_TRUE(account_store_->Init(/*prefs=*/nullptr, - /*affiliated_match_helper=*/nullptr)); + account_store_->Init(/*prefs=*/nullptr, + /*affiliated_match_helper=*/nullptr); } client_ = std::make_unique<testing::NiceMock<MockPasswordManagerClient>>( store_.get(), account_store_.get());
diff --git a/components/password_manager/core/browser/http_credentials_cleaner_unittest.cc b/components/password_manager/core/browser/http_credentials_cleaner_unittest.cc index 1ba3c62..180317d3 100644 --- a/components/password_manager/core/browser/http_credentials_cleaner_unittest.cc +++ b/components/password_manager/core/browser/http_credentials_cleaner_unittest.cc
@@ -144,8 +144,7 @@ static const std::u16string password[2] = {u"pass0", u"pass1"}; base::test::TaskEnvironment task_environment; - ASSERT_TRUE( - store_->Init(/*prefs=*/nullptr, /*affiliated_match_helper=*/nullptr)); + store_->Init(/*prefs=*/nullptr, /*affiliated_match_helper=*/nullptr); TestCase test = GetParam(); SCOPED_TRACE(testing::Message() << "is_hsts_enabled=" << test.is_hsts_enabled @@ -255,8 +254,8 @@ base::test::TaskEnvironment task_environment; auto password_store = base::MakeRefCounted<TestPasswordStore>(); - ASSERT_TRUE(password_store->Init(/*prefs=*/nullptr, - /*affiliated_match_helper=*/nullptr)); + password_store->Init(/*prefs=*/nullptr, + /*affiliated_match_helper=*/nullptr); double last_time = (base::Time::Now() - base::Minutes(10)).ToDoubleT(); if (should_start_clean_up) {
diff --git a/components/password_manager/core/browser/leak_detection_dialog_utils.cc b/components/password_manager/core/browser/leak_detection_dialog_utils.cc index 99e0b7a..9027303 100644 --- a/components/password_manager/core/browser/leak_detection_dialog_utils.cc +++ b/components/password_manager/core/browser/leak_detection_dialog_utils.cc
@@ -84,42 +84,25 @@ } std::u16string GetDescription(CredentialLeakType leak_type) { -#if BUILDFLAG(IS_IOS) - const bool uses_password_manager_updated_naming = - base::FeatureList::IsEnabled( - password_manager::features::kIOSEnablePasswordManagerBrandingUpdate); - const bool uses_password_manager_google_branding = true; -#elif BUILDFLAG(IS_ANDROID) - const bool uses_password_manager_updated_naming = - password_manager::features::UsesUnifiedPasswordManagerBranding(); - const bool uses_password_manager_google_branding = - password_manager_util::UsesPasswordManagerGoogleBranding( - IsSyncingPasswordsNormally(leak_type)); -#else - const bool uses_password_manager_updated_naming = true; - const bool uses_password_manager_google_branding = - password_manager_util::UsesPasswordManagerGoogleBranding( - IsSyncingPasswordsNormally(leak_type)); -#endif - if (uses_password_manager_updated_naming) { + if (UsesPasswordManagerUpdatedNaming()) { if (ShouldShowAutomaticChangePasswordButton(leak_type)) { return l10n_util::GetStringUTF16( IDS_CREDENTIAL_LEAK_CHANGE_PASSWORD_AUTOMATICALLY_MESSAGE_GPM); } if (!ShouldCheckPasswords(leak_type)) { return l10n_util::GetStringUTF16( - uses_password_manager_google_branding + UsesPasswordManagerGoogleBranding() ? IDS_CREDENTIAL_LEAK_CHANGE_PASSWORD_MESSAGE_GPM_BRANDED : IDS_CREDENTIAL_LEAK_CHANGE_PASSWORD_MESSAGE_GPM_NON_BRANDED); } if (password_manager::IsPasswordSaved(leak_type)) { return l10n_util::GetStringUTF16( - uses_password_manager_google_branding + UsesPasswordManagerGoogleBranding() ? IDS_CREDENTIAL_LEAK_CHECK_PASSWORDS_MESSAGE_GPM_BRANDED : IDS_CREDENTIAL_LEAK_CHECK_PASSWORDS_MESSAGE_GPM_NON_BRANDED); } return l10n_util::GetStringUTF16( - uses_password_manager_google_branding + UsesPasswordManagerGoogleBranding() ? IDS_CREDENTIAL_LEAK_CHANGE_AND_CHECK_PASSWORDS_MESSAGE_GPM_BRANDED : IDS_CREDENTIAL_LEAK_CHANGE_AND_CHECK_PASSWORDS_MESSAGE_GPM_NON_BRANDED); } else { @@ -145,18 +128,7 @@ return l10n_util::GetStringUTF16( IDS_CREDENTIAL_LEAK_TITLE_CHANGE_AUTOMATICALLY); } - -#if BUILDFLAG(IS_IOS) - const bool uses_password_manager_updated_naming = - base::FeatureList::IsEnabled( - password_manager::features::kIOSEnablePasswordManagerBrandingUpdate); -#elif BUILDFLAG(IS_ANDROID) - const bool uses_password_manager_updated_naming = - password_manager::features::UsesUnifiedPasswordManagerBranding(); -#else - const bool uses_password_manager_updated_naming = true; -#endif - if (uses_password_manager_updated_naming) { + if (UsesPasswordManagerUpdatedNaming()) { return l10n_util::GetStringUTF16(ShouldCheckPasswords(leak_type) ? IDS_CREDENTIAL_LEAK_TITLE_CHECK_GPM : IDS_CREDENTIAL_LEAK_TITLE_CHANGE); @@ -231,42 +203,30 @@ return net::AppendQueryParameter(url, "utm_campaign", campaign); } -LeakDialogTraits::LeakDialogTraits(CredentialLeakType leak_type) - : +bool UsesPasswordManagerUpdatedNaming() { #if BUILDFLAG(IS_IOS) - uses_password_manager_updated_naming_(base::FeatureList::IsEnabled( - password_manager::features::kIOSEnablePasswordManagerBrandingUpdate)), - uses_password_manager_google_branding_(true) + return base::FeatureList::IsEnabled( + password_manager::features::kIOSEnablePasswordManagerBrandingUpdate); #elif BUILDFLAG(IS_ANDROID) - uses_password_manager_updated_naming_( - password_manager::features::UsesUnifiedPasswordManagerBranding()), - uses_password_manager_google_branding_( - password_manager_util::UsesPasswordManagerGoogleBranding( - IsSyncingPasswordsNormally(leak_type))) + return password_manager::features::UsesUnifiedPasswordManagerBranding(); #else - uses_password_manager_updated_naming_(true), - uses_password_manager_google_branding_( - password_manager_util::UsesPasswordManagerGoogleBranding( - IsSyncingPasswordsNormally(leak_type))) + return true; #endif -{ } std::unique_ptr<LeakDialogTraits> CreateDialogTraits( CredentialLeakType leak_type) { switch (password_manager::GetLeakDialogType(leak_type)) { case LeakDialogType::kChange: - return std::make_unique<LeakDialogTraitsImp<LeakDialogType::kChange>>( - leak_type); + return std::make_unique<LeakDialogTraitsImp<LeakDialogType::kChange>>(); case LeakDialogType::kCheckup: - return std::make_unique<LeakDialogTraitsImp<LeakDialogType::kCheckup>>( - leak_type); + return std::make_unique<LeakDialogTraitsImp<LeakDialogType::kCheckup>>(); case LeakDialogType::kCheckupAndChange: return std::make_unique< - LeakDialogTraitsImp<LeakDialogType::kCheckupAndChange>>(leak_type); + LeakDialogTraitsImp<LeakDialogType::kCheckupAndChange>>(); case LeakDialogType::kChangeAutomatically: return std::make_unique< - LeakDialogTraitsImp<LeakDialogType::kChangeAutomatically>>(leak_type); + LeakDialogTraitsImp<LeakDialogType::kChangeAutomatically>>(); } }
diff --git a/components/password_manager/core/browser/leak_detection_dialog_utils.h b/components/password_manager/core/browser/leak_detection_dialog_utils.h index 5ef395e..2958ee0 100644 --- a/components/password_manager/core/browser/leak_detection_dialog_utils.h +++ b/components/password_manager/core/browser/leak_detection_dialog_utils.h
@@ -9,6 +9,7 @@ #include <type_traits> #include "base/types/strong_alias.h" +#include "build/branding_buildflags.h" #include "components/password_manager/core/browser/password_manager_metrics_util.h" #include "components/strings/grit/components_strings.h" #include "ui/base/l10n/l10n_util.h" @@ -93,10 +94,22 @@ GURL GetPasswordCheckupURL(PasswordCheckupReferrer referrer = PasswordCheckupReferrer::kLeakDetectionDialog); +// Returns whether to use the naming for unified password manager. +bool UsesPasswordManagerUpdatedNaming(); + +// Returns whether to use Google Chrome branded strings. +constexpr bool UsesPasswordManagerGoogleBranding() { +#if BUILDFLAG(GOOGLE_CHROME_BRANDING) + return true; +#else + return false; +#endif +} + // Captures common traits needed for a leak dialog. class LeakDialogTraits { public: - explicit LeakDialogTraits(CredentialLeakType leak_type); + LeakDialogTraits() = default; virtual ~LeakDialogTraits() = default; @@ -117,21 +130,6 @@ // Checks whether the dialog should show cancel button. virtual bool ShouldShowCancelButton() const = 0; - - protected: - bool uses_password_manager_updated_naming() const { - return uses_password_manager_updated_naming_; - } - - bool uses_password_manager_google_branding() const { - return uses_password_manager_google_branding_; - } - - private: - // Set iff Unified Password Manager / Updated branding strings are used. - const bool uses_password_manager_updated_naming_; - // Set iff Google Chrome Branding strings are used. - const bool uses_password_manager_google_branding_; }; // Creates a dialog traits object. @@ -141,8 +139,7 @@ template <metrics_util::LeakDialogType kDialogType> class LeakDialogTraitsImp : public LeakDialogTraits { public: - explicit LeakDialogTraitsImp(CredentialLeakType leak_type) - : LeakDialogTraits(leak_type) {} + LeakDialogTraitsImp() = default; LeakDialogTraitsImp(const LeakDialogTraitsImp&) = delete; LeakDialogTraitsImp& operator=(const LeakDialogTraitsImp&) = delete; @@ -159,8 +156,7 @@ class LeakDialogTraitsImp<metrics_util::LeakDialogType::kCheckup> : public LeakDialogTraits { public: - explicit LeakDialogTraitsImp(CredentialLeakType leak_type) - : LeakDialogTraits(leak_type) {} + LeakDialogTraitsImp() = default; LeakDialogTraitsImp(const LeakDialogTraitsImp&) = delete; LeakDialogTraitsImp& operator=(const LeakDialogTraitsImp&) = delete; @@ -173,9 +169,9 @@ } std::u16string GetDescription() const override { - if (uses_password_manager_updated_naming()) { + if (UsesPasswordManagerUpdatedNaming()) { return l10n_util::GetStringUTF16( - uses_password_manager_google_branding() + UsesPasswordManagerGoogleBranding() ? IDS_CREDENTIAL_LEAK_CHECK_PASSWORDS_MESSAGE_GPM_BRANDED : IDS_CREDENTIAL_LEAK_CHECK_PASSWORDS_MESSAGE_GPM_NON_BRANDED); } else { @@ -185,7 +181,7 @@ } std::u16string GetTitle() const override { - return l10n_util::GetStringUTF16(uses_password_manager_updated_naming() + return l10n_util::GetStringUTF16(UsesPasswordManagerUpdatedNaming() ? IDS_CREDENTIAL_LEAK_TITLE_CHECK_GPM : IDS_CREDENTIAL_LEAK_TITLE_CHECK); } @@ -200,8 +196,7 @@ class LeakDialogTraitsImp<metrics_util::LeakDialogType::kChange> : public LeakDialogTraits { public: - explicit LeakDialogTraitsImp(CredentialLeakType leak_type) - : LeakDialogTraits(leak_type) {} + LeakDialogTraitsImp() = default; LeakDialogTraitsImp(const LeakDialogTraitsImp&) = delete; LeakDialogTraitsImp& operator=(const LeakDialogTraitsImp&) = delete; @@ -214,9 +209,9 @@ } std::u16string GetDescription() const override { - if (uses_password_manager_updated_naming()) { + if (UsesPasswordManagerUpdatedNaming()) { return l10n_util::GetStringUTF16( - uses_password_manager_google_branding() + UsesPasswordManagerGoogleBranding() ? IDS_CREDENTIAL_LEAK_CHANGE_PASSWORD_MESSAGE_GPM_BRANDED : IDS_CREDENTIAL_LEAK_CHANGE_PASSWORD_MESSAGE_GPM_NON_BRANDED); } else { @@ -239,8 +234,7 @@ class LeakDialogTraitsImp<metrics_util::LeakDialogType::kCheckupAndChange> : public LeakDialogTraits { public: - explicit LeakDialogTraitsImp(CredentialLeakType leak_type) - : LeakDialogTraits(leak_type) {} + LeakDialogTraitsImp() = default; LeakDialogTraitsImp(const LeakDialogTraitsImp&) = delete; LeakDialogTraitsImp& operator=(const LeakDialogTraitsImp&) = delete; @@ -253,9 +247,9 @@ } std::u16string GetDescription() const override { - if (uses_password_manager_updated_naming()) + if (UsesPasswordManagerUpdatedNaming()) return l10n_util::GetStringUTF16( - uses_password_manager_google_branding() + UsesPasswordManagerGoogleBranding() ? IDS_CREDENTIAL_LEAK_CHANGE_AND_CHECK_PASSWORDS_MESSAGE_GPM_BRANDED : IDS_CREDENTIAL_LEAK_CHANGE_AND_CHECK_PASSWORDS_MESSAGE_GPM_NON_BRANDED); else @@ -264,7 +258,7 @@ } std::u16string GetTitle() const override { - return l10n_util::GetStringUTF16(uses_password_manager_updated_naming() + return l10n_util::GetStringUTF16(UsesPasswordManagerUpdatedNaming() ? IDS_CREDENTIAL_LEAK_TITLE_CHECK_GPM : IDS_CREDENTIAL_LEAK_TITLE_CHECK); } @@ -279,8 +273,7 @@ class LeakDialogTraitsImp<metrics_util::LeakDialogType::kChangeAutomatically> : public LeakDialogTraits { public: - explicit LeakDialogTraitsImp(CredentialLeakType leak_type) - : LeakDialogTraits(leak_type) {} + LeakDialogTraitsImp() = default; LeakDialogTraitsImp(const LeakDialogTraitsImp&) = delete; LeakDialogTraitsImp& operator=(const LeakDialogTraitsImp&) = delete; @@ -294,7 +287,7 @@ std::u16string GetDescription() const override { return l10n_util::GetStringUTF16( - uses_password_manager_updated_naming() + UsesPasswordManagerUpdatedNaming() ? IDS_CREDENTIAL_LEAK_CHANGE_PASSWORD_AUTOMATICALLY_MESSAGE_GPM : IDS_CREDENTIAL_LEAK_CHANGE_PASSWORD_AUTOMATICALLY_MESSAGE); }
diff --git a/components/password_manager/core/browser/leak_detection_dialog_utils_unittest.cc b/components/password_manager/core/browser/leak_detection_dialog_utils_unittest.cc index 53d2afd0..de87bde 100644 --- a/components/password_manager/core/browser/leak_detection_dialog_utils_unittest.cc +++ b/components/password_manager/core/browser/leak_detection_dialog_utils_unittest.cc
@@ -28,8 +28,17 @@ namespace password_manager { namespace { + +constexpr int GetLeakChangePasswordMessage() { +#if BUILDFLAG(GOOGLE_CHROME_BRANDING) + return IDS_CREDENTIAL_LEAK_CHANGE_PASSWORD_MESSAGE_GPM_BRANDED; +#else + return IDS_CREDENTIAL_LEAK_CHANGE_PASSWORD_MESSAGE_GPM_NON_BRANDED; +#endif +} + // Contains information that should be displayed on the leak dialog for -// specified |leak_type|. +// specified `leak_type`. const struct { // Specifies the test case. CredentialLeakType leak_type; @@ -45,44 +54,47 @@ IsReused(false), IsSyncing(false), HasChangeScript(false)), - IDS_OK, IDS_CLOSE, -#if BUILDFLAG(IS_IOS) || BUILDFLAG(GOOGLE_CHROME_BRANDING) - IDS_CREDENTIAL_LEAK_CHANGE_PASSWORD_MESSAGE_GPM_BRANDED, -#elif !BUILDFLAG(GOOGLE_CHROME_BRANDING) - IDS_CREDENTIAL_LEAK_CHANGE_PASSWORD_MESSAGE_GPM_NON_BRANDED, -#endif + IDS_OK, IDS_CLOSE, GetLeakChangePasswordMessage(), IDS_CREDENTIAL_LEAK_TITLE_CHANGE, false, false}, {CreateLeakType(IsSaved(false), IsReused(false), IsSyncing(true), HasChangeScript(false)), - IDS_OK, IDS_CLOSE, IDS_CREDENTIAL_LEAK_CHANGE_PASSWORD_MESSAGE_GPM_BRANDED, + IDS_OK, IDS_CLOSE, GetLeakChangePasswordMessage(), IDS_CREDENTIAL_LEAK_TITLE_CHANGE, false, false}, {CreateLeakType(IsSaved(false), IsReused(true), IsSyncing(true), HasChangeScript(false)), IDS_LEAK_CHECK_CREDENTIALS, IDS_CLOSE, +#if BUILDFLAG(GOOGLE_CHROME_BRANDING) IDS_CREDENTIAL_LEAK_CHANGE_AND_CHECK_PASSWORDS_MESSAGE_GPM_BRANDED, +#else + IDS_CREDENTIAL_LEAK_CHANGE_AND_CHECK_PASSWORDS_MESSAGE_GPM_NON_BRANDED, +#endif IDS_CREDENTIAL_LEAK_TITLE_CHECK_GPM, true, true}, {CreateLeakType(IsSaved(false), IsReused(false), IsSyncing(true), HasChangeScript(true)), - IDS_OK, IDS_CLOSE, IDS_CREDENTIAL_LEAK_CHANGE_PASSWORD_MESSAGE_GPM_BRANDED, + IDS_OK, IDS_CLOSE, GetLeakChangePasswordMessage(), IDS_CREDENTIAL_LEAK_TITLE_CHANGE, false, false}, {CreateLeakType(IsSaved(true), IsReused(false), IsSyncing(true), HasChangeScript(false)), - IDS_OK, IDS_CLOSE, IDS_CREDENTIAL_LEAK_CHANGE_PASSWORD_MESSAGE_GPM_BRANDED, + IDS_OK, IDS_CLOSE, GetLeakChangePasswordMessage(), IDS_CREDENTIAL_LEAK_TITLE_CHANGE, false, false}, {CreateLeakType(IsSaved(true), IsReused(true), IsSyncing(true), HasChangeScript(false)), IDS_LEAK_CHECK_CREDENTIALS, IDS_CLOSE, +#if BUILDFLAG(GOOGLE_CHROME_BRANDING) IDS_CREDENTIAL_LEAK_CHECK_PASSWORDS_MESSAGE_GPM_BRANDED, +#else + IDS_CREDENTIAL_LEAK_CHECK_PASSWORDS_MESSAGE_GPM_NON_BRANDED, +#endif IDS_CREDENTIAL_LEAK_TITLE_CHECK_GPM, true, true}, };
diff --git a/components/password_manager/core/browser/password_manager_test_utils.h b/components/password_manager/core/browser/password_manager_test_utils.h index cb440faf..88594e9 100644 --- a/components/password_manager/core/browser/password_manager_test_utils.h +++ b/components/password_manager/core/browser/password_manager_test_utils.h
@@ -29,8 +29,7 @@ template <class Context, class Store> scoped_refptr<RefcountedKeyedService> BuildPasswordStore(Context* context) { scoped_refptr<password_manager::PasswordStore> store(new Store); - if (!store->Init(/*prefs=*/nullptr, /*affiliated_match_helper=*/nullptr)) - return nullptr; + store->Init(/*prefs=*/nullptr, /*affiliated_match_helper=*/nullptr); return store; } @@ -51,8 +50,7 @@ Context* context) { scoped_refptr<password_manager::PasswordStore> store( new Store(std::forward<Args>(args)...)); - if (!store->Init(/*prefs=*/nullptr, /*affiliated_match_helper=*/nullptr)) - return nullptr; + store->Init(/*prefs=*/nullptr, /*affiliated_match_helper=*/nullptr); return store; }
diff --git a/components/password_manager/core/browser/password_store.cc b/components/password_manager/core/browser/password_store.cc index 6c6bc4c..ccdd338 100644 --- a/components/password_manager/core/browser/password_store.cc +++ b/components/password_manager/core/browser/password_store.cc
@@ -78,7 +78,7 @@ PasswordStore::PasswordStore(std::unique_ptr<PasswordStoreBackend> backend) : backend_(std::move(backend)) {} -bool PasswordStore::Init( +void PasswordStore::Init( PrefService* prefs, std::unique_ptr<AffiliatedMatchHelper> affiliated_match_helper, base::RepeatingClosure sync_enabled_or_disabled_cb) { @@ -99,7 +99,6 @@ base::BindRepeating( &PasswordStore::NotifySyncEnabledOrDisabledOnMainSequence, this)), base::BindOnce(&PasswordStore::OnInitCompleted, this)); - return true; } void PasswordStore::AddLogin(const PasswordForm& form,
diff --git a/components/password_manager/core/browser/password_store.h b/components/password_manager/core/browser/password_store.h index 1b639a4..08fda502 100644 --- a/components/password_manager/core/browser/password_store.h +++ b/components/password_manager/core/browser/password_store.h
@@ -75,7 +75,7 @@ // invoked in UI thread (or sequence used to invoke Init()) when sync is // enabled or disabled. It is no longer invoked after ShutdownOnUIThread(). // TODO(crbug.com/1218413): Move initialization into the core interface, too. - bool Init( + void Init( PrefService* prefs, std::unique_ptr<AffiliatedMatchHelper> affiliated_match_helper, base::RepeatingClosure sync_enabled_or_disabled_cb = base::DoNothing());
diff --git a/components/permissions/permission_manager_unittest.cc b/components/permissions/permission_manager_unittest.cc index 52b29d2f..0c7f778 100644 --- a/components/permissions/permission_manager_unittest.cc +++ b/components/permissions/permission_manager_unittest.cc
@@ -342,10 +342,10 @@ #if BUILDFLAG(IS_ANDROID) CheckPermissionStatus(PermissionType::PROTECTED_MEDIA_IDENTIFIER, GetDefaultProtectedMediaIdentifierPermissionStatus()); - CheckPermissionStatus(PermissionType::WINDOW_PLACEMENT, + CheckPermissionStatus(PermissionType::WINDOW_MANAGEMENT, PermissionStatus::DENIED); #else - CheckPermissionStatus(PermissionType::WINDOW_PLACEMENT, + CheckPermissionStatus(PermissionType::WINDOW_MANAGEMENT, PermissionStatus::ASK); #endif } @@ -367,12 +367,12 @@ CheckPermissionStatus(PermissionType::PROTECTED_MEDIA_IDENTIFIER, PermissionStatus::GRANTED); - SetPermission(PermissionType::WINDOW_PLACEMENT, PermissionStatus::GRANTED); - CheckPermissionStatus(PermissionType::WINDOW_PLACEMENT, + SetPermission(PermissionType::WINDOW_MANAGEMENT, PermissionStatus::GRANTED); + CheckPermissionStatus(PermissionType::WINDOW_MANAGEMENT, PermissionStatus::DENIED); #else - SetPermission(PermissionType::WINDOW_PLACEMENT, PermissionStatus::GRANTED); - CheckPermissionStatus(PermissionType::WINDOW_PLACEMENT, + SetPermission(PermissionType::WINDOW_MANAGEMENT, PermissionStatus::GRANTED); + CheckPermissionStatus(PermissionType::WINDOW_MANAGEMENT, PermissionStatus::GRANTED); #endif }
diff --git a/components/permissions/permission_util.cc b/components/permissions/permission_util.cc index a061fc3a..3db596e 100644 --- a/components/permissions/permission_util.cc +++ b/components/permissions/permission_util.cc
@@ -151,7 +151,7 @@ *out = PermissionType::CAMERA_PAN_TILT_ZOOM; break; case ContentSettingsType::WINDOW_MANAGEMENT: - *out = PermissionType::WINDOW_PLACEMENT; + *out = PermissionType::WINDOW_MANAGEMENT; break; case ContentSettingsType::LOCAL_FONTS: *out = PermissionType::LOCAL_FONTS; @@ -282,7 +282,7 @@ return ContentSettingsType::STORAGE_ACCESS; case PermissionType::CAMERA_PAN_TILT_ZOOM: return ContentSettingsType::CAMERA_PAN_TILT_ZOOM; - case PermissionType::WINDOW_PLACEMENT: + case PermissionType::WINDOW_MANAGEMENT: return ContentSettingsType::WINDOW_MANAGEMENT; case PermissionType::LOCAL_FONTS: return ContentSettingsType::LOCAL_FONTS;
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index e595e1b..ee6b7a5 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -11766,14 +11766,14 @@ 'dynamic_refresh': True, 'unlisted': True, }, - 'example_value': 600000, - 'default': 600000, + 'example_value': 900000, + 'default': 900000, 'id': 929, 'caption': '''Audio telemetry collection rate in milliseconds.''', 'tags': ['admin-sharing'], 'desc': '''Rate at which audio data is sampled and collected. The minimum allowed is 1 minute. - If not set, the default rate of 10 minutes applies.''', + If not set, the default rate of 15 minutes applies.''', 'arc_support': 'This policy has no effect on the logging done by Android.', }, { @@ -18074,6 +18074,16 @@ 'dynamic_refresh': True, 'per_profile': True, }, + 'items': [ + { + 'value': True, + 'caption': 'Enable creation of supervised users', + }, + { + 'value': False, + 'caption': 'Disable creation of supervised users', + }, + ], 'example_value': True, 'id': 223, 'caption': '''Enable creation of supervised users''', @@ -19085,6 +19095,16 @@ 'dynamic_refresh': True, 'per_profile': True, }, + 'items': [ + { + 'value': True, + 'caption': 'Allow users to click through SSL warning pages', + }, + { + 'value': False, + 'caption': 'Prevent users from clicking through SSL warning pages', + }, + ], 'example_value': True, 'id': 300, 'caption': '''Allow proceeding from the SSL warning page''', @@ -22340,6 +22360,16 @@ 'dynamic_refresh': True, 'per_profile': True, }, + 'items': [ + { + 'value': True, + 'caption': 'Enable casting content to the device', + }, + { + 'value': False, + 'caption': 'Disable casting content to the device', + }, + ], 'example_value': False, 'id': 378, 'default_for_enterprise_users': False, @@ -26935,6 +26965,16 @@ 'dynamic_refresh': False, 'per_profile': True, }, + 'items': [ + { + 'value': True, + 'caption': 'Allow pages to show pop-ups during unloading', + }, + { + 'value': False, + 'caption': 'Prevent pages from showing pop-ups during unloading', + }, + ], 'default_for_enterprise_users': False, 'example_value': False, 'id': 533, @@ -29260,6 +29300,16 @@ 'dynamic_refresh': False, 'per_profile': True, }, + 'items': [ + { + 'value': True, + 'caption': 'Allow pages to send synchronous XHR requests during page dismissal', + }, + { + 'value': False, + 'caption': 'Do not allow pages to send synchronous XHR requests during page dismissal', + }, + ], 'default_for_enterprise_users': False, 'example_value': False, 'id': 604, @@ -30317,7 +30367,7 @@ 'owners': ['carlosil@chromium.org', 'estark@chromium.org'], 'type': 'main', 'schema': { 'type': 'boolean' }, - 'supported_on': ['chrome.*:80-', 'chrome_os:80-'], + 'supported_on': ['chrome.*:80-84', 'chrome_os:80-84'], 'features': { 'dynamic_refresh': True, 'per_profile': True,
diff --git a/components/policy/resources/templates/common_schemas.yaml b/components/policy/resources/templates/common_schemas.yaml index 9342882..fa12ef3 100644 --- a/components/policy/resources/templates/common_schemas.yaml +++ b/components/policy/resources/templates/common_schemas.yaml
@@ -187,6 +187,14 @@ - FINGERPRINT type: string type: array +QuickUnlockModeWhitelist: + items: + enum: + - all + - PIN + - FINGERPRINT + type: string + type: array Time: description: Time interpreted in local wall-clock 24h format. properties: @@ -210,6 +218,13 @@ minimum: 0 type: integer type: object +UsbDeviceId: + properties: + product_id: + type: integer + vendor_id: + type: integer + type: object UsbDeviceIdInclusive: properties: product_id:
diff --git a/components/policy/resources/templates/device_policy_proto_map.yaml b/components/policy/resources/templates/device_policy_proto_map.yaml index 52769e10..c3aae15 100644 --- a/components/policy/resources/templates/device_policy_proto_map.yaml +++ b/components/policy/resources/templates/device_policy_proto_map.yaml
@@ -93,6 +93,8 @@ DeviceMinimumVersionAueMessage: device_minimum_version_aue_message.value DeviceNativePrinters: native_device_printers.external_policy DeviceNativePrintersAccessMode: native_device_printers_access_mode.access_mode +DeviceNativePrintersBlacklist: native_device_printers_blacklist.blacklist # nocheck +DeviceNativePrintersWhitelist: native_device_printers_whitelist.whitelist # nocheck DeviceOpenNetworkConfiguration: open_network_configuration.open_network_configuration DevicePciPeripheralDataAccessEnabled: device_pci_peripheral_data_access_enabled_v2.enabled DevicePolicyRefreshRate: device_policy_refresh_rate.device_policy_refresh_rate
diff --git a/components/policy/resources/templates/policies.yaml b/components/policy/resources/templates/policies.yaml index bbb5339..2e427c9 100644 --- a/components/policy/resources/templates/policies.yaml +++ b/components/policy/resources/templates/policies.yaml
@@ -27,11 +27,11 @@ 26: AuthSchemes 27: DisableAuthNegotiateCnameLookup 28: EnableAuthNegotiatePort - 29: '' - 30: '' + 29: AuthServerWhitelist + 30: AuthNegotiateDelegateWhitelist 31: GSSAPILibraryName - 32: '' - 33: '' + 32: ExtensionInstallBlacklist + 33: ExtensionInstallWhitelist 34: ExtensionInstallForcelist 35: ShowHomeButton 36: DeveloperToolsDisabled @@ -101,8 +101,8 @@ 100: ImportSearchEngine 101: ImportSavedPasswords 102: AutoSelectCertificateForUrls - 103: '' - 104: '' + 103: URLBlacklist + 104: URLWhitelist 105: NotificationsAllowedForUrls 106: NotificationsBlockedForUrls 107: OpenNetworkConfiguration @@ -120,7 +120,7 @@ 119: ReportDeviceVersionInfo 120: ReportDeviceActivityTimes 121: ReportDeviceBootMode - 122: '' + 122: DeviceUserWhitelist 123: DeviceAllowNewUsers 124: DeviceGuestModeEnabled 125: DeviceShowUserNamesOnSignin @@ -199,7 +199,7 @@ 198: IdleWarningDelayBattery 199: DeviceVariationsRestrictParameter 200: AttestationEnabledForUser - 201: '' + 201: AttestationExtensionWhitelist 202: DeviceLocalAccountAutoLoginBailoutEnabled 203: AllowScreenWakeLocks 204: '' @@ -249,8 +249,8 @@ 248: ReportDeviceUsers 249: UserAvatarImage 250: DeviceLocalAccountPromptForNetworkWhenOffline - 251: '' - 252: '' + 251: NativeMessagingBlacklist + 252: NativeMessagingWhitelist 253: NativeMessagingUserLevelHosts 254: SAMLOfflineSigninTimeLimit 255: VirtualKeyboardEnabled @@ -320,7 +320,7 @@ 319: AllowKioskAppControlChromeVersion 320: DefaultWebBluetoothGuardSetting 321: LoginAuthenticationBehavior - 322: '' + 322: UsbDetachableWhitelist 323: DeviceAllowBluetooth 324: SuppressUnsupportedOSWarning 325: DeviceQuirksDownloadEnabled @@ -350,7 +350,7 @@ 349: ReportArcStatusEnabled 350: NativePrinters 351: NetworkThrottlingEnabled - 352: '' + 352: QuickUnlockModeWhitelist 353: QuickUnlockTimeout 354: PinUnlockMinimumLength 355: PinUnlockMaximumLength @@ -375,19 +375,19 @@ 374: DeviceEcryptfsMigrationStrategy 375: SafeBrowsingForTrustedSourcesEnabled 376: EcryptfsMigrationStrategy - 377: '' + 377: NoteTakingAppsLockScreenWhitelist 378: CastReceiverEnabled 379: CastReceiverName 380: DeviceOffHours 381: CloudPolicyOverridesPlatformPolicy 382: NativePrintersBulkConfiguration - 383: '' - 384: '' - 385: '' + 383: NativePrintersBulkAccessMode + 384: NativePrintersBulkBlacklist + 385: NativePrintersBulkWhitelist 386: DeviceNativePrinters - 387: '' - 388: '' - 389: '' + 387: DeviceNativePrintersAccessMode + 388: DeviceNativePrintersBlacklist + 389: DeviceNativePrintersWhitelist 390: TPMFirmwareUpdateSettings 391: RunAllFlashInAllowMode 392: AutofillCreditCardEnabled @@ -420,7 +420,7 @@ 419: RelaunchNotification 420: RelaunchNotificationPeriod 421: VirtualMachinesAllowed - 422: '' + 422: SafeBrowsingWhitelistDomains 423: PasswordProtectionLoginURLs 424: PasswordProtectionChangePasswordURL 425: DeviceMachinePasswordChangeRate @@ -429,7 +429,7 @@ 428: MachineLevelUserCloudPolicyEnrollmentToken 429: SafeBrowsingExtendedReportingEnabled 430: AutoplayAllowed - 431: '' + 431: AutoplayWhitelist 432: TabUnderAllowed 433: UserNativePrintersAllowed 434: DefaultWebUsbGuardSetting @@ -534,7 +534,7 @@ 533: AllowPopupsDuringPageUnload 534: RemoteAccessHostAllowFileTransfer 535: DeviceWilcoDtcConfiguration - 536: '' + 536: SpellcheckLanguageBlacklist 537: DeviceWiFiAllowed 538: DevicePowerPeakShiftEnabled 539: DevicePowerPeakShiftBatteryThreshold @@ -629,7 +629,7 @@ 628: DeviceLoginScreenScreenMagnifierType 629: CorsMitigationList 630: CorsLegacyModeEnabled - 631: '' + 631: ExternalPrintServersWhitelist 632: ExternalProtocolDialogShowAlwaysOpenCheckbox 633: DefaultInsecureContentSetting 634: InsecureContentAllowedForUrls @@ -656,13 +656,13 @@ 655: PrimaryMouseButtonSwitch 656: ReportDeviceCpuInfo 657: DeviceLoginScreenPrimaryMouseButtonSwitch - 658: '' + 658: PerAppTimeLimitsWhitelist 659: AccessibilityShortcutsEnabled 660: ReportDeviceGraphicsStatus 661: DeviceLoginScreenAccessibilityShortcutsEnabled 662: LocalDiscoveryEnabled 663: ChromeVariations - 664: '' + 664: PrintingAPIExtensionsWhitelist 665: ReportDeviceCrashReportInfo 666: ScreenCaptureAllowed 667: AdvancedProtectionDeepScanningEnabled @@ -878,7 +878,7 @@ 877: DataLeakPreventionClipboardCheckSizeLimit 878: CrossOriginWebAssemblyModuleSharingEnabled 879: RestrictedManagedGuestSessionExtensionCleanupExemptList - 880: '' + 880: DisplayCapturePermissionsPolicyEnabled 881: ScreenCaptureAllowedByOrigins 882: WindowCaptureAllowedByOrigins 883: TabCaptureAllowedByOrigins @@ -1018,6 +1018,12 @@ 1017: TrashEnabled 1018: ShoppingListEnabled 1019: DeskAPIThirdPartyAccessEnabled + 1020: FileSystemSyncAccessHandleAsyncInterfaceEnabled + 1021: DefaultHandlersForFileExtensions + 1022: IsolatedWebAppInstallForceList + 1023: DeskAPIThirdPartyAllowlist + 1024: VirtualKeyboardResizesLayoutByDefault + 1025: HindiInscriptLayoutEnabled atomic_groups: 1: Homepage 2: RemoteAccess
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/AccessibilityShortcutsEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/AccessibilityShortcutsEnabled.yaml index cee78172..60c59c802 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/AccessibilityShortcutsEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/AccessibilityShortcutsEnabled.yaml
@@ -1,4 +1,5 @@ caption: Enable accessibility features shortcuts +default: null desc: |- Enable accessibility features shortcuts. @@ -14,6 +15,13 @@ can_be_recommended: true dynamic_refresh: true per_profile: true +items: +- caption: Enable accessibility shortcuts + value: true +- caption: Disable accessibility shortcuts + value: false +- caption: Allow the user to decide + value: null owners: - amraboelkher@chromium.org - emaxx@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/AutoclickEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/AutoclickEnabled.yaml index a4dfa140..5bb53ef 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/AutoclickEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/AutoclickEnabled.yaml
@@ -1,4 +1,5 @@ caption: Enable the autoclick accessibility feature +default: null desc: |- Enable the autoclick accessibility feature. @@ -16,6 +17,13 @@ can_be_recommended: true dynamic_refresh: true per_profile: true +items: +- caption: Enable auto-click + value: true +- caption: Disable auto-click + value: false +- caption: Allow the user to decide + value: null owners: - amraboelkher@chromium.org schema:
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/CaretHighlightEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/CaretHighlightEnabled.yaml index 3c0e7bd3..716e9b24 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/CaretHighlightEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/CaretHighlightEnabled.yaml
@@ -1,4 +1,5 @@ caption: Enable the caret highlight accessibility feature +default: null desc: |- Enable the caret highlight accessibility feature. @@ -16,6 +17,13 @@ can_be_recommended: true dynamic_refresh: true per_profile: true +items: +- caption: Enable caret highlight + value: true +- caption: Disable caret highlight + value: false +- caption: Allow the user to decide + value: null owners: - amraboelkher@chromium.org schema:
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/CursorHighlightEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/CursorHighlightEnabled.yaml index 89598dd..db81be1 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/CursorHighlightEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/CursorHighlightEnabled.yaml
@@ -1,4 +1,5 @@ caption: Enable the cursor highlight accessibility feature +default: null desc: |- Enable the cursor highlight accessibility feature. @@ -16,6 +17,13 @@ can_be_recommended: true dynamic_refresh: true per_profile: true +items: +- caption: Enable cursor highlight + value: true +- caption: Disable cursor highlight + value: false +- caption: Allow the user to decide + value: null owners: - amraboelkher@chromium.org - emaxx@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenAccessibilityShortcutsEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenAccessibilityShortcutsEnabled.yaml index aaaf7c6..a653e45 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenAccessibilityShortcutsEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenAccessibilityShortcutsEnabled.yaml
@@ -1,4 +1,5 @@ caption: Enable accessibility features shortcuts on the login screen +default: null desc: |- Enable accessibility features shortcuts on the login screen. @@ -15,6 +16,13 @@ can_be_recommended: true dynamic_refresh: true per_profile: false +items: +- caption: Enable accessibility shortcuts on the sign-in screen + value: true +- caption: Disable accessibility shortcuts on the sign-in screen + value: false +- caption: Allow the user to decide + value: null owners: - amraboelkher@chromium.org - emaxx@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenAutoclickEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenAutoclickEnabled.yaml index b3704aac..a52c259a 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenAutoclickEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenAutoclickEnabled.yaml
@@ -1,4 +1,5 @@ -caption: Enable the autoclick on the login screen +caption: Enable autoclick on the login screen +default: null desc: |- Enable the autoclick accessibility feature on the login screen. @@ -16,6 +17,13 @@ features: can_be_recommended: true dynamic_refresh: true +items: +- caption: Enable auto-click on the login screen + value: true +- caption: Disable auto-click on the login screen + value: false +- caption: Allow the user to decide + value: null owners: - amraboelkher@chromium.org - emaxx@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenCaretHighlightEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenCaretHighlightEnabled.yaml index d82a4f4..81dbd53 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenCaretHighlightEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenCaretHighlightEnabled.yaml
@@ -1,4 +1,5 @@ -caption: Enable the caret highlight on the login screen +caption: Enable caret highlight on the login screen +default: null desc: |- Enable the caret highlight accessibility feature on the login screen. @@ -14,6 +15,13 @@ features: can_be_recommended: true dynamic_refresh: true +items: +- caption: Enable caret highlight on the login screen + value: true +- caption: Disable caret highlight on the login screen + value: false +- caption: Allow the user to decide + value: null owners: - amraboelkher@chromium.org - emaxx@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenCursorHighlightEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenCursorHighlightEnabled.yaml index 0f4db0b..fde774a6 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenCursorHighlightEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenCursorHighlightEnabled.yaml
@@ -1,4 +1,5 @@ caption: Enable the cursor highlight on the login screen +default: null desc: |- Enable the cursor highlight accessibility feature on the login screen. @@ -14,6 +15,13 @@ features: can_be_recommended: true dynamic_refresh: true +items: +- caption: Enable cursor highlight on the login screen + value: true +- caption: Disable cursor highlight on the login screen + value: false +- caption: Allow the user to decide + value: null owners: - amraboelkher@chromium.org - emaxx@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenDefaultHighContrastEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenDefaultHighContrastEnabled.yaml index 697c24de..24121edf 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenDefaultHighContrastEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenDefaultHighContrastEnabled.yaml
@@ -1,4 +1,5 @@ caption: Set the default state of high contrast mode on the login screen +default: null desc: |- Setting the policy to True turns High-contrast mode on at the sign-in screen. Setting the policy to False turns High-contrast mode off at the screen. @@ -11,6 +12,15 @@ example_value: true features: dynamic_refresh: true +items: +- caption: Enable high contrast on the login screen and allow the user to temporarily + disable it + value: true +- caption: Disable high contrast on the login screen and allow the user to temporarily + enable it + value: false +- caption: Allow the user to decide + value: null owners: - file://components/policy/resources/OWNERS - rsorokin@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenDefaultLargeCursorEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenDefaultLargeCursorEnabled.yaml index 9c79015..5fe7ba050 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenDefaultLargeCursorEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenDefaultLargeCursorEnabled.yaml
@@ -1,4 +1,5 @@ caption: Set default state of the large cursor on the login screen +default: null desc: |- Setting the policy to True turns the large cursor on at the sign-in screen. Setting the policy to False turns the large cursor off at the sign-in screen. @@ -11,6 +12,13 @@ example_value: true features: dynamic_refresh: true +items: +- caption: Enable large cursor on the login screen + value: true +- caption: Disable large cursor on the login screen + value: false +- caption: Allow the user to decide + value: null owners: - file://components/policy/resources/OWNERS - rsorokin@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenDefaultSpokenFeedbackEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenDefaultSpokenFeedbackEnabled.yaml index f280201..ba392a7a 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenDefaultSpokenFeedbackEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenDefaultSpokenFeedbackEnabled.yaml
@@ -1,4 +1,5 @@ caption: Set the default state of spoken feedback on the login screen +default: null desc: |- Setting the policy to True turns spoken feedback on at the sign-in screen. Setting the policy to False turns spoken feedback off at the screen. @@ -11,6 +12,15 @@ example_value: true features: dynamic_refresh: true +items: +- caption: Enable spoken feedback on the login screen and allow the user to temporarily + disable it + value: true +- caption: Disable spoken feedback on the login screen and allow the user to temporarily + enable it + value: false +- caption: Allow the user to decide + value: null owners: - amraboelkher@chromium.org - emaxx@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenDefaultVirtualKeyboardEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenDefaultVirtualKeyboardEnabled.yaml index 4b2b5ef..f86739d 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenDefaultVirtualKeyboardEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenDefaultVirtualKeyboardEnabled.yaml
@@ -1,4 +1,5 @@ caption: Set default state of the on-screen keyboard on the login screen +default: null deprecated: true desc: |- This policy is deprecated, please use the <ph name="DEVICE_LOGIN_SCREEN_VIRTUAL_KEYBOARD_ENABLED_POLICY_NAME">DeviceLoginScreenVirtualKeyboardEnabled</ph> policy instead. @@ -14,6 +15,15 @@ example_value: true features: dynamic_refresh: true +items: +- caption: Enable on-screen keyboard on the login screen and allow the user to temporarily + disable it + value: true +- caption: Disable on-screen keyboard on the login screen and allow the user to temporarily + enable it + value: false +- caption: Allow the user to decide + value: null owners: - file://components/policy/resources/OWNERS - rsorokin@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenDictationEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenDictationEnabled.yaml index 9139e18..91dc3e2c 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenDictationEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenDictationEnabled.yaml
@@ -1,4 +1,5 @@ caption: Enable the dictation on the login screen +default: null desc: |- Enable the dictation accessibility feature on the login screen. @@ -14,6 +15,13 @@ features: can_be_recommended: true dynamic_refresh: true +items: +- caption: Enable dictation on the login screen + value: true +- caption: Disable dictation on the login screen + value: false +- caption: Allow the user to decide + value: null owners: - amraboelkher@chromium.org - emaxx@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenHighContrastEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenHighContrastEnabled.yaml index bea99bc..550b798 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenHighContrastEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenHighContrastEnabled.yaml
@@ -1,4 +1,5 @@ caption: Enable the high contrast on the login screen +default: null desc: |- Enable the high contrast accessibility feature on the login screen. @@ -14,6 +15,13 @@ features: can_be_recommended: true dynamic_refresh: true +items: +- caption: Enable high contrast on the login screen + value: true +- caption: Disable high contrast on the login screen + value: false +- caption: Allow the user to decide + value: null owners: - amraboelkher@chromium.org - emaxx@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenKeyboardFocusHighlightEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenKeyboardFocusHighlightEnabled.yaml index d356ccf..267ea61 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenKeyboardFocusHighlightEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenKeyboardFocusHighlightEnabled.yaml
@@ -1,4 +1,5 @@ caption: Enable the keyboard focus highlighting accessibility feature +default: null desc: |- Enable the keyboard focus highlighting accessibility feature on the login screen. @@ -16,6 +17,13 @@ features: can_be_recommended: true dynamic_refresh: true +items: +- caption: Enable keyboard focus highlighting on the login screen + value: true +- caption: Disable keyboard focus highlighting on the login screen + value: false +- caption: Allow the user to decide + value: null owners: - amraboelkher@chromium.org schema:
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenLargeCursorEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenLargeCursorEnabled.yaml index b0f310e..86c2a3fb 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenLargeCursorEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenLargeCursorEnabled.yaml
@@ -1,4 +1,5 @@ caption: Enable the large cursor on the login screen +default: null desc: |- Enable the large cursor accessibility feature on the login screen. @@ -14,6 +15,13 @@ features: can_be_recommended: true dynamic_refresh: true +items: +- caption: Enable large cursor on the login screen + value: true +- caption: Disable large cursor on the login screen + value: false +- caption: Allow the user to decide + value: null owners: - amraboelkher@chromium.org - emaxx@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenMonoAudioEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenMonoAudioEnabled.yaml index 7483315c..790161c9 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenMonoAudioEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenMonoAudioEnabled.yaml
@@ -1,4 +1,5 @@ -caption: Enable the mono audio on the login screen +caption: Enable mono audio on the login screen +default: null desc: |- Enable the mono audio accessibility feature on the login screen. @@ -16,6 +17,13 @@ features: can_be_recommended: true dynamic_refresh: true +items: +- caption: Enable mono audio on the login screen + value: true +- caption: Disable mono audio on the login screen + value: false +- caption: Allow the user to decide + value: null owners: - amraboelkher@chromium.org - emaxx@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenSelectToSpeakEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenSelectToSpeakEnabled.yaml index 7e069c23..82d9249 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenSelectToSpeakEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenSelectToSpeakEnabled.yaml
@@ -1,4 +1,5 @@ caption: Enable the select to speak on the login screen +default: null desc: |- Enable the select to speak accessibility feature on the login screen. @@ -14,6 +15,13 @@ features: can_be_recommended: true dynamic_refresh: true +items: +- caption: Enable select to speak on the login screen + value: true +- caption: Disable select to speak on the login screen + value: false +- caption: Allow the user to decide + value: null owners: - amraboelkher@chromium.org - emaxx@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenShowOptionsInSystemTrayMenu.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenShowOptionsInSystemTrayMenu.yaml index 1733f02..10b7631 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenShowOptionsInSystemTrayMenu.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenShowOptionsInSystemTrayMenu.yaml
@@ -1,4 +1,5 @@ caption: Show accessibility options in system tray menu in the login screen +default: null desc: |- Setting the policy to True displays the accessibility options in the system tray menu. If you set the policy to False, the options don't appear in the menu. @@ -10,6 +11,13 @@ features: can_be_recommended: true dynamic_refresh: true +items: +- caption: Show accessibility options in the login screen system tray menu + value: true +- caption: Hide accessibility options in the login screen system tray menu + value: false +- caption: Allow the user to decide + value: null owners: - file://components/policy/resources/OWNERS - bartfab@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenSpokenFeedbackEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenSpokenFeedbackEnabled.yaml index 109f98d..5d48ce7 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenSpokenFeedbackEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenSpokenFeedbackEnabled.yaml
@@ -1,4 +1,5 @@ caption: Enable the spoken feedback on the login screen +default: null desc: |- Enable the spoken feedback accessibility feature on the login screen. @@ -14,6 +15,13 @@ features: can_be_recommended: true dynamic_refresh: true +items: +- caption: Enable spoken feedback on the login screen + value: true +- caption: Disable spoken feedback on the login screen + value: false +- caption: Allow the user to decide + value: null owners: - amraboelkher@chromium.org - emaxx@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenStickyKeysEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenStickyKeysEnabled.yaml index 744f793..ecdc1dd 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenStickyKeysEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenStickyKeysEnabled.yaml
@@ -1,4 +1,5 @@ -caption: Enable the sticky keys on the login screen +caption: Enable sticky keys on the login screen +default: null desc: |- Enable the sticky keys accessibility feature on the login screen. @@ -14,6 +15,13 @@ features: can_be_recommended: true dynamic_refresh: true +items: +- caption: Enable sticky keys on the login screen + value: true +- caption: Disable sticky keys on the login screen + value: false +- caption: Allow the user to decide + value: null owners: - amraboelkher@chromium.org - emaxx@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenVirtualKeyboardEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenVirtualKeyboardEnabled.yaml index f4a06d0..942f789 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenVirtualKeyboardEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/DeviceLoginScreenVirtualKeyboardEnabled.yaml
@@ -1,4 +1,5 @@ caption: Enable the virtual keyboard on the login screen +default: null desc: |- Enable the virtual keyboard accessibility feature on the login screen. @@ -14,6 +15,13 @@ features: can_be_recommended: true dynamic_refresh: true +items: +- caption: Enable on-screen keyboard on the login screen + value: true +- caption: Disable on-screen keyboard on the login screen + value: false +- caption: Allow the user to decide + value: null owners: - amraboelkher@chromium.org - emaxx@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/DictationEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/DictationEnabled.yaml index 9fd334d..7b8361af 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/DictationEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/DictationEnabled.yaml
@@ -1,4 +1,5 @@ caption: Enable the dictation accessibility feature +default: null desc: |- Enable the dictation accessibility feature. @@ -14,6 +15,13 @@ can_be_recommended: true dynamic_refresh: true per_profile: true +items: +- caption: Enable dictation + value: true +- caption: Disable dictation + value: false +- caption: Allow the user to decide + value: null owners: - amraboelkher@chromium.org - emaxx@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/FloatingAccessibilityMenuEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/FloatingAccessibilityMenuEnabled.yaml index e31e3b4..2f1f3faf 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/FloatingAccessibilityMenuEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/FloatingAccessibilityMenuEnabled.yaml
@@ -9,6 +9,11 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Show the floating accessibility menu in kiosk mode + value: true +- caption: Do not show the floating accessibility menu in kiosk mode + value: false owners: - apotapchuk@chromium.org schema:
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/HighContrastEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/HighContrastEnabled.yaml index eaa5817..b1f5161 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/HighContrastEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/HighContrastEnabled.yaml
@@ -1,4 +1,5 @@ caption: Enable high contrast mode +default: null desc: |- Setting the policy to True keeps High-contrast mode on. Setting the policy to False keeps High-contrast mode off. @@ -8,6 +9,13 @@ can_be_recommended: true dynamic_refresh: true per_profile: true +items: +- caption: Enable high contrast + value: true +- caption: Disable high contrast + value: false +- caption: Allow the user to decide + value: null owners: - file://components/policy/resources/OWNERS - rsorokin@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/KeyboardDefaultToFunctionKeys.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/KeyboardDefaultToFunctionKeys.yaml index 0363073..c8edf57c 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/KeyboardDefaultToFunctionKeys.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/KeyboardDefaultToFunctionKeys.yaml
@@ -8,6 +8,11 @@ can_be_recommended: true dynamic_refresh: true per_profile: true +items: +- caption: Treat top-row keys as function keys, but allow user to change + value: true +- caption: Treat top-row keys as media keys, but allow user to change + value: false owners: - file://components/policy/resources/OWNERS - rsorokin@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/KeyboardFocusHighlightEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/KeyboardFocusHighlightEnabled.yaml index d697a67..00c82963 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/KeyboardFocusHighlightEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/KeyboardFocusHighlightEnabled.yaml
@@ -1,4 +1,5 @@ caption: Enable the keyboard focus highlighting accessibility feature +default: null desc: |- Enable the keyboard focus highlighting accessibility feature. @@ -16,6 +17,13 @@ can_be_recommended: true dynamic_refresh: true per_profile: true +items: +- caption: Enable keyboard focus highlighting + value: true +- caption: Disable keyboard focus highlighting + value: false +- caption: Allow the user to decide + value: null owners: - amraboelkher@chromium.org schema:
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/LargeCursorEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/LargeCursorEnabled.yaml index f9b6b8f6..65642cb 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/LargeCursorEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/LargeCursorEnabled.yaml
@@ -1,4 +1,5 @@ caption: Enable large cursor +default: null desc: |- Setting the policy to True keeps the large cursor on. Setting the policy to False keeps the large cursor off. @@ -8,6 +9,13 @@ can_be_recommended: true dynamic_refresh: true per_profile: true +items: +- caption: Enable large cursor + value: true +- caption: Disable large cursor + value: false +- caption: Allow the user to decide + value: null owners: - file://components/policy/resources/OWNERS - rsorokin@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/MonoAudioEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/MonoAudioEnabled.yaml index e2cb5d4..455b48c 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/MonoAudioEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/MonoAudioEnabled.yaml
@@ -1,4 +1,5 @@ caption: Enable the mono audio accessibility feature +default: null desc: |- Enable the mono audio accessibility feature. @@ -16,6 +17,13 @@ can_be_recommended: true dynamic_refresh: true per_profile: true +items: +- caption: Enable mono audio + value: true +- caption: Disable mono audio + value: false +- caption: Allow the user to decide + value: null owners: - amraboelkher@chromium.org schema:
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/SelectToSpeakEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/SelectToSpeakEnabled.yaml index 6818ce7..429168b 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/SelectToSpeakEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/SelectToSpeakEnabled.yaml
@@ -1,4 +1,5 @@ caption: Enable select to speak +default: null desc: |- Enable the select to speak accessibility feature. @@ -14,6 +15,13 @@ can_be_recommended: true dynamic_refresh: true per_profile: true +items: +- caption: Enable select to speak + value: true +- caption: Disable select to speak + value: false +- caption: Allow the user to decide + value: null owners: - amraboelkher@chromium.org schema:
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/ShowAccessibilityOptionsInSystemTrayMenu.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/ShowAccessibilityOptionsInSystemTrayMenu.yaml index 24b08da..ecdf7bd 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/ShowAccessibilityOptionsInSystemTrayMenu.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/ShowAccessibilityOptionsInSystemTrayMenu.yaml
@@ -1,4 +1,5 @@ caption: Show accessibility options in system tray menu +default: null desc: |- Setting the policy to True displays the accessibility options in the system tray menu. If you set the policy to False, the options don't appear in the menu. @@ -10,6 +11,13 @@ can_be_recommended: true dynamic_refresh: true per_profile: true +items: +- caption: Show accessibility options in the system tray menu + value: true +- caption: Hide accessibility options in the system tray menu + value: false +- caption: Allow the user to decide + value: null owners: - josiahk@google.com - file://ui/accessibility/OWNERS
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/SpokenFeedbackEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/SpokenFeedbackEnabled.yaml index d9462a5..c19354d 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/SpokenFeedbackEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/SpokenFeedbackEnabled.yaml
@@ -1,4 +1,5 @@ caption: Enable spoken feedback +default: null desc: |- Setting the policy to True keeps spoken feedback on. Setting the policy to False keeps spoken feedback off. @@ -8,6 +9,13 @@ can_be_recommended: true dynamic_refresh: true per_profile: true +items: +- caption: Enable spoken feedback + value: true +- caption: Disable spoken feedback + value: false +- caption: Allow the user to decide + value: null owners: - file://components/policy/resources/OWNERS - rsorokin@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/StickyKeysEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/StickyKeysEnabled.yaml index fca2538a..bc281ad 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/StickyKeysEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/StickyKeysEnabled.yaml
@@ -1,4 +1,5 @@ caption: Enable sticky keys +default: null desc: |- Setting the policy to True keeps sticky keys on. Setting the policy to False keeps sticky keys off. @@ -8,6 +9,13 @@ can_be_recommended: true dynamic_refresh: true per_profile: true +items: +- caption: Enable sticky keys + value: true +- caption: Disable sticky keys + value: false +- caption: Allow the user to decide + value: null owners: - amraboelkher@chromium.org - emaxx@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Accessibility/VirtualKeyboardEnabled.yaml b/components/policy/resources/templates/policy_definitions/Accessibility/VirtualKeyboardEnabled.yaml index 7d176f0..10a66975 100644 --- a/components/policy/resources/templates/policy_definitions/Accessibility/VirtualKeyboardEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Accessibility/VirtualKeyboardEnabled.yaml
@@ -1,4 +1,5 @@ caption: Enable on-screen keyboard +default: null desc: |- Setting the policy to True keeps the on-screen keyboard on. Setting the policy to False keeps the on-screen keyboard off unless other factors turn it on. See the <ph name="TOUCH_VIRTUAL_KEYBOARD_ENABLED_POLICY_NAME">TouchVirtualKeyboardEnabled</ph> policy as an example of these factors. @@ -8,6 +9,13 @@ can_be_recommended: true dynamic_refresh: true per_profile: true +items: +- caption: Enable on-screen keyboard + value: true +- caption: Disable on-screen keyboard + value: false +- caption: Allow the user to decide + value: null owners: - shend@google.com - e14s-eng@google.com
diff --git a/components/policy/resources/templates/policy_definitions/Arc/ArcAppInstallEventLoggingEnabled.yaml b/components/policy/resources/templates/policy_definitions/Arc/ArcAppInstallEventLoggingEnabled.yaml index 5943fea2..d455569 100644 --- a/components/policy/resources/templates/policy_definitions/Arc/ArcAppInstallEventLoggingEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Arc/ArcAppInstallEventLoggingEnabled.yaml
@@ -5,6 +5,11 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Android app install event logs are shared with Google + value: true +- caption: Android app install event logs are not shared with Google + value: false owners: - file://components/policy/resources/OWNERS - pastarmovj@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Arc/ArcEnabled.yaml b/components/policy/resources/templates/policy_definitions/Arc/ArcEnabled.yaml index 3db4db6..16cf419 100644 --- a/components/policy/resources/templates/policy_definitions/Arc/ArcEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Arc/ArcEnabled.yaml
@@ -7,6 +7,11 @@ features: dynamic_refresh: true per_profile: false +items: +- caption: Enable ARC + value: true +- caption: Disable ARC + value: false owners: - pbond@chromium.org schema:
diff --git a/components/policy/resources/templates/policy_definitions/Arc/UnaffiliatedArcAllowed.yaml b/components/policy/resources/templates/policy_definitions/Arc/UnaffiliatedArcAllowed.yaml index df3717f..28896a82e 100644 --- a/components/policy/resources/templates/policy_definitions/Arc/UnaffiliatedArcAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Arc/UnaffiliatedArcAllowed.yaml
@@ -7,6 +7,11 @@ example_value: false features: dynamic_refresh: false +items: +- caption: Allow unaffiliated users to use Android apps + value: true +- caption: Do not allow unaffiliated users to use Android apps + value: false owners: - phweiss@chromium.org schema:
diff --git a/components/policy/resources/templates/policy_definitions/Attestation/AttestationEnabledForDevice.yaml b/components/policy/resources/templates/policy_definitions/Attestation/AttestationEnabledForDevice.yaml index 9780aab..8da0c3aa 100644 --- a/components/policy/resources/templates/policy_definitions/Attestation/AttestationEnabledForDevice.yaml +++ b/components/policy/resources/templates/policy_definitions/Attestation/AttestationEnabledForDevice.yaml
@@ -7,6 +7,11 @@ example_value: true features: dynamic_refresh: true +items: +- caption: Enable remote attestation for the device + value: true +- caption: Disable remote attestation for the device + value: false owners: - emaxx@chromium.org - file://chrome/browser/ash/attestation/OWNERS
diff --git a/components/policy/resources/templates/policy_definitions/Attestation/AttestationEnabledForUser.yaml b/components/policy/resources/templates/policy_definitions/Attestation/AttestationEnabledForUser.yaml index c1b2eec5..58b15f7 100644 --- a/components/policy/resources/templates/policy_definitions/Attestation/AttestationEnabledForUser.yaml +++ b/components/policy/resources/templates/policy_definitions/Attestation/AttestationEnabledForUser.yaml
@@ -7,6 +7,11 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Enable remote attestation for the user + value: true +- caption: Disable remote attestation for the user + value: false owners: - emaxx@chromium.org - file://chrome/browser/ash/attestation/OWNERS
diff --git a/components/policy/resources/templates/policy_definitions/Attestation/AttestationForContentProtectionEnabled.yaml b/components/policy/resources/templates/policy_definitions/Attestation/AttestationForContentProtectionEnabled.yaml index 91b49d1e..8e0c7b1c 100644 --- a/components/policy/resources/templates/policy_definitions/Attestation/AttestationForContentProtectionEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Attestation/AttestationForContentProtectionEnabled.yaml
@@ -7,6 +7,11 @@ example_value: true features: dynamic_refresh: true +items: +- caption: Enable remote attestation for content protection + value: true +- caption: Disable remote attestation for content protection + value: false owners: - emaxx@chromium.org - file://chrome/browser/ash/attestation/OWNERS
diff --git a/components/policy/resources/templates/policy_definitions/BrowserSwitcher/AlternativeBrowserParameters.yaml b/components/policy/resources/templates/policy_definitions/BrowserSwitcher/AlternativeBrowserParameters.yaml index 7fc7d34..46d04bb8 100644 --- a/components/policy/resources/templates/policy_definitions/BrowserSwitcher/AlternativeBrowserParameters.yaml +++ b/components/policy/resources/templates/policy_definitions/BrowserSwitcher/AlternativeBrowserParameters.yaml
@@ -16,8 +16,6 @@ features: dynamic_refresh: true per_profile: true -future_on: -- fuchsia owners: - nicolaso@chromium.org - pastarmovj@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/BrowserSwitcher/AlternativeBrowserPath.yaml b/components/policy/resources/templates/policy_definitions/BrowserSwitcher/AlternativeBrowserPath.yaml index 6bc47862..a40ff72 100644 --- a/components/policy/resources/templates/policy_definitions/BrowserSwitcher/AlternativeBrowserPath.yaml +++ b/components/policy/resources/templates/policy_definitions/BrowserSwitcher/AlternativeBrowserPath.yaml
@@ -7,8 +7,6 @@ features: dynamic_refresh: true per_profile: true -future_on: -- fuchsia owners: - nicolaso@chromium.org - pastarmovj@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherDelay.yaml b/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherDelay.yaml index 98bcac6..3f07fc2 100644 --- a/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherDelay.yaml +++ b/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherDelay.yaml
@@ -7,8 +7,6 @@ features: dynamic_refresh: true per_profile: true -future_on: -- fuchsia owners: - nicolaso@chromium.org - pastarmovj@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherEnabled.yaml b/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherEnabled.yaml index f650277..783869c 100644 --- a/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherEnabled.yaml
@@ -7,8 +7,11 @@ features: dynamic_refresh: true per_profile: true -future_on: -- fuchsia +items: +- caption: Enable Legacy Browser Support + value: true +- caption: Disable Legacy Browser Support + value: false owners: - nicolaso@chromium.org - pastarmovj@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherExternalGreylistUrl.yaml b/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherExternalGreylistUrl.yaml index 9fb793e..9a47429 100644 --- a/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherExternalGreylistUrl.yaml +++ b/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherExternalGreylistUrl.yaml
@@ -10,8 +10,6 @@ features: dynamic_refresh: true per_profile: true -future_on: -- fuchsia owners: - nicolaso@chromium.org - pastarmovj@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherKeepLastChromeTab.yaml b/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherKeepLastChromeTab.yaml index 8210882..65eb41e 100644 --- a/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherKeepLastChromeTab.yaml +++ b/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherKeepLastChromeTab.yaml
@@ -7,8 +7,11 @@ features: dynamic_refresh: true per_profile: true -future_on: -- fuchsia +items: +- caption: Keep at least one Chrome tab open + value: true +- caption: Close Chrome completely + value: false owners: - nicolaso@chromium.org - pastarmovj@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherParsingMode.yaml b/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherParsingMode.yaml index 6321a4f..a0a8296 100644 --- a/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherParsingMode.yaml +++ b/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherParsingMode.yaml
@@ -18,8 +18,6 @@ features: dynamic_refresh: true per_profile: true -future_on: -- fuchsia items: - caption: Default behavior for LBS. name: Default
diff --git a/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherUrlList.yaml b/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherUrlList.yaml index 75d84cdf..d9752176 100644 --- a/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherUrlList.yaml +++ b/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherUrlList.yaml
@@ -12,8 +12,6 @@ features: dynamic_refresh: true per_profile: true -future_on: -- fuchsia owners: - nicolaso@chromium.org - pastarmovj@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherUseIeSitelist.yaml b/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherUseIeSitelist.yaml index 2f85c6aa..0d348d5 100644 --- a/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherUseIeSitelist.yaml +++ b/components/policy/resources/templates/policy_definitions/BrowserSwitcher/BrowserSwitcherUseIeSitelist.yaml
@@ -11,6 +11,11 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Use the Internet Explorer SiteList policy as a source of rules + value: true +- caption: Do not use the Internet Explorer SiteList policy as a source of rules + value: false owners: - nicolaso@chromium.org - pastarmovj@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/CloudReporting/CloudExtensionRequestEnabled.yaml b/components/policy/resources/templates/policy_definitions/CloudReporting/CloudExtensionRequestEnabled.yaml index 92f6664b..405fdc05 100644 --- a/components/policy/resources/templates/policy_definitions/CloudReporting/CloudExtensionRequestEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/CloudReporting/CloudExtensionRequestEnabled.yaml
@@ -18,6 +18,11 @@ per_profile: true future_on: - fuchsia +items: +- caption: Create and upload extension install requests to the Admin console + value: true +- caption: Do not create or upload extension install requests to the Admin console + value: false owners: - zmin@chromium.org schema:
diff --git a/components/policy/resources/templates/policy_definitions/CloudReporting/ReportExtensionsAndPluginsData.yaml b/components/policy/resources/templates/policy_definitions/CloudReporting/ReportExtensionsAndPluginsData.yaml index dbc4de2d..b85656a 100644 --- a/components/policy/resources/templates/policy_definitions/CloudReporting/ReportExtensionsAndPluginsData.yaml +++ b/components/policy/resources/templates/policy_definitions/CloudReporting/ReportExtensionsAndPluginsData.yaml
@@ -16,6 +16,11 @@ per_profile: true future_on: - chrome.* +items: +- caption: Enable reporting of extension and plugin information + value: true +- caption: Disable reporting of extension and plugin information + value: false owners: - zmin@chromium.org - pastarmovj@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/CloudReporting/ReportMachineIDData.yaml b/components/policy/resources/templates/policy_definitions/CloudReporting/ReportMachineIDData.yaml index f875e31..1bee826 100644 --- a/components/policy/resources/templates/policy_definitions/CloudReporting/ReportMachineIDData.yaml +++ b/components/policy/resources/templates/policy_definitions/CloudReporting/ReportMachineIDData.yaml
@@ -15,6 +15,11 @@ per_profile: true future_on: - chrome.* +items: +- caption: Enable reporting of machine identification information + value: true +- caption: Disable reporting of machine identification information + value: false owners: - zmin@chromium.org - pastarmovj@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/CloudReporting/ReportPolicyData.yaml b/components/policy/resources/templates/policy_definitions/CloudReporting/ReportPolicyData.yaml index 74e4159..88fa544 100644 --- a/components/policy/resources/templates/policy_definitions/CloudReporting/ReportPolicyData.yaml +++ b/components/policy/resources/templates/policy_definitions/CloudReporting/ReportPolicyData.yaml
@@ -16,6 +16,11 @@ per_profile: true future_on: - chrome.* +items: +- caption: Enable reporting of policy data + value: true +- caption: Disable reporting of policy data + value: false owners: - zmin@chromium.org - pastarmovj@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/CloudReporting/ReportUserIDData.yaml b/components/policy/resources/templates/policy_definitions/CloudReporting/ReportUserIDData.yaml index 987fc51..90a134a 100644 --- a/components/policy/resources/templates/policy_definitions/CloudReporting/ReportUserIDData.yaml +++ b/components/policy/resources/templates/policy_definitions/CloudReporting/ReportUserIDData.yaml
@@ -16,6 +16,11 @@ per_profile: true future_on: - chrome.* +items: +- caption: Enable reporting of user identification information + value: true +- caption: Disable reporting of user identification information + value: false owners: - zmin@chromium.org - pastarmovj@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/CloudReporting/ReportVersionData.yaml b/components/policy/resources/templates/policy_definitions/CloudReporting/ReportVersionData.yaml index 5a49308f..1cb305b 100644 --- a/components/policy/resources/templates/policy_definitions/CloudReporting/ReportVersionData.yaml +++ b/components/policy/resources/templates/policy_definitions/CloudReporting/ReportVersionData.yaml
@@ -17,6 +17,11 @@ per_profile: true future_on: - chrome.* +items: +- caption: Enable reporting of version information + value: true +- caption: Disable reporting of version information + value: false owners: - zmin@chromium.org - pastarmovj@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/ContentSettings/FileSystemSyncAccessHandleAsyncInterfaceEnabled.yaml b/components/policy/resources/templates/policy_definitions/ContentSettings/FileSystemSyncAccessHandleAsyncInterfaceEnabled.yaml new file mode 100644 index 0000000..384d69c --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/ContentSettings/FileSystemSyncAccessHandleAsyncInterfaceEnabled.yaml
@@ -0,0 +1,31 @@ +caption: Re-enable the deprecated async interface for <ph name="FILE_SYSTEM_SYNC_ACCESS_HANDLE">FileSystemSyncAccessHandle</ph> + in File System Access API +default: false +desc: |- + Starting in M108, all of <ph name="FILE_SYSTEM_SYNC_ACCESS_HANDLE">FileSystemSyncAccessHandle</ph> methods will be invoked synchronously. + Until M110, this policy re-enables asynchronous invocation of <ph name="FILE_SYSTEM_SYNC_ACCESS_HANDLE">FileSystemSyncAccessHandle</ph> methods. + If this policy is set to Enabled, <ph name="FILE_SYSTEM_SYNC_ACCESS_HANDLE">FileSystemSyncAccessHandle</ph> methods are invoked asynchronously. + If this policy is set to Disabled or not set, all of <ph name="FILE_SYSTEM_SYNC_ACCESS_HANDLE">FileSystemSyncAccessHandle</ph> methods are invoked synchronously. +example_value: false +features: + dynamic_refresh: true + per_profile: true +future_on: +- fuchsia +items: +- caption: Enables <ph name="FILE_SYSTEM_SYNC_ACCESS_HANDLE">FileSystemSyncAccessHandle</ph> + methods to be invoked asynchronously + value: true +- caption: Disables any asynchronous methods of <ph name="FILE_SYSTEM_SYNC_ACCESS_HANDLE">FileSystemSyncAccessHandle</ph>. + value: false +owners: +- dslee@chromium.org +- chrome-owp-storage@google.com +schema: + type: boolean +supported_on: +- chrome.*:108-110 +- chrome_os:108-110 +- android:108-110 +tags: [] +type: main
diff --git a/components/policy/resources/templates/policy_definitions/Crostini/CrostiniAllowed.yaml b/components/policy/resources/templates/policy_definitions/Crostini/CrostiniAllowed.yaml index cdb8a01..9ec7b8f 100644 --- a/components/policy/resources/templates/policy_definitions/Crostini/CrostiniAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Crostini/CrostiniAllowed.yaml
@@ -10,6 +10,11 @@ features: dynamic_refresh: true per_profile: false +items: +- caption: Allow users to use virtual machines needed to support Linux apps + value: true +- caption: Do not allow users to use virtual machines needed to support Linux apps + value: false owners: - timzheng@chromium.org - aoldemeier@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Crostini/CrostiniExportImportUIAllowed.yaml b/components/policy/resources/templates/policy_definitions/Crostini/CrostiniExportImportUIAllowed.yaml index 7c74142..9da4bbe 100644 --- a/components/policy/resources/templates/policy_definitions/Crostini/CrostiniExportImportUIAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Crostini/CrostiniExportImportUIAllowed.yaml
@@ -6,6 +6,11 @@ features: dynamic_refresh: true per_profile: false +items: +- caption: Enable Linux virtual machine backup and restore + value: true +- caption: Disable Linux virtual machine backup and restore + value: false owners: - joelhockey@chromium.org - aoldemeier@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Crostini/CrostiniPortForwardingAllowed.yaml b/components/policy/resources/templates/policy_definitions/Crostini/CrostiniPortForwardingAllowed.yaml index 4661dce..6f1acfb7 100644 --- a/components/policy/resources/templates/policy_definitions/Crostini/CrostiniPortForwardingAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Crostini/CrostiniPortForwardingAllowed.yaml
@@ -9,6 +9,11 @@ features: dynamic_refresh: true per_profile: false +items: +- caption: Allow port forwarding into Linux virtual machines + value: true +- caption: Do not allow port forwarding into Linux virtual machines + value: false owners: - danielng@google.com schema:
diff --git a/components/policy/resources/templates/policy_definitions/Crostini/CrostiniRootAccessAllowed.yaml b/components/policy/resources/templates/policy_definitions/Crostini/CrostiniRootAccessAllowed.yaml index d38cd6b..ee03dcd 100644 --- a/components/policy/resources/templates/policy_definitions/Crostini/CrostiniRootAccessAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Crostini/CrostiniRootAccessAllowed.yaml
@@ -10,6 +10,11 @@ per_profile: false future_on: - chrome_os +items: +- caption: Enable root access to Linux virtual machines + value: true +- caption: Disable root access to Linux virtual machines + value: false owners: - aoldemeier@chromium.org - okalitova@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Crostini/DeviceUnaffiliatedCrostiniAllowed.yaml b/components/policy/resources/templates/policy_definitions/Crostini/DeviceUnaffiliatedCrostiniAllowed.yaml index 1bee7ef7..8d03a80 100644 --- a/components/policy/resources/templates/policy_definitions/Crostini/DeviceUnaffiliatedCrostiniAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Crostini/DeviceUnaffiliatedCrostiniAllowed.yaml
@@ -10,6 +10,13 @@ example_value: false features: dynamic_refresh: true +items: +- caption: Allow unaffiliated users to use virtual machines needed to support Linux + apps + value: true +- caption: Do not allow unaffiliated users to use virtual machines needed to support + Linux apps + value: false owners: - timzheng@chromium.org - aoldemeier@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Crostini/VirtualMachinesAllowed.yaml b/components/policy/resources/templates/policy_definitions/Crostini/VirtualMachinesAllowed.yaml index e6568cf..34f8659 100644 --- a/components/policy/resources/templates/policy_definitions/Crostini/VirtualMachinesAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Crostini/VirtualMachinesAllowed.yaml
@@ -8,6 +8,11 @@ example_value: true features: dynamic_refresh: true +items: +- caption: Allow the device to run virtual machines + value: true +- caption: Do not allow the device to run virtual machines + value: false owners: - timzheng@chromium.org - aoldemeier@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/DateAndTime/CalendarIntegrationEnabled.yaml b/components/policy/resources/templates/policy_definitions/DateAndTime/CalendarIntegrationEnabled.yaml index 4c530a6..bcfa7ab0 100644 --- a/components/policy/resources/templates/policy_definitions/DateAndTime/CalendarIntegrationEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/DateAndTime/CalendarIntegrationEnabled.yaml
@@ -1,6 +1,5 @@ caption: Enable <ph name="GOOGLE_CALENDAR_NAME">Google Calendar</ph> Integration default: true -default_for_enterprise_users: false desc: |- Enable <ph name="GOOGLE_CALENDAR_NAME">Google Calendar</ph> integration which allows <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph> users to fetch events from <ph name="GOOGLE_CALENDAR_NAME">Google Calendar</ph> to populate <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph> calendar widget in system status bar. @@ -8,7 +7,7 @@ If this policy is disabled, <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph> device cannot retrieve <ph name="GOOGLE_CALENDAR_NAME">Google Calendar</ph> events to populate <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph> calendar widget in system status bar for the logged in user. - If this policy is left unset, the <ph name="GOOGLE_CALENDAR_NAME">Google Calendar</ph> feature is disabled by default for enterprise users. + If this policy is left unset, the <ph name="GOOGLE_CALENDAR_NAME">Google Calendar</ph> feature is enabled by default for enterprise users. example_value: true features: dynamic_refresh: true
diff --git a/components/policy/resources/templates/policy_definitions/DateAndTime/SystemUse24HourClock.yaml b/components/policy/resources/templates/policy_definitions/DateAndTime/SystemUse24HourClock.yaml index 698af3b..dfae3f5 100644 --- a/components/policy/resources/templates/policy_definitions/DateAndTime/SystemUse24HourClock.yaml +++ b/components/policy/resources/templates/policy_definitions/DateAndTime/SystemUse24HourClock.yaml
@@ -1,4 +1,5 @@ caption: Use 24 hour clock by default +default: null desc: |- Setting the policy to True gives a device's sign-in screen a 24-hour clock format. @@ -11,6 +12,13 @@ example_value: true features: dynamic_refresh: true +items: +- caption: 24 hour clock format + value: true +- caption: 12 hour clock format + value: false +- caption: Automatic based on current language + value: null owners: - alemate@chromium.org - michaelpg@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/DeviceUpdate/ChromeOsReleaseChannelDelegated.yaml b/components/policy/resources/templates/policy_definitions/DeviceUpdate/ChromeOsReleaseChannelDelegated.yaml index e1ad21d..67776e5 100644 --- a/components/policy/resources/templates/policy_definitions/DeviceUpdate/ChromeOsReleaseChannelDelegated.yaml +++ b/components/policy/resources/templates/policy_definitions/DeviceUpdate/ChromeOsReleaseChannelDelegated.yaml
@@ -8,6 +8,11 @@ example_value: false features: dynamic_refresh: true +items: +- caption: Allow users to change the release channel + value: true +- caption: Prevent users from changing the release channel + value: false owners: - file://components/policy/resources/OWNERS - pastarmovj@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/DeviceUpdate/DeviceAutoUpdateDisabled.yaml b/components/policy/resources/templates/policy_definitions/DeviceUpdate/DeviceAutoUpdateDisabled.yaml index 3b405ee3..07f29b7 100644 --- a/components/policy/resources/templates/policy_definitions/DeviceUpdate/DeviceAutoUpdateDisabled.yaml +++ b/components/policy/resources/templates/policy_definitions/DeviceUpdate/DeviceAutoUpdateDisabled.yaml
@@ -9,6 +9,11 @@ example_value: true features: dynamic_refresh: true +items: +- caption: Block updates + value: true +- caption: Allow updates + value: false owners: - file://components/policy/resources/OWNERS - hendrich@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/DeviceUpdate/DeviceAutoUpdateP2PEnabled.yaml b/components/policy/resources/templates/policy_definitions/DeviceUpdate/DeviceAutoUpdateP2PEnabled.yaml index 5c9ae44..7e073db2 100644 --- a/components/policy/resources/templates/policy_definitions/DeviceUpdate/DeviceAutoUpdateP2PEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/DeviceUpdate/DeviceAutoUpdateP2PEnabled.yaml
@@ -10,6 +10,11 @@ example_value: false features: dynamic_refresh: true +items: +- caption: Allow peer to peer auto update downloads + value: true +- caption: Do not allow peer to peer auto update downloads + value: false owners: - zeuthen@chromium.org - poromov@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/DeviceUpdate/DeviceUpdateHttpDownloadsEnabled.yaml b/components/policy/resources/templates/policy_definitions/DeviceUpdate/DeviceUpdateHttpDownloadsEnabled.yaml index d761b633..35a5b9b 100644 --- a/components/policy/resources/templates/policy_definitions/DeviceUpdate/DeviceUpdateHttpDownloadsEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/DeviceUpdate/DeviceUpdateHttpDownloadsEnabled.yaml
@@ -7,6 +7,11 @@ example_value: true features: dynamic_refresh: true +items: +- caption: Use HTTP for update downloads + value: true +- caption: Use HTTPS for update downloads + value: false owners: - file://components/policy/resources/OWNERS - bartfab@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/DeviceUpdate/RebootAfterUpdate.yaml b/components/policy/resources/templates/policy_definitions/DeviceUpdate/RebootAfterUpdate.yaml index 06370bb..a0ae286 100644 --- a/components/policy/resources/templates/policy_definitions/DeviceUpdate/RebootAfterUpdate.yaml +++ b/components/policy/resources/templates/policy_definitions/DeviceUpdate/RebootAfterUpdate.yaml
@@ -13,6 +13,11 @@ example_value: true features: dynamic_refresh: true +items: +- caption: Allow automatic reboot after updates + value: true +- caption: Disallow automatic reboot after updates + value: false owners: - file://components/policy/resources/OWNERS - bartfab@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Drive/DriveDisabled.yaml b/components/policy/resources/templates/policy_definitions/Drive/DriveDisabled.yaml index 2b97e2e..65b72aa 100644 --- a/components/policy/resources/templates/policy_definitions/Drive/DriveDisabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Drive/DriveDisabled.yaml
@@ -11,6 +11,11 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Disable Google Drive syncing + value: true +- caption: Enable Google Drive syncing + value: false owners: - file://components/policy/resources/OWNERS - rsorokin@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Drive/DriveDisabledOverCellular.yaml b/components/policy/resources/templates/policy_definitions/Drive/DriveDisabledOverCellular.yaml index 109952b..ed47f33 100644 --- a/components/policy/resources/templates/policy_definitions/Drive/DriveDisabledOverCellular.yaml +++ b/components/policy/resources/templates/policy_definitions/Drive/DriveDisabledOverCellular.yaml
@@ -11,6 +11,11 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Disable Google Drive syncing over cellular connections + value: true +- caption: Enable Google Drive syncing over cellular connections + value: false owners: - file://components/policy/resources/OWNERS - rsorokin@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/FirstPartySets/FirstPartySetsEnabled.yaml b/components/policy/resources/templates/policy_definitions/FirstPartySets/FirstPartySetsEnabled.yaml index 36f208e..488db24 100644 --- a/components/policy/resources/templates/policy_definitions/FirstPartySets/FirstPartySetsEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/FirstPartySets/FirstPartySetsEnabled.yaml
@@ -10,7 +10,7 @@ It controls whether Chrome supports First-Party Sets related features (e.g. the SameParty cookie attribute). example_value: false features: - dynamic_refresh: false + dynamic_refresh: true per_profile: true future_on: - chrome.*
diff --git a/components/policy/resources/templates/policy_definitions/GoogleAssistant/VoiceInteractionContextEnabled.yaml b/components/policy/resources/templates/policy_definitions/GoogleAssistant/VoiceInteractionContextEnabled.yaml index 5f4fe96..94197611 100644 --- a/components/policy/resources/templates/policy_definitions/GoogleAssistant/VoiceInteractionContextEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/GoogleAssistant/VoiceInteractionContextEnabled.yaml
@@ -1,4 +1,5 @@ caption: Allow Google Assistant to access screen context +default: null desc: |- Setting the policy to Enabled lets Google Assistant access screen context and send that data to a server. Setting the policy to Disabled keeps Google Assistant from screen context. @@ -7,6 +8,13 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Allow Google Assistant to access screen context + value: true +- caption: Block Google Assistant from accessing screen context during interactions + value: false +- caption: Allow the user to decide + value: null owners: - yanxiao@google.com schema:
diff --git a/components/policy/resources/templates/policy_definitions/GoogleAssistant/VoiceInteractionHotwordEnabled.yaml b/components/policy/resources/templates/policy_definitions/GoogleAssistant/VoiceInteractionHotwordEnabled.yaml index 3e76c8d5..12d246ac5 100644 --- a/components/policy/resources/templates/policy_definitions/GoogleAssistant/VoiceInteractionHotwordEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/GoogleAssistant/VoiceInteractionHotwordEnabled.yaml
@@ -1,4 +1,5 @@ caption: Allow Google Assistant to listen for the voice activation phrase +default: null desc: |- Setting the policy to Enabled lets Google Assistant listen for the voice activation phrase. Setting the policy to Disabled keeps Google Assistant from listening for the phrase. @@ -7,6 +8,13 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Enable the Google Assistant hotword + value: true +- caption: Disable the Google Assistant hotword + value: false +- caption: Allow the user to decide + value: null owners: - yanxiao@google.com schema:
diff --git a/components/policy/resources/templates/policy_definitions/GoogleCast/EnableMediaRouter.yaml b/components/policy/resources/templates/policy_definitions/GoogleCast/EnableMediaRouter.yaml index f4771ca..e204d6f 100644 --- a/components/policy/resources/templates/policy_definitions/GoogleCast/EnableMediaRouter.yaml +++ b/components/policy/resources/templates/policy_definitions/GoogleCast/EnableMediaRouter.yaml
@@ -9,6 +9,11 @@ per_profile: true future_on: - fuchsia +items: +- caption: Allow users to use <ph name="PRODUCT_NAME">Google Cast</ph> + value: true +- caption: Do not allow users to use <ph name="PRODUCT_NAME">Google Cast</ph> + value: false owners: - file://components/media_router/OWNERS schema:
diff --git a/components/policy/resources/templates/policy_definitions/GoogleCast/MediaRouterCastAllowAllIPs.yaml b/components/policy/resources/templates/policy_definitions/GoogleCast/MediaRouterCastAllowAllIPs.yaml index 14faddbbe..c0976eb79 100644 --- a/components/policy/resources/templates/policy_definitions/GoogleCast/MediaRouterCastAllowAllIPs.yaml +++ b/components/policy/resources/templates/policy_definitions/GoogleCast/MediaRouterCastAllowAllIPs.yaml
@@ -12,6 +12,13 @@ per_profile: false future_on: - fuchsia +items: +- caption: Allow <ph name="PRODUCT_NAME">Google Cast</ph> to connect to devices on + all IP addresses + value: true +- caption: Allow <ph name="PRODUCT_NAME">Google Cast</ph> to only connect to devices + on private IP addresses + value: false owners: - file://components/media_router/OWNERS schema:
diff --git a/components/policy/resources/templates/policy_definitions/GoogleCast/ShowCastIconInToolbar.yaml b/components/policy/resources/templates/policy_definitions/GoogleCast/ShowCastIconInToolbar.yaml index dc20ddb..955b99f 100644 --- a/components/policy/resources/templates/policy_definitions/GoogleCast/ShowCastIconInToolbar.yaml +++ b/components/policy/resources/templates/policy_definitions/GoogleCast/ShowCastIconInToolbar.yaml
@@ -11,6 +11,12 @@ per_profile: true future_on: - fuchsia +items: +- caption: Always show the <ph name="PRODUCT_NAME">Google Cast</ph> icon in the toolbar + value: true +- caption: Do not show the <ph name="PRODUCT_NAME">Google Cast</ph> icon in the toolbar + by default, but let users choose + value: false owners: - file://components/media_router/OWNERS schema:
diff --git a/components/policy/resources/templates/policy_definitions/HTTPAuthentication/AllHttpAuthSchemesAllowedForOrigins.yaml b/components/policy/resources/templates/policy_definitions/HTTPAuthentication/AllHttpAuthSchemesAllowedForOrigins.yaml index ce9b575d..d8c5d52f 100644 --- a/components/policy/resources/templates/policy_definitions/HTTPAuthentication/AllHttpAuthSchemesAllowedForOrigins.yaml +++ b/components/policy/resources/templates/policy_definitions/HTTPAuthentication/AllHttpAuthSchemesAllowedForOrigins.yaml
@@ -2,7 +2,7 @@ desc: |- Setting the policy specifies for which origins to allow all the HTTP authentication schemes <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> supports regardless of the <ph name="AUTH_SCHEMES_POLICY_NAME">AuthSchemes</ph> policy. - Format the origin pattern according to this format (<ph name="URL_SCHEME_FORMAT_LINK">https://www.chromium.org/administrators/url-blocklist-filter-format</ph>). Up to 1,000 exceptions can be defined in <ph name="ALL_HTTP_AUTH_ALLOWED_FOR_ORIGINS_POLICY_NAME">AllHttpAuthSchemesAllowedForOrigins</ph>. + Format the origin pattern according to this format (<ph name="URL_SCHEME_FORMAT_LINK">https://support.google.com/chrome/a?p=url_blocklist_filter_format</ph>). Up to 1,000 exceptions can be defined in <ph name="ALL_HTTP_AUTH_ALLOWED_FOR_ORIGINS_POLICY_NAME">AllHttpAuthSchemesAllowedForOrigins</ph>. Wildcards are allowed for the whole origin or parts of the origin, either the scheme, host, port. example_value: - '*.example.com'
diff --git a/components/policy/resources/templates/policy_definitions/Kerberos/KerberosAddAccountsAllowed.yaml b/components/policy/resources/templates/policy_definitions/Kerberos/KerberosAddAccountsAllowed.yaml index 0164404e..1f817c0d 100644 --- a/components/policy/resources/templates/policy_definitions/Kerberos/KerberosAddAccountsAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Kerberos/KerberosAddAccountsAllowed.yaml
@@ -9,6 +9,11 @@ features: dynamic_refresh: true per_profile: false +items: +- caption: Allow users to add Kerberos accounts + value: true +- caption: Do not allow users to add Kerberos accounts + value: false owners: - fsandrade@chromium.org - file://chrome/browser/ash/kerberos/OWNERS
diff --git a/components/policy/resources/templates/policy_definitions/Kerberos/KerberosEnabled.yaml b/components/policy/resources/templates/policy_definitions/Kerberos/KerberosEnabled.yaml index 22460a3a..22fff83 100644 --- a/components/policy/resources/templates/policy_definitions/Kerberos/KerberosEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Kerberos/KerberosEnabled.yaml
@@ -9,6 +9,11 @@ features: dynamic_refresh: true per_profile: false +items: +- caption: Enable Kerberos + value: true +- caption: Disable Kerberos + value: false owners: - fsandrade@chromium.org - file://chrome/browser/ash/kerberos/OWNERS
diff --git a/components/policy/resources/templates/policy_definitions/Kerberos/KerberosRememberPasswordEnabled.yaml b/components/policy/resources/templates/policy_definitions/Kerberos/KerberosRememberPasswordEnabled.yaml index 8cb1b10..34988bc 100644 --- a/components/policy/resources/templates/policy_definitions/Kerberos/KerberosRememberPasswordEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Kerberos/KerberosRememberPasswordEnabled.yaml
@@ -9,6 +9,11 @@ features: dynamic_refresh: true per_profile: false +items: +- caption: Allow users to remember Kerberos passwords + value: true +- caption: Do not allow users to remember Kerberos passwords + value: false owners: - fsandrade@chromium.org - file://chrome/browser/ash/kerberos/OWNERS
diff --git a/components/policy/resources/templates/policy_definitions/Kiosk/AllowKioskAppControlChromeVersion.yaml b/components/policy/resources/templates/policy_definitions/Kiosk/AllowKioskAppControlChromeVersion.yaml index 1d0df28..8fd254a7 100644 --- a/components/policy/resources/templates/policy_definitions/Kiosk/AllowKioskAppControlChromeVersion.yaml +++ b/components/policy/resources/templates/policy_definitions/Kiosk/AllowKioskAppControlChromeVersion.yaml
@@ -13,6 +13,11 @@ example_value: true features: dynamic_refresh: true +items: +- caption: ChromeOS updates are set to the version defined in the kiosk app manifest + value: true +- caption: ChromeOS updates ignore the version defined in the kiosk app manifest + value: false owners: - xiyuan@chromium.org - poromov@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Kiosk/DeviceLocalAccountAutoLoginBailoutEnabled.yaml b/components/policy/resources/templates/policy_definitions/Kiosk/DeviceLocalAccountAutoLoginBailoutEnabled.yaml index da57a27..13bfc3cb 100644 --- a/components/policy/resources/templates/policy_definitions/Kiosk/DeviceLocalAccountAutoLoginBailoutEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Kiosk/DeviceLocalAccountAutoLoginBailoutEnabled.yaml
@@ -7,6 +7,11 @@ example_value: true features: dynamic_refresh: true +items: +- caption: Enable auto-login bailout + value: true +- caption: Disable auto-login bailout + value: false owners: - file://components/policy/resources/OWNERS - pmarko@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Kiosk/DeviceLocalAccountPromptForNetworkWhenOffline.yaml b/components/policy/resources/templates/policy_definitions/Kiosk/DeviceLocalAccountPromptForNetworkWhenOffline.yaml index 57f0eb21..f09e186 100644 --- a/components/policy/resources/templates/policy_definitions/Kiosk/DeviceLocalAccountPromptForNetworkWhenOffline.yaml +++ b/components/policy/resources/templates/policy_definitions/Kiosk/DeviceLocalAccountPromptForNetworkWhenOffline.yaml
@@ -7,6 +7,11 @@ example_value: true features: dynamic_refresh: true +items: +- caption: Enable network configuration prompt when offline + value: true +- caption: Disable network configuration prompt when offline + value: false owners: - xiyuan@chromium.org - poromov@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/AdvancedProtectionAllowed.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/AdvancedProtectionAllowed.yaml index 91716e5d..a1df8a5 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/AdvancedProtectionAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/AdvancedProtectionAllowed.yaml
@@ -13,6 +13,12 @@ per_profile: true future_on: - fuchsia +items: +- caption: Users enrolled in the Advanced Protection program will receive extra protections + value: true +- caption: Users enrolled in the Advanced Protection program will only receive standard + consumer protections + value: false owners: - file://chrome/browser/safe_browsing/OWNERS - drubery@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/AllowScreenLock.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/AllowScreenLock.yaml index 9144726..aef2fdf 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/AllowScreenLock.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/AllowScreenLock.yaml
@@ -7,6 +7,11 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Allow locking the screen + value: true +- caption: Do not allow locking the screen + value: false owners: - file://components/policy/resources/OWNERS - emaxx@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/AttestationExtensionWhitelist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/AttestationExtensionWhitelist.yaml new file mode 100644 index 0000000..7ab5ebf4 --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/AttestationExtensionWhitelist.yaml
@@ -0,0 +1,24 @@ +caption: Extensions allowed to to use the remote attestation API +deprecated: true +desc: |- + This policy is deprecated, please use <ph name="ATTESTATION_EXTENSION_ALLOWLIST_POLICY_NAME">AttestationExtensionAllowlist</ph> instead. + + Setting the policy specifies the allowed extensions to use the <ph name="ENTERPRISE_PLATFORM_KEYS_API">Enterprise Platform Keys API</ph> function <ph name="CHALLENGE_USER_KEY_FUNCTION">chrome.enterprise.platformKeys.challengeUserKey()</ph> for remote attestation. Extensions must be on this list to use the API. + + If an extension is not in the list, or the list is not set, the call to the API fails with an error code. +example_value: +- ghdilpkmfbfdnomkmaiogjhjnggaggoi +features: + dynamic_refresh: true + per_profile: true +owners: +- emaxx@chromium.org +- file://chrome/browser/extensions/api/enterprise_platform_keys/OWNERS +schema: + items: + type: string + type: array +supported_on: +- chrome_os:28-100 +tags: [] +type: list
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/AudioCaptureAllowed.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/AudioCaptureAllowed.yaml index d900aa9..041c992 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/AudioCaptureAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/AudioCaptureAllowed.yaml
@@ -13,6 +13,11 @@ per_profile: true future_on: - fuchsia +items: +- caption: Enable audio input + value: true +- caption: Disable audio input + value: false owners: - file://components/policy/resources/OWNERS - pastarmovj@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/AudioOutputAllowed.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/AudioOutputAllowed.yaml index 08845754..941ad64 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/AudioOutputAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/AudioOutputAllowed.yaml
@@ -9,6 +9,11 @@ features: dynamic_refresh: true per_profile: false +items: +- caption: Enable audio output + value: true +- caption: Disable audio output + value: false owners: - file://components/policy/resources/OWNERS - pastarmovj@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/AudioSandboxEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/AudioSandboxEnabled.yaml index 3f09b57..d77d61e0 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/AudioSandboxEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/AudioSandboxEnabled.yaml
@@ -1,4 +1,5 @@ caption: Allow the audio sandbox to run +default: null desc: |- This policy controls the audio process sandbox. If this policy is enabled, the audio process will run sandboxed. @@ -10,6 +11,13 @@ features: dynamic_refresh: false per_profile: false +items: +- caption: Always sandbox the audio process + value: true +- caption: Never sandbox the audio process + value: false +- caption: Use the default configuration for the audio sandbox + value: null owners: - file://services/audio/OWNERS - dalecurtis@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/AuthNegotiateDelegateWhitelist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/AuthNegotiateDelegateWhitelist.yaml new file mode 100644 index 0000000..1b5edfc --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/AuthNegotiateDelegateWhitelist.yaml
@@ -0,0 +1,18 @@ +caption: Kerberos delegation server allowlist +deprecated: true +desc: This policy is deprecated, please use the '<ph name="AUTH_NEGOTIATE_DELEGATE_ALLOWLIST_POLICY_NAME">AuthNegotiateDelegateAllowlist</ph>' policy instead. +example_value: foobar.example.com +features: + dynamic_refresh: false + per_profile: false +owners: +- file://components/policy/resources/OWNERS +- rsorokin@chromium.org +schema: + type: string +supported_on: +- chrome.*:9-100 +- android:46-100 +- chrome_os:62-100 +tags: [] +type: string
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/AuthServerWhitelist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/AuthServerWhitelist.yaml new file mode 100644 index 0000000..c0f29c50 --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/AuthServerWhitelist.yaml
@@ -0,0 +1,19 @@ +caption: Authentication server allowlist +deprecated: true +desc: This policy is deprecated and unsupported, please use the '<ph name="AUTH_SERVER_ALLOWLIST_POLICY_NAME">AuthServerAllowlist</ph>' policy instead. +example_value: '*.example.com,example.com' +features: + dynamic_refresh: false + per_profile: false +owners: +- file://components/policy/resources/OWNERS +- rsorokin@chromium.org +schema: + type: string +supported_on: +- chrome.*:9-100 +- android:46-100 +- webview_android:49-100 +- chrome_os:62-100 +tags: [] +type: string
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/AutoOpenAllowedForURLs.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/AutoOpenAllowedForURLs.yaml index ef9ad312..fee44125 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/AutoOpenAllowedForURLs.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/AutoOpenAllowedForURLs.yaml
@@ -6,7 +6,7 @@ If this policy isn't set, all downloads where the file type is in <ph name="AUTO_OPEN_FILE_TYPES_POLICY_NAME">AutoOpenFileTypes</ph> will automatically open. - A URL pattern has to be formatted according to https://www.chromium.org/administrators/url-blocklist-filter-format. + A URL pattern has to be formatted according to https://support.google.com/chrome/a?p=url_blocklist_filter_format. example_value: - example.com - https://ssl.server.com
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/AutoplayAllowed.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/AutoplayAllowed.yaml index f9dca8c..aa96b8a 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/AutoplayAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/AutoplayAllowed.yaml
@@ -11,6 +11,11 @@ per_profile: true future_on: - fuchsia +items: +- caption: Allow Chrome to autoplay media + value: true +- caption: Do not allow Chrome to autoplay media + value: false owners: - fbeaufort@chromium.org - beccahughes@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/AutoplayWhitelist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/AutoplayWhitelist.yaml new file mode 100644 index 0000000..1824d31e --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/AutoplayWhitelist.yaml
@@ -0,0 +1,21 @@ +caption: Allow media autoplay on a allowlist of URL patterns +deprecated: true +desc: This policy is deprecated and unsupported, please use the '<ph name="AUTOPLAY_ALLOWLIST_POLICY_NAME">AutoplayAllowlist</ph>' policy instead. +example_value: +- https://www.example.com +- '[*.]example.edu' +features: + dynamic_refresh: true + per_profile: true +owners: +- fbeaufort@chromium.org +- beccahughes@chromium.org +schema: + items: + type: string + type: array +supported_on: +- chrome.*:66-100 +- chrome_os:66-100 +tags: [] +type: list
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/BackgroundModeEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/BackgroundModeEnabled.yaml index 37aac4d..d8b4f9d 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/BackgroundModeEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/BackgroundModeEnabled.yaml
@@ -1,5 +1,6 @@ caption: Continue running background apps when <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> is closed +default: null desc: |- Setting the policy to Enabled turns background mode on. In background mode, a <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> process is started on OS sign-in and keeps running when the last browser window is closed, allowing background apps and the browsing session to remain active. The background process displays an icon in the system tray and can always be closed from there. @@ -11,6 +12,13 @@ can_be_recommended: true dynamic_refresh: true per_profile: false +items: +- caption: Enable background mode + value: true +- caption: Disable background mode + value: false +- caption: Allow the user to decide + value: null owners: - file://components/policy/resources/OWNERS - pmarko@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/BrowserAddPersonEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/BrowserAddPersonEnabled.yaml index f37a536..09397e83 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/BrowserAddPersonEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/BrowserAddPersonEnabled.yaml
@@ -11,6 +11,11 @@ per_profile: false future_on: - fuchsia +items: +- caption: Allow adding new profiles + value: true +- caption: Disallow adding new profiles + value: false owners: - mlerman@chromium.org - zmin@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/BrowserGuestModeEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/BrowserGuestModeEnabled.yaml index 90406873..5150fd4b 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/BrowserGuestModeEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/BrowserGuestModeEnabled.yaml
@@ -11,6 +11,11 @@ per_profile: false future_on: - fuchsia +items: +- caption: Allow guest browser logins + value: true +- caption: Prevent guest browser logins + value: false owners: - mlerman@chromium.org - zmin@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/BrowserGuestModeEnforced.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/BrowserGuestModeEnforced.yaml index 20956613..45fda02f 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/BrowserGuestModeEnforced.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/BrowserGuestModeEnforced.yaml
@@ -9,6 +9,11 @@ per_profile: false future_on: - fuchsia +items: +- caption: Only allow guest browser logins + value: true +- caption: Allow guest browser logins and profile logins + value: false owners: - mlerman@chromium.org - zmin@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/BuiltInDnsClientEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/BuiltInDnsClientEnabled.yaml index 9ebe65b..3d4a345 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/BuiltInDnsClientEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/BuiltInDnsClientEnabled.yaml
@@ -1,4 +1,5 @@ caption: Use built-in DNS client +default: null desc: |- This policy controls which software stack is used to communicate with the DNS server: the Operating System DNS client, or <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>'s built-in DNS client. This policy does not affect which DNS servers are used: if, for example, the operating system is configured to use an enterprise DNS server, that same server would be used by the built-in DNS client. It also does not control if DNS-over-HTTPS is used; <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> will always use the built-in resolver for DNS-over-HTTPS requests. Please see the <ph name="DNS_OVER_HTTPS_MODE_POLICY_NAME">DnsOverHttpsMode</ph> policy for information on controlling DNS-over-HTTPS. @@ -13,6 +14,13 @@ per_profile: false future_on: - fuchsia +items: +- caption: Always use the built-in DNS client if available + value: true +- caption: Never use the built-in DNS client + value: false +- caption: Use the built-in DNS client on macOS, Android and ChromeOS + value: null owners: - ericorth@chromium.org - pmarko@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/CertificateTransparencyEnforcementDisabledForUrls.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/CertificateTransparencyEnforcementDisabledForUrls.yaml index 52dc20b..4a60707 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/CertificateTransparencyEnforcementDisabledForUrls.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/CertificateTransparencyEnforcementDisabledForUrls.yaml
@@ -4,7 +4,7 @@ Leaving the policy unset means that if certificates requiring disclosure through Certificate Transparency aren't disclosed, then <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> doesn't trust those certificates. - A URL pattern follows this format ( https://www.chromium.org/administrators/url-blocklist-filter-format ). However, because the validity of certificates for a given hostname is independent of the scheme, port, or path, <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> only considers the hostname portion of the URL. Wildcard hosts aren't supported. + A URL pattern follows this format ( https://support.google.com/chrome/a?p=url_blocklist_filter_format ). However, because the validity of certificates for a given hostname is independent of the scheme, port, or path, <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> only considers the hostname portion of the URL. Wildcard hosts aren't supported. example_value: - example.com - .example.com
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/ChromeCleanupEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/ChromeCleanupEnabled.yaml index af4d47d..c3a5d07 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/ChromeCleanupEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/ChromeCleanupEnabled.yaml
@@ -9,6 +9,12 @@ features: dynamic_refresh: false per_profile: false +items: +- caption: Allow Chrome Cleanup to periodically scan the system and allow manual scans + value: true +- caption: Prevent Chrome Cleanup from periodically scanning the system and disable + manual scans + value: false owners: - proberge@chromium.org schema:
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/ChromeCleanupReportingEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/ChromeCleanupReportingEnabled.yaml index 506581844..51713cd 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/ChromeCleanupReportingEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/ChromeCleanupReportingEnabled.yaml
@@ -1,4 +1,5 @@ caption: Control how Chrome Cleanup reports data to Google +default: null desc: |- Setting the policy to Enabled means if <ph name="CHROME_CLEANUP_NAME">Chrome Cleanup</ph> detects unwanted software, it may, in line with policy set by <ph name="SAFE_BROWSING_EXTENDED_REPORTING_ENABLED_POLICY_NAME">SafeBrowsingExtendedReportingEnabled</ph>, report about the scan to Google. <ph name="CHROME_CLEANUP_NAME">Chrome Cleanup</ph> asks users if they want the cleanup. It sends results to Google. @@ -11,6 +12,13 @@ features: dynamic_refresh: true per_profile: false +items: +- caption: Results from a Chrome Cleanup cleanup are always shared with Google + value: true +- caption: Results from a Chrome Cleanup cleanup are never shared with Google + value: false +- caption: Users may choose to share results from a Chrome Cleanup cleanup with Google + value: null owners: - proberge@chromium.org schema:
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/ChromeRootStoreEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/ChromeRootStoreEnabled.yaml index eacb4f1..86dc281c 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/ChromeRootStoreEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/ChromeRootStoreEnabled.yaml
@@ -2,18 +2,17 @@ will be used to verify server certificates default: null desc: |- -When this policy is set to enabled, <ph name="PRODUCT_NAME">$1<ex>Google -Chrome</ex></ph> will perform verification of server certificates using the built-in -certificate verifier with the Chrome Root Store as the source of public trust. -When this policy is set to disabled, <ph name="PRODUCT_NAME">$1<ex>Google -Chrome</ex></ph> will use the system certificate verifier and system root certificates. -When this policy is not set, the Chrome Root Store or system provided roots -may be used. + When this policy is set to enabled, <ph name="PRODUCT_NAME">$1<ex>Google + Chrome</ex></ph> will perform verification of server certificates using the built-in + certificate verifier with the Chrome Root Store as the source of public trust. + When this policy is set to disabled, <ph name="PRODUCT_NAME">$1<ex>Google + Chrome</ex></ph> will use the system certificate verifier and system root certificates. + When this policy is not set, the Chrome Root Store or system provided roots + may be used. -This policy is planned to be removed in <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> -for <ph name="MS_WIN_NAME">Microsoft® Windows®</ph> and <ph name="MAC_OS_NAME">macOS</ph> version 111, -when support for using the platform supplied certificate verifier and roots are planned to be removed. - + This policy is planned to be removed in <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> + for <ph name="MS_WIN_NAME">Microsoft® Windows®</ph> and <ph name="MAC_OS_NAME">macOS</ph> version 111, + when support for using the platform supplied certificate verifier and roots are planned to be removed. example_value: false features: dynamic_refresh: false
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/ClickToCallEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/ClickToCallEnabled.yaml index 8d2b3c74..7fb778bb 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/ClickToCallEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/ClickToCallEnabled.yaml
@@ -1,4 +1,5 @@ caption: Enable the Click to Call Feature +default: null desc: |- Enable the Click to Call feature which allows users to send phone numbers from Chrome Desktops to an Android device when the user is Signed-in. For more information, see help center article: https://support.google.com/chrome/answer/9430554?hl=en. @@ -15,6 +16,13 @@ per_profile: true future_on: - fuchsia +items: +- caption: Allow users to send phone numbers from Chrome to their Android device + value: true +- caption: Do not allow users to send phone numbers from Chrome to their Android device + value: false +- caption: Allow the user to decide + value: null owners: - knollr@chromium.org - mvanouwerkerk@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/CloudManagementEnrollmentMandatory.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/CloudManagementEnrollmentMandatory.yaml index 835ae43..ab29654 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/CloudManagementEnrollmentMandatory.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/CloudManagementEnrollmentMandatory.yaml
@@ -12,6 +12,12 @@ platform_only: true future_on: - fuchsia +items: +- caption: Prevent Chrome from launching if not enrolled into Chrome Browser Cloud + Management + value: true +- caption: Allow Chrome to launch if not enrolled into Chrome Browser Cloud Management + value: false owners: - zmin@chromium.org - pastarmovj@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/CloudPolicyOverridesPlatformPolicy.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/CloudPolicyOverridesPlatformPolicy.yaml index a30b702..a7c7bc9f 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/CloudPolicyOverridesPlatformPolicy.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/CloudPolicyOverridesPlatformPolicy.yaml
@@ -15,6 +15,11 @@ per_profile: false future_on: - fuchsia +items: +- caption: Cloud machine policies take precedence over platform machine policies + value: true +- caption: Platform machine policies take precedence over cloud machine policies + value: false owners: - zmin@chromium.org - pastarmovj@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/ComponentUpdatesEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/ComponentUpdatesEnabled.yaml index 1c06df8c..dec1915 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/ComponentUpdatesEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/ComponentUpdatesEnabled.yaml
@@ -10,6 +10,11 @@ per_profile: false future_on: - fuchsia +items: +- caption: Enable updates for all components + value: true +- caption: Disable updates for non-critical components + value: false owners: - file://components/update_client/OWNERS - sorin@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/ContextAwareAccessSignalsAllowlist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/ContextAwareAccessSignalsAllowlist.yaml index b4f1603..406ee08 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/ContextAwareAccessSignalsAllowlist.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/ContextAwareAccessSignalsAllowlist.yaml
@@ -6,16 +6,14 @@ Leaving this policy unset or empty means that no endpoint will be able to start the attestation flow nor get signals from the machine. - URLs must have HTTPS scheme, e.g. "https://example.com". - Note: Wildcards, <ph name="WILDCARD_VALUE">*</ph>, are allowed. For ChromeOS, this policy is related to remote attestation where a certificate is automatically generated and uploaded to the Device Management Server. - For detailed information on valid <ph name="URL_LABEL">URL</ph> patterns, please see https://cloud.google.com/docs/chrome-enterprise/policies/url-patterns. + For detailed information on valid <ph name="URL_LABEL">URL</ph> patterns, please see https://support.google.com/chrome/a?p=url_blocklist_filter_format. example_value: - https://example1.com -- https://[*.]example2.com +- example2.com - https://foo.example3.com/path features: cloud_only: true
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/DHEEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/DHEEnabled.yaml index 257ea45..a48114db 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/DHEEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/DHEEnabled.yaml
@@ -1,7 +1,7 @@ caption: Enable DHE cipher suites in TLS deprecated: true desc: |- - Warning: DHE will be completely removed from <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> after version 57 (around March 2017) and this policy will stop working then. + This policy was removed in M58 after DHE was removed from <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>. If the policy is not set, or is set to false, then DHE cipher suites in TLS will not be enabled. Otherwise it may be set to true to enable DHE cipher suites and retain compatibility with an outdated server. This is a stopgap measure and the server should be reconfigured.
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/DataLeakPreventionRulesList.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/DataLeakPreventionRulesList.yaml index ec26d8f..97213105 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/DataLeakPreventionRulesList.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/DataLeakPreventionRulesList.yaml
@@ -14,6 +14,7 @@ - Control printing of any of the sources. - Control the privacy screen when any of the sources is visible. - Control screen sharing of any of the sources. + - Control files downloaded from any of the sources when they are transferred to the destination. Supported on <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph> version 108 and higher. The restriction level can be set to BLOCK, ALLOW, REPORT, WARN. - If the restriction level is set to BLOCK, the action won't be allowed. If <ph name="DATA_LEAK_PREVENTION_REPORTING_ENABLED">DataLeakPreventionReportingEnabled</ph> is set to True, the blocked action will be reported to the admin. @@ -23,8 +24,9 @@ Notes: - PRIVACY_SCREEN restriction doesn't block the ability to turn on privacy screen, but enforces it when the restriction class is set to BLOCK. - - Destinations cannot be empty in case one of the restrictions is CLIPBOARD, but they don't make any difference for the remaining restrictions. - - Format the URL patterns according to this format ( https://www.chromium.org/administrators/url-blocklist-filter-format ). + - Destinations cannot be empty in case one of the restrictions is CLIPBOARD or FILES, but they don't make any difference for the remaining restrictions. + - DRIVE and USB destinations are ignored for CLIPBOARD restriction. + - Format the URL patterns according to this format ( https://support.google.com/chrome/a?p=url_blocklist_filter_format ). If the policy is left not set, no restrictions will be applied. example_value: @@ -94,6 +96,8 @@ - ARC - CROSTINI - PLUGIN_VM + - DRIVE + - USB type: string type: array urls: @@ -113,6 +117,7 @@ - PRINTING - PRIVACY_SCREEN - SCREEN_SHARE + - FILES type: string level: enum:
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/DefaultHandlersForFileExtensions.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/DefaultHandlersForFileExtensions.yaml new file mode 100644 index 0000000..c59b290 --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/DefaultHandlersForFileExtensions.yaml
@@ -0,0 +1,51 @@ +caption: Assigns apps as default handlers for specified file extensions +desc: "This policy allows the admins to specify apps that act as default handlers\ + \ for the respective file extensions on <ph name=\"PRODUCT_OS_NAME\">$2<ex>Google\ + \ ChromeOS</ex></ph> that users can't change.\n For all file extensions not\ + \ specified in the policy, users are free to set their own defaults with respect\ + \ to the usual workflow.\n\n Specify Chrome apps by their ID, such as <ph name=\"\ + DEFAULT_HANDLERS_FOR_FILE_EXTENSIONS_POLICY_CHROME_APP_EXAMPLE\">pjkljhegncpnkpknbcohdijeoejaedia</ph>\ + \ and web apps by the URL used in <ph name=\"WEB_APP_INSTALL_FORCE_LIST_POLICY_NAME\"\ + >WebAppInstallForceList</ph>, such as <ph name=\"DEFAULT_HANDLERS_FOR_FILE_EXTENSIONS_POLICY_WEB_APP_EXAMPLE\"\ + >https://google.com/maps</ph>.\n\n Note that apps MUST declare themselves as\ + \ a file handlers for specified file extensions in the manifest in order for that\ + \ policy item to take effect (i.e. the policy does NOT extend existing app capabilities).\n\ + \n Leaving the policy unset allows <ph name=\"PRODUCT_OS_NAME\">$2<ex>Google\ + \ ChromeOS</ex></ph> to select default handlers according to the internal logic.\n\ + \ " +example_value: +- file_extensions: + - maps + policy_id: https://google.com/maps +- file_extensions: + - xslx + policy_id: pnomlkjighijklmnopabcdefghijklff +- file_extensions: + - docx + - pdf + policy_id: abcdefghijklmnopabcdefghijklmnop +features: + can_be_recommended: true + dynamic_refresh: true + per_profile: true +future_on: +- chrome_os +owners: +- greengrape@google.com +- file://ui/file_manager/OWNERS +schema: + items: + properties: + file_extensions: + items: + type: string + type: array + policy_id: + type: string + required: + - policy_id + - file_extensions + type: object + type: array +tags: [] +type: dict
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/DeskAPIThirdPartyAccessEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/DeskAPIThirdPartyAccessEnabled.yaml index 5ee327f..e11f9ce 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/DeskAPIThirdPartyAccessEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/DeskAPIThirdPartyAccessEnabled.yaml
@@ -1,9 +1,8 @@ caption: Enable Desk API for third-party ChromeOS control default: false -desc: |- -Setting the policy to Enabled allows third-party web applications to use Desk -API to control ChromeOS desks. If the policy is not set or disabled, the Desk API -will be unavailable. +desc: Setting the policy to Enabled allows third-party web applications to use Desk + API to control ChromeOS desks. If the policy is not set or disabled, the Desk API + will be unavailable. example_value: true features: dynamic_refresh: true
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/DeskAPIThirdPartyAllowlist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/DeskAPIThirdPartyAllowlist.yaml new file mode 100644 index 0000000..ffaf317 --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/DeskAPIThirdPartyAllowlist.yaml
@@ -0,0 +1,20 @@ +caption: Enable Desk API for a list of third-party domains +desc: Specifies the list of third-party web application domains that are allowed to + use Desk API to control ChromeOS desks. These URL patterns should follow the format + defined for "matches" property in https://developer.chrome.com/docs/extensions/mv3/manifest/externally_connectable/#reference +example_value: +- https://*.chromium.org/* +features: + dynamic_refresh: true + per_profile: true +future_on: +- chrome_os +owners: +- aprilzhou@google.com +- yzd@google.com +schema: + items: + type: string + type: array +tags: [] +type: list
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceAllowBluetooth.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceAllowBluetooth.yaml index dcdaa28c..1bf1927b 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceAllowBluetooth.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceAllowBluetooth.yaml
@@ -9,6 +9,11 @@ example_value: true features: dynamic_refresh: false +items: +- caption: Allow users to turn Bluetooth on or off + value: true +- caption: Disable Bluetooth + value: false owners: - isandrk@chromium.org - sinhak@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceBlockDevmode.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceBlockDevmode.yaml index 4d1e689..5d63d67 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceBlockDevmode.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceBlockDevmode.yaml
@@ -11,6 +11,11 @@ example_value: true features: dynamic_refresh: true +items: +- caption: Block developer mode + value: true +- caption: Allow developer mode + value: false owners: - file://components/policy/resources/OWNERS - atwilson@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceLocalAccountManagedSessionEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceLocalAccountManagedSessionEnabled.yaml index 3d1b5de..e49b4ef 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceLocalAccountManagedSessionEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceLocalAccountManagedSessionEnabled.yaml
@@ -1,7 +1,7 @@ caption: Allow managed session on device deprecated: true desc: |- - Note that this policy is deprecated and will be removed in <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph> version 88. Public sessions are no longer supported. Please use <ph name="DEVICE_LOCAL_ACCOUNTS_POLICY_NAME">DeviceLocalAccounts</ph> to configure managed-guest sessions instead. + Note that this policy is deprecated and removed in <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph> version 88. Public sessions are no longer supported. Please use <ph name="DEVICE_LOCAL_ACCOUNTS_POLICY_NAME">DeviceLocalAccounts</ph> to configure managed-guest sessions instead. If this policy is set to false, managed guest session will behave as documented in https://support.google.com/chrome/a/answer/3017014 - the standard "Public Session". If this policy is set to true or left unset, managed guest session will take on "Managed Session" behaviour which lifts many of the restrictions that are in place for regular "Public Sessions". @@ -17,6 +17,6 @@ schema: type: boolean supported_on: -- chrome_os:70- +- chrome_os:70-87 tags: [] type: main
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceLoginScreenContextAwareAccessSignalsAllowlist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceLoginScreenContextAwareAccessSignalsAllowlist.yaml index 77beb0e..ce8a77f 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceLoginScreenContextAwareAccessSignalsAllowlist.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceLoginScreenContextAwareAccessSignalsAllowlist.yaml
@@ -6,17 +6,15 @@ Leaving this policy unset or empty means that no endpoint will be able to start the attestation flow nor get signals from the machine. - URLs must have HTTPS scheme, e.g. "https://example.com". - Note: Wildcards, <ph name="WILDCARD_VALUE">*</ph>, are allowed. This policy will only impact the attestation flow on the login and lock screen. To change the in-session attestation flow, please use the <ph name="CONTEXT_AWARE_ACCESS_SIGNALS_ALLOWLIST_POLICY_NAME">ContextAwareAccessSignalsAllowlist</ph> policy. - For detailed information on valid <ph name="URL_LABEL">URL</ph> patterns, please see https://cloud.google.com/docs/chrome-enterprise/policies/url-patterns. + For detailed information on valid <ph name="URL_LABEL">URL</ph> patterns, please see https://support.google.com/chrome/a?p=url_blocklist_filter_format. device_only: true example_value: - https://example1.com -- https://[*.]example2.com +- example2.com - https://foo.example3.com/path features: cloud_only: true
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceLoginScreenPrimaryMouseButtonSwitch.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceLoginScreenPrimaryMouseButtonSwitch.yaml index 30a7e99..7162b6d 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceLoginScreenPrimaryMouseButtonSwitch.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceLoginScreenPrimaryMouseButtonSwitch.yaml
@@ -1,4 +1,5 @@ caption: Switch the primary mouse button to the right button on the login screen +default: null desc: |- Switch the primary mouse button to the right button on the login screen. @@ -14,6 +15,13 @@ features: can_be_recommended: true dynamic_refresh: true +items: +- caption: Right button is primary on the login screen + value: true +- caption: Left button is primary on the login screen + value: false +- caption: Allow the user to decide + value: null owners: - amraboelkher@chromium.org - emaxx@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceNativePrintersBlacklist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceNativePrintersBlacklist.yaml new file mode 100644 index 0000000..5722917 --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceNativePrintersBlacklist.yaml
@@ -0,0 +1,24 @@ +caption: Disabled enterprise device printers +deprecated: true +desc: |- + If <ph name="PRINTERS_BLACKLIST">BlacklistRestriction</ph> is chosen for <ph name="DEVICE_PRINTERS_ACCESS_MODE_POLICY_NAME">DevicePrintersAccessMode</ph>, then setting <ph name="DEVICE_NATIVE_PRINTERS_BLACKLIST_POLICY_NAME">DeviceNativePrintersBlacklist</ph> specifies which printers users can't use. All printers are provided to users, except for the IDs listed in this policy. The IDs must correspond to the <ph name="ID_FIELD">"id"</ph> or <ph name="GUID_FIELD">"guid"</ph> fields in the file specified in <ph name="DEVICE_PRINTERS_POLICY_NAME">DevicePrinters</ph>. + + This policy is deprecated, please use <ph name="DEVICE_PRINTERS_BLOCKLIST_POLICY_NAME">DevicePrintersBlocklist</ph> instead. +device_only: true +example_value: +- id1 +- id2 +- id3 +features: + dynamic_refresh: true +owners: +- srad@google.com +- pawliczek@chromium.org +schema: + items: + type: string + type: array +supported_on: +- chrome_os:73-100 +tags: [] +type: list
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceNativePrintersWhitelist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceNativePrintersWhitelist.yaml new file mode 100644 index 0000000..df637882 --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceNativePrintersWhitelist.yaml
@@ -0,0 +1,25 @@ +caption: Enabled enterprise device printers +deprecated: true +desc: |- + If <ph name="PRINTERS_WHITELIST">WhitelistPrintersOnly</ph> is chosen for <ph name="DEVICE_PRINTERS_ACCESS_MODE_POLICY_NAME">DevicePrintersAccessMode</ph>, then setting <ph name="DEVICE_NATIVE_PRINTERS_WHITELIST_POLICY_NAME">DeviceNativePrintersWhitelist</ph> specifies which printers users can use. Only the printers with IDs matching the values in this policy are available to users. The IDs must correspond to the <ph name="ID_FIELD">"id"</ph> or <ph name="GUID_FIELD">"guid"</ph> fields in the file specified in <ph name="DEVICE_PRINTERS_POLICY_NAME">DevicePrinters</ph>. + + This policy is deprecated, please use <ph name="DEVICE_PRINTERS_ALLOWLIST_POLICY_NAME">DevicePrintersAllowlist</ph> instead. +device_only: true +example_value: +- id1 +- id2 +- id3 +features: + dynamic_refresh: true + per_profile: false +owners: +- srad@google.com +- pawliczek@chromium.org +schema: + items: + type: string + type: array +supported_on: +- chrome_os:73-100 +tags: [] +type: list
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/DevicePowerwashAllowed.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/DevicePowerwashAllowed.yaml index 2b86c90..77b89e9d 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/DevicePowerwashAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/DevicePowerwashAllowed.yaml
@@ -8,6 +8,11 @@ features: dynamic_refresh: true per_profile: false +items: +- caption: Allow the device to request powerwash + value: true +- caption: Do not allow the device to request powerwash + value: false owners: - file://components/policy/resources/OWNERS - emaxx@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceUserWhitelist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceUserWhitelist.yaml new file mode 100644 index 0000000..933bd19 --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/DeviceUserWhitelist.yaml
@@ -0,0 +1,34 @@ +arc_support: This policy controls who may start a <ph name="PRODUCT_OS_NAME">$2<ex>ChromiumOS</ex></ph> + session. It does not prevent users from signing in to additional Google accounts + within Android. If you want to prevent this, configure the Android-specific <ph + name="ACCOUNT_TYPES_WITH_MANAGEMENT_DISABLED_CLOUDDPC_POLICY_NAME">accountTypesWithManagementDisabled</ph> + policy as part of <ph name="ARC_POLICY_POLICY_NAME">ArcPolicy</ph>. +caption: Login user white list +deprecated: true +desc: "Defines the list of users that are allowed to login to the device. Entries\ + \ are of the form <ph name=\"USER_ALLOWLIST_ENTRY_FORMAT\">user@domain</ph>, such\ + \ as <ph name=\"USER_ALLOWLIST_ENTRY_EXAMPLE\">madmax@managedchrome.com</ph>. To\ + \ allow arbitrary users on a domain, use entries of the form <ph name=\"USER_ALLOWLIST_ENTRY_WILDCARD\"\ + >*@domain</ph>.\n\n If this policy is not configured, there are no restrictions\ + \ on which users are allowed to sign in. Note that creating new users still requires\ + \ the <ph name=\"DEVICE_ALLOW_NEW_USERS_POLICY_NAME\">DeviceAllowNewUsers</ph> policy\ + \ to be configured appropriately.\n\n This policy is deprecated, please use\ + \ <ph name=\"DEVICE_USER_ALLOWLIST_POLICY_NAME\">DeviceUserAllowlist</ph> instead.\n\ + \ " +device_only: true +example_value: +- madmax@managedchrome.com +features: + dynamic_refresh: true +owners: +- file://components/policy/resources/OWNERS +- pmarko@chromium.org +schema: + items: + type: string + sensitiveValue: true + type: array +supported_on: +- chrome_os:12-100 +tags: [] +type: list
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/DisableSafeBrowsingProceedAnyway.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/DisableSafeBrowsingProceedAnyway.yaml index 38ce74e9..0aaba42 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/DisableSafeBrowsingProceedAnyway.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/DisableSafeBrowsingProceedAnyway.yaml
@@ -11,6 +11,11 @@ per_profile: true future_on: - fuchsia +items: +- caption: Do not allow user to bypass Safe Browsing warning + value: true +- caption: Allow user to bypass Safe Browsing warning + value: false owners: - file://components/policy/resources/OWNERS - pastarmovj@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/DisableScreenshots.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/DisableScreenshots.yaml index cab92cc7..94e2c3d 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/DisableScreenshots.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/DisableScreenshots.yaml
@@ -1,12 +1,22 @@ caption: Disable taking screenshots -desc: Setting the policy to True disallows screenshots taken with keyboard shortcuts - or extension APIs. Setting the policy to False allows screenshots. +default: false +desc: |- + Setting the policy to Enabled disallows screenshots taken with keyboard shortcuts + or extension APIs. Setting the policy to Disabled or not set allows screenshots. + + Note that on <ph name="MS_WIN_NAME">Microsoft® Windows®</ph>, <ph name="MAC_OS_NAME">macOS</ph> and <ph name="LINUX_OS_NAME">Linux</ph>, + this does not prevent screenshots that are taken with operating system or third party applications. example_value: true features: dynamic_refresh: true per_profile: false future_on: - fuchsia +items: +- caption: Do not allow users to take screenshots or video recordings + value: true +- caption: Allow users to take screenshots and video recordings + value: false owners: - file://components/policy/resources/OWNERS - poromov@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/DisplayCapturePermissionsPolicyEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/DisplayCapturePermissionsPolicyEnabled.yaml new file mode 100644 index 0000000..ed48b2b3 --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/DisplayCapturePermissionsPolicyEnabled.yaml
@@ -0,0 +1,39 @@ +caption: Specifies whether the display-capture permissions-policy is checked or skipped. +default: true +deprecated: true +desc: |2- + + The display-capture permissions-policy gates access to getDisplayMedia(), as per this spec: https://www.w3.org/TR/screen-capture/#feature-policy-integration. However, if this policy is Disabled, this requirement is not enforced, and getDisplayMedia() is allowed from contexts that would otherwise be forbidden. This Enterprise policy is temporary; it's intended to be removed after <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> version 100. It is intended to unblock Enterprise users whose application is non-spec compliant, but needs time to be fixed. + + When enabled or not set, sites can only call getDisplayMedia() from contexts which are allowlisted by the display-capture permissions-policy. + + When disabled, sites can call getDisplayMedia() even from contexts which are not allowlisted by the display-capture permissions policy. Note that other restrictions may still apply. +device_only: false +example_value: true +features: + dynamic_refresh: false + per_profile: true +future_on: +- fuchsia +items: +- caption: |2- + + Calls to getDisplayMedia originating from non-allowlisted contexts + are denied. + value: true +- caption: |2- + + Calls are not denied on account of originating from non-allowlisted + contexts. (Calls may still be denied for other reasons.) + value: false +owners: +- eladalon@chromium.org +- guidou@chromium.org +schema: + type: boolean +supported_on: +- chrome.*:94-107 +- chrome_os:94-107 +tags: +- system-security +type: main
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/EasyUnlockAllowed.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/EasyUnlockAllowed.yaml index dabe104..565f254d 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/EasyUnlockAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/EasyUnlockAllowed.yaml
@@ -10,6 +10,11 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Allow Smart Lock + value: true +- caption: Do not allow Smart Lock + value: false owners: - file://chrome/browser/ash/login/easy_unlock/OWNERS - hansberry@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/EmojiSuggestionEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/EmojiSuggestionEnabled.yaml index ce04ac5..3a5de8b 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/EmojiSuggestionEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/EmojiSuggestionEnabled.yaml
@@ -8,6 +8,11 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Enable emoji suggestions when users type + value: true +- caption: Disable emoji suggestions when users type + value: false owners: - myy@chromium.org - essential-inputs-team@google.com
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/EnableSyncConsent.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/EnableSyncConsent.yaml index 48261d7a..c07aa99 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/EnableSyncConsent.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/EnableSyncConsent.yaml
@@ -7,6 +7,11 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Display Sync Consent during sign-in + value: true +- caption: Do not display Sync Consent during sign-in + value: false owners: - agawronska@chromium.org - alemate@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/EnterpriseAuthenticationAppLinkPolicy.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/EnterpriseAuthenticationAppLinkPolicy.yaml index 9410c82..fefef12 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/EnterpriseAuthenticationAppLinkPolicy.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/EnterpriseAuthenticationAppLinkPolicy.yaml
@@ -11,8 +11,7 @@ \ during authentication.\n\n If there is no valid app installed to handle authentication\ \ url on the device, navigation will continue in <ph name=\"WEBVIEW_PRODUCT_NAME\"\ >Android WebView</ph>.\n\n Authentication URL pattern has to be formatted according\ - \ to https://www.chromium.org/administrators/url-blocklist-filter-format.\n \ - \ " + \ to https://support.google.com/chrome/a?p=url_blocklist_filter_format.\n " example_value: - url: https://www.abc.com features:
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/EnterpriseHardwarePlatformAPIEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/EnterpriseHardwarePlatformAPIEnabled.yaml index 86f132c..d2b595d 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/EnterpriseHardwarePlatformAPIEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/EnterpriseHardwarePlatformAPIEnabled.yaml
@@ -11,6 +11,12 @@ per_profile: true future_on: - fuchsia +items: +- caption: Allow managed extensions to use the Enterprise Hardware Platform API + value: true +- caption: Do not allow managed extensions to use the Enterprise Hardware Platform + API + value: false owners: - guidou@chromium.org schema:
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/EnterpriseProfileCreationKeepBrowsingData.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/EnterpriseProfileCreationKeepBrowsingData.yaml index 9d0ab76..b629250 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/EnterpriseProfileCreationKeepBrowsingData.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/EnterpriseProfileCreationKeepBrowsingData.yaml
@@ -10,7 +10,6 @@ This policy has no effect if the option to keep existing browsing data is not available; this happens if enterprise profile separation is strictly enforced, or if the data would be from an already managed profile. example_value: true features: - can_be_mandatory: false can_be_recommended: true dynamic_refresh: true per_profile: false
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/ExtensionInstallBlacklist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/ExtensionInstallBlacklist.yaml new file mode 100644 index 0000000..1248882 --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/ExtensionInstallBlacklist.yaml
@@ -0,0 +1,22 @@ +caption: Configure extension installation blocklist +deprecated: true +desc: This policy is deprecated and unsupported, please use the '<ph name="EXTENSION_INSTALL_BLOCKLIST_POLICY_NAME">ExtensionInstallBlocklist</ph>' policy instead. +example_value: +- extension_id1 +- extension_id2 +features: + dynamic_refresh: true + per_profile: true +label: Extension IDs the user should be prevented from installing (or * for all) +owners: +- lazyboy@chromium.org +- file://extensions/OWNERS +schema: + items: + type: string + type: array +supported_on: +- chrome.*:8-100 +- chrome_os:11-100 +tags: [] +type: list
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/ExtensionInstallWhitelist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/ExtensionInstallWhitelist.yaml new file mode 100644 index 0000000..25e38ae --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/ExtensionInstallWhitelist.yaml
@@ -0,0 +1,22 @@ +caption: Configure extension installation allowlist +deprecated: true +desc: This policy is deprecated and unsupported, please use the '<ph name="EXTENSION_INSTALL_ALLOWLIST_POLICY_NAME">ExtensionInstallAllowlist</ph>' policy instead. +example_value: +- extension_id1 +- extension_id2 +features: + dynamic_refresh: true + per_profile: true +label: Extension IDs to exempt from the blocklist +owners: +- rdevlin.cronin@chromium.org +- file://extensions/OWNERS +schema: + items: + type: string + type: array +supported_on: +- chrome.*:8-100 +- chrome_os:11-100 +tags: [] +type: list
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/ExternalPrintServersWhitelist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/ExternalPrintServersWhitelist.yaml new file mode 100644 index 0000000..e9cd20a --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/ExternalPrintServersWhitelist.yaml
@@ -0,0 +1,30 @@ +caption: Enabled external print servers +deprecated: true +desc: |- + Specifies the subset of print servers that will be queried for server printers. + + If this policy is used, only the server printers with ids matching the values in this policy are available to the user. + + The ids must correspond to the "id" field in the file specified in <ph name="EXTERNAL_PRINT_SERVERS_POLICY">ExternalPrintServers</ph>. + + If this policy is not set, filtering is omitted and all print servers are taken into account. + + This policy is deprecated, please use <ph name="EXTERNAL_PRINT_SERVERS_ALLOWLIST">ExternalPrintServersAllowlist</ph> instead. +example_value: +- id1 +- id2 +- id3 +features: + dynamic_refresh: true + per_profile: true +owners: +- file://chromeos/printing/OWNERS +- luum@chromium.org +schema: + items: + type: string + type: array +supported_on: +- chrome_os:79-100 +tags: [] +type: list
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/ExternalStorageDisabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/ExternalStorageDisabled.yaml index 4b884e06..efe3d93 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/ExternalStorageDisabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/ExternalStorageDisabled.yaml
@@ -7,6 +7,11 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Disallow external storage devices + value: true +- caption: Allow external storage devices + value: false owners: - file://components/policy/resources/OWNERS - pastarmovj@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/ExternalStorageReadOnly.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/ExternalStorageReadOnly.yaml index dc8ecdc..daa9457 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/ExternalStorageReadOnly.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/ExternalStorageReadOnly.yaml
@@ -7,6 +7,11 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Disallow writing to external storage devices + value: true +- caption: Allow writing to external storage devices + value: false owners: - yamaguchi@chromium.org schema:
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/ForceBrowserSignin.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/ForceBrowserSignin.yaml index c2396cb..9fb4ed47 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/ForceBrowserSignin.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/ForceBrowserSignin.yaml
@@ -12,6 +12,11 @@ per_profile: false future_on: - chrome.linux +items: +- caption: Force the user to sign in before using the browser + value: true +- caption: Allow the user to use the browser without signing in + value: false owners: - zmin@chromium.org - pastarmovj@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/ForceMaximizeOnFirstRun.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/ForceMaximizeOnFirstRun.yaml index e6483de3..6c670372 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/ForceMaximizeOnFirstRun.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/ForceMaximizeOnFirstRun.yaml
@@ -7,6 +7,11 @@ features: dynamic_refresh: false per_profile: true +items: +- caption: Maximize the first browser window on first run + value: true +- caption: Default system behavior (depends on screen size) + value: false owners: - file://components/policy/resources/OWNERS - poromov@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/FullscreenAllowed.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/FullscreenAllowed.yaml index d301b6e..21da2cfe 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/FullscreenAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/FullscreenAllowed.yaml
@@ -11,6 +11,11 @@ per_profile: true future_on: - fuchsia +items: +- caption: Allow fullscreen mode + value: true +- caption: Do not allow fullscreen mode + value: false owners: - file://components/policy/resources/OWNERS - bartfab@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/HardwareAccelerationModeEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/HardwareAccelerationModeEnabled.yaml index ba204c34..42c335f 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/HardwareAccelerationModeEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/HardwareAccelerationModeEnabled.yaml
@@ -9,6 +9,11 @@ per_profile: false future_on: - fuchsia +items: +- caption: Enable hardware acceleration + value: true +- caption: Disable hardware acceleration + value: false owners: - zmo@chromium.org - kbr@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/HideWebStoreIcon.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/HideWebStoreIcon.yaml index 4f57009..e5610c6 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/HideWebStoreIcon.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/HideWebStoreIcon.yaml
@@ -11,6 +11,13 @@ per_profile: true future_on: - fuchsia +items: +- caption: Do not show the Chrome Web Store icon in the <ph name="PRODUCT_OS_NAME">$2<ex>Google + ChromeOS</ex></ph> launcher or on the new tab page + value: true +- caption: Show the Chrome Web Store icon in the <ph name="PRODUCT_OS_NAME">$2<ex>Google + ChromeOS</ex></ph> launcher and on the new tab page + value: false owners: - file://components/policy/resources/OWNERS - rsorokin@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/HindiInscriptLayoutEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/HindiInscriptLayoutEnabled.yaml new file mode 100644 index 0000000..efbc086 --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/HindiInscriptLayoutEnabled.yaml
@@ -0,0 +1,25 @@ +caption: Enable the Hindi Inscript Layout +default: false +desc: Setting the policy enables Hindi Inscript Layout on <ph name="PRODUCT_OS_NAME">$2<ex>Google + ChromeOS</ex></ph>. If false or unset, the layout is not available. +device_only: false +example_value: true +features: + cloud_only: true + dynamic_refresh: true + per_profile: true + unlisted: true +items: +- caption: Enable Hindi Inscript Layout + value: true +- caption: Disable Hindi Inscript Layout + value: false +owners: +- jshin@chromium.org +- tranbaoduy@chromium.org +schema: + type: boolean +supported_on: +- chrome_os:108- +tags: [] +type: main
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/HistoryClustersVisible.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/HistoryClustersVisible.yaml index 811f09b1..fc65eeb 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/HistoryClustersVisible.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/HistoryClustersVisible.yaml
@@ -33,5 +33,6 @@ supported_on: - chrome.*:97- - chrome_os:97- +- android:107- tags: [] type: main
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/InsecureFormsWarningsEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/InsecureFormsWarningsEnabled.yaml index 9d8253b..c5440e2 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/InsecureFormsWarningsEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/InsecureFormsWarningsEnabled.yaml
@@ -10,6 +10,11 @@ per_profile: true future_on: - fuchsia +items: +- caption: Show warnings and disable autofill on insecure forms + value: true +- caption: Do not show warnings or disable autofill on insecure forms + value: false owners: - carlosil@chromium.org - estark@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/InstantTetheringAllowed.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/InstantTetheringAllowed.yaml index 6e588c4..969a273 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/InstantTetheringAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/InstantTetheringAllowed.yaml
@@ -10,6 +10,11 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Allow users to use Instant Tethering + value: true +- caption: Do not allow users to use Instant Tethering + value: false owners: - hansberry@chromium.org - khorimoto@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/IntensiveWakeUpThrottlingEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/IntensiveWakeUpThrottlingEnabled.yaml index 495d982..5d1f2e5 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/IntensiveWakeUpThrottlingEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/IntensiveWakeUpThrottlingEnabled.yaml
@@ -1,7 +1,7 @@ caption: Control the <ph name="PRODUCT_NAME">IntensiveWakeUpThrottling</ph> feature. default: null desc: "When enabled the <ph name=\"PRODUCT_NAME\">IntensiveWakeUpThrottling</ph> feature\ - \ causes Javascript timers in background tabs to be aggressively throttled and coalesced,\ + \ causes JavaScript timers in background tabs to be aggressively throttled and coalesced,\ \ running no more than once per minute after a page has been backgrounded for 5\ \ minutes or more.\n\n This is a web standards compliant feature, but it\ \ may break functionality\n on some websites by causing certain actions\ @@ -24,6 +24,14 @@ per_profile: false future_on: - fuchsia +items: +- caption: Force throttling of background JavaScript timers + value: true +- caption: Force no throttling of background JavaScript timers + value: false +- caption: Allow throttling of background JavaScript timers to be controlled by Chrome + logic and configured by users + value: null owners: - file://components/performance_manager/OWNERS - chrisha@google.com
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/IsolatedWebAppInstallForceList.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/IsolatedWebAppInstallForceList.yaml new file mode 100644 index 0000000..fe80f8b --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/IsolatedWebAppInstallForceList.yaml
@@ -0,0 +1,32 @@ +caption: Configure list of force-installed Isolated Web Apps +desc: |- + Setting the policy specifies a list of isolated web apps (IWAs) that install silently. + IWAs are applications that have useful security properties unavailable to normal web pages. They are packaged in a Signed Web Bundle. The public key of the Signed Web Bundle is used to create the Web Bundle ID that identifies the IWA. + So far this policy works for Managed Guest Session only. + + Each list item of the policy is an object with the update manifest <ph name="URL_LABEL">URL</ph> and Web Bundle ID of the Isolated Web App. Both fields are mandatory. +example_value: +- update_manifest_url: https://example.com/isolated_web_app/update_manifest.json + web_bundle_id: aerugqztij5biqquuk3mfwpsaibuegaqcitgfchwuosuofdjabzqaaic +features: + dynamic_refresh: true + per_profile: true +future_on: +- chrome_os +owners: +- file://chrome/browser/web_applications/OWNERS +- peletskyi@chromium.org +schema: + items: + properties: + update_manifest_url: + type: string + web_bundle_id: + type: string + required: + - update_manifest_url + - web_bundle_id + type: object + type: array +tags: [] +type: dict
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/KeepFullscreenWithoutNotificationUrlAllowList.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/KeepFullscreenWithoutNotificationUrlAllowList.yaml index d93626b..96d4257 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/KeepFullscreenWithoutNotificationUrlAllowList.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/KeepFullscreenWithoutNotificationUrlAllowList.yaml
@@ -3,7 +3,7 @@ desc: |- Configure a list of URLs that are allowed to stay in full screen mode without showing a notification when the device returns from the lock screen. - Normally, full screen mode is turned off when returning from the lock screen in order to reduce the risk of phishing attacks. This policy allows to specify URLs that will be considered trusted sources which are permitted to continue full screen mode on unlock. It is set by specifying a list of URL patterns formatted according to this format ( https://www.chromium.org/administrators/url-blocklist-filter-format ). E.g., it is possible to always keep full screen mode on unlock and disable the notifications altogether by specifying the wildcard character <ph name="WILDCARD_VALUE">*</ph> matching all URLs. + Normally, full screen mode is turned off when returning from the lock screen in order to reduce the risk of phishing attacks. This policy allows to specify URLs that will be considered trusted sources which are permitted to continue full screen mode on unlock. It is set by specifying a list of URL patterns formatted according to this format ( https://support.google.com/chrome/a?p=url_blocklist_filter_format ). E.g., it is possible to always keep full screen mode on unlock and disable the notifications altogether by specifying the wildcard character <ph name="WILDCARD_VALUE">*</ph> matching all URLs. Setting this policy to an empty list or leaving it unset means no URLs are allowed to continue full screen mode without a notification. example_value:
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/LockScreenMediaPlaybackEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/LockScreenMediaPlaybackEnabled.yaml index 727c479..3b63aa5b 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/LockScreenMediaPlaybackEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/LockScreenMediaPlaybackEnabled.yaml
@@ -8,6 +8,11 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Allow users to play media when the device is locked + value: true +- caption: Do not allow users to play media when the device is locked + value: false owners: - file://services/media_session/OWNERS - mlamouri@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/LoginDisplayPasswordButtonEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/LoginDisplayPasswordButtonEnabled.yaml index cf67d2a..fa2b440 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/LoginDisplayPasswordButtonEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/LoginDisplayPasswordButtonEnabled.yaml
@@ -8,6 +8,11 @@ features: dynamic_refresh: false per_profile: true +items: +- caption: Show the display password button on the login and lock screen + value: true +- caption: Do not show the display password button on the login and lock screen + value: false owners: - rsorokin@chromium.org - cros-oac@google.com
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/ManagedGuestSessionPrivacyWarningsEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/ManagedGuestSessionPrivacyWarningsEnabled.yaml index e1d6fbe..8123c84 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/ManagedGuestSessionPrivacyWarningsEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/ManagedGuestSessionPrivacyWarningsEnabled.yaml
@@ -13,6 +13,11 @@ can_be_recommended: false dynamic_refresh: true per_profile: false +items: +- caption: Show privacy notifications until dismissed by the user + value: true +- caption: Do not show privacy notifications + value: false owners: - file://components/policy/resources/OWNERS - ayaelattar@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/NativeMessagingBlacklist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/NativeMessagingBlacklist.yaml new file mode 100644 index 0000000..52fc7c11 --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/NativeMessagingBlacklist.yaml
@@ -0,0 +1,21 @@ +caption: Configure native messaging blocklist +deprecated: true +desc: This policy is deprecated and unsupported, please use the '<ph name="NATIVE_MESSAGING_BLOCKLIST_POLICY_NAME">NativeMessagingBlocklist</ph>' policy instead. +example_value: +- com.native.messaging.host.name1 +- com.native.messaging.host.name2 +features: + dynamic_refresh: true + per_profile: true +label: Names of the forbidden native messaging hosts (or * for all) +owners: +- file://components/policy/resources/OWNERS +- rsorokin@chromium.org +schema: + items: + type: string + type: array +supported_on: +- chrome.*:34-100 +tags: [] +type: list
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/NativeMessagingWhitelist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/NativeMessagingWhitelist.yaml new file mode 100644 index 0000000..4c09a0ce --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/NativeMessagingWhitelist.yaml
@@ -0,0 +1,21 @@ +caption: Configure native messaging allowlist +deprecated: true +desc: This policy is deprecated and unsupported, please use the '<ph name="NATIVE_MESSAGING_ALLOWLIST_POLICY_NAME">NativeMessagingAllowlist</ph>' policy instead. +example_value: +- com.native.messaging.host.name1 +- com.native.messaging.host.name2 +features: + dynamic_refresh: true + per_profile: true +label: Names of the native messaging hosts to exempt from the blocklist +owners: +- file://components/policy/resources/OWNERS +- rsorokin@chromium.org +schema: + items: + type: string + type: array +supported_on: +- chrome.*:34-100 +tags: [] +type: list
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/NativePrintersBulkBlacklist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/NativePrintersBulkBlacklist.yaml new file mode 100644 index 0000000..039e5a24 --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/NativePrintersBulkBlacklist.yaml
@@ -0,0 +1,25 @@ +caption: Disabled enterprise printers +deprecated: true +desc: |- + If <ph name="PRINTERS_BLACKLIST">BlacklistRestriction</ph> is chosen for <ph name="BULK_PRINTERS_ACCESS_MODE_POLICY_NAME">NativePrintersBulkAccessMode</ph>, then setting <ph name="NATIVE_PRINTERS_BULK_BLACKLIST_POLICY_NAME">NativePrintersBulkBlacklist</ph> specifies which printers users can't use. All printers are provided to the user, except for the IDs listed in this policy. The IDs must correspond to the <ph name="ID_FIELD">"id"</ph> or <ph name="GUID_FIELD">"guid"</ph> fields in the file specified in <ph name="BULK_PRINTERS_POLICY_NAME">NativePrintersBulkConfiguration</ph>. + + This policy is deprecated, please use <ph name="PRINTERS_BULK_BLOCKLIST">PrintersBulkBlocklist</ph> instead. +example_value: +- id1 +- id2 +- id3 +features: + dynamic_refresh: true + per_profile: true +owners: +- file://chromeos/printing/OWNERS +- thestig@chromium.org +- skau@chromium.org +schema: + items: + type: string + type: array +supported_on: +- chrome_os:65-100 +tags: [] +type: list
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/NativePrintersBulkWhitelist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/NativePrintersBulkWhitelist.yaml new file mode 100644 index 0000000..d7204133 --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/NativePrintersBulkWhitelist.yaml
@@ -0,0 +1,25 @@ +caption: Enabled enterprise printers +deprecated: true +desc: |- + If <ph name="PRINTERS_WHITELIST">WhitelistPrintersOnly</ph> is chosen for <ph name="BULK_PRINTERS_ACCESS_MODE_POLICY_NAME">NativePrintersBulkAccessMode</ph>, then setting <ph name="NATIVE_PRINTERS_BULK_WHITELIST_POLICY_NAME">NativePrintersBulkWhitelist</ph> specifies which printers users can use. Only the printers with IDs matching the values in this policy are available to the user. The IDs must correspond to the <ph name="ID_FIELD">"id"</ph> or <ph name="GUID_FIELD">"guid"</ph> fields in the file specified in <ph name="NATIVE_PRINTERS_BULK_CONFIGURATION_POLICY_NAME">NativePrintersBulkConfiguration</ph>. + + This policy is deprecated, please use <ph name="PRINTERS_BULK_ALLOWLIST_POLICY_NAME">PrintersBulkAllowlist</ph> instead. +example_value: +- id1 +- id2 +- id3 +features: + dynamic_refresh: true + per_profile: true +owners: +- file://chromeos/printing/OWNERS +- thestig@chromium.org +- skau@chromium.org +schema: + items: + type: string + type: array +supported_on: +- chrome_os:65-100 +tags: [] +type: list
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/NearbyShareAllowed.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/NearbyShareAllowed.yaml index 1c6f1fa..ddea78b 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/NearbyShareAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/NearbyShareAllowed.yaml
@@ -10,6 +10,11 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Allow users to enable Nearby Share + value: true +- caption: Prevent users from enabling Nearby Share + value: false owners: - danlee@google.com - hansberry@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/NoteTakingAppsLockScreenWhitelist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/NoteTakingAppsLockScreenWhitelist.yaml new file mode 100644 index 0000000..6f590c5 --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/NoteTakingAppsLockScreenWhitelist.yaml
@@ -0,0 +1,19 @@ +caption: Allowlist note-taking apps allowed on the <ph name="PRODUCT_OS_NAME">$2<ex>Google + ChromeOS</ex></ph> lock screen +deprecated: true +desc: This policy is deprecated and unsupported, please use <ph name="NOTE_TAKING_APPS_LOCK_SCREEN_ALLOWLIST">NoteTakingAppsLockScreenAllowlist</ph> instead. +example_value: +- abcdefghabcdefghabcdefghabcdefgh +features: + dynamic_refresh: true + per_profile: true +owners: +- tbarzic@chromium.org +schema: + items: + type: string + type: array +supported_on: +- chrome_os:61-100 +tags: [] +type: list
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/PaymentMethodQueryEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/PaymentMethodQueryEnabled.yaml index 4b8d7f2..6380e83 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/PaymentMethodQueryEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/PaymentMethodQueryEnabled.yaml
@@ -11,6 +11,11 @@ per_profile: true future_on: - fuchsia +items: +- caption: Allow websites to check if the user has payment methods saved + value: true +- caption: Always tell websites that no payment methods are saved + value: false owners: - file://components/payments/OWNERS - nburris@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/PerAppTimeLimitsWhitelist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/PerAppTimeLimitsWhitelist.yaml new file mode 100644 index 0000000..55d68daf --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/PerAppTimeLimitsWhitelist.yaml
@@ -0,0 +1,46 @@ +caption: Per-App Time Limits Allowlist +deprecated: true +desc: This policy is deprecated and unsupported , please use <ph name="PER_APP_TIME_LIMITS_ALLOWLIST">PerAppTimeLimitsAllowlist</ph> instead. +example_value: + app_list: + - app_id: pjkljhegncpnkpknbcohdijeoejaedia + app_type: EXTENSION + - app_id: iniodglblcgmngkgdipeiclkdjjpnlbn + app_type: BUILT-IN + url_list: + - chrome://* + - file://* + - https://www.support.google.com + - https://www.policies.google.com +features: + dynamic_refresh: true + per_profile: false +owners: +- yilkal@chromium.org +- cros-families-eng@google.com +schema: + properties: + app_list: + items: + properties: + app_id: + type: string + app_type: + enum: + - ARC + - BUILT-IN + - EXTENSION + - WEB + - CROSTINI + type: string + type: object + type: array + url_list: + items: + type: string + type: array + type: object +supported_on: +- 'chrome_os: 80-100' +tags: [] +type: dict
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/PhoneHubAllowed.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/PhoneHubAllowed.yaml index 8b95a3f..ba48d9a 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/PhoneHubAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/PhoneHubAllowed.yaml
@@ -10,6 +10,11 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Allow Phone Hub to be enabled + value: true +- caption: Do not allow Phone Hub to be enabled + value: false owners: - khorimoto@google.com - danlee@google.com
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/PhoneHubNotificationsAllowed.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/PhoneHubNotificationsAllowed.yaml index 8434e4c..ba70f263 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/PhoneHubNotificationsAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/PhoneHubNotificationsAllowed.yaml
@@ -9,6 +9,11 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Allow Phone Hub notifications to be enabled + value: true +- caption: Do not allow Phone Hub notifications to be enabled + value: false owners: - khorimoto@google.com - danlee@google.com
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/PhoneHubTaskContinuationAllowed.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/PhoneHubTaskContinuationAllowed.yaml index f7d3efc..fba0e86 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/PhoneHubTaskContinuationAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/PhoneHubTaskContinuationAllowed.yaml
@@ -9,6 +9,11 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Allow Phone Hub task continuation to be enabled + value: true +- caption: Do not allow Phone Hub task continuation to be enabled + value: false owners: - khorimoto@google.com - danlee@google.com
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/PrimaryMouseButtonSwitch.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/PrimaryMouseButtonSwitch.yaml index 932adf9..dcf2a37 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/PrimaryMouseButtonSwitch.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/PrimaryMouseButtonSwitch.yaml
@@ -1,4 +1,5 @@ caption: Switch the primary mouse button to the right button +default: null desc: |- Switch the primary mouse button to the right button. @@ -14,6 +15,13 @@ can_be_recommended: true dynamic_refresh: true per_profile: true +items: +- caption: Right button is primary + value: true +- caption: Left button is primary + value: false +- caption: Allow the user to decide + value: null owners: - amraboelkher@chromium.org - emaxx@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/PrintingAPIExtensionsWhitelist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/PrintingAPIExtensionsWhitelist.yaml new file mode 100644 index 0000000..10cd5277 --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/PrintingAPIExtensionsWhitelist.yaml
@@ -0,0 +1,25 @@ +caption: Extensions allowed to skip confirmation dialog when sending print jobs via + chrome.printing API +deprecated: true +desc: |- + This policy specifies the allowed extensions to skip print job confirmation dialog when they use the <ph name="PRINTING_API">Printing API</ph> function <ph name="SUBMIT_JOB_FUNCTION">chrome.printing.submitJob()</ph> for sending a print job. + + If an extension is not in the list, or the list is not set, the print job confirmation dialog will be shown to the user for every <ph name="SUBMIT_JOB_FUNCTION">chrome.printing.submitJob()</ph> function call. + + This policy is deprecated, please use <ph name="PRINTING_API_EXTENSIONS_ALLOWLIST_POLICY_NAME">PrintingAPIExtensionsAllowlist</ph> instead. +example_value: +- abcdefghabcdefghabcdefghabcdefgh +features: + dynamic_refresh: true + per_profile: true +owners: +- srad@google.com +- pawliczek@chromium.org +schema: + items: + type: string + type: array +supported_on: +- chrome_os:81-100 +tags: [] +type: list
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/PromotionalTabsEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/PromotionalTabsEnabled.yaml index 046fbae6..f080a9d 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/PromotionalTabsEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/PromotionalTabsEnabled.yaml
@@ -11,6 +11,11 @@ per_profile: false future_on: - fuchsia +items: +- caption: Enable showing full-tab promotional content + value: true +- caption: Disable showing full-tab promotional content + value: false owners: - grt@chromium.org - rbpotter@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/PromptForDownloadLocation.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/PromptForDownloadLocation.yaml index 6cd605e..0eb6bd6 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/PromptForDownloadLocation.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/PromptForDownloadLocation.yaml
@@ -1,4 +1,5 @@ caption: Ask where to save each file before downloading +default: null desc: |- Setting the policy to Enabled means users are asked where to save each file before downloading. Setting the policy to Disabled has downloads start immediately, and users aren't asked where to save the file. @@ -9,6 +10,13 @@ per_profile: true future_on: - fuchsia +items: +- caption: Ask the user where to save the file before downloading + value: true +- caption: Do not ask the user (downloads start immediately) + value: false +- caption: Allow the user to decide + value: null owners: - macourteau@chromium.org - zmin@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/QuicAllowed.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/QuicAllowed.yaml index ede7e47..2cc95a0c 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/QuicAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/QuicAllowed.yaml
@@ -9,6 +9,11 @@ per_profile: false future_on: - fuchsia +items: +- caption: Allow QUIC + value: true +- caption: Disallow QUIC + value: false owners: - file://components/policy/resources/OWNERS - zmin@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/QuickUnlockModeWhitelist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/QuickUnlockModeWhitelist.yaml new file mode 100644 index 0000000..e7a210f8 --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/QuickUnlockModeWhitelist.yaml
@@ -0,0 +1,41 @@ +caption: Configure allowed quick unlock modes +default_for_enterprise_users: [] +deprecated: true +desc: |- + Setting the policy controls which quick unlock modes can unlock the lock screen. + + To allow: + + * Every quick unlock mode, use ["all"] (includes modes added in the future). + + * Only PIN unlock, use ["PIN"]. + + * PIN and fingerprint, use ["PIN", "FINGERPRINT"]. + + If the policy is unset or set to an empty list, no quick unlock modes are available for managed devices. + + This policy is deprecated, please use <ph name="QUICK_UNLOCK_MODE_ALLOW_LIST_POLICY_NAME">QuickUnlockModeAllowlist</ph> instead +example_value: +- PIN +features: + dynamic_refresh: true + per_profile: true +items: +- caption: All + name: all + value: all +- caption: PIN + name: PIN + value: PIN +- caption: Fingerprint + name: FINGERPRINT + value: FINGERPRINT +owners: +- file://components/policy/resources/OWNERS +- rsorokin@chromium.org +schema: + $ref: QuickUnlockModeWhitelist +supported_on: +- chrome_os:56-100 +tags: [] +type: string-enum-list
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/RC4Enabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/RC4Enabled.yaml index d01b86a..091adbf 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/RC4Enabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/RC4Enabled.yaml
@@ -1,7 +1,7 @@ caption: Enable RC4 cipher suites in TLS deprecated: true desc: |- - Warning: RC4 will be completely removed from <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> after version 52 (around September 2016) and this policy will stop working then. + This policy was removed in M53 after RC4 was removed from <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>. If the policy is not set, or is set to false, then RC4 cipher suites in TLS will not be enabled. Otherwise it may be set to true to retain compatibility with an outdated server. This is a stopgap measure and the server should be reconfigured. example_value: false
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/RendererCodeIntegrityEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/RendererCodeIntegrityEnabled.yaml index a35614f..eb3bc112 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/RendererCodeIntegrityEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/RendererCodeIntegrityEnabled.yaml
@@ -9,6 +9,11 @@ features: dynamic_refresh: false per_profile: false +items: +- caption: Enable Renderer Code Integrity + value: true +- caption: Disable Renderer Code Integrity + value: false owners: - wfh@chromium.org - adetaylor@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/SSLVersionFallbackMin.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/SSLVersionFallbackMin.yaml index 7bebe36..5108c7c 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/SSLVersionFallbackMin.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/SSLVersionFallbackMin.yaml
@@ -1,7 +1,7 @@ caption: Minimum TLS version to fallback to deprecated: true desc: |- - Warning: The TLS version fallback will be removed from <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> after version 52 (around September 2016) and this policy will stop working then. + This policy was removed in M53 after TLS version fallback was removed from <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>. When a TLS handshake fails, <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> would previously retry the connection with a lesser version of TLS in order to work around bugs in HTTPS servers. This setting configures the version at which this fallback process will stop. If a server performs version negotiation correctly (i.e. without breaking the connection) then this setting doesn't apply. Regardless, the resulting connection must still comply with SSLVersionMin.
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/SSLVersionMax.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/SSLVersionMax.yaml index a2484dab..0b69f7db 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/SSLVersionMax.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/SSLVersionMax.yaml
@@ -1,7 +1,7 @@ caption: Maximum SSL version enabled deprecated: true desc: |- - Warning: The max TLS version policy will be entirely removed from <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> around version 75 (around June 2019). + This policy was removed in M75 after the max TLS version policy was removed from <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>. If this policy is not configured then <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> uses the default maximum version.
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/SafeBrowsingWhitelistDomains.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/SafeBrowsingWhitelistDomains.yaml new file mode 100644 index 0000000..e057c15f --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/SafeBrowsingWhitelistDomains.yaml
@@ -0,0 +1,28 @@ +caption: Configure the list of domains on which Safe Browsing will not trigger warnings. +deprecated: true +desc: |- + This policy is deprecated, please use <ph name="SAFE_BROWSING_ALLOWLIST_DOMAINS_POLICY_NAME">SafeBrowsingAllowlistDomains</ph> instead. + + Setting the policy to Enabled means Safe Browsing will trust the domains you designate. It won't check them for dangerous resources such as phishing, malware, or unwanted software. Safe Browsing's download protection service won't check downloads hosted on these domains. Its password protection service won't check for password reuse. + + Setting the policy to Disabled or leaving it unset means default Safe Browsing protection applies to all resources. + + On <ph name="MS_WIN_NAME">Microsoft® Windows®</ph>, this functionality is only available on instances that are joined to a <ph name="MS_AD_NAME">Microsoft® Active Directory®</ph> domain, running on Windows 10 Pro, or enrolled in <ph name="CHROME_BROWSER_CLOUD_MANAGEMENT_NAME">Chrome Browser Cloud Management</ph>. On <ph name="MAC_OS_NAME">macOS</ph>, this functionality is only available on instances that are managed via MDM, or joined to a domain via MCX. +example_value: +- mydomain.com +- myuniversity.edu +features: + dynamic_refresh: true + per_profile: true +owners: +- nwokedi@chromium.org +- nparker@chromium.org +schema: + items: + type: string + type: array +supported_on: +- chrome.*:68-100 +- chrome_os:68-100 +tags: [] +type: list
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/ScrollToTextFragmentEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/ScrollToTextFragmentEnabled.yaml index d26beb7..2b99e5f 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/ScrollToTextFragmentEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/ScrollToTextFragmentEnabled.yaml
@@ -12,6 +12,11 @@ per_profile: true future_on: - fuchsia +items: +- caption: Allow sites to scroll to specific text fragments via URL + value: true +- caption: Do not allow sites to scroll to specific text fragments via URL + value: false owners: - dlibby@microsoft.com - bokan@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/SharedClipboardEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/SharedClipboardEnabled.yaml index 4b01be4..e3446599 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/SharedClipboardEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/SharedClipboardEnabled.yaml
@@ -17,6 +17,11 @@ per_profile: true future_on: - fuchsia +items: +- caption: Enable the shared clipboard feature + value: true +- caption: Disable the shared clipboard feature + value: false owners: - mvanouwerkerk@chromium.org - yasmo@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/ShowFullUrlsInAddressBar.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/ShowFullUrlsInAddressBar.yaml index 31507bb..5bd14ee 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/ShowFullUrlsInAddressBar.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/ShowFullUrlsInAddressBar.yaml
@@ -14,6 +14,13 @@ per_profile: true future_on: - fuchsia +items: +- caption: Display the full URL + value: true +- caption: Display the default URL + value: false +- caption: Display the default URL, allow users to switch to the full URL + value: null owners: - livvielin@chromium.org - enamelites@google.com
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/ShowLogoutButtonInTray.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/ShowLogoutButtonInTray.yaml index 55f5325..2ae6aba1 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/ShowLogoutButtonInTray.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/ShowLogoutButtonInTray.yaml
@@ -7,6 +7,11 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Show logout button in tray + value: true +- caption: Do not show logout button in tray + value: false owners: - file://components/policy/resources/OWNERS - bartfab@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/SitePerProcess.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/SitePerProcess.yaml index f6d4aa7e..600008c9 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/SitePerProcess.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/SitePerProcess.yaml
@@ -14,6 +14,11 @@ per_profile: false future_on: - fuchsia +items: +- caption: Require site isolation for all websites + value: true +- caption: Enable site isolation for all websites, but allow the user to opt out + value: false owners: - alexmos@chromium.org - creis@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/SitePerProcessAndroid.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/SitePerProcessAndroid.yaml index 71eda29..b124ed9 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/SitePerProcessAndroid.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/SitePerProcessAndroid.yaml
@@ -1,4 +1,5 @@ caption: Enable Site Isolation for every site +default: null desc: |- Setting the policy to Enabled isolates all sites on Android, such that each site runs in its own process, and it prevents users from opting out. A site is a scheme plus eTLD+1 (e.g., https://example.com). Note that Android isolates certain sensitive sites by default starting in <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> version 77, and this policy extends that default site isolation mode to apply to all sites. @@ -14,6 +15,13 @@ features: dynamic_refresh: false per_profile: false +items: +- caption: Require site isolation for all websites + value: true +- caption: Disable site isolation for all websites, but allow the user to enable it + value: false +- caption: Allow the user to decide + value: null owners: - alexmos@chromium.org - creis@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/SmartLockSigninAllowed.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/SmartLockSigninAllowed.yaml index 463a1396..e1d9d33d 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/SmartLockSigninAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/SmartLockSigninAllowed.yaml
@@ -10,6 +10,11 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Allow users to sign into their device with Smart Lock + value: true +- caption: Do not allow users to sign into their device with Smart Lock + value: false owners: - hansberry@chromium.org - jhawkins@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/SmsMessagesAllowed.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/SmsMessagesAllowed.yaml index d177f5f..2e11c04 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/SmsMessagesAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/SmsMessagesAllowed.yaml
@@ -10,6 +10,11 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Allow users to sync SMS messages between their phone and Chromebook + value: true +- caption: Do not allow users to sync SMS messages between their phone and Chromebook + value: false owners: - jlklein@chromium.org - jonmann@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/SpellcheckLanguageBlacklist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/SpellcheckLanguageBlacklist.yaml new file mode 100644 index 0000000..c2a1b2d2 --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/SpellcheckLanguageBlacklist.yaml
@@ -0,0 +1,35 @@ +caption: Force disable spellcheck languages +deprecated: true +desc: |- + This policy is deprecated, please use <ph name="SPELLCHECK_LANGUAGE_BLOCKLIST_POLICY_NAME">SpellcheckLanguageBlocklist</ph> instead. + + Force-disables spellcheck languages. Unrecognized languages in that list will be ignored. + + If you enable this policy, spellcheck will be disabled for the languages specified. The user can still enable or disable spellcheck for languages not in the list. + + If you do not set this policy, or disable it, there will be no change to the user's spellcheck preferences. + + If the <ph name="SPELLCHECK_ENABLED_POLICY_NAME">SpellcheckEnabled</ph> policy is set to false, this policy will have no effect. + + If a language is included in both this policy and the <ph name="SPELLCHECK_LANGUAGE_POLICY_NAME">SpellcheckLanguage</ph> policy, the latter is prioritized and the spellcheck language will be enabled. + + The currently supported languages are: af, bg, ca, cs, da, de, el, en-AU, en-CA, en-GB, en-US, es, es-419, es-AR, es-ES, es-MX, es-US, et, fa, fo, fr, he, hi, hr, hu, id, it, ko, lt, lv, nb, nl, pl, pt-BR, pt-PT, ro, ru, sh, sk, sl, sq, sr, sv, ta, tg, tr, uk, vi. +example_value: +- fr +- es +features: + can_be_recommended: false + dynamic_refresh: true + per_profile: true +owners: +- gujen@google.com +schema: + items: + type: string + type: array +supported_on: +- chrome.win:75-100 +- chrome.linux:75-100 +- chrome_os:75-100 +tags: [] +type: list
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/StartupBrowserWindowLaunchSuppressed.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/StartupBrowserWindowLaunchSuppressed.yaml index 2a0fa4f0..92a4b4e 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/StartupBrowserWindowLaunchSuppressed.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/StartupBrowserWindowLaunchSuppressed.yaml
@@ -9,6 +9,11 @@ features: dynamic_refresh: false per_profile: true +items: +- caption: Do not launch the browser on startup + value: true +- caption: Automatically launch the browser on startup + value: false owners: - file://components/policy/resources/OWNERS - hendrich@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/SuggestedContentEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/SuggestedContentEnabled.yaml index 682b33f..97e4927 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/SuggestedContentEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/SuggestedContentEnabled.yaml
@@ -11,6 +11,11 @@ can_be_recommended: true dynamic_refresh: true per_profile: true +items: +- caption: Enable suggested content + value: true +- caption: Disable suggested content + value: false owners: - wrong@chromium.org - chrome-knowledge-eng@google.com
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/SuppressUnsupportedOSWarning.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/SuppressUnsupportedOSWarning.yaml index 8e3288a..95387cd 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/SuppressUnsupportedOSWarning.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/SuppressUnsupportedOSWarning.yaml
@@ -9,6 +9,11 @@ per_profile: false future_on: - fuchsia +items: +- caption: Suppress warnings when Chrome is running on an unsupported system + value: true +- caption: Allow Chrome to display warnings when running on an unsupported system + value: false owners: - grt@chromium.org schema:
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/TaskManagerEndProcessEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/TaskManagerEndProcessEnabled.yaml index 5cc66fa04..f740156b 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/TaskManagerEndProcessEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/TaskManagerEndProcessEnabled.yaml
@@ -9,6 +9,11 @@ per_profile: false future_on: - fuchsia +items: +- caption: Allow users to end processes with the Chrome task manager + value: true +- caption: Block users from ending processes with the Chrome task manager + value: false owners: - file://components/policy/resources/OWNERS - atwilson@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/ThirdPartyBlockingEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/ThirdPartyBlockingEnabled.yaml index 751a6cd..09bab21 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/ThirdPartyBlockingEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/ThirdPartyBlockingEnabled.yaml
@@ -7,6 +7,11 @@ features: dynamic_refresh: false per_profile: false +items: +- caption: Prevent third party code from being injected into Chrome + value: true +- caption: Allow third party code to be injected into Chrome + value: false owners: - chrisha@chromium.org - pastarmovj@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/TouchVirtualKeyboardEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/TouchVirtualKeyboardEnabled.yaml index fb7f32ce..1fcec793 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/TouchVirtualKeyboardEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/TouchVirtualKeyboardEnabled.yaml
@@ -1,4 +1,5 @@ caption: Enable virtual keyboard +default: null desc: |- Controls the on-screen keyboard, acting as a supplementary policy to the <ph name="VIRTUAL_KEYBOARD_ENABLED_POLICY_NAME">VirtualKeyboardEnabled</ph> policy. @@ -16,6 +17,13 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Enable on-screen keyboard + value: true +- caption: Disable on-screen keyboard + value: false +- caption: Enable on-screen keyboard in tablet mode + value: null owners: - rsadam@chromium.org schema:
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/TripleDESEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/TripleDESEnabled.yaml index 2375d69..8e807fcc 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/TripleDESEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/TripleDESEnabled.yaml
@@ -1,13 +1,12 @@ caption: Enable 3DES cipher suites in TLS default: null deprecated: true -desc: "Warning: 3DES will be completely removed from <ph name=\"PRODUCT_NAME\">$1<ex>Google\ - \ Chrome</ex></ph> in version 95 (around October 2021) and this policy will stop\ - \ working then.\n\n If the policy is set to true, then 3DES cipher suites in\ - \ TLS will be enabled. If it is set to false, they will be disabled. If the policy\ - \ is unset, 3DES cipher suites are disabled by default. This policy may be used\ - \ to temporarily retain compatibility with an outdated server. This is a stopgap\ - \ measure and the server should be reconfigured.\n " +desc: "This policy was removed in M97 after 3DES was removed from <ph name=\"PRODUCT_NAME\"\ + >$1<ex>Google Chrome</ex></ph>.\n\n If the policy is set to true, then 3DES\ + \ cipher suites in TLS will be enabled. If it is set to false, they will be disabled.\ + \ If the policy is unset, 3DES cipher suites are disabled by default. This policy\ + \ may be used to temporarily retain compatibility with an outdated server. This\ + \ is a stopgap measure and the server should be reconfigured.\n " example_value: false features: dynamic_refresh: true
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/URLAllowlist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/URLAllowlist.yaml index 253038b..4ae1942 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/URLAllowlist.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/URLAllowlist.yaml
@@ -2,7 +2,7 @@ them to honor it. caption: Allow access to a list of URLs desc: |- - Setting the policy provides access to the listed URLs, as exceptions to <ph name="URL_BLOCKLIST_POLICY_NAME">URLBlocklist</ph>. See that policy's description for the format of entries of this list. For example, setting <ph name="URL_BLOCKLIST_POLICY_NAME">URLBlocklist</ph> to * will block all requests, and you can use this policy to allow access to a limited list of URLs. Use it to open exceptions to certain schemes, subdomains of other domains, ports, or specific paths, using the format specified at ( https://www.chromium.org/administrators/url-blocklist-filter-format ). The most specific filter determines if a URL is blocked or allowed. The <ph name="URL_ALLOWLIST_POLICY_NAME">URLAllowlist</ph> policy takes precedence over <ph name="URL_BLOCKLIST_POLICY_NAME">URLBlocklist</ph>. This policy is limited to 1,000 entries. + Setting the policy provides access to the listed URLs, as exceptions to <ph name="URL_BLOCKLIST_POLICY_NAME">URLBlocklist</ph>. See that policy's description for the format of entries of this list. For example, setting <ph name="URL_BLOCKLIST_POLICY_NAME">URLBlocklist</ph> to * will block all requests, and you can use this policy to allow access to a limited list of URLs. Use it to open exceptions to certain schemes, subdomains of other domains, ports, or specific paths, using the format specified at ( https://support.google.com/chrome/a?p=url_blocklist_filter_format ). The most specific filter determines if a URL is blocked or allowed. The <ph name="URL_ALLOWLIST_POLICY_NAME">URLAllowlist</ph> policy takes precedence over <ph name="URL_BLOCKLIST_POLICY_NAME">URLBlocklist</ph>. This policy is limited to 1,000 entries. This policy also allows enabling the automatic invocation by the browser of external application registered as protocol handlers for the listed protocols like "tel:" or "ssh:".
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/URLBlacklist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/URLBlacklist.yaml new file mode 100644 index 0000000..c2222491 --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/URLBlacklist.yaml
@@ -0,0 +1,32 @@ +arc_support: Android apps may voluntarily choose to honor this list. You cannot force + them to honor it. +caption: Block access to a list of URLs +deprecated: true +desc: This policy is deprecated and unsupported, please use the '<ph name="URL_BLOCKLIST_POLICY_NAME">URLBlocklist</ph>' policy instead. +example_value: +- example.com +- https://ssl.server.com +- hosting.com/bad_path +- https://server:8080/path +- .exact.hostname.com +- file://* +- custom_scheme:* +- '*' +features: + dynamic_refresh: true + per_profile: true +owners: +- file://components/policy/resources/OWNERS +- hendrich@chromium.org +schema: + items: + type: string + type: array +supported_on: +- chrome.*:15-100 +- chrome_os:15-100 +- android:30-100 +- webview_android:47-100 +tags: +- filtering +type: list
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/URLBlocklist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/URLBlocklist.yaml index 19f2330..fa2ef18 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/URLBlocklist.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/URLBlocklist.yaml
@@ -2,7 +2,7 @@ them to honor it. caption: Block access to a list of URLs desc: |- - Setting the policy prevents webpages with prohibited URLs from loading. It provides a list of URL patterns that specify forbidden URLs. Leaving the policy unset means no URLs are prohibited in the browser. Format the URL pattern according to this format ( https://www.chromium.org/administrators/url-blocklist-filter-format ). Up to 1,000 exceptions can be defined in <ph name="URL_ALLOWLIST_POLICY_NAME">URLAllowlist</ph>. + Setting the policy prevents webpages with prohibited URLs from loading. It provides a list of URL patterns that specify forbidden URLs. Leaving the policy unset means no URLs are prohibited in the browser. Format the URL pattern according to this format ( https://support.google.com/chrome/a?p=url_blocklist_filter_format ). Up to 1,000 exceptions can be defined in <ph name="URL_ALLOWLIST_POLICY_NAME">URLAllowlist</ph>. From <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> version 73, you can block javascript://* URLs. However, it affects only JavaScript entered in the address bar (or, for example, bookmarklets). In-page JavaScript URLs with dynamically loaded data aren't subject to this policy. For example, if you block example.com/abc, then example.com can still load example.com/abc using XMLHTTPRequest.
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/URLWhitelist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/URLWhitelist.yaml new file mode 100644 index 0000000..97ed323 --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/URLWhitelist.yaml
@@ -0,0 +1,28 @@ +arc_support: Android apps may voluntarily choose to honor this list. You cannot force + them to honor it. +caption: Allow access to a list of URLs +deprecated: true +desc: This policy is deprecated and unsupported, please use the '<ph name="URL_ALLOWLIST_POLICY_NAME">URLAllowlist</ph>' policy instead. +example_value: +- example.com +- https://ssl.server.com +- hosting.com/good_path +- https://server:8080/path +- .exact.hostname.com +features: + dynamic_refresh: true + per_profile: true +owners: +- file://components/policy/resources/OWNERS +- hendrich@chromium.org +schema: + items: + type: string + type: array +supported_on: +- chrome.*:15-100 +- chrome_os:15-100 +- android:30-100 +- webview_android:47-100 +tags: [] +type: list
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/UnifiedDesktopEnabledByDefault.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/UnifiedDesktopEnabledByDefault.yaml index a38e0b9..1e91613 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/UnifiedDesktopEnabledByDefault.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/UnifiedDesktopEnabledByDefault.yaml
@@ -8,6 +8,11 @@ can_be_recommended: false dynamic_refresh: true per_profile: false +items: +- caption: Make Unified Desktop mode available to the user + value: true +- caption: Do not make Unified Desktop mode available to the user + value: false owners: - phweiss@chromium.org schema:
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/UrlKeyedAnonymizedDataCollectionEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/UrlKeyedAnonymizedDataCollectionEnabled.yaml index 22b5683..fece879 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/UrlKeyedAnonymizedDataCollectionEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/UrlKeyedAnonymizedDataCollectionEnabled.yaml
@@ -1,4 +1,5 @@ caption: Enable URL-keyed anonymized data collection +default: null desc: |- Setting the policy to Enabled means URL-keyed anonymized data collection, which sends URLs of pages the user visits to Google to make searches and browsing better, is always active. @@ -11,6 +12,13 @@ per_profile: true future_on: - fuchsia +items: +- caption: URL-keyed anonymized data collection is always active + value: true +- caption: URL-keyed anonymized data collection is never active + value: false +- caption: Allow the user to decide + value: null owners: - file://base/metrics/OWNERS schema:
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/UsbDetachableWhitelist.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/UsbDetachableWhitelist.yaml new file mode 100644 index 0000000..7545a34 --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/UsbDetachableWhitelist.yaml
@@ -0,0 +1,23 @@ +caption: Allowlist of USB detachable devices +deprecated: true +desc: This policy is deprecated and unsupported, please use <ph name="USB_DETACHABLE_ALLOWLIST_POLICY_NAME">UsbDetachableAllowlist</ph> instead. +device_only: true +example_value: +- product_id: 24577 + vendor_id: 1027 +- product_id: 8453 + vendor_id: 16700 +features: + dynamic_refresh: false +owners: +- vpalatin@chromium.org +- hendrich@chromium.org +schema: + items: + $ref: UsbDeviceId + type: array +supported_on: +- chrome_os:51-100 +tags: +- system-security +type: dict
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/VideoCaptureAllowed.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/VideoCaptureAllowed.yaml index 8a414142..a486282 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/VideoCaptureAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/VideoCaptureAllowed.yaml
@@ -11,6 +11,11 @@ per_profile: true future_on: - fuchsia +items: +- caption: Enable video input + value: true +- caption: Disable video input + value: false owners: - file://components/policy/resources/OWNERS - pastarmovj@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/VirtualKeyboardResizesLayoutByDefault.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/VirtualKeyboardResizesLayoutByDefault.yaml new file mode 100644 index 0000000..4eed912 --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/VirtualKeyboardResizesLayoutByDefault.yaml
@@ -0,0 +1,27 @@ +caption: The virtual keyboard resizes the layout viewport by default +default: false +desc: "Setting the policy to True causes the virtual keyboard to resize the layout\ + \ viewport by default.\n Other states (False/unset) have no effect.\n\n \ + \ Note that this only affects the default resizing behavior: if a page requests\ + \ a specific behavior using a <meta> tag or the Virtual Keyboard API, then\ + \ that requested behavior will still apply.\n\n Note also that this is an \"\ + escape hatch\" policy that's intended to be short-lived.\n " +example_value: true +features: + dynamic_refresh: true + per_profile: true +items: +- caption: The default virtual keyboard resize behavior is changed to resize the layout + viewport + value: true +- caption: The default virtual keyboard resize behavior is not modified + value: false +owners: +- andruud@chromium.org +- bokan@chromium.org +schema: + type: boolean +supported_on: +- android:108- +tags: [] +type: main
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/VmManagementCliAllowed.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/VmManagementCliAllowed.yaml index 53b11905..7af84cb 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/VmManagementCliAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/VmManagementCliAllowed.yaml
@@ -7,6 +7,11 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Enable virtual machine command line access + value: true +- caption: Disable virtual machine command line access + value: false owners: - aoldemeier@chromium.org - okalitova@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/VpnConfigAllowed.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/VpnConfigAllowed.yaml index 24f31e4..e075041 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/VpnConfigAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/VpnConfigAllowed.yaml
@@ -7,6 +7,11 @@ features: dynamic_refresh: true per_profile: false +items: +- caption: Allow the user to manually disconnect or modify a VPN + value: true +- caption: Do not allow the user to manually disconnect or modify a VPN + value: false owners: - phweiss@chromium.org schema:
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/WebRtcEventLogCollectionAllowed.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/WebRtcEventLogCollectionAllowed.yaml index d0fc4fe..bbfede69 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/WebRtcEventLogCollectionAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/WebRtcEventLogCollectionAllowed.yaml
@@ -11,6 +11,11 @@ per_profile: true future_on: - fuchsia +items: +- caption: Allow WebRTC event log collection from Google services + value: true +- caption: Do not allow WebRTC event log collection from Google services + value: false owners: - eladalon@chromium.org schema:
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/WifiSyncAndroidAllowed.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/WifiSyncAndroidAllowed.yaml index b7ebb2b..342d3bc 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/WifiSyncAndroidAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/WifiSyncAndroidAllowed.yaml
@@ -13,6 +13,13 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Allow Wi-Fi network configurations to be synced across <ph name="PRODUCT_OS_NAME">$2<ex>Google + ChromeOS</ex></ph> devices and a connected Android phone + value: true +- caption: Do not allow Wi-Fi network configurations to be synced across <ph name="PRODUCT_OS_NAME">$2<ex>Google + ChromeOS</ex></ph> devices and a connected Android phone + value: false owners: - jonmann@chromium.org - chromeos-cross-device-eng@google.com
diff --git a/components/policy/resources/templates/policy_definitions/Network/DeviceWiFiAllowed.yaml b/components/policy/resources/templates/policy_definitions/Network/DeviceWiFiAllowed.yaml index 5503d348..f6ff301 100644 --- a/components/policy/resources/templates/policy_definitions/Network/DeviceWiFiAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Network/DeviceWiFiAllowed.yaml
@@ -8,6 +8,11 @@ features: dynamic_refresh: true per_profile: false +items: +- caption: Allow users to turn WiFi on or off + value: true +- caption: Disable WiFi + value: false owners: - apotapchuk@chromium.org schema:
diff --git a/components/policy/resources/templates/policy_definitions/Network/DeviceWiFiFastTransitionEnabled.yaml b/components/policy/resources/templates/policy_definitions/Network/DeviceWiFiFastTransitionEnabled.yaml index d060031..29609bd 100644 --- a/components/policy/resources/templates/policy_definitions/Network/DeviceWiFiFastTransitionEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Network/DeviceWiFiFastTransitionEnabled.yaml
@@ -8,6 +8,11 @@ features: dynamic_refresh: true per_profile: false +items: +- caption: Use Fast Transition when the wireless access point supports it + value: true +- caption: Disable Fast Transition + value: false owners: - matthewmwang@chromium.org schema:
diff --git a/components/policy/resources/templates/policy_definitions/NetworkFileShares/NTLMShareAuthenticationEnabled.yaml b/components/policy/resources/templates/policy_definitions/NetworkFileShares/NTLMShareAuthenticationEnabled.yaml index 71e9ac1..286ff8f9 100644 --- a/components/policy/resources/templates/policy_definitions/NetworkFileShares/NTLMShareAuthenticationEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/NetworkFileShares/NTLMShareAuthenticationEnabled.yaml
@@ -8,6 +8,11 @@ features: dynamic_refresh: false per_profile: true +items: +- caption: Use NTLM authentication + value: true +- caption: Do not use NTLM authentication + value: false owners: - amistry@chromium.org schema:
diff --git a/components/policy/resources/templates/policy_definitions/NetworkFileShares/NetBiosShareDiscoveryEnabled.yaml b/components/policy/resources/templates/policy_definitions/NetworkFileShares/NetBiosShareDiscoveryEnabled.yaml index 6724d758..d5ec646 100644 --- a/components/policy/resources/templates/policy_definitions/NetworkFileShares/NetBiosShareDiscoveryEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/NetworkFileShares/NetBiosShareDiscoveryEnabled.yaml
@@ -8,6 +8,11 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Allow NetBIOS share discovery + value: true +- caption: Do not allow NetBIOS share discovery + value: false owners: - amistry@chromium.org schema:
diff --git a/components/policy/resources/templates/policy_definitions/NetworkFileShares/NetworkFileSharesAllowed.yaml b/components/policy/resources/templates/policy_definitions/NetworkFileShares/NetworkFileSharesAllowed.yaml index 1ef8bf5..e7615c7 100644 --- a/components/policy/resources/templates/policy_definitions/NetworkFileShares/NetworkFileSharesAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/NetworkFileShares/NetworkFileSharesAllowed.yaml
@@ -5,6 +5,11 @@ features: dynamic_refresh: false per_profile: true +items: +- caption: Allow network file shares + value: true +- caption: Block network file shares + value: false owners: - amistry@chromium.org schema:
diff --git a/components/policy/resources/templates/policy_definitions/PluginVm/PluginVmAllowed.yaml b/components/policy/resources/templates/policy_definitions/PluginVm/PluginVmAllowed.yaml index a470aa4..0d754b4 100644 --- a/components/policy/resources/templates/policy_definitions/PluginVm/PluginVmAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/PluginVm/PluginVmAllowed.yaml
@@ -8,6 +8,11 @@ example_value: true features: dynamic_refresh: true +items: +- caption: Allow devices to use a PluginVm + value: true +- caption: Do not allow devices to use a PluginVm + value: false owners: - okalitova@chromium.org - aoldemeier@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/PluginVm/PluginVmDataCollectionAllowed.yaml b/components/policy/resources/templates/policy_definitions/PluginVm/PluginVmDataCollectionAllowed.yaml index c3adcec..e5ebc68 100644 --- a/components/policy/resources/templates/policy_definitions/PluginVm/PluginVmDataCollectionAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/PluginVm/PluginVmDataCollectionAllowed.yaml
@@ -8,6 +8,11 @@ features: dynamic_refresh: true per_profile: false +items: +- caption: Enable sharing diagnostics data to PluginVm + value: true +- caption: Disable sharing diagnostics data to PluginVm + value: false owners: - okalitova@chromium.org - janagrill@google.com
diff --git a/components/policy/resources/templates/policy_definitions/PluginVm/UserPluginVmAllowed.yaml b/components/policy/resources/templates/policy_definitions/PluginVm/UserPluginVmAllowed.yaml index d187073..0c67a7b9 100644 --- a/components/policy/resources/templates/policy_definitions/PluginVm/UserPluginVmAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/PluginVm/UserPluginVmAllowed.yaml
@@ -10,6 +10,11 @@ features: dynamic_refresh: true per_profile: false +items: +- caption: Allow users to use a PluginVm + value: true +- caption: Do not allow users to use a PluginVm + value: false owners: - okalitova@chromium.org - janagrill@google.com
diff --git a/components/policy/resources/templates/policy_definitions/PowerAndShutdown/DeviceRebootOnShutdown.yaml b/components/policy/resources/templates/policy_definitions/PowerAndShutdown/DeviceRebootOnShutdown.yaml index 99537a3..e1f3f69 100644 --- a/components/policy/resources/templates/policy_definitions/PowerAndShutdown/DeviceRebootOnShutdown.yaml +++ b/components/policy/resources/templates/policy_definitions/PowerAndShutdown/DeviceRebootOnShutdown.yaml
@@ -7,6 +7,12 @@ example_value: true features: dynamic_refresh: true +items: +- caption: Only allow users to turn off the device using the physical power button + value: true +- caption: Allow users to turn off the device using either the shut down icon or the + physical power button + value: false owners: - file://components/policy/resources/OWNERS - emaxx@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/PowerManagement/DeviceAdvancedBatteryChargeModeEnabled.yaml b/components/policy/resources/templates/policy_definitions/PowerManagement/DeviceAdvancedBatteryChargeModeEnabled.yaml index a5ad0d2d..7f642bd 100644 --- a/components/policy/resources/templates/policy_definitions/PowerManagement/DeviceAdvancedBatteryChargeModeEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/PowerManagement/DeviceAdvancedBatteryChargeModeEnabled.yaml
@@ -10,6 +10,11 @@ features: dynamic_refresh: true per_profile: false +items: +- caption: Enable advanced battery charge mode + value: true +- caption: Disable advanced battery charge mode + value: false owners: - lamzin@google.com schema:
diff --git a/components/policy/resources/templates/policy_definitions/PowerManagement/DeviceBootOnAcEnabled.yaml b/components/policy/resources/templates/policy_definitions/PowerManagement/DeviceBootOnAcEnabled.yaml index 9749d61..436c042 100644 --- a/components/policy/resources/templates/policy_definitions/PowerManagement/DeviceBootOnAcEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/PowerManagement/DeviceBootOnAcEnabled.yaml
@@ -10,6 +10,11 @@ features: dynamic_refresh: true per_profile: false +items: +- caption: Enable boot on AC + value: true +- caption: Disable boot on AC + value: false owners: - lamzin@google.com schema:
diff --git a/components/policy/resources/templates/policy_definitions/PowerManagement/DevicePowerPeakShiftEnabled.yaml b/components/policy/resources/templates/policy_definitions/PowerManagement/DevicePowerPeakShiftEnabled.yaml index fd4c53b8..7054dfd 100644 --- a/components/policy/resources/templates/policy_definitions/PowerManagement/DevicePowerPeakShiftEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/PowerManagement/DevicePowerPeakShiftEnabled.yaml
@@ -10,6 +10,11 @@ features: dynamic_refresh: true per_profile: false +items: +- caption: Enable peak shift power management + value: true +- caption: Disable peak shift power management + value: false owners: - lamzin@google.com schema:
diff --git a/components/policy/resources/templates/policy_definitions/PowerManagement/DeviceUsbPowerShareEnabled.yaml b/components/policy/resources/templates/policy_definitions/PowerManagement/DeviceUsbPowerShareEnabled.yaml index 623d242..3042ce5e 100644 --- a/components/policy/resources/templates/policy_definitions/PowerManagement/DeviceUsbPowerShareEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/PowerManagement/DeviceUsbPowerShareEnabled.yaml
@@ -14,6 +14,11 @@ features: dynamic_refresh: true per_profile: false +items: +- caption: Enable USB power share + value: true +- caption: Disable USB power share + value: false owners: - lamzin@google.com schema:
diff --git a/components/policy/resources/templates/policy_definitions/PowerManagement/PowerManagementUsesAudioActivity.yaml b/components/policy/resources/templates/policy_definitions/PowerManagement/PowerManagementUsesAudioActivity.yaml index 90f674f..39ab435 100644 --- a/components/policy/resources/templates/policy_definitions/PowerManagement/PowerManagementUsesAudioActivity.yaml +++ b/components/policy/resources/templates/policy_definitions/PowerManagement/PowerManagementUsesAudioActivity.yaml
@@ -7,6 +7,11 @@ features: dynamic_refresh: true per_profile: false +items: +- caption: Do not consider the user as idle while audio plays + value: true +- caption: Consider the user as idle while audio plays + value: false owners: - reinauer@google.com - chromeos-power@google.com
diff --git a/components/policy/resources/templates/policy_definitions/PowerManagement/PowerManagementUsesVideoActivity.yaml b/components/policy/resources/templates/policy_definitions/PowerManagement/PowerManagementUsesVideoActivity.yaml index 80a3ed20..370fc1e4 100644 --- a/components/policy/resources/templates/policy_definitions/PowerManagement/PowerManagementUsesVideoActivity.yaml +++ b/components/policy/resources/templates/policy_definitions/PowerManagement/PowerManagementUsesVideoActivity.yaml
@@ -9,6 +9,11 @@ features: dynamic_refresh: true per_profile: false +items: +- caption: Do not consider the user as idle while video plays + value: true +- caption: Consider the user as idle while video plays + value: false owners: - reinauer@google.com - chromeos-power@google.com
diff --git a/components/policy/resources/templates/policy_definitions/PowerManagement/PowerSmartDimEnabled.yaml b/components/policy/resources/templates/policy_definitions/PowerManagement/PowerSmartDimEnabled.yaml index 924407bb..d00e3c9 100644 --- a/components/policy/resources/templates/policy_definitions/PowerManagement/PowerSmartDimEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/PowerManagement/PowerSmartDimEnabled.yaml
@@ -7,6 +7,11 @@ features: dynamic_refresh: true per_profile: false +items: +- caption: Allow the smart dim model to extend the time until the screen dims + value: true +- caption: Do not allow the smart dim model to extend the time until the screen dims + value: false owners: - jiameng@chromium.org - ejcaruso@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/PowerManagement/WaitForInitialUserActivity.yaml b/components/policy/resources/templates/policy_definitions/PowerManagement/WaitForInitialUserActivity.yaml index d28beaf..c2a9cbd 100644 --- a/components/policy/resources/templates/policy_definitions/PowerManagement/WaitForInitialUserActivity.yaml +++ b/components/policy/resources/templates/policy_definitions/PowerManagement/WaitForInitialUserActivity.yaml
@@ -7,6 +7,12 @@ features: dynamic_refresh: true per_profile: false +items: +- caption: Start power management delays and session length limits after initial user + activity + value: true +- caption: Start power management delays and session length limits at session start + value: false owners: - reinauer@google.com - chromeos-power@google.com
diff --git a/components/policy/resources/templates/policy_definitions/Printing/DeletePrintJobHistoryAllowed.yaml b/components/policy/resources/templates/policy_definitions/Printing/DeletePrintJobHistoryAllowed.yaml index 94840f3..555f9d7b 100644 --- a/components/policy/resources/templates/policy_definitions/Printing/DeletePrintJobHistoryAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Printing/DeletePrintJobHistoryAllowed.yaml
@@ -12,6 +12,11 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Allow print job history to be deleted + value: true +- caption: Do not allow print job history to be deleted + value: false owners: - jimmyxgong@chromium.org - file://printing/OWNERS
diff --git a/components/policy/resources/templates/policy_definitions/Printing/DeviceNativePrintersAccessMode.yaml b/components/policy/resources/templates/policy_definitions/Printing/DeviceNativePrintersAccessMode.yaml new file mode 100644 index 0000000..5d0544c3 --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Printing/DeviceNativePrintersAccessMode.yaml
@@ -0,0 +1,31 @@ +caption: Device printers configuration access policy. +deprecated: true +desc: This policy is deprecated and unsupported, please use <ph name="DEVICE_PRINTERS_ACCESS_MODE_POLICY_NAME">DevicePrintersAccessMode</ph> instead. +device_only: true +example_value: 1 +features: + dynamic_refresh: true + per_profile: false +items: +- caption: All printers are shown except those in the blocklist. + name: BlocklistRestriction + value: 0 +- caption: Only printers in the allowlist are shown to users + name: AllowlistPrintersOnly + value: 1 +- caption: Allow all printers from the configuration file. + name: AllowAll + value: 2 +owners: +- srad@google.com +- pawliczek@chromium.org +schema: + enum: + - 0 + - 1 + - 2 + type: integer +supported_on: +- chrome_os:73-100 +tags: [] +type: int-enum
diff --git a/components/policy/resources/templates/policy_definitions/Printing/NativePrintersBulkAccessMode.yaml b/components/policy/resources/templates/policy_definitions/Printing/NativePrintersBulkAccessMode.yaml new file mode 100644 index 0000000..37270e9 --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/Printing/NativePrintersBulkAccessMode.yaml
@@ -0,0 +1,32 @@ +caption: Printer configuration access policy. +deprecated: true +desc: This policy is deprecated and unsuppported, please use <ph name="PRINTERS_BULK_ACCESS_MODE_POLICY_NAME_POLICY_NAME">PrintersBulkAccessMode</ph> instead. +example_value: 1 +features: + can_be_recommended: true + dynamic_refresh: true + per_profile: true +items: +- caption: All printers are shown except those in the blocklist. + name: BlocklistRestriction + value: 0 +- caption: Only printers in the allowlist are shown to users + name: AllowlistPrintersOnly + value: 1 +- caption: Allow all printers from the configuration file. + name: AllowAll + value: 2 +owners: +- file://chromeos/printing/OWNERS +- zentaro@chromium.org +- skau@chromium.org +schema: + enum: + - 0 + - 1 + - 2 + type: integer +supported_on: +- chrome_os:65-100 +tags: [] +type: int-enum
diff --git a/components/policy/resources/templates/policy_definitions/Printing/UserPrintersAllowed.yaml b/components/policy/resources/templates/policy_definitions/Printing/UserPrintersAllowed.yaml index f52f02c..236a8fd 100644 --- a/components/policy/resources/templates/policy_definitions/Printing/UserPrintersAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Printing/UserPrintersAllowed.yaml
@@ -8,6 +8,11 @@ features: dynamic_refresh: true per_profile: true +items: +- caption: Allow users to add, configure, and print from non-enterprise printers + value: true +- caption: Do not allow users to add, configure, and print from non-enterprise printers + value: false owners: - valleau@chromium.org - skau@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/PrivacyScreen/DeviceLoginScreenPrivacyScreenEnabled.yaml b/components/policy/resources/templates/policy_definitions/PrivacyScreen/DeviceLoginScreenPrivacyScreenEnabled.yaml index 7e854bb2..c1f6237e 100644 --- a/components/policy/resources/templates/policy_definitions/PrivacyScreen/DeviceLoginScreenPrivacyScreenEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/PrivacyScreen/DeviceLoginScreenPrivacyScreenEnabled.yaml
@@ -17,6 +17,13 @@ can_be_recommended: false dynamic_refresh: true per_profile: false +items: +- caption: Always enable the privacy screen on the sign-in screen + value: true +- caption: Always disable the privacy screen on the sign-in screen + value: false +- caption: Allow the user to decide + value: null owners: - lamzin@google.com - gildekel@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/PrivacyScreen/PrivacyScreenEnabled.yaml b/components/policy/resources/templates/policy_definitions/PrivacyScreen/PrivacyScreenEnabled.yaml index e433aab..18d70f5 100644 --- a/components/policy/resources/templates/policy_definitions/PrivacyScreen/PrivacyScreenEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/PrivacyScreen/PrivacyScreenEnabled.yaml
@@ -16,6 +16,13 @@ can_be_recommended: false dynamic_refresh: true per_profile: false +items: +- caption: Always enable the privacy screen + value: true +- caption: Always disable the privacy screen + value: false +- caption: Allow the user to decide + value: null owners: - lamzin@google.com - gildekel@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/QuickUnlock/PinUnlockAutosubmitEnabled.yaml b/components/policy/resources/templates/policy_definitions/QuickUnlock/PinUnlockAutosubmitEnabled.yaml index f6fec13d..61d3ab7 100644 --- a/components/policy/resources/templates/policy_definitions/QuickUnlock/PinUnlockAutosubmitEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/QuickUnlock/PinUnlockAutosubmitEnabled.yaml
@@ -1,20 +1,27 @@ caption: Enable PIN auto-submit feature on the lock and login screen. default_for_enterprise_users: false desc: |- - The PIN auto-submit feature changes how PINs are entered in ChromeOS. + The PIN auto-submit feature changes how PINs are entered in <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph>. Instead of showing the same textfield that is used for password input, this feature shows a special UI that clearly shows to the user how many digits are necessary for their PIN. As a consequence, the user's PIN length will be stored outside the user encrypted data. Only supports PINs that are between 6 and 12 digits long. - If this policy is set to false, users will not have the option of enabling - the feature on the Settings page. + If the policy is set to true, users will have PIN auto-submit on the lock and login screen. + If the policy is set to false or not set, users will not have PIN auto-submit on the lock and login screen. + + If this policy is set, users will not have the option of enabling the feature. example_value: true features: can_be_recommended: true dynamic_refresh: true per_profile: false +items: +- caption: Enable PIN auto-submit on the lock and login screen + value: true +- caption: Disable PIN auto-submit on the lock and login screen + value: false owners: - rrsilva@google.com - cros-oac@google.com
diff --git a/components/policy/resources/templates/policy_definitions/QuickUnlock/PinUnlockWeakPinsAllowed.yaml b/components/policy/resources/templates/policy_definitions/QuickUnlock/PinUnlockWeakPinsAllowed.yaml index 5d8f05fbd..04105ec 100644 --- a/components/policy/resources/templates/policy_definitions/QuickUnlock/PinUnlockWeakPinsAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/QuickUnlock/PinUnlockWeakPinsAllowed.yaml
@@ -1,12 +1,20 @@ caption: Enable users to set weak PINs for the lock screen PIN +default: null desc: |- Setting the policy to Enabled allows weak PINs. Some characteristics of weak PINs: only one digit (1111), digits increase by 1 (1234), digits decrease by 1 (4321), and common PINs. Setting the policy to Disabled means users can't set weak, easy-to-guess PINs. - By default, users get a warning, not an error, for a weak PIN. + If policy is not set, users get a warning, not an error, for a weak PIN. example_value: false features: dynamic_refresh: true per_profile: true +items: +- caption: Allow users to set a weak PIN + value: true +- caption: Do not allow users to set a weak PIN + value: false +- caption: Allow users to set a weak PIN, but show a warning + value: null owners: - file://components/policy/resources/OWNERS - rsorokin@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/SAML/LockScreenReauthenticationEnabled.yaml b/components/policy/resources/templates/policy_definitions/SAML/LockScreenReauthenticationEnabled.yaml index 229515c9..0e7b393 100644 --- a/components/policy/resources/templates/policy_definitions/SAML/LockScreenReauthenticationEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/SAML/LockScreenReauthenticationEnabled.yaml
@@ -7,6 +7,11 @@ features: dynamic_refresh: true per_profile: false +items: +- caption: Enforce online logins on the login and lock screens + value: true +- caption: Only enforce online logins on the login screen + value: false owners: - mslus@chromium.org - emaxx@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/SafeBrowsing/SafeBrowsingExtendedReportingEnabled.yaml b/components/policy/resources/templates/policy_definitions/SafeBrowsing/SafeBrowsingExtendedReportingEnabled.yaml index 7f13a742..5aac896 100644 --- a/components/policy/resources/templates/policy_definitions/SafeBrowsing/SafeBrowsingExtendedReportingEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/SafeBrowsing/SafeBrowsingExtendedReportingEnabled.yaml
@@ -1,5 +1,6 @@ arc_support: This policy is not supported within Arc. caption: Enable Safe Browsing Extended Reporting +default: null desc: |- Setting the policy to Enabled turns on <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>'s Safe Browsing Extended Reporting, which sends some system information and page content to Google servers to help detect dangerous apps and sites. @@ -14,6 +15,15 @@ per_profile: true future_on: - fuchsia +items: +- caption: Enable reporting of system information and page content to help improve + Safe Browsing + value: true +- caption: Disable reporting of system information and page content to help improve + Safe Browsing + value: false +- caption: Allow the user to decide + value: null owners: - nwokedi@chromium.org - nparker@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/ScreenCapture/ScreenCaptureAllowed.yaml b/components/policy/resources/templates/policy_definitions/ScreenCapture/ScreenCaptureAllowed.yaml index 5eb89d3e..cd09246 100644 --- a/components/policy/resources/templates/policy_definitions/ScreenCapture/ScreenCaptureAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/ScreenCapture/ScreenCaptureAllowed.yaml
@@ -17,6 +17,12 @@ per_profile: true future_on: - fuchsia +items: +- caption: Allow sites to prompt the user to share a video stream of their screen + value: true +- caption: Do not allow sites to prompt the user to share a video stream of their + screen + value: false owners: - guidou@chromium.org - marinaciocea@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Signin/DeviceEphemeralUsersEnabled.yaml b/components/policy/resources/templates/policy_definitions/Signin/DeviceEphemeralUsersEnabled.yaml index 60d6f767..719d3d5 100644 --- a/components/policy/resources/templates/policy_definitions/Signin/DeviceEphemeralUsersEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Signin/DeviceEphemeralUsersEnabled.yaml
@@ -8,6 +8,11 @@ example_value: true features: dynamic_refresh: true +items: +- caption: Erase all local user data + value: true +- caption: Do not erase local user data + value: false owners: - file://components/policy/resources/OWNERS - zmin@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Signin/DeviceFamilyLinkAccountsAllowed.yaml b/components/policy/resources/templates/policy_definitions/Signin/DeviceFamilyLinkAccountsAllowed.yaml index f7bc654..69c05ded 100644 --- a/components/policy/resources/templates/policy_definitions/Signin/DeviceFamilyLinkAccountsAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/Signin/DeviceFamilyLinkAccountsAllowed.yaml
@@ -13,6 +13,11 @@ example_value: false features: dynamic_refresh: true +items: +- caption: Allow parents to add supervised accounts + value: true +- caption: Do not allow parents to add supervised accounts + value: false owners: - agawronska@chromium.org - cros-families-eng@google.com
diff --git a/components/policy/resources/templates/policy_definitions/Signin/DeviceLoginScreenSystemInfoEnforced.yaml b/components/policy/resources/templates/policy_definitions/Signin/DeviceLoginScreenSystemInfoEnforced.yaml index 064de23..6c8abe2 100644 --- a/components/policy/resources/templates/policy_definitions/Signin/DeviceLoginScreenSystemInfoEnforced.yaml +++ b/components/policy/resources/templates/policy_definitions/Signin/DeviceLoginScreenSystemInfoEnforced.yaml
@@ -1,4 +1,5 @@ caption: Force the sign-in screen to show or hide system information. +default: null desc: |- Specify whether the system information (e.g. ChromeOS version, device serial number) is always shown (or hidden) on the login screen. @@ -11,6 +12,14 @@ example_value: true features: dynamic_refresh: true +items: +- caption: Always display system information on the sign-in screen + value: true +- caption: Do not display system information on the sign-in screen + value: false +- caption: Allow users to toggle the display of system information on the sign-in + screen + value: null owners: - anqing@chromium.org schema:
diff --git a/components/policy/resources/templates/policy_definitions/Signin/DeviceShowNumericKeyboardForPassword.yaml b/components/policy/resources/templates/policy_definitions/Signin/DeviceShowNumericKeyboardForPassword.yaml index 9e116fc..85c06eb 100644 --- a/components/policy/resources/templates/policy_definitions/Signin/DeviceShowNumericKeyboardForPassword.yaml +++ b/components/policy/resources/templates/policy_definitions/Signin/DeviceShowNumericKeyboardForPassword.yaml
@@ -7,6 +7,11 @@ example_value: true features: dynamic_refresh: true +items: +- caption: Default to a numeric keyboard for password input + value: true +- caption: Default to a standard keyboard for password input + value: false owners: - raleksandrov@google.com - file://chrome/browser/ash/login/OWNERS
diff --git a/components/policy/resources/templates/policy_definitions/Signin/DeviceTransferSAMLCookies.yaml b/components/policy/resources/templates/policy_definitions/Signin/DeviceTransferSAMLCookies.yaml index 6b76b67..26f598e3 100644 --- a/components/policy/resources/templates/policy_definitions/Signin/DeviceTransferSAMLCookies.yaml +++ b/components/policy/resources/templates/policy_definitions/Signin/DeviceTransferSAMLCookies.yaml
@@ -15,6 +15,11 @@ example_value: true features: dynamic_refresh: true +items: +- caption: Enable transfer of SAML SSO Cookies into user session during sign-in + value: true +- caption: Disable transfer of SAML SSO Cookies into user session during sign-in + value: false owners: - file://components/policy/resources/OWNERS - bartfab@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/Signin/DeviceUserAllowlist.yaml b/components/policy/resources/templates/policy_definitions/Signin/DeviceUserAllowlist.yaml index d1b878572..b689d29 100644 --- a/components/policy/resources/templates/policy_definitions/Signin/DeviceUserAllowlist.yaml +++ b/components/policy/resources/templates/policy_definitions/Signin/DeviceUserAllowlist.yaml
@@ -16,7 +16,7 @@ dynamic_refresh: true owners: - file://components/policy/resources/OWNERS -- atwilson@chromium.org +- emaamari@google.com schema: items: type: string
diff --git a/components/policy/resources/templates/policy_definitions/UserAndDeviceReporting/DeviceMetricsReportingEnabled.yaml b/components/policy/resources/templates/policy_definitions/UserAndDeviceReporting/DeviceMetricsReportingEnabled.yaml index 5efd887d..45d6536 100644 --- a/components/policy/resources/templates/policy_definitions/UserAndDeviceReporting/DeviceMetricsReportingEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/UserAndDeviceReporting/DeviceMetricsReportingEnabled.yaml
@@ -8,6 +8,11 @@ example_value: true features: dynamic_refresh: true +items: +- caption: Always send metrics to Google + value: true +- caption: Never send metrics to Google + value: false owners: - cros-reporting-team@google.com - lbaraz@chromium.org
diff --git a/components/policy/resources/templates/policy_definitions/UserAndDeviceReporting/DeviceReportXDREvents.yaml b/components/policy/resources/templates/policy_definitions/UserAndDeviceReporting/DeviceReportXDREvents.yaml index 1b7a381..eaf6a08b 100644 --- a/components/policy/resources/templates/policy_definitions/UserAndDeviceReporting/DeviceReportXDREvents.yaml +++ b/components/policy/resources/templates/policy_definitions/UserAndDeviceReporting/DeviceReportXDREvents.yaml
@@ -14,8 +14,7 @@ items: - caption: Report information about extended detection and response (XDR) events value: true -- caption: Do not report information about about extended detection and response (XDR) - events +- caption: Do not report information about extended detection and response (XDR) events value: false owners: - cros-reporting-team@google.com
diff --git a/components/policy/resources/templates/policy_definitions/UserAndDeviceReporting/ReportDeviceAudioStatusCheckingRateMs.yaml b/components/policy/resources/templates/policy_definitions/UserAndDeviceReporting/ReportDeviceAudioStatusCheckingRateMs.yaml index 4040bed..3465db4 100644 --- a/components/policy/resources/templates/policy_definitions/UserAndDeviceReporting/ReportDeviceAudioStatusCheckingRateMs.yaml +++ b/components/policy/resources/templates/policy_definitions/UserAndDeviceReporting/ReportDeviceAudioStatusCheckingRateMs.yaml
@@ -1,12 +1,12 @@ arc_support: This policy has no effect on the logging done by Android. caption: Audio telemetry collection rate in milliseconds. -default: 600000 +default: 900000 desc: |- Rate at which audio data is sampled and collected. The minimum allowed is 1 minute. - If not set, the default rate of 10 minutes applies. + If not set, the default rate of 15 minutes applies. device_only: true -example_value: 600000 +example_value: 900000 features: cloud_only: true dynamic_refresh: true
diff --git a/components/policy/resources/templates/policy_definitions/WilcoDtc/DeviceWilcoDtcAllowed.yaml b/components/policy/resources/templates/policy_definitions/WilcoDtc/DeviceWilcoDtcAllowed.yaml index 00746f5..b1618834 100644 --- a/components/policy/resources/templates/policy_definitions/WilcoDtc/DeviceWilcoDtcAllowed.yaml +++ b/components/policy/resources/templates/policy_definitions/WilcoDtc/DeviceWilcoDtcAllowed.yaml
@@ -8,6 +8,11 @@ features: dynamic_refresh: true per_profile: false +items: +- caption: Enable the wilco diagnostics and telemetry controller + value: true +- caption: Disable the wilco diagnostics and telemetry controller + value: false owners: - pbond@chromium.org - lamzin@google.com
diff --git a/components/policy/tools/syntax_check_policy_template_json.py b/components/policy/tools/syntax_check_policy_template_json.py index f6edd20..ae546511 100755 --- a/components/policy/tools/syntax_check_policy_template_json.py +++ b/components/policy/tools/syntax_check_policy_template_json.py
@@ -781,9 +781,13 @@ return if policy_type == 'main': - # TODO(crbug.com/1139306): Query the acceptable values from items - # once that is used for policy type main. - acceptable_values = (True, False, None) + # If the policy doesn't have items but is no longer supported, predefined + # values are used. Otherwise the policy must have items defined. + if 'items' not in policy and not self._SupportedPolicy( + policy, current_version): + acceptable_values = (True, False, None) + else: + acceptable_values = [x['value'] for x in policy['items']] elif policy_type in ('string-enum', 'int-enum'): acceptable_values = [None] + [x['value'] for x in policy['items']] else: @@ -807,12 +811,6 @@ policy, current_version): return - # TODO(crbug.com/1139306): Remove this check once all main policies - # have specified their items field. - policy_type = self.policy_type_provider.GetPolicyType(policy) - if policy_type == 'main' and 'items' not in policy: - return - items = self._CheckContains(policy, 'items', list) if items is None: return @@ -829,6 +827,7 @@ container_name='item', identifier=policy.get('name')) + policy_type = self.policy_type_provider.GetPolicyType(policy) if policy_type == 'main': # Main (bool) policies must contain a list of items to clearly # indicate what the states mean. @@ -1898,11 +1897,6 @@ if self._NeedsDefault(new_policy) and not 'default' in new_policy: self._PolicyError('Policy does not have "default" field', new_policy) - # TODO(crbug.com/1139306): This item check should apply to all policies - # instead of just new ones. - if self._NeedsItems(new_policy) and new_policy.get('items', None) == None: - self._PolicyError('Policy does not have "items" field', new_policy) - def _LeadingWhitespace(self, line): match = LEADING_WHITESPACE.match(line) if match:
diff --git a/components/sync/base/features.cc b/components/sync/base/features.cc index 41f925f25..26cce5a 100644 --- a/components/sync/base/features.cc +++ b/components/sync/base/features.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "components/sync/base/features.h" +#include "base/feature_list.h" namespace syncer { @@ -110,6 +111,10 @@ "SyncTrustedVaultResetKeysAreStale", base::FEATURE_ENABLED_BY_DEFAULT); +BASE_FEATURE(kSyncTrustedVaultUseMD5HashedFile, + "SyncTrustedVaultUseMD5HashedFile", + base::FEATURE_ENABLED_BY_DEFAULT); + BASE_FEATURE(kUseSyncInvalidations, "UseSyncInvalidations", base::FEATURE_DISABLED_BY_DEFAULT);
diff --git a/components/sync/base/features.h b/components/sync/base/features.h index fbdeac4..87c5c10b 100644 --- a/components/sync/base/features.h +++ b/components/sync/base/features.h
@@ -134,6 +134,9 @@ // registration attempt if previous was failed. BASE_DECLARE_FEATURE(kSyncTrustedVaultResetKeysAreStale); +// Enables storing MD5 hashed trusted vault file instead of OSCrypt encrypted. +BASE_DECLARE_FEATURE(kSyncTrustedVaultUseMD5HashedFile); + // If enabled, the device will register with FCM and listen to new // invalidations. Also, FCM token will be set in DeviceInfo, which signals to // the server that device listens to new invalidations.
diff --git a/components/sync/driver/trusted_vault_histograms.cc b/components/sync/driver/trusted_vault_histograms.cc index ff51079..34ae44d 100644 --- a/components/sync/driver/trusted_vault_histograms.cc +++ b/components/sync/driver/trusted_vault_histograms.cc
@@ -104,4 +104,8 @@ } } +void RecordTrustedVaultFileReadStatus(TrustedVaultFileReadStatusForUMA status) { + base::UmaHistogramEnumeration("Sync.TrustedVaultFileReadStatus", status); +} + } // namespace syncer
diff --git a/components/sync/driver/trusted_vault_histograms.h b/components/sync/driver/trusted_vault_histograms.h index 06e55b0..e02f9e25 100644 --- a/components/sync/driver/trusted_vault_histograms.h +++ b/components/sync/driver/trusted_vault_histograms.h
@@ -55,6 +55,18 @@ kMaxValue = kAborted }; +// These values are persisted to logs. Entries should not be renumbered and +// numeric values should never be reused. +enum class TrustedVaultFileReadStatusForUMA { + kSuccess = 0, + kNotFound = 1, + kFileReadFailed = 2, + kMD5DigestMismatch = 3, + kFileProtoDeserializationFailed = 4, + kDataProtoDeserializationFailed = 5, + kMaxValue = kDataProtoDeserializationFailed +}; + void RecordTrustedVaultDeviceRegistrationState( TrustedVaultDeviceRegistrationStateForUMA registration_state); @@ -80,6 +92,8 @@ bool sample, const SyncStatus& sync_status); +void RecordTrustedVaultFileReadStatus(TrustedVaultFileReadStatusForUMA status); + } // namespace syncer #endif // COMPONENTS_SYNC_DRIVER_TRUSTED_VAULT_HISTOGRAMS_H_
diff --git a/components/sync/engine/model_type_worker.cc b/components/sync/engine/model_type_worker.cc index 8e88745..c81519f 100644 --- a/components/sync/engine/model_type_worker.cc +++ b/components/sync/engine/model_type_worker.cc
@@ -572,10 +572,7 @@ } } - if (last_dropped_invalidation_) { - last_dropped_invalidation_->Acknowledge(); - last_dropped_invalidation_.reset(); - } + has_dropped_invalidation_ = false; nudge_handler_->SetHasPendingInvalidations(type_, HasPendingInvalidations()); @@ -1102,11 +1099,10 @@ // The incoming invalidation may have caused us to exceed our buffer size. // Trim some items from our list, if necessary. while (pending_invalidations_.size() > kMaxPendingInvalidations) { - last_dropped_invalidation_ = - std::move(pending_invalidations_.front().pending_invalidation); - last_dropped_invalidation_->Drop(); + has_dropped_invalidation_ = true; LogPendingInvalidationStatus( PendingInvalidationStatus::kInvalidationsOverflow); + pending_invalidations_.front().pending_invalidation->Drop(); pending_invalidations_.erase(pending_invalidations_.begin()); } nudge_handler_->SetHasPendingInvalidations(type_, HasPendingInvalidations()); @@ -1128,11 +1124,11 @@ !pending_invalidations_.empty() && (pending_invalidations_.begin()->pending_invalidation) ->IsUnknownVersion()); - msg->set_client_dropped_hints(!!last_dropped_invalidation_); + msg->set_client_dropped_hints(has_dropped_invalidation_); } bool ModelTypeWorker::HasPendingInvalidations() const { - return !pending_invalidations_.empty() || last_dropped_invalidation_; + return !pending_invalidations_.empty() || has_dropped_invalidation_; } GetLocalChangesRequest::GetLocalChangesRequest(
diff --git a/components/sync/engine/model_type_worker.h b/components/sync/engine/model_type_worker.h index 875f0ab..5371528 100644 --- a/components/sync/engine/model_type_worker.h +++ b/components/sync/engine/model_type_worker.h
@@ -305,10 +305,9 @@ // successful sync cycle. std::vector<PendingInvalidation> pending_invalidations_; - // A helper to keep track invalidations we dropped due to overflow. - // TODO(crbug.com/1365290): Change it to boolean. As it is used as does - // |last_dropped_invalidation_| exist or not. - std::unique_ptr<SyncInvalidation> last_dropped_invalidation_; + // Whether any invalidations were dropped due to overflow since the last + // GetUpdates cycle. + bool has_dropped_invalidation_ = false; // Returns whether |pending_updates_| contain any non-deletion update. bool HasNonDeletionUpdates() const;
diff --git a/components/sync/protocol/local_trusted_vault.proto b/components/sync/protocol/local_trusted_vault.proto index 48c05e5..98a56b9 100644 --- a/components/sync/protocol/local_trusted_vault.proto +++ b/components/sync/protocol/local_trusted_vault.proto
@@ -90,3 +90,14 @@ // Version of the stored data, used to perform data migrations. optional int32 data_version = 2; } + +// Encapsulates serialized local data (LocalTrustedVault) together with its MD5 +// digest, used to store data in the file and verify its integrity. +message LocalTrustedVaultFileContent { + // Serialized LocalTrustedVault. + optional string serialized_local_trusted_vault = 1; + + // MD5 digest of `serialized_local_trusted_vault` formatted as hexadecimal + // string. + optional string md5_digest_hex_string = 2; +} \ No newline at end of file
diff --git a/components/sync/protocol/sync_protocol_error.cc b/components/sync/protocol/sync_protocol_error.cc index 25781864..8274119 100644 --- a/components/sync/protocol/sync_protocol_error.cc +++ b/components/sync/protocol/sync_protocol_error.cc
@@ -53,12 +53,4 @@ SyncProtocolError::~SyncProtocolError() = default; -std::unique_ptr<base::DictionaryValue> SyncProtocolError::ToValue() const { - auto value = std::make_unique<base::DictionaryValue>(); - value->SetStringKey("ErrorType", GetSyncErrorTypeString(error_type)); - value->SetStringKey("ErrorDescription", error_description); - value->SetStringKey("action", GetClientActionString(action)); - return value; -} - } // namespace syncer
diff --git a/components/sync/protocol/sync_protocol_error.h b/components/sync/protocol/sync_protocol_error.h index d20756c..b4ed342f 100644 --- a/components/sync/protocol/sync_protocol_error.h +++ b/components/sync/protocol/sync_protocol_error.h
@@ -7,7 +7,6 @@ #include <memory> #include <string> -#include "base/values.h" #include "components/sync/base/model_type.h" namespace syncer { @@ -78,7 +77,6 @@ SyncProtocolError(); SyncProtocolError(const SyncProtocolError& other); ~SyncProtocolError(); - std::unique_ptr<base::DictionaryValue> ToValue() const; }; const char* GetSyncErrorTypeString(SyncProtocolErrorType type);
diff --git a/components/sync/trusted_vault/standalone_trusted_vault_backend.cc b/components/sync/trusted_vault/standalone_trusted_vault_backend.cc index 9d9ea0f5..ac9268e 100644 --- a/components/sync/trusted_vault/standalone_trusted_vault_backend.cc +++ b/components/sync/trusted_vault/standalone_trusted_vault_backend.cc
@@ -16,6 +16,7 @@ #include "base/feature_list.h" #include "base/files/file_util.h" #include "base/files/important_file_writer.h" +#include "base/hash/md5.h" #include "base/logging.h" #include "base/memory/scoped_refptr.h" #include "base/metrics/histogram_functions.h" @@ -30,6 +31,7 @@ #include "components/signin/public/identity_manager/accounts_in_cookie_jar_info.h" #include "components/sync/base/features.h" #include "components/sync/base/time.h" +#include "components/sync/driver/trusted_vault_histograms.h" #include "components/sync/protocol/local_trusted_vault.pb.h" #include "components/sync/trusted_vault/proto_string_bytes_conversion.h" #include "components/sync/trusted_vault/securebox.h" @@ -64,8 +66,46 @@ return proto; } -void WriteToDisk(const sync_pb::LocalTrustedVault& data, - const base::FilePath& file_path) { +sync_pb::LocalTrustedVault ReadMD5HashedFile(const base::FilePath& file_path) { + std::string file_content; + + sync_pb::LocalTrustedVault data_proto; + if (!base::PathExists(file_path)) { + RecordTrustedVaultFileReadStatus( + TrustedVaultFileReadStatusForUMA::kNotFound); + return data_proto; + } + if (!base::ReadFileToString(file_path, &file_content)) { + RecordTrustedVaultFileReadStatus( + TrustedVaultFileReadStatusForUMA::kFileReadFailed); + return data_proto; + } + sync_pb::LocalTrustedVaultFileContent file_proto; + if (!file_proto.ParseFromString(file_content)) { + RecordTrustedVaultFileReadStatus( + TrustedVaultFileReadStatusForUMA::kFileProtoDeserializationFailed); + return data_proto; + } + + if (base::MD5String(file_proto.serialized_local_trusted_vault()) != + file_proto.md5_digest_hex_string()) { + RecordTrustedVaultFileReadStatus( + TrustedVaultFileReadStatusForUMA::kMD5DigestMismatch); + return data_proto; + } + + if (!data_proto.ParseFromString( + file_proto.serialized_local_trusted_vault())) { + RecordTrustedVaultFileReadStatus( + TrustedVaultFileReadStatusForUMA::kDataProtoDeserializationFailed); + return data_proto; + } + RecordTrustedVaultFileReadStatus(TrustedVaultFileReadStatusForUMA::kSuccess); + return data_proto; +} + +void WriteEncryptedFileToDisk(const sync_pb::LocalTrustedVault& data, + const base::FilePath& file_path) { std::string encrypted_data; const bool encryption_success = OSCrypt::EncryptString(data.SerializeAsString(), &encrypted_data); @@ -82,6 +122,36 @@ } } +void WriteMD5HashedFileToDisk(const sync_pb::LocalTrustedVault& data, + const base::FilePath& file_path) { + sync_pb::LocalTrustedVaultFileContent file_proto; + file_proto.set_serialized_local_trusted_vault(data.SerializeAsString()); + file_proto.set_md5_digest_hex_string( + base::MD5String(file_proto.serialized_local_trusted_vault())); + bool success = base::ImportantFileWriter::WriteFileAtomically( + file_path, file_proto.SerializeAsString()); + if (!success) { + DLOG(ERROR) << "Failed to write trusted vault file."; + } + base::UmaHistogramBoolean("Sync.TrustedVaultFileWriteSuccess", success); +} + +void MaybeMigrateDataFile(const base::FilePath& old_file_path, + const base::FilePath& new_file_path) { + if (!base::PathExists(old_file_path)) { + return; + } + if (!base::PathExists(new_file_path)) { + // Only write to `new_file_path` if it doesn't exist yet to prevent + // overwriting the content with stale data. + sync_pb::LocalTrustedVault proto = ReadEncryptedFile(old_file_path); + WriteMD5HashedFileToDisk(proto, new_file_path); + } + if (base::PathExists(new_file_path)) { + base::DeleteFile(old_file_path); + } +} + bool HasNonConstantKey( const sync_pb::LocalTrustedVaultPerUser& per_user_vault) { std::string constant_key_as_proto_string; @@ -216,10 +286,12 @@ } StandaloneTrustedVaultBackend::StandaloneTrustedVaultBackend( - const base::FilePath& file_path, + const base::FilePath& md5_hashed_file_path, + const base::FilePath& deprecated_encrypted_file_path, std::unique_ptr<Delegate> delegate, std::unique_ptr<TrustedVaultConnection> connection) - : file_path_(file_path), + : md5_hashed_file_path_(md5_hashed_file_path), + deprecated_encrypted_file_path_(deprecated_encrypted_file_path), delegate_(std::move(delegate)), connection_(std::move(connection)), clock_(base::DefaultClock::GetInstance()) {} @@ -234,7 +306,7 @@ FindUserVault(primary_account_->gaia); *per_user_vault->mutable_degraded_recoverability_state() = degraded_recoverability_state; - WriteToDisk(data_, file_path_); + WriteDataToDisk(); } void StandaloneTrustedVaultBackend::OnDegradedRecoverabilityChanged() { @@ -242,7 +314,14 @@ } void StandaloneTrustedVaultBackend::ReadDataFromDisk() { - data_ = ReadEncryptedFile(file_path_); + if (base::FeatureList::IsEnabled(kSyncTrustedVaultUseMD5HashedFile)) { + MaybeMigrateDataFile(deprecated_encrypted_file_path_, + md5_hashed_file_path_); + data_ = ReadMD5HashedFile(md5_hashed_file_path_); + } else { + data_ = ReadEncryptedFile(deprecated_encrypted_file_path_); + } + if (data_.user_size() == 0) { // No data, set the current version and omit writing the file. data_.set_data_version(kCurrentLocalTrustedVaultVersion); @@ -250,13 +329,13 @@ if (data_.data_version() == 0) { UpgradeToVersion1(&data_); - WriteToDisk(data_, file_path_); + WriteDataToDisk(); } if (base::FeatureList::IsEnabled(kSyncTrustedVaultResetKeysAreStale) && data_.data_version() == 1) { UpgradeToVersion2(&data_); - WriteToDisk(data_, file_path_); + WriteDataToDisk(); } // TODO(crbug.com/1362513): DCHECK against kCurrentLocalTrustedVaultVersion @@ -380,7 +459,7 @@ key, per_user_vault->add_vault_key()->mutable_key_material()); } - WriteToDisk(data_, file_path_); + WriteDataToDisk(); MaybeRegisterDevice(); } @@ -501,7 +580,7 @@ data_.mutable_user()->erase( base::ranges::remove_if(*data_.mutable_user(), should_remove_user_data), data_.mutable_user()->end()); - WriteToDisk(data_, file_path_); + WriteDataToDisk(); } bool StandaloneTrustedVaultBackend::MarkLocalKeysAsStale( @@ -514,7 +593,7 @@ } per_user_vault->set_keys_marked_as_stale_by_consumer(true); - WriteToDisk(data_, file_path_); + WriteDataToDisk(); return true; } @@ -619,7 +698,7 @@ *per_user_vault = sync_pb::LocalTrustedVaultPerUser(); per_user_vault->set_gaia_id(account_info.gaia); - WriteToDisk(data_, file_path_); + WriteDataToDisk(); // This codepath invoked as part of sync reset. While sync reset can cause // resetting primary account, this is not the case for Chrome OS and Butter @@ -656,7 +735,7 @@ DCHECK(per_user_vault); per_user_vault->mutable_local_device_registration_info() ->set_device_registered_version(version); - WriteToDisk(data_, file_path_); + WriteDataToDisk(); } void StandaloneTrustedVaultBackend:: @@ -666,7 +745,7 @@ DCHECK(per_user_vault); per_user_vault->mutable_local_device_registration_info() ->set_last_registration_returned_local_data_obsolete(true); - WriteToDisk(data_, file_path_); + WriteDataToDisk(); } void StandaloneTrustedVaultBackend::SetClockForTesting(base::Clock* clock) { @@ -754,7 +833,7 @@ key_pair->private_key().ExportToBytes(), per_user_vault->mutable_local_device_registration_info() ->mutable_private_key_material()); - WriteToDisk(data_, file_path_); + WriteDataToDisk(); } // Cancel existing callbacks passed to |connection_| to ensure there is only @@ -840,12 +919,12 @@ ->set_device_registered(true); per_user_vault->mutable_local_device_registration_info() ->set_device_registered_version(kCurrentDeviceRegistrationVersion); - WriteToDisk(data_, file_path_); + WriteDataToDisk(); return; case TrustedVaultRegistrationStatus::kLocalDataObsolete: per_user_vault->mutable_local_device_registration_info() ->set_last_registration_returned_local_data_obsolete(true); - WriteToDisk(data_, file_path_); + WriteDataToDisk(); return; case TrustedVaultRegistrationStatus::kAccessTokenFetchingFailure: // Request wasn't sent to the server, so there is no need for throttling. @@ -945,7 +1024,7 @@ ->set_device_registered(false); per_user_vault->mutable_local_device_registration_info() ->clear_device_registered_version(); - WriteToDisk(data_, file_path_); + WriteDataToDisk(); break; } case TrustedVaultDownloadKeysStatus::kNoNewKeys: @@ -1051,7 +1130,7 @@ FindUserVault(primary_account_->gaia) ->set_last_failed_request_millis_since_unix_epoch( TimeToProtoTime(clock_->Now())); - WriteToDisk(data_, file_path_); + WriteDataToDisk(); } void StandaloneTrustedVaultBackend:: @@ -1067,7 +1146,7 @@ data_.mutable_user()->erase( base::ranges::remove_if(*data_.mutable_user(), should_remove_user_data), data_.mutable_user()->end()); - WriteToDisk(data_, file_path_); + WriteDataToDisk(); } sync_pb::LocalTrustedVaultPerUser* StandaloneTrustedVaultBackend::FindUserVault( @@ -1141,4 +1220,12 @@ device_registered_version)); } +void StandaloneTrustedVaultBackend::WriteDataToDisk() { + if (base::FeatureList::IsEnabled(kSyncTrustedVaultUseMD5HashedFile)) { + WriteMD5HashedFileToDisk(data_, md5_hashed_file_path_); + } else { + WriteEncryptedFileToDisk(data_, deprecated_encrypted_file_path_); + } +} + } // namespace syncer
diff --git a/components/sync/trusted_vault/standalone_trusted_vault_backend.h b/components/sync/trusted_vault/standalone_trusted_vault_backend.h index 7ef6eba2..313f2dbb 100644 --- a/components/sync/trusted_vault/standalone_trusted_vault_backend.h +++ b/components/sync/trusted_vault/standalone_trusted_vault_backend.h
@@ -59,7 +59,8 @@ // interaction with vault service (such as device registration, keys // downloading, etc.) will be disabled. StandaloneTrustedVaultBackend( - const base::FilePath& file_path, + const base::FilePath& md5_hashed_file_path, + const base::FilePath& deprecated_encrypted_file_path, std::unique_ptr<Delegate> delegate, std::unique_ptr<TrustedVaultConnection> connection); StandaloneTrustedVaultBackend(const StandaloneTrustedVaultBackend& other) = @@ -199,7 +200,10 @@ void VerifyDeviceRegistrationForUMA(const std::string& gaia_id); - const base::FilePath file_path_; + void WriteDataToDisk(); + + const base::FilePath md5_hashed_file_path_; + const base::FilePath deprecated_encrypted_file_path_; const std::unique_ptr<Delegate> delegate_;
diff --git a/components/sync/trusted_vault/standalone_trusted_vault_backend_unittest.cc b/components/sync/trusted_vault/standalone_trusted_vault_backend_unittest.cc index 712b88e..5b1d189d 100644 --- a/components/sync/trusted_vault/standalone_trusted_vault_backend_unittest.cc +++ b/components/sync/trusted_vault/standalone_trusted_vault_backend_unittest.cc
@@ -10,8 +10,10 @@ #include <vector> #include "base/callback_helpers.h" +#include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" +#include "base/hash/md5.h" #include "base/memory/raw_ptr.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/mock_callback.h" @@ -83,18 +85,27 @@ return account_info; } -bool WriteLocalTrustedVaultFile(const sync_pb::LocalTrustedVault& content, +bool WriteLocalTrustedVaultFile(const sync_pb::LocalTrustedVault& proto, const base::FilePath& path) { + sync_pb::LocalTrustedVaultFileContent file_proto; + file_proto.set_serialized_local_trusted_vault(proto.SerializeAsString()); + file_proto.set_md5_digest_hex_string( + base::MD5String(file_proto.serialized_local_trusted_vault())); + return base::WriteFile(path, file_proto.SerializeAsString()); +} + +bool WriteLocalEncryptedTrustedVaultFile( + const sync_pb::LocalTrustedVault& proto, + const base::FilePath& path) { std::string encrypted_content; - if (!OSCrypt::EncryptString(content.SerializeAsString(), - &encrypted_content)) { + if (!OSCrypt::EncryptString(proto.SerializeAsString(), &encrypted_content)) { return false; } return base::WriteFile(path, encrypted_content.c_str(), encrypted_content.size()) != -1; } -sync_pb::LocalTrustedVault ReadLocalTrustedVaultFile( +sync_pb::LocalTrustedVault ReadLocalEncryptedTrustedVaultFile( const base::FilePath& path) { std::string ciphertext; base::ReadFileToString(path, &ciphertext); @@ -107,6 +118,27 @@ return proto; } +sync_pb::LocalTrustedVault ReadLocalTrustedVaultFile( + const base::FilePath& path) { + std::string file_content; + sync_pb::LocalTrustedVault data_proto; + if (!base::ReadFileToString(path, &file_content)) { + return data_proto; + } + sync_pb::LocalTrustedVaultFileContent file_proto; + if (!file_proto.ParseFromString(file_content)) { + return data_proto; + } + + if (base::MD5String(file_proto.serialized_local_trusted_vault()) != + file_proto.md5_digest_hex_string()) { + return data_proto; + } + + data_proto.ParseFromString(file_proto.serialized_local_trusted_vault()); + return data_proto; +} + class MockDelegate : public StandaloneTrustedVaultBackend::Delegate { public: MockDelegate() = default; @@ -152,9 +184,10 @@ class StandaloneTrustedVaultBackendTest : public testing::Test { public: StandaloneTrustedVaultBackendTest() - : file_path_( - CreateUniqueTempDir(&temp_dir_) - .Append(base::FilePath(FILE_PATH_LITERAL("some_file")))) { + : file_path_(CreateUniqueTempDir(&temp_dir_) + .Append(base::FilePath(FILE_PATH_LITERAL("some_file")))), + deprecated_file_path_(temp_dir_.GetPath().Append( + base::FilePath(FILE_PATH_LITERAL("deprecated_file")))) { clock_.SetNow(base::Time::Now()); ResetBackend(); } @@ -174,7 +207,8 @@ connection_ = connection.get(); backend_ = base::MakeRefCounted<StandaloneTrustedVaultBackend>( - file_path_, std::move(delegate), std::move(connection)); + file_path_, deprecated_file_path_, std::move(delegate), + std::move(connection)); backend_->SetClockForTesting(&clock_); backend_->ReadDataFromDisk(); @@ -199,6 +233,8 @@ const base::FilePath& file_path() { return file_path_; } + const base::FilePath& deprecated_file_path() { return deprecated_file_path_; } + // Stores |vault_keys| and mimics successful device registration, returns // private device key material. std::vector<uint8_t> StoreKeysAndMimicDeviceRegistration( @@ -254,6 +290,7 @@ private: base::ScopedTempDir temp_dir_; const base::FilePath file_path_; + const base::FilePath deprecated_file_path_; raw_ptr<testing::NiceMock<MockDelegate>> delegate_; raw_ptr<testing::NiceMock<MockTrustedVaultConnection>> connection_; base::SimpleTestClock clock_; @@ -307,6 +344,60 @@ backend()->FetchKeys(account_info, fetch_keys_callback.Get()); } +TEST_F(StandaloneTrustedVaultBackendTest, ShouldRecordNotFoundWhenReadingFile) { + base::HistogramTester histogram_tester; + backend()->ReadDataFromDisk(); + histogram_tester.ExpectUniqueSample( + "Sync.TrustedVaultFileReadStatus", + /*sample=*/TrustedVaultFileReadStatusForUMA::kNotFound, + /*expected_bucket_count=*/1); +} + +TEST_F(StandaloneTrustedVaultBackendTest, + ShouldRecordMD5DigestMismatchWhenReadingFile) { + sync_pb::LocalTrustedVaultFileContent file_proto; + file_proto.set_md5_digest_hex_string("corrupted_md5_digest"); + ASSERT_TRUE(base::WriteFile(file_path(), file_proto.SerializeAsString())); + + base::HistogramTester histogram_tester; + backend()->ReadDataFromDisk(); + histogram_tester.ExpectUniqueSample( + "Sync.TrustedVaultFileReadStatus", + /*sample=*/TrustedVaultFileReadStatusForUMA::kMD5DigestMismatch, + /*expected_bucket_count=*/1); +} + +TEST_F(StandaloneTrustedVaultBackendTest, + ShouldRecordFileProtoDeserializationFailedWhenReadingFile) { + ASSERT_TRUE(base::WriteFile(file_path(), "corrupted_proto")); + + base::HistogramTester histogram_tester; + backend()->ReadDataFromDisk(); + histogram_tester.ExpectUniqueSample( + "Sync.TrustedVaultFileReadStatus", + /*sample=*/ + TrustedVaultFileReadStatusForUMA::kFileProtoDeserializationFailed, + /*expected_bucket_count=*/1); +} + +TEST_F(StandaloneTrustedVaultBackendTest, + ShouldRecordDataProtoDeserializationFailedWhenReadingFile) { + const std::string kCorruptedSerializedDataProto = "corrupted_proto"; + sync_pb::LocalTrustedVaultFileContent file_proto; + file_proto.set_serialized_local_trusted_vault(kCorruptedSerializedDataProto); + file_proto.set_md5_digest_hex_string( + base::MD5String(kCorruptedSerializedDataProto)); + ASSERT_TRUE(base::WriteFile(file_path(), file_proto.SerializeAsString())); + + base::HistogramTester histogram_tester; + backend()->ReadDataFromDisk(); + histogram_tester.ExpectUniqueSample( + "Sync.TrustedVaultFileReadStatus", + /*sample=*/ + TrustedVaultFileReadStatusForUMA::kDataProtoDeserializationFailed, + /*expected_bucket_count=*/1); +} + TEST_F(StandaloneTrustedVaultBackendTest, ShouldReadAndFetchNonEmptyKeys) { const CoreAccountInfo account_info_1 = MakeAccountInfoWithGaiaId("user1"); const CoreAccountInfo account_info_2 = MakeAccountInfoWithGaiaId("user2"); @@ -325,6 +416,45 @@ user_data2->add_vault_key()->set_key_material(kKey3.data(), kKey3.size()); ASSERT_TRUE(WriteLocalTrustedVaultFile(initial_data, file_path())); + base::HistogramTester histogram_tester; + backend()->ReadDataFromDisk(); + histogram_tester.ExpectUniqueSample( + "Sync.TrustedVaultFileReadStatus", + /*sample=*/TrustedVaultFileReadStatusForUMA::kSuccess, + /*expected_bucket_count=*/1); + + // Keys should be fetched immediately for both accounts. + base::MockCallback<StandaloneTrustedVaultBackend::FetchKeysCallback> + fetch_keys_callback; + EXPECT_CALL(fetch_keys_callback, Run(/*keys=*/ElementsAre(kKey1))); + backend()->FetchKeys(account_info_1, fetch_keys_callback.Get()); + EXPECT_CALL(fetch_keys_callback, Run(/*keys=*/ElementsAre(kKey2, kKey3))); + backend()->FetchKeys(account_info_2, fetch_keys_callback.Get()); +} + +TEST_F(StandaloneTrustedVaultBackendTest, + ShouldReadAndFetchNonEmptyKeysFromDeprecatedFile) { + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndDisableFeature(kSyncTrustedVaultUseMD5HashedFile); + + const CoreAccountInfo account_info_1 = MakeAccountInfoWithGaiaId("user1"); + const CoreAccountInfo account_info_2 = MakeAccountInfoWithGaiaId("user2"); + + const std::vector<uint8_t> kKey1 = {0, 1, 2, 3, 4}; + const std::vector<uint8_t> kKey2 = {1, 2, 3, 4}; + const std::vector<uint8_t> kKey3 = {2, 3, 4}; + + sync_pb::LocalTrustedVault initial_data; + sync_pb::LocalTrustedVaultPerUser* user_data1 = initial_data.add_user(); + sync_pb::LocalTrustedVaultPerUser* user_data2 = initial_data.add_user(); + user_data1->set_gaia_id(account_info_1.gaia); + user_data2->set_gaia_id(account_info_2.gaia); + user_data1->add_vault_key()->set_key_material(kKey1.data(), kKey1.size()); + user_data2->add_vault_key()->set_key_material(kKey2.data(), kKey2.size()); + user_data2->add_vault_key()->set_key_material(kKey3.data(), kKey3.size()); + + ASSERT_TRUE(WriteLocalEncryptedTrustedVaultFile(initial_data, + deprecated_file_path())); backend()->ReadDataFromDisk(); // Keys should be fetched immediately for both accounts. @@ -336,6 +466,38 @@ backend()->FetchKeys(account_info_2, fetch_keys_callback.Get()); } +TEST_F(StandaloneTrustedVaultBackendTest, ShouldMigrateDataFromDeprecatedFile) { + const CoreAccountInfo account_info = MakeAccountInfoWithGaiaId("user1"); + const std::vector<uint8_t> kKey = {0, 1, 2, 3, 4}; + const int kLastKeyVersion = 1; + + sync_pb::LocalTrustedVault initial_data; + // Migration from version 0 to version 1 makes test more complex, bypass it. + initial_data.set_data_version(1); + + sync_pb::LocalTrustedVaultPerUser* user_data = initial_data.add_user(); + user_data->set_gaia_id(account_info.gaia); + user_data->add_vault_key()->set_key_material(kKey.data(), kKey.size()); + user_data->set_last_vault_key_version(kLastKeyVersion); + + ASSERT_TRUE(WriteLocalEncryptedTrustedVaultFile(initial_data, + deprecated_file_path())); + backend()->ReadDataFromDisk(); + + // Ensure that backend is able to use data from deprecated file. + base::MockCallback<StandaloneTrustedVaultBackend::FetchKeysCallback> + fetch_keys_callback; + EXPECT_CALL(fetch_keys_callback, Run(/*keys=*/ElementsAre(kKey))); + backend()->FetchKeys(account_info, fetch_keys_callback.Get()); + + // Ensure that backend completed file migration. + EXPECT_FALSE(base::PathExists(deprecated_file_path())); + sync_pb::LocalTrustedVault proto = ReadLocalTrustedVaultFile(file_path()); + ASSERT_THAT(proto.user_size(), Eq(1)); + EXPECT_THAT(proto.user(0).vault_key(), ElementsAre(KeyMaterialEq(kKey))); + EXPECT_THAT(proto.user(0).last_vault_key_version(), Eq(kLastKeyVersion)); +} + TEST_F(StandaloneTrustedVaultBackendTest, ShouldFilterOutConstantKey) { const CoreAccountInfo account_info = MakeAccountInfoWithGaiaId("user1"); const std::vector<uint8_t> kKey = {1, 2, 3, 4}; @@ -365,13 +527,44 @@ const std::vector<uint8_t> kKey3 = {2, 3, 4}; const std::vector<uint8_t> kKey4 = {3, 4}; + base::HistogramTester histogram_tester; + backend()->StoreKeys(kGaiaId1, {kKey1}, /*last_key_version=*/7); + backend()->StoreKeys(kGaiaId2, {kKey2}, /*last_key_version=*/8); + // Keys for |kGaiaId2| overridden, so |kKey2| should be lost. + backend()->StoreKeys(kGaiaId2, {kKey3, kKey4}, /*last_key_version=*/9); + histogram_tester.ExpectUniqueSample("Sync.TrustedVaultFileWriteSuccess", + /*sample=*/true, + /*expected_bucket_count=*/3); + + // Read the file from disk. + sync_pb::LocalTrustedVault proto = ReadLocalTrustedVaultFile(file_path()); + ASSERT_THAT(proto.user_size(), Eq(2)); + EXPECT_THAT(proto.user(0).vault_key(), ElementsAre(KeyMaterialEq(kKey1))); + EXPECT_THAT(proto.user(0).last_vault_key_version(), Eq(7)); + EXPECT_THAT(proto.user(1).vault_key(), + ElementsAre(KeyMaterialEq(kKey3), KeyMaterialEq(kKey4))); + EXPECT_THAT(proto.user(1).last_vault_key_version(), Eq(9)); +} + +TEST_F(StandaloneTrustedVaultBackendTest, ShouldStoreKeysInDeprecatedFile) { + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndDisableFeature(kSyncTrustedVaultUseMD5HashedFile); + + const std::string kGaiaId1 = "user1"; + const std::string kGaiaId2 = "user2"; + const std::vector<uint8_t> kKey1 = {0, 1, 2, 3, 4}; + const std::vector<uint8_t> kKey2 = {1, 2, 3, 4}; + const std::vector<uint8_t> kKey3 = {2, 3, 4}; + const std::vector<uint8_t> kKey4 = {3, 4}; + backend()->StoreKeys(kGaiaId1, {kKey1}, /*last_key_version=*/7); backend()->StoreKeys(kGaiaId2, {kKey2}, /*last_key_version=*/8); // Keys for |kGaiaId2| overridden, so |kKey2| should be lost. backend()->StoreKeys(kGaiaId2, {kKey3, kKey4}, /*last_key_version=*/9); // Read the file from disk. - sync_pb::LocalTrustedVault proto = ReadLocalTrustedVaultFile(file_path()); + sync_pb::LocalTrustedVault proto = + ReadLocalEncryptedTrustedVaultFile(deprecated_file_path()); ASSERT_THAT(proto.user_size(), Eq(2)); EXPECT_THAT(proto.user(0).vault_key(), ElementsAre(KeyMaterialEq(kKey1))); EXPECT_THAT(proto.user(0).last_vault_key_version(), Eq(7)); @@ -466,7 +659,8 @@ // Instantiate a second backend to read the file. auto other_backend = base::MakeRefCounted<StandaloneTrustedVaultBackend>( - file_path(), std::make_unique<testing::NiceMock<MockDelegate>>(), + file_path(), deprecated_file_path(), + std::make_unique<testing::NiceMock<MockDelegate>>(), std::make_unique<testing::NiceMock<MockTrustedVaultConnection>>()); other_backend->ReadDataFromDisk(); @@ -562,7 +756,7 @@ // Mimic browser restart and reset primary account. auto new_backend = base::MakeRefCounted<StandaloneTrustedVaultBackend>( - file_path(), + file_path(), deprecated_file_path(), /*delegate=*/std::make_unique<testing::NiceMock<MockDelegate>>(), /*connection=*/nullptr); new_backend->ReadDataFromDisk(); @@ -671,13 +865,7 @@ .Run(TrustedVaultRegistrationStatus::kLocalDataObsolete); // Verify persisted file state. - std::string ciphertext; - std::string decrypted_content; - sync_pb::LocalTrustedVault proto; - EXPECT_TRUE(base::ReadFileToString(file_path(), &ciphertext)); - EXPECT_THAT(ciphertext, Ne("")); - EXPECT_TRUE(OSCrypt::DecryptString(ciphertext, &decrypted_content)); - EXPECT_TRUE(proto.ParseFromString(decrypted_content)); + sync_pb::LocalTrustedVault proto = ReadLocalTrustedVaultFile(file_path()); ASSERT_THAT(proto.user_size(), Eq(1)); // Ensure that the failure is remembered, so there are no retries. This is a // regression test for crbug.com/1358015.
diff --git a/components/sync/trusted_vault/standalone_trusted_vault_client.cc b/components/sync/trusted_vault/standalone_trusted_vault_client.cc index 060d5e9..4f165893 100644 --- a/components/sync/trusted_vault/standalone_trusted_vault_client.cc +++ b/components/sync/trusted_vault/standalone_trusted_vault_client.cc
@@ -223,6 +223,7 @@ StandaloneTrustedVaultClient::StandaloneTrustedVaultClient( const base::FilePath& file_path, + const base::FilePath& deprecated_file_path, signin::IdentityManager* identity_manager, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory) : backend_task_runner_( @@ -240,7 +241,7 @@ } backend_ = base::MakeRefCounted<StandaloneTrustedVaultBackend>( - file_path, + file_path, deprecated_file_path, std::make_unique< BackendDelegate>(BindToCurrentSequence(base::BindRepeating( &StandaloneTrustedVaultClient::NotifyRecoverabilityDegradedChanged,
diff --git a/components/sync/trusted_vault/standalone_trusted_vault_client.h b/components/sync/trusted_vault/standalone_trusted_vault_client.h index baa2cce0..27b8b28f 100644 --- a/components/sync/trusted_vault/standalone_trusted_vault_client.h +++ b/components/sync/trusted_vault/standalone_trusted_vault_client.h
@@ -41,6 +41,7 @@ // |url_loader_factory| must not be null. StandaloneTrustedVaultClient( const base::FilePath& file_path, + const base::FilePath& deprecated_file_path, signin::IdentityManager* identity_manager, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory);
diff --git a/components/viz/common/switches.cc b/components/viz/common/switches.cc index cbc4bd79..8774fd9 100644 --- a/components/viz/common/switches.cc +++ b/components/viz/common/switches.cc
@@ -41,6 +41,14 @@ // fullscreen overlay and use it as main framebuffer where possible. const char kEnableHardwareOverlays[] = "enable-hardware-overlays"; +#if BUILDFLAG(IS_CHROMEOS) +// ChromeOS uses one of two VideoDecoder implementations based on SoC/board +// specific configurations that are signalled via this command line flag. +// TODO(b/159825227): remove when the "old" video decoder is fully launched. +const char kPlatformDisallowsChromeOSDirectVideoDecoder[] = + "platform-disallows-chromeos-direct-video-decoder"; +#endif + // Effectively disables pipelining of compositor frame production stages by // waiting for each stage to finish before completing a frame. const char kRunAllCompositorStagesBeforeDraw[] =
diff --git a/components/viz/common/switches.h b/components/viz/common/switches.h index 378b1f1c..c664034f 100644 --- a/components/viz/common/switches.h +++ b/components/viz/common/switches.h
@@ -8,6 +8,7 @@ #include <stdint.h> #include "build/build_config.h" +#include "build/chromeos_buildflags.h" #include "components/viz/common/viz_common_export.h" #include "third_party/abseil-cpp/absl/types/optional.h" @@ -20,6 +21,12 @@ VIZ_COMMON_EXPORT extern const char kDoubleBufferCompositing[]; VIZ_COMMON_EXPORT extern const char kEnableDeJelly[]; VIZ_COMMON_EXPORT extern const char kEnableHardwareOverlays[]; + +#if BUILDFLAG(IS_CHROMEOS) +VIZ_COMMON_EXPORT extern const char + kPlatformDisallowsChromeOSDirectVideoDecoder[]; +#endif + VIZ_COMMON_EXPORT extern const char kRunAllCompositorStagesBeforeDraw[]; VIZ_COMMON_EXPORT extern const char kShowAggregatedDamage[]; VIZ_COMMON_EXPORT extern const char kTintCompositedContentModulate[];
diff --git a/components/webapps/browser/android/java/src/org/chromium/components/webapps/AddToHomescreenDialogView.java b/components/webapps/browser/android/java/src/org/chromium/components/webapps/AddToHomescreenDialogView.java index 9841501c..e00a622 100644 --- a/components/webapps/browser/android/java/src/org/chromium/components/webapps/AddToHomescreenDialogView.java +++ b/components/webapps/browser/android/java/src/org/chromium/components/webapps/AddToHomescreenDialogView.java
@@ -136,6 +136,7 @@ protected void setTitle(String title) { mAppNameView.setText(title); mShortcutTitleInput.setText(title); + mIconView.setContentDescription(title); } void setUrl(String url) {
diff --git a/content/browser/accessibility/accessibility_win_browsertest.cc b/content/browser/accessibility/accessibility_win_browsertest.cc index cf5705d..0068f46 100644 --- a/content/browser/accessibility/accessibility_win_browsertest.cc +++ b/content/browser/accessibility/accessibility_win_browsertest.cc
@@ -4335,6 +4335,12 @@ image_action->get_localizedName(2, localized_name.Receive())); EXPECT_EQ(nullptr, localized_name.Get()); + LONG n_key_bindings = -1; + BSTR* key_bindings[n_actions]; + EXPECT_HRESULT_SUCCEEDED( + image_action->get_keyBinding(0, 100, key_bindings, &n_key_bindings)); + EXPECT_EQ(0, n_key_bindings); + base::win::ScopedVariant childid_self(CHILDID_SELF); base::win::ScopedBstr image_name; EXPECT_HRESULT_SUCCEEDED(
diff --git a/content/browser/accessibility/browser_accessibility_com_win.cc b/content/browser/accessibility/browser_accessibility_com_win.cc index 46300d3..b5d8cfb 100644 --- a/content/browser/accessibility/browser_accessibility_com_win.cc +++ b/content/browser/accessibility/browser_accessibility_com_win.cc
@@ -725,31 +725,25 @@ if (!key_bindings || !n_bindings) return E_INVALIDARG; - const std::vector<ax::mojom::Action> actions = owner()->GetSupportedActions(); - if (action_index < 0 || action_index >= static_cast<LONG>(actions.size())) { - *key_bindings = nullptr; - return E_INVALIDARG; - } - n_bindings = 0; - int action; - std::u16string key_binding_string; - if (action_index == 0 && - owner()->GetIntAttribute(ax::mojom::IntAttribute::kDefaultActionVerb, - &action)) { - if (owner()->GetString16Attribute(ax::mojom::StringAttribute::kAccessKey, - &key_binding_string)) - *n_bindings = 1; - } + *key_bindings = nullptr; + *n_bindings = 0; - if (n_bindings == 0) { - *key_bindings = nullptr; + const std::vector<ax::mojom::Action> actions = owner()->GetSupportedActions(); + if (action_index < 0 || action_index >= static_cast<LONG>(actions.size())) + return E_INVALIDARG; + + // Only the default action, in index 0, may have a key binding. If it does, + // it will be stored in the attribute kAccessKey. + std::u16string key_binding_string; + if (action_index != 0 || !owner()->HasDefaultActionVerb() || + !owner()->GetString16Attribute(ax::mojom::StringAttribute::kAccessKey, + &key_binding_string)) { return S_FALSE; } + *n_bindings = 1; *key_bindings = static_cast<BSTR*>(CoTaskMemAlloc(sizeof(BSTR))); (*key_bindings)[0] = SysAllocString(base::as_wcstr(key_binding_string)); - - DCHECK(key_bindings); return S_OK; }
diff --git a/content/browser/attribution_reporting/attribution_report_network_sender.cc b/content/browser/attribution_reporting/attribution_report_network_sender.cc index 61382c47..5ebd6bc 100644 --- a/content/browser/attribution_reporting/attribution_report_network_sender.cc +++ b/content/browser/attribution_reporting/attribution_report_network_sender.cc
@@ -139,23 +139,48 @@ ? Status::kOk : !internal_ok ? Status::kInternalError : Status::kExternalError; - base::UmaHistogramEnumeration(is_debug_report - ? "Conversions.DebugReport.ReportStatus" - : "Conversions.ReportStatus2", - status); + const char* status_metric; + const char* http_response_or_net_error_code_metric; + const char* retry_succeed_metric; + + switch (report.GetReportType()) { + case AttributionReport::Type::kEventLevel: + status_metric = is_debug_report + ? "Conversions.DebugReport.ReportStatusEventLevel" + : "Conversions.ReportStatusEventLevel"; + http_response_or_net_error_code_metric = + is_debug_report + ? "Conversions.DebugReport.HttpResponseOrNetErrorCodeEventLevel" + : "Conversions.HttpResponseOrNetErrorCodeEventLevel"; + retry_succeed_metric = + is_debug_report + ? "Conversions.DebugReport.ReportRetrySucceedEventLevel" + : "Conversions.ReportRetrySucceedEventLevel"; + break; + case AttributionReport::Type::kAggregatableAttribution: + status_metric = is_debug_report + ? "Conversions.DebugReport.ReportStatusAggregatable" + : "Conversions.ReportStatusAggregatable"; + http_response_or_net_error_code_metric = + is_debug_report + ? "Conversions.DebugReport.HttpResponseOrNetErrorCodeAggregatable" + : "Conversions.HttpResponseOrNetErrorCodeAggregatable"; + retry_succeed_metric = + is_debug_report + ? "Conversions.DebugReport.ReportRetrySucceedAggregatable" + : "Conversions.ReportRetrySucceedAggregatable"; + break; + } + + base::UmaHistogramEnumeration(status_metric, status); // Since net errors are always negative and HTTP errors are always positive, // it is fine to combine these in a single histogram. - base::UmaHistogramSparse( - is_debug_report ? "Conversions.DebugReport.HttpResponseOrNetErrorCode" - : "Conversions.Report.HttpResponseOrNetErrorCode", - internal_ok ? response_code : net_error); + base::UmaHistogramSparse(http_response_or_net_error_code_metric, + internal_ok ? response_code : net_error); if (loader->GetNumRetries() > 0) { - base::UmaHistogramBoolean(is_debug_report - ? "Conversions.DebugReport.ReportRetrySucceed" - : "Conversions.ReportRetrySucceed2", - status == Status::kOk); + base::UmaHistogramBoolean(retry_succeed_metric, status == Status::kOk); } loaders_in_progress_.erase(it);
diff --git a/content/browser/attribution_reporting/attribution_report_network_sender_unittest.cc b/content/browser/attribution_reporting/attribution_report_network_sender_unittest.cc index 44e8b4b..698711d8 100644 --- a/content/browser/attribution_reporting/attribution_report_network_sender_unittest.cc +++ b/content/browser/attribution_reporting/attribution_report_network_sender_unittest.cc
@@ -59,13 +59,21 @@ "https://report.test/.well-known/attribution-reporting/debug/" "report-aggregate-attribution"; -AttributionReport DefaultReport() { +AttributionReport DefaultEventLevelReport() { return ReportBuilder( AttributionInfoBuilder(SourceBuilder(base::Time()).BuildStored()) .Build()) .Build(); } +AttributionReport DefaultAggregatableReport() { + return ReportBuilder( + AttributionInfoBuilder( + SourceBuilder(SourceBuilder(base::Time())).BuildStored()) + .Build()) + .BuildAggregatableAttribution(); +} + } // namespace class AttributionReportNetworkSenderTest : public testing::Test { @@ -91,7 +99,7 @@ TEST_F(AttributionReportNetworkSenderTest, ConversionReportReceived_NetworkRequestMade) { - auto report = DefaultReport(); + auto report = DefaultEventLevelReport(); network_sender_->SendReport(report, /*is_debug_report=*/false, base::DoNothing()); EXPECT_EQ(1, test_url_loader_factory_.NumPending()); @@ -100,7 +108,7 @@ } TEST_F(AttributionReportNetworkSenderTest, LoadFlags) { - auto report = DefaultReport(); + auto report = DefaultEventLevelReport(); network_sender_->SendReport(report, /*is_debug_report=*/false, base::DoNothing()); int load_flags = @@ -110,7 +118,7 @@ } TEST_F(AttributionReportNetworkSenderTest, Isolation) { - auto report = DefaultReport(); + auto report = DefaultEventLevelReport(); network_sender_->SendReport(report, /*is_debug_report=*/false, base::DoNothing()); network_sender_->SendReport(report, /*is_debug_report=*/false, @@ -216,39 +224,6 @@ kEventLevelReportUrl, "")); } -TEST_F(AttributionReportNetworkSenderTest, DebugReportSent_MetricsRecorded) { - base::HistogramTester histograms; - - auto source = SourceBuilder().BuildStored(); - AttributionReport report = - ReportBuilder(AttributionInfoBuilder(source).Build()) - .SetTriggerData(5) - .SetRandomizedTriggerRate(0.2) - .Build(); - network_sender_->SendReport(report, /*is_debug_report=*/true, - base::DoNothing()); - - ASSERT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest( - GURL(kDebugEventLevelReportUrl), - network::URLLoaderCompletionStatus(net::ERR_NETWORK_CHANGED), - network::mojom::URLResponseHead::New(), "")); - - ASSERT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest( - kDebugEventLevelReportUrl, "")); - - histograms.ExpectTotalCount("Conversions.ReportStatus2", 0); - histograms.ExpectTotalCount("Conversions.Report.HttpResponseOrNetErrorCode", - 0); - histograms.ExpectTotalCount("Conversions.ReportRetrySucceed2", 0); - - // kOk = 0. - histograms.ExpectUniqueSample("Conversions.DebugReport.ReportStatus", 0, 1); - histograms.ExpectUniqueSample( - "Conversions.DebugReport.HttpResponseOrNetErrorCode", net::HTTP_OK, 1); - histograms.ExpectUniqueSample("Conversions.DebugReport.ReportRetrySucceed", - true, 1); -} - TEST_F(AttributionReportNetworkSenderTest, ReportSentWithDebugKeys_ReportBodySetCorrectly) { const struct { @@ -341,7 +316,7 @@ } TEST_F(AttributionReportNetworkSenderTest, ReportSent_CallbackFired) { - const auto report = DefaultReport(); + const auto report = DefaultEventLevelReport(); static const net::HttpStatusCode kTestCases[] = { net::HTTP_OK, @@ -370,7 +345,7 @@ TEST_F(AttributionReportNetworkSenderTest, SenderDeletedDuringRequest_NoCrash) { EXPECT_CALL(callback_, Run).Times(0); - auto report = DefaultReport(); + auto report = DefaultEventLevelReport(); network_sender_->SendReport(report, /*is_debug_report=*/false, callback_.Get()); EXPECT_EQ(1, test_url_loader_factory_.NumPending()); @@ -380,7 +355,7 @@ } TEST_F(AttributionReportNetworkSenderTest, ReportRequestHangs_TimesOut) { - auto report = DefaultReport(); + auto report = DefaultEventLevelReport(); // Verify that the sent callback runs if the request times out. EXPECT_CALL(callback_, @@ -412,7 +387,7 @@ }; for (const auto& test_case : kTestCases) { - auto report = DefaultReport(); + auto report = DefaultEventLevelReport(); EXPECT_CALL(callback_, Run(report, Field(&SendResult::status, test_case.expected_status))); @@ -445,7 +420,7 @@ network::TestURLLoaderFactory::ResponseProduceFlags:: kSendHeadersOnNetworkError); - auto report = DefaultReport(); + auto report = DefaultEventLevelReport(); EXPECT_CALL(callback_, Run(report, SendResult(SendResult::Status::kFailure, net::ERR_INTERNET_DISCONNECTED, net::HttpStatusCode::HTTP_OK))); @@ -458,7 +433,7 @@ TEST_F(AttributionReportNetworkSenderTest, ReportRequestFailsWithHttpError_ShouldRetryNotSet) { - auto report = DefaultReport(); + auto report = DefaultEventLevelReport(); EXPECT_CALL(callback_, Run(report, SendResult(SendResult::Status::kFailure, net::ERR_HTTP_RESPONSE_CODE_FAILURE, @@ -480,7 +455,7 @@ EXPECT_CALL(callback_, Run); - auto report = DefaultReport(); + auto report = DefaultEventLevelReport(); network_sender_->SendReport(report, /*is_debug_report=*/false, callback_.Get()); EXPECT_EQ(1, test_url_loader_factory_.NumPending()); @@ -505,14 +480,15 @@ EXPECT_EQ(0, test_url_loader_factory_.NumPending()); Mock::VerifyAndClear(&callback_); - histograms.ExpectUniqueSample("Conversions.ReportRetrySucceed2", false, 1); + histograms.ExpectUniqueSample("Conversions.ReportRetrySucceedEventLevel", + false, 1); } // Retry succeeds { base::HistogramTester histograms; - auto report = DefaultReport(); + auto report = DefaultEventLevelReport(); network_sender_->SendReport(report, /*is_debug_report=*/false, base::DoNothing()); EXPECT_EQ(1, test_url_loader_factory_.NumPending()); @@ -530,13 +506,14 @@ test_url_loader_factory_.SimulateResponseForPendingRequest( kEventLevelReportUrl, ""); - histograms.ExpectUniqueSample("Conversions.ReportRetrySucceed2", true, 1); + histograms.ExpectUniqueSample("Conversions.ReportRetrySucceedEventLevel", + true, 1); } } TEST_F(AttributionReportNetworkSenderTest, ReportResultsInHttpError_SentCallbackRuns) { - auto report = DefaultReport(); + auto report = DefaultEventLevelReport(); Checkpoint checkpoint; { @@ -563,7 +540,7 @@ EXPECT_CALL(callback_, Run).Times(10); for (int i = 0; i < 10; i++) { - auto report = DefaultReport(); + auto report = DefaultEventLevelReport(); network_sender_->SendReport(report, /*is_debug_report=*/false, callback_.Get()); } @@ -578,50 +555,6 @@ EXPECT_EQ(0, test_url_loader_factory_.NumPending()); } -TEST_F(AttributionReportNetworkSenderTest, ErrorHistogram) { - // All OK. - { - base::HistogramTester histograms; - auto report = DefaultReport(); - network_sender_->SendReport(report, /*is_debug_report=*/false, - base::DoNothing()); - EXPECT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest( - kEventLevelReportUrl, "")); - // kOk = 0. - histograms.ExpectUniqueSample("Conversions.ReportStatus2", 0, 1); - histograms.ExpectUniqueSample( - "Conversions.Report.HttpResponseOrNetErrorCode", net::HTTP_OK, 1); - } - // Internal error. - { - base::HistogramTester histograms; - auto report = DefaultReport(); - network_sender_->SendReport(report, /*is_debug_report=*/false, - base::DoNothing()); - network::URLLoaderCompletionStatus completion_status(net::ERR_FAILED); - EXPECT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest( - GURL(kEventLevelReportUrl), completion_status, - network::mojom::URLResponseHead::New(), "")); - // kInternalError = 1. - histograms.ExpectUniqueSample("Conversions.ReportStatus2", 1, 1); - histograms.ExpectUniqueSample( - "Conversions.Report.HttpResponseOrNetErrorCode", net::ERR_FAILED, 1); - } - { - base::HistogramTester histograms; - auto report = DefaultReport(); - network_sender_->SendReport(report, /*is_debug_report=*/false, - base::DoNothing()); - EXPECT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest( - kEventLevelReportUrl, "", net::HTTP_UNAUTHORIZED)); - // kExternalError = 2. - histograms.ExpectUniqueSample("Conversions.ReportStatus2", 2, 1); - histograms.ExpectUniqueSample( - "Conversions.Report.HttpResponseOrNetErrorCode", net::HTTP_UNAUTHORIZED, - 1); - } -} - TEST_F(AttributionReportNetworkSenderTest, AggregatableReportSent_ReportBodySetCorrectly) { static constexpr char kExpectedReportBody[] = @@ -683,4 +616,275 @@ kAggregatableReportUrl, "")); } +TEST_F(AttributionReportNetworkSenderTest, + EventLevelReportSent_MetricsRecorded) { + // All OK + { + base::HistogramTester histograms; + auto report = DefaultEventLevelReport(); + network_sender_->SendReport(report, /*is_debug_report=*/false, + base::DoNothing()); + EXPECT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest( + kEventLevelReportUrl, "")); + // kOk = 0. + histograms.ExpectUniqueSample("Conversions.ReportStatusEventLevel", 0, 1); + histograms.ExpectUniqueSample( + "Conversions.HttpResponseOrNetErrorCodeEventLevel", net::HTTP_OK, 1); + } + + // Internal error + { + base::HistogramTester histograms; + auto report = DefaultEventLevelReport(); + network_sender_->SendReport(report, /*is_debug_report=*/false, + base::DoNothing()); + network::URLLoaderCompletionStatus completion_status(net::ERR_FAILED); + EXPECT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest( + GURL(kEventLevelReportUrl), completion_status, + network::mojom::URLResponseHead::New(), "")); + // kInternalError = 1. + histograms.ExpectUniqueSample("Conversions.ReportStatusEventLevel", 1, 1); + histograms.ExpectUniqueSample( + "Conversions.HttpResponseOrNetErrorCodeEventLevel", net::ERR_FAILED, 1); + } + // External error + { + base::HistogramTester histograms; + auto report = DefaultEventLevelReport(); + network_sender_->SendReport(report, /*is_debug_report=*/false, + base::DoNothing()); + EXPECT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest( + kEventLevelReportUrl, "", net::HTTP_UNAUTHORIZED)); + // kExternalError = 2. + histograms.ExpectUniqueSample("Conversions.ReportStatusEventLevel", 2, 1); + histograms.ExpectUniqueSample( + "Conversions.HttpResponseOrNetErrorCodeEventLevel", + net::HTTP_UNAUTHORIZED, 1); + } + // Retried network change error + { + base::HistogramTester histograms; + auto report = DefaultEventLevelReport(); + network_sender_->SendReport(report, /*is_debug_report=*/false, + base::DoNothing()); + + ASSERT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest( + GURL(kEventLevelReportUrl), + network::URLLoaderCompletionStatus(net::ERR_NETWORK_CHANGED), + network::mojom::URLResponseHead::New(), "")); + + ASSERT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest( + kEventLevelReportUrl, "")); + + histograms.ExpectUniqueSample("Conversions.ReportRetrySucceedEventLevel", + true, 1); + } +} + +TEST_F(AttributionReportNetworkSenderTest, + EventLevelReportSent_DebugMetricsRecorded) { + // All OK + { + base::HistogramTester histograms; + auto report = DefaultEventLevelReport(); + network_sender_->SendReport(report, /*is_debug_report=*/true, + base::DoNothing()); + EXPECT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest( + kDebugEventLevelReportUrl, "")); + // kOk = 0. + histograms.ExpectUniqueSample( + "Conversions.DebugReport.ReportStatusEventLevel", 0, 1); + histograms.ExpectUniqueSample( + "Conversions.DebugReport.HttpResponseOrNetErrorCodeEventLevel", + net::HTTP_OK, 1); + } + + // Internal error + { + base::HistogramTester histograms; + auto report = DefaultEventLevelReport(); + network_sender_->SendReport(report, /*is_debug_report=*/true, + base::DoNothing()); + network::URLLoaderCompletionStatus completion_status(net::ERR_FAILED); + EXPECT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest( + GURL(kDebugEventLevelReportUrl), completion_status, + network::mojom::URLResponseHead::New(), "")); + // kInternalError = 1. + histograms.ExpectUniqueSample( + "Conversions.DebugReport.ReportStatusEventLevel", 1, 1); + histograms.ExpectUniqueSample( + "Conversions.DebugReport.HttpResponseOrNetErrorCodeEventLevel", + net::ERR_FAILED, 1); + } + // External error + { + base::HistogramTester histograms; + auto report = DefaultEventLevelReport(); + network_sender_->SendReport(report, /*is_debug_report=*/true, + base::DoNothing()); + EXPECT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest( + kDebugEventLevelReportUrl, "", net::HTTP_UNAUTHORIZED)); + // kExternalError = 2. + histograms.ExpectUniqueSample( + "Conversions.DebugReport.ReportStatusEventLevel", 2, 1); + histograms.ExpectUniqueSample( + "Conversions.DebugReport.HttpResponseOrNetErrorCodeEventLevel", + net::HTTP_UNAUTHORIZED, 1); + } + // Retried network change error + { + base::HistogramTester histograms; + auto report = DefaultEventLevelReport(); + network_sender_->SendReport(report, /*is_debug_report=*/true, + base::DoNothing()); + + ASSERT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest( + GURL(kDebugEventLevelReportUrl), + network::URLLoaderCompletionStatus(net::ERR_NETWORK_CHANGED), + network::mojom::URLResponseHead::New(), "")); + + ASSERT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest( + kDebugEventLevelReportUrl, "")); + + histograms.ExpectUniqueSample( + "Conversions.DebugReport.ReportRetrySucceedEventLevel", true, 1); + } +} + +TEST_F(AttributionReportNetworkSenderTest, + AggregatableReportSent_MetricsRecorded) { + // All OK + { + base::HistogramTester histograms; + auto report = DefaultAggregatableReport(); + network_sender_->SendReport(report, /*is_debug_report=*/false, + base::DoNothing()); + EXPECT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest( + kAggregatableReportUrl, "")); + // kOk = 0. + histograms.ExpectUniqueSample("Conversions.ReportStatusAggregatable", 0, 1); + histograms.ExpectUniqueSample( + "Conversions.HttpResponseOrNetErrorCodeAggregatable", net::HTTP_OK, 1); + } + + // Internal error + { + base::HistogramTester histograms; + auto report = DefaultAggregatableReport(); + network_sender_->SendReport(report, /*is_debug_report=*/false, + base::DoNothing()); + network::URLLoaderCompletionStatus completion_status(net::ERR_FAILED); + EXPECT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest( + GURL(kAggregatableReportUrl), completion_status, + network::mojom::URLResponseHead::New(), "")); + // kInternalError = 1. + histograms.ExpectUniqueSample("Conversions.ReportStatusAggregatable", 1, 1); + histograms.ExpectUniqueSample( + "Conversions.HttpResponseOrNetErrorCodeAggregatable", net::ERR_FAILED, + 1); + } + // External error + { + base::HistogramTester histograms; + auto report = DefaultAggregatableReport(); + network_sender_->SendReport(report, /*is_debug_report=*/false, + base::DoNothing()); + EXPECT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest( + kAggregatableReportUrl, "", net::HTTP_UNAUTHORIZED)); + // kExternalError = 2. + histograms.ExpectUniqueSample("Conversions.ReportStatusAggregatable", 2, 1); + histograms.ExpectUniqueSample( + "Conversions.HttpResponseOrNetErrorCodeAggregatable", + net::HTTP_UNAUTHORIZED, 1); + } + // Retried network change error + { + base::HistogramTester histograms; + auto report = DefaultAggregatableReport(); + network_sender_->SendReport(report, /*is_debug_report=*/false, + base::DoNothing()); + + ASSERT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest( + GURL(kAggregatableReportUrl), + network::URLLoaderCompletionStatus(net::ERR_NETWORK_CHANGED), + network::mojom::URLResponseHead::New(), "")); + + ASSERT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest( + kAggregatableReportUrl, "")); + + histograms.ExpectUniqueSample("Conversions.ReportRetrySucceedAggregatable", + true, 1); + } +} + +TEST_F(AttributionReportNetworkSenderTest, + AggregatableReportSent_DebugMetricsRecorded) { + // All OK + { + base::HistogramTester histograms; + auto report = DefaultAggregatableReport(); + network_sender_->SendReport(report, /*is_debug_report=*/true, + base::DoNothing()); + EXPECT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest( + kDebugAggregatableReportUrl, "")); + // kOk = 0. + histograms.ExpectUniqueSample( + "Conversions.DebugReport.ReportStatusAggregatable", 0, 1); + histograms.ExpectUniqueSample( + "Conversions.DebugReport.HttpResponseOrNetErrorCodeAggregatable", + net::HTTP_OK, 1); + } + + // Internal error + { + base::HistogramTester histograms; + auto report = DefaultAggregatableReport(); + network_sender_->SendReport(report, /*is_debug_report=*/true, + base::DoNothing()); + network::URLLoaderCompletionStatus completion_status(net::ERR_FAILED); + EXPECT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest( + GURL(kDebugAggregatableReportUrl), completion_status, + network::mojom::URLResponseHead::New(), "")); + // kInternalError = 1. + histograms.ExpectUniqueSample( + "Conversions.DebugReport.ReportStatusAggregatable", 1, 1); + histograms.ExpectUniqueSample( + "Conversions.DebugReport.HttpResponseOrNetErrorCodeAggregatable", + net::ERR_FAILED, 1); + } + // External error + { + base::HistogramTester histograms; + auto report = DefaultAggregatableReport(); + network_sender_->SendReport(report, /*is_debug_report=*/true, + base::DoNothing()); + EXPECT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest( + kDebugAggregatableReportUrl, "", net::HTTP_UNAUTHORIZED)); + // kExternalError = 2. + histograms.ExpectUniqueSample( + "Conversions.DebugReport.ReportStatusAggregatable", 2, 1); + histograms.ExpectUniqueSample( + "Conversions.DebugReport.HttpResponseOrNetErrorCodeAggregatable", + net::HTTP_UNAUTHORIZED, 1); + } + // Retried network change error + { + base::HistogramTester histograms; + auto report = DefaultAggregatableReport(); + network_sender_->SendReport(report, /*is_debug_report=*/true, + base::DoNothing()); + + ASSERT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest( + GURL(kDebugAggregatableReportUrl), + network::URLLoaderCompletionStatus(net::ERR_NETWORK_CHANGED), + network::mojom::URLResponseHead::New(), "")); + + ASSERT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest( + kDebugAggregatableReportUrl, "")); + + histograms.ExpectUniqueSample( + "Conversions.DebugReport.ReportRetrySucceedAggregatable", true, 1); + } +} + } // namespace content
diff --git a/content/browser/devtools/protocol/browser_handler.cc b/content/browser/devtools/protocol/browser_handler.cc index e21a123a..8b98b63 100644 --- a/content/browser/devtools/protocol/browser_handler.cc +++ b/content/browser/devtools/protocol/browser_handler.cc
@@ -207,7 +207,7 @@ } else if (name == "nfc") { *permission_type = PermissionType::NFC; } else if (name == "window-placement") { - *permission_type = PermissionType::WINDOW_PLACEMENT; + *permission_type = PermissionType::WINDOW_MANAGEMENT; } else if (name == "local-fonts") { *permission_type = PermissionType::LOCAL_FONTS; } else if (name == "display-capture") {
diff --git a/content/browser/devtools/protocol/network_handler.cc b/content/browser/devtools/protocol/network_handler.cc index 8012c3c..8b39c8fc 100644 --- a/content/browser/devtools/protocol/network_handler.cc +++ b/content/browser/devtools/protocol/network_handler.cc
@@ -1936,8 +1936,12 @@ } response->SetProtocol(GetProtocol(url, info)); - response->SetAlternateProtocolUsage( - AlternateProtocolUsageToString(info.alternate_protocol_usage)); + if (info.alternate_protocol_usage != + net::AlternateProtocolUsage:: + ALTERNATE_PROTOCOL_USAGE_UNSPECIFIED_REASON) { + response->SetAlternateProtocolUsage( + AlternateProtocolUsageToString(info.alternate_protocol_usage)); + } response->SetRemoteIPAddress( net::HostPortPair::FromIPEndPoint(info.remote_endpoint).HostForURL()); response->SetRemotePort(info.remote_endpoint.port());
diff --git a/content/browser/first_party_sets/first_party_sets_handler_impl.cc b/content/browser/first_party_sets/first_party_sets_handler_impl.cc index 5568647..d8f12e3 100644 --- a/content/browser/first_party_sets/first_party_sets_handler_impl.cc +++ b/content/browser/first_party_sets/first_party_sets_handler_impl.cc
@@ -102,6 +102,13 @@ return {absl::nullopt, parsed_or_error.value().second}; } +// static +FirstPartySetsHandlerImpl FirstPartySetsHandlerImpl::CreateForTesting( + bool enabled, + bool embedder_will_provide_public_sets) { + return FirstPartySetsHandlerImpl(enabled, embedder_will_provide_public_sets); +} + void FirstPartySetsHandlerImpl::GetContextConfigForPolicy( const base::Value::Dict* policy, base::OnceCallback<void(net::FirstPartySetsContextConfig)> callback) {
diff --git a/content/browser/first_party_sets/first_party_sets_handler_impl.h b/content/browser/first_party_sets/first_party_sets_handler_impl.h index bc69f225..f464f126 100644 --- a/content/browser/first_party_sets/first_party_sets_handler_impl.h +++ b/content/browser/first_party_sets/first_party_sets_handler_impl.h
@@ -93,6 +93,11 @@ void Init(const base::FilePath& user_data_dir, const LocalSetDeclaration& local_set); + // Factory method that exposes the ctor for testing. + static FirstPartySetsHandlerImpl CreateForTesting( + bool enabled, + bool embedder_will_provide_public_sets); + // Returns the fully-parsed and validated global First-Party Sets data. // Returns the data synchronously via an optional if it's already available, // or via an asynchronously-invoked callback if the data is not ready yet. @@ -126,17 +131,6 @@ net::FirstPartySetsCacheFilter)> callback) override; - // Sets whether FPS is enabled (for testing). - void SetEnabledForTesting(bool enabled) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - enabled_ = enabled; - } - - void SetEmbedderWillProvidePublicSetsForTesting(bool will_provide) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - embedder_will_provide_public_sets_ = enabled_ && will_provide; - } - void GetPersistedGlobalSetsForTesting( const std::string& browser_context_id, base::OnceCallback<void(absl::optional<net::GlobalFirstPartySets>)>
diff --git a/content/browser/first_party_sets/first_party_sets_handler_impl_unittest.cc b/content/browser/first_party_sets/first_party_sets_handler_impl_unittest.cc index ec2dc9a..93dc9983 100644 --- a/content/browser/first_party_sets/first_party_sets_handler_impl_unittest.cc +++ b/content/browser/first_party_sets/first_party_sets_handler_impl_unittest.cc
@@ -57,29 +57,6 @@ const char* kFirstPartySetsClearSiteDataOutcomeHistogram = "FirstPartySets.Initialization.ClearSiteDataOutcomeType"; -net::GlobalFirstPartySets GetSetsAndWait() { - base::test::TestFuture<net::GlobalFirstPartySets> future; - absl::optional<net::GlobalFirstPartySets> result = - FirstPartySetsHandlerImpl::GetInstance()->GetSets(future.GetCallback()); - return result.has_value() ? std::move(result).value() : future.Take(); -} - -absl::optional<net::GlobalFirstPartySets> GetPersistedGlobalSetsAndWait( - const std::string& browser_context_id) { - base::test::TestFuture<absl::optional<net::GlobalFirstPartySets>> future; - FirstPartySetsHandlerImpl::GetInstance()->GetPersistedGlobalSetsForTesting( - browser_context_id, future.GetCallback()); - return future.Take(); -} - -absl::optional<bool> HasEntryInBrowserContextsClearedAndWait( - const std::string& browser_context_id) { - base::test::TestFuture<absl::optional<bool>> future; - FirstPartySetsHandlerImpl::GetInstance()->HasBrowserContextClearedForTesting( - browser_context_id, future.GetCallback()); - return future.Take(); -} - } // namespace TEST(FirstPartySetsHandlerImpl, ValidateEnterprisePolicy_ValidPolicy) { @@ -177,9 +154,10 @@ class FirstPartySetsHandlerImplTest : public ::testing::Test { public: - explicit FirstPartySetsHandlerImplTest(bool enabled) { - FirstPartySetsHandlerImpl::GetInstance()->SetEnabledForTesting(enabled); - + explicit FirstPartySetsHandlerImplTest(bool embedder_will_provide_public_sets) + : handler_(FirstPartySetsHandlerImpl::CreateForTesting( + /*enabled=*/true, + embedder_will_provide_public_sets)) { CHECK(scoped_dir_.CreateUniqueTempDir()); CHECK(PathExists(scoped_dir_.GetPath())); } @@ -192,32 +170,55 @@ return base::File(path, base::File::FLAG_OPEN | base::File::FLAG_READ); } - void TearDown() override { - FirstPartySetsHandlerImpl::GetInstance()->ResetForTesting(); + net::GlobalFirstPartySets GetSetsAndWait() { + base::test::TestFuture<net::GlobalFirstPartySets> future; + absl::optional<net::GlobalFirstPartySets> result = + handler().GetSets(future.GetCallback()); + return result.has_value() ? std::move(result).value() : future.Take(); } + absl::optional<net::GlobalFirstPartySets> GetPersistedGlobalSetsAndWait( + const std::string& browser_context_id) { + base::test::TestFuture<absl::optional<net::GlobalFirstPartySets>> future; + handler().GetPersistedGlobalSetsForTesting(browser_context_id, + future.GetCallback()); + return future.Take(); + } + + absl::optional<bool> HasEntryInBrowserContextsClearedAndWait( + const std::string& browser_context_id) { + base::test::TestFuture<absl::optional<bool>> future; + handler().HasBrowserContextClearedForTesting(browser_context_id, + future.GetCallback()); + return future.Take(); + } + + FirstPartySetsHandlerImpl& handler() { return handler_; } + BrowserContext* context() { return &context_; } protected: base::ScopedTempDir scoped_dir_; BrowserTaskEnvironment env_; TestBrowserContext context_; + FirstPartySetsHandlerImpl handler_; }; -class FirstPartySetsHandlerImplEnabledTest +class FirstPartySetsHandlerImplWithoutPublicSetsTest : public FirstPartySetsHandlerImplTest { public: - FirstPartySetsHandlerImplEnabledTest() - : FirstPartySetsHandlerImplTest(true) {} + FirstPartySetsHandlerImplWithoutPublicSetsTest() + : FirstPartySetsHandlerImplTest( + /*embedder_will_provide_public_sets=*/false) {} }; -TEST_F(FirstPartySetsHandlerImplEnabledTest, EmptyDBPath) { +TEST_F(FirstPartySetsHandlerImplWithoutPublicSetsTest, EmptyDBPath) { net::SchemefulSite example(GURL("https://example.test")); net::SchemefulSite associated(GURL("https://associatedsite1.test")); // Empty `user_data_dir` will fail to load persisted sets, but that will not // prevent `on_sets_ready` from being invoked. - FirstPartySetsHandlerImpl::GetInstance()->Init( + handler().Init( /*user_data_dir=*/{}, LocalSetDeclaration( R"({"primary": "https://example.test",)" @@ -233,24 +234,29 @@ example, net::SiteType::kAssociated, 0)))); } +class FirstPartySetsHandlerImplEnabledTest + : public FirstPartySetsHandlerImplTest { + public: + FirstPartySetsHandlerImplEnabledTest() + : FirstPartySetsHandlerImplTest( + /*embedder_will_provide_public_sets=*/true) {} +}; + TEST_F(FirstPartySetsHandlerImplEnabledTest, ClearSiteDataOnChangedSetsForContext_FeatureNotEnabled) { base::HistogramTester histogram; net::SchemefulSite foo(GURL("https://foo.test")); net::SchemefulSite associated(GURL("https://associatedsite.test")); - FirstPartySetsHandlerImpl::GetInstance() - ->SetEmbedderWillProvidePublicSetsForTesting(true); const std::string browser_context_id = "profile"; const std::string input = R"({"primary": "https://foo.test", )" R"("associatedSites": ["https://associatedsite.test"]})"; ASSERT_TRUE(base::JSONReader::Read(input)); - FirstPartySetsHandlerImpl::GetInstance()->SetPublicFirstPartySets( - base::Version("0.0.1"), WritePublicSetsFile(input)); + handler().SetPublicFirstPartySets(base::Version("0.0.1"), + WritePublicSetsFile(input)); - FirstPartySetsHandlerImpl::GetInstance()->Init(scoped_dir_.GetPath(), - LocalSetDeclaration()); + handler().Init(scoped_dir_.GetPath(), LocalSetDeclaration()); ASSERT_THAT(GetSetsAndWait().FindEntries({foo, associated}, net::FirstPartySetsContextConfig()), UnorderedElementsAre( @@ -260,13 +266,12 @@ foo, net::SiteType::kAssociated, 0)))); base::RunLoop run_loop; - FirstPartySetsHandlerImpl::GetInstance() - ->ClearSiteDataOnChangedSetsForContext( - base::BindLambdaForTesting([&]() { return context(); }), - browser_context_id, net::FirstPartySetsContextConfig(), - base::BindLambdaForTesting( - [&](net::FirstPartySetsContextConfig, - net::FirstPartySetsCacheFilter) { run_loop.Quit(); })); + handler().ClearSiteDataOnChangedSetsForContext( + base::BindLambdaForTesting([&]() { return context(); }), + browser_context_id, net::FirstPartySetsContextConfig(), + base::BindLambdaForTesting( + [&](net::FirstPartySetsContextConfig, + net::FirstPartySetsCacheFilter) { run_loop.Quit(); })); run_loop.Run(); EXPECT_THAT( @@ -288,18 +293,15 @@ net::SchemefulSite foo(GURL("https://foo.test")); net::SchemefulSite associated(GURL("https://associatedsite.test")); - FirstPartySetsHandlerImpl::GetInstance() - ->SetEmbedderWillProvidePublicSetsForTesting(true); const std::string browser_context_id = "profile"; const std::string input = R"({"primary": "https://foo.test", )" R"("associatedSites": ["https://associatedsite.test"]})"; ASSERT_TRUE(base::JSONReader::Read(input)); - FirstPartySetsHandlerImpl::GetInstance()->SetPublicFirstPartySets( - base::Version("0.0.1"), WritePublicSetsFile(input)); + handler().SetPublicFirstPartySets(base::Version("0.0.1"), + WritePublicSetsFile(input)); - FirstPartySetsHandlerImpl::GetInstance()->Init(scoped_dir_.GetPath(), - LocalSetDeclaration()); + handler().Init(scoped_dir_.GetPath(), LocalSetDeclaration()); EXPECT_THAT(HasEntryInBrowserContextsClearedAndWait(browser_context_id), Optional(false)); @@ -315,13 +317,12 @@ // Should not yet be recorded. histogram.ExpectTotalCount(kFirstPartySetsClearSiteDataOutcomeHistogram, 0); base::RunLoop run_loop; - FirstPartySetsHandlerImpl::GetInstance() - ->ClearSiteDataOnChangedSetsForContext( - base::BindLambdaForTesting([&]() { return context(); }), - browser_context_id, net::FirstPartySetsContextConfig(), - base::BindLambdaForTesting( - [&](net::FirstPartySetsContextConfig, - net::FirstPartySetsCacheFilter) { run_loop.Quit(); })); + handler().ClearSiteDataOnChangedSetsForContext( + base::BindLambdaForTesting([&]() { return context(); }), + browser_context_id, net::FirstPartySetsContextConfig(), + base::BindLambdaForTesting( + [&](net::FirstPartySetsContextConfig, + net::FirstPartySetsCacheFilter) { run_loop.Quit(); })); run_loop.Run(); EXPECT_THAT( @@ -352,17 +353,15 @@ net::SchemefulSite foo(GURL("https://foo.test")); net::SchemefulSite associated(GURL("https://associatedsite.test")); - FirstPartySetsHandlerImpl::GetInstance() - ->SetEmbedderWillProvidePublicSetsForTesting(true); const std::string browser_context_id = "profile"; const std::string input = R"({"primary": "https://foo.test", )" R"("associatedSites": ["https://associatedsite.test"]})"; ASSERT_TRUE(base::JSONReader::Read(input)); - FirstPartySetsHandlerImpl::GetInstance()->SetPublicFirstPartySets( - base::Version("0.0.1"), WritePublicSetsFile(input)); + handler().SetPublicFirstPartySets(base::Version("0.0.1"), + WritePublicSetsFile(input)); - FirstPartySetsHandlerImpl::GetInstance()->Init( + handler().Init( /*user_data_dir=*/{}, LocalSetDeclaration()); ASSERT_THAT(GetSetsAndWait().FindEntries({foo, associated}, net::FirstPartySetsContextConfig()), @@ -373,13 +372,12 @@ foo, net::SiteType::kAssociated, 0)))); base::RunLoop run_loop; - FirstPartySetsHandlerImpl::GetInstance() - ->ClearSiteDataOnChangedSetsForContext( - base::BindLambdaForTesting([&]() { return context(); }), - browser_context_id, net::FirstPartySetsContextConfig(), - base::BindLambdaForTesting( - [&](net::FirstPartySetsContextConfig, - net::FirstPartySetsCacheFilter) { run_loop.Quit(); })); + handler().ClearSiteDataOnChangedSetsForContext( + base::BindLambdaForTesting([&]() { return context(); }), + browser_context_id, net::FirstPartySetsContextConfig(), + base::BindLambdaForTesting( + [&](net::FirstPartySetsContextConfig, + net::FirstPartySetsCacheFilter) { run_loop.Quit(); })); run_loop.Run(); EXPECT_EQ(GetPersistedGlobalSetsAndWait(browser_context_id), absl::nullopt); @@ -395,23 +393,19 @@ {{features::kFirstPartySetsClearSiteDataOnChangedSets.name, "true"}}); base::HistogramTester histogram; - FirstPartySetsHandlerImpl::GetInstance() - ->SetEmbedderWillProvidePublicSetsForTesting(true); - FirstPartySetsHandlerImpl::GetInstance()->Init(scoped_dir_.GetPath(), - LocalSetDeclaration()); + handler().Init(scoped_dir_.GetPath(), LocalSetDeclaration()); const std::string browser_context_id = "profile"; base::test::TestFuture<net::FirstPartySetsContextConfig, net::FirstPartySetsCacheFilter> future; - FirstPartySetsHandlerImpl::GetInstance() - ->ClearSiteDataOnChangedSetsForContext( - base::BindLambdaForTesting([&]() { return context(); }), - browser_context_id, net::FirstPartySetsContextConfig(), - future.GetCallback()); + handler().ClearSiteDataOnChangedSetsForContext( + base::BindLambdaForTesting([&]() { return context(); }), + browser_context_id, net::FirstPartySetsContextConfig(), + future.GetCallback()); - FirstPartySetsHandlerImpl::GetInstance()->SetPublicFirstPartySets( + handler().SetPublicFirstPartySets( base::Version("0.0.1"), WritePublicSetsFile( R"({"primary": "https://foo.test", )" @@ -440,25 +434,21 @@ net::SchemefulSite example(GURL("https://example.test")); net::SchemefulSite associated(GURL("https://associatedsite.test")); - FirstPartySetsHandlerImpl::GetInstance() - ->SetEmbedderWillProvidePublicSetsForTesting(true); - const std::string input = R"({"primary": "https://example.test", )" R"("associatedSites": ["https://associatedsite.test"]})"; ASSERT_TRUE(base::JSONReader::Read(input)); - FirstPartySetsHandlerImpl::GetInstance()->SetPublicFirstPartySets( - base::Version(), WritePublicSetsFile(input)); + handler().SetPublicFirstPartySets(base::Version(), + WritePublicSetsFile(input)); - FirstPartySetsHandlerImpl::GetInstance()->Init(scoped_dir_.GetPath(), - LocalSetDeclaration()); + handler().Init(scoped_dir_.GetPath(), LocalSetDeclaration()); // Wait until initialization is complete. GetSetsAndWait(); EXPECT_THAT( - FirstPartySetsHandlerImpl::GetInstance() - ->GetSets(base::NullCallback()) + handler() + .GetSets(base::NullCallback()) .value() .FindEntries({example, associated}, net::FirstPartySetsContextConfig()), @@ -474,24 +464,18 @@ net::SchemefulSite example(GURL("https://example.test")); net::SchemefulSite associated(GURL("https://associatedsite.test")); - FirstPartySetsHandlerImpl::GetInstance() - ->SetEmbedderWillProvidePublicSetsForTesting(true); - // Call GetSets before the sets are ready, and before Init has been called. base::test::TestFuture<net::GlobalFirstPartySets> future; - EXPECT_EQ( - FirstPartySetsHandlerImpl::GetInstance()->GetSets(future.GetCallback()), - absl::nullopt); + EXPECT_EQ(handler().GetSets(future.GetCallback()), absl::nullopt); - FirstPartySetsHandlerImpl::GetInstance()->Init(scoped_dir_.GetPath(), - LocalSetDeclaration()); + handler().Init(scoped_dir_.GetPath(), LocalSetDeclaration()); const std::string input = R"({"primary": "https://example.test", )" R"("associatedSites": ["https://associatedsite.test"]})"; ASSERT_TRUE(base::JSONReader::Read(input)); - FirstPartySetsHandlerImpl::GetInstance()->SetPublicFirstPartySets( - base::Version(), WritePublicSetsFile(input)); + handler().SetPublicFirstPartySets(base::Version(), + WritePublicSetsFile(input)); EXPECT_THAT( future.Get().FindEntries({example, associated}, @@ -503,8 +487,8 @@ example, net::SiteType::kAssociated, 0)))); EXPECT_THAT( - FirstPartySetsHandlerImpl::GetInstance() - ->GetSets(base::NullCallback()) + handler() + .GetSets(base::NullCallback()) .value() .FindEntries({example, associated}, net::FirstPartySetsContextConfig()), @@ -519,10 +503,7 @@ : public FirstPartySetsHandlerImplEnabledTest { public: FirstPartySetsHandlerGetContextConfigForPolicyTest() { - FirstPartySetsHandlerImpl::GetInstance() - ->SetEmbedderWillProvidePublicSetsForTesting(true); - FirstPartySetsHandlerImpl::GetInstance()->Init(scoped_dir_.GetPath(), - LocalSetDeclaration()); + handler().Init(scoped_dir_.GetPath(), LocalSetDeclaration()); } // Writes the public list of First-Party Sets which GetContextConfigForPolicy @@ -546,8 +527,8 @@ R"({"primary": "https://primary1.test", )" R"("associatedSites": ["https://associatedsite1.test", "https://associatedsite2.test"]})"; ASSERT_TRUE(base::JSONReader::Read(input)); - FirstPartySetsHandlerImpl::GetInstance()->SetPublicFirstPartySets( - base::Version(), WritePublicSetsFile(input)); + handler().SetPublicFirstPartySets(base::Version(), + WritePublicSetsFile(input)); ASSERT_THAT( GetSetsAndWait().FindEntries({primary1, associated1, associated2}, @@ -570,8 +551,7 @@ TEST_F(FirstPartySetsHandlerGetContextConfigForPolicyTest, DefaultOverridesPolicy_DefaultContextConfigs) { base::Value policy = base::JSONReader::Read(R"({})").value(); - FirstPartySetsHandlerImpl::GetInstance()->GetContextConfigForPolicy( - &policy.GetDict(), GetConfigCallback()); + handler().GetContextConfigForPolicy(&policy.GetDict(), GetConfigCallback()); InitPublicFirstPartySets(); EXPECT_EQ(GetConfig(), net::FirstPartySetsContextConfig()); @@ -584,8 +564,7 @@ "additions": true })") .value(); - FirstPartySetsHandlerImpl::GetInstance()->GetContextConfigForPolicy( - &policy.GetDict(), GetConfigCallback()); + handler().GetContextConfigForPolicy(&policy.GetDict(), GetConfigCallback()); InitPublicFirstPartySets(); EXPECT_EQ(GetConfig(), net::FirstPartySetsContextConfig()); @@ -610,8 +589,7 @@ } )") .value(); - FirstPartySetsHandlerImpl::GetInstance()->GetContextConfigForPolicy( - &policy.GetDict(), GetConfigCallback()); + handler().GetContextConfigForPolicy(&policy.GetDict(), GetConfigCallback()); InitPublicFirstPartySets(); // We don't care what the customizations are, here; we only care that they're
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc index f52718f..f04810f 100644 --- a/content/browser/gpu/gpu_process_host.cc +++ b/content/browser/gpu/gpu_process_host.cc
@@ -302,6 +302,7 @@ switches::kReachedCodeSamplingIntervalUs, #endif #if BUILDFLAG(IS_CHROMEOS) + switches::kPlatformDisallowsChromeOSDirectVideoDecoder, switches::kSchedulerBoostUrgent, #endif #if BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION)
diff --git a/content/browser/media/stable_video_decoder_factory.cc b/content/browser/media/stable_video_decoder_factory.cc index 2f7cf8e..ec85bd63 100644 --- a/content/browser/media/stable_video_decoder_factory.cc +++ b/content/browser/media/stable_video_decoder_factory.cc
@@ -5,10 +5,10 @@ #include "content/public/browser/stable_video_decoder_factory.h" #include "build/chromeos_buildflags.h" +#include "components/viz/common/switches.h" #include "content/public/browser/gpu_utils.h" #include "content/public/browser/service_process_host.h" #include "media/mojo/mojom/stable/stable_video_decoder.mojom.h" -#include "ui/ozone/public/ozone_switches.h" #if BUILDFLAG(IS_CHROMEOS_LACROS) #include "chromeos/lacros/lacros_service.h" @@ -34,7 +34,7 @@ // TODO(b/195769334): consider passing |gpu_preferences|.ToSwitchValue() to // the utility process instead. extra_switches.push_back( - switches::kPlatformDisallowsChromeOSDirectVideoDecoder); + ::switches::kPlatformDisallowsChromeOSDirectVideoDecoder); } #endif ServiceProcessHost::Launch(
diff --git a/content/browser/permissions/permission_controller_impl.cc b/content/browser/permissions/permission_controller_impl.cc index 9e506344..25ef68d 100644 --- a/content/browser/permissions/permission_controller_impl.cc +++ b/content/browser/permissions/permission_controller_impl.cc
@@ -66,7 +66,7 @@ case PermissionType::AR: case PermissionType::VR: case PermissionType::CAMERA_PAN_TILT_ZOOM: - case PermissionType::WINDOW_PLACEMENT: + case PermissionType::WINDOW_MANAGEMENT: case PermissionType::LOCAL_FONTS: case PermissionType::DISPLAY_CAPTURE: case PermissionType::GEOLOCATION:
diff --git a/content/browser/preloading/preloading_attempt_impl.h b/content/browser/preloading/preloading_attempt_impl.h index 8a12866..6e13d71 100644 --- a/content/browser/preloading/preloading_attempt_impl.h +++ b/content/browser/preloading/preloading_attempt_impl.h
@@ -13,6 +13,10 @@ namespace content { +namespace test { +class PreloadingAttemptAccessor; +} + class CONTENT_EXPORT PreloadingAttemptImpl : public PreloadingAttempt { public: ~PreloadingAttemptImpl() override; @@ -45,11 +49,9 @@ ukm::SourceId triggered_primary_page_source_id, PreloadingURLMatchCallback url_match_predicate); - PreloadingTriggeringOutcome get_triggering_outcome_for_testing() const { - return triggering_outcome_; - } - private: + friend class test::PreloadingAttemptAccessor; + // Reason why the preloading attempt failed, this is similar to specific // preloading logging reason. Zero as a failure reason signifies no reason is // specified. This value is casted from preloading specific enum to int64_t
diff --git a/content/browser/preloading/prerender/prerender_browsertest.cc b/content/browser/preloading/prerender/prerender_browsertest.cc index 38b17f6a..ad434b2 100644 --- a/content/browser/preloading/prerender/prerender_browsertest.cc +++ b/content/browser/preloading/prerender/prerender_browsertest.cc
@@ -4316,7 +4316,8 @@ kPrerender2); auto* preloading_attempt_impl = static_cast<PreloadingAttemptImpl*>( prerender2_host->preloading_attempt().get()); - EXPECT_EQ(preloading_attempt_impl->get_triggering_outcome_for_testing(), + EXPECT_EQ(test::PreloadingAttemptAccessor(preloading_attempt_impl) + .GetTriggeringOutcome(), PreloadingTriggeringOutcome::kTriggeredButPending); NavigationHandleObserver activation_observer(web_contents(), kPrerender1);
diff --git a/content/browser/preloading/prerender/prerender_handle_impl.cc b/content/browser/preloading/prerender/prerender_handle_impl.cc index ff06bee..f0d73433 100644 --- a/content/browser/preloading/prerender/prerender_handle_impl.cc +++ b/content/browser/preloading/prerender/prerender_handle_impl.cc
@@ -39,4 +39,16 @@ return weak_factory_.GetWeakPtr(); } +void PrerenderHandleImpl::SetPreloadingAttemptFailureReason( + PreloadingFailureReason reason) { + if (!prerender_host_registry_) + return; + auto* prerender_host = + prerender_host_registry_->FindNonReservedHostById(frame_tree_node_id_); + if (!prerender_host) { + return; + } + prerender_host->preloading_attempt()->SetFailureReason(reason); +} + } // namespace content
diff --git a/content/browser/preloading/prerender/prerender_handle_impl.h b/content/browser/preloading/prerender/prerender_handle_impl.h index 7f7ae38..c6c282ba 100644 --- a/content/browser/preloading/prerender/prerender_handle_impl.h +++ b/content/browser/preloading/prerender/prerender_handle_impl.h
@@ -19,6 +19,8 @@ ~PrerenderHandleImpl() override; GURL GetInitialPrerenderingUrl() override; base::WeakPtr<PrerenderHandle> GetWeakPtr() override; + void SetPreloadingAttemptFailureReason( + PreloadingFailureReason reason) override; private: base::WeakPtr<PrerenderHostRegistry> prerender_host_registry_;
diff --git a/content/browser/preloading/prerender/prerender_host_unittest.cc b/content/browser/preloading/prerender/prerender_host_unittest.cc index e44178fc..64293ba 100644 --- a/content/browser/preloading/prerender/prerender_host_unittest.cc +++ b/content/browser/preloading/prerender/prerender_host_unittest.cc
@@ -11,7 +11,6 @@ #include "build/build_config.h" #include "components/ukm/test_ukm_recorder.h" #include "content/browser/preloading/preloading.h" -#include "content/browser/preloading/preloading_attempt_impl.h" #include "content/browser/preloading/prerender/prerender_attributes.h" #include "content/browser/preloading/prerender/prerender_host_registry.h" #include "content/browser/site_instance_impl.h" @@ -19,6 +18,7 @@ #include "content/public/browser/preloading_data.h" #include "content/public/test/mock_web_contents_observer.h" #include "content/public/test/navigation_simulator.h" +#include "content/public/test/preloading_test_util.h" #include "content/public/test/prerender_test_util.h" #include "content/public/test/test_browser_context.h" #include "content/test/mock_commit_deferring_condition.h" @@ -527,9 +527,8 @@ // Wait for the completion of CommitPrerenderNavigation() above. run_loop.Run(); - auto* preloading_attempt_impl = - static_cast<PreloadingAttemptImpl*>(preloading_attempt); - EXPECT_EQ(preloading_attempt_impl->get_triggering_outcome_for_testing(), + EXPECT_EQ(test::PreloadingAttemptAccessor(preloading_attempt) + .GetTriggeringOutcome(), PreloadingTriggeringOutcome::kFailure); }
diff --git a/content/browser/renderer_host/cookie_utils.cc b/content/browser/renderer_host/cookie_utils.cc index 258f25b..4278b64 100644 --- a/content/browser/renderer_host/cookie_utils.cc +++ b/content/browser/renderer_host/cookie_utils.cc
@@ -80,14 +80,13 @@ [](const network::mojom::CookieOrLineWithAccessResultPtr& cookie_and_access_result) { return cookie_and_access_result->access_result.status - .HasOnlyExclusionReason( - net::CookieInclusionStatus::EXCLUDE_USER_PREFERENCES); + .ExcludedByUserPreferences(); }); blocked->cookie_list.reserve(blocked_count); for (const auto& cookie_and_access_result : cookie_details->cookie_list) { - if (cookie_and_access_result->access_result.status.HasOnlyExclusionReason( - net::CookieInclusionStatus::EXCLUDE_USER_PREFERENCES)) { + if (cookie_and_access_result->access_result.status + .ExcludedByUserPreferences()) { blocked->cookie_list.emplace_back( std::move(cookie_and_access_result->cookie_or_line->get_cookie())); } else if (cookie_and_access_result->access_result.status.IsInclude()) {
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc index 371d453..c57e550 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc
@@ -208,6 +208,9 @@ "frame-src 'self' https:;" "connect-src 'self' https:;" "script-src 'self' 'wasm-unsafe-eval';" + "img-src 'self' data:;" + "media-src 'self' data:;" + "font-src 'self' data:;" "require-trusted-types-for 'script';"; // Corresponds to the "NavigationURLScheme" histogram enumeration type in
diff --git a/content/browser/renderer_host/navigation_request_unittest.cc b/content/browser/renderer_host/navigation_request_unittest.cc index 72cd15b..9caa0c0 100644 --- a/content/browser/renderer_host/navigation_request_unittest.cc +++ b/content/browser/renderer_host/navigation_request_unittest.cc
@@ -804,7 +804,7 @@ // Validate CSP. EXPECT_EQ(1UL, policies.content_security_policies.size()); const auto& csp = policies.content_security_policies[0]; - EXPECT_EQ(7UL, csp->raw_directives.size()); + EXPECT_EQ(10UL, csp->raw_directives.size()); using Directive = network::mojom::CSPDirectiveName; EXPECT_EQ("'none'", csp->raw_directives[Directive::BaseURI]); EXPECT_EQ("'none'", csp->raw_directives[Directive::ObjectSrc]); @@ -813,6 +813,9 @@ EXPECT_EQ("'self' https:", csp->raw_directives[Directive::ConnectSrc]); EXPECT_EQ("'self' 'wasm-unsafe-eval'", csp->raw_directives[Directive::ScriptSrc]); + EXPECT_EQ("'self' data:", csp->raw_directives[Directive::ImgSrc]); + EXPECT_EQ("'self' data:", csp->raw_directives[Directive::MediaSrc]); + EXPECT_EQ("'self' data:", csp->raw_directives[Directive::FontSrc]); EXPECT_EQ("'script'", csp->raw_directives[Directive::RequireTrustedTypesFor]); }
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc index 488f3f6..74c1d3f 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -1147,7 +1147,7 @@ DCHECK(permission_controller); return permission_controller->GetPermissionStatusForCurrentDocument( - blink::PermissionType::WINDOW_PLACEMENT, host) == + blink::PermissionType::WINDOW_MANAGEMENT, host) == blink::mojom::PermissionStatus::GRANTED; }
diff --git a/content/browser/tracing/startup_tracing_browsertest.cc b/content/browser/tracing/startup_tracing_browsertest.cc index ad2a739..c995d39 100644 --- a/content/browser/tracing/startup_tracing_browsertest.cc +++ b/content/browser/tracing/startup_tracing_browsertest.cc
@@ -354,21 +354,14 @@ testing::Values(OutputType::kJSON, OutputType::kProto), testing::Values(OutputLocation::kDirectoryWithDefaultBasename))); -// Flaky; see https://crbug.com/1341341 . -#if BUILDFLAG(IS_MAC) -#define MAYBE_StopOnUIThread DISABLED_StopOnUIThread -#else -#define MAYBE_StopOnUIThread StopOnUIThread -#endif -IN_PROC_BROWSER_TEST_P(EmergencyStopTracingTest, MAYBE_StopOnUIThread) { +IN_PROC_BROWSER_TEST_P(EmergencyStopTracingTest, StopOnUIThread) { EXPECT_TRUE(NavigateToURL(shell(), GetTestUrl("", "title1.html"))); StartupTracingController::EmergencyStop(); CheckOutput(GetExpectedPath(), GetOutputType()); } -// Flaky: crbug.com/1372387 -IN_PROC_BROWSER_TEST_P(EmergencyStopTracingTest, DISABLED_StopOnThreadPool) { +IN_PROC_BROWSER_TEST_P(EmergencyStopTracingTest, StopOnThreadPool) { EXPECT_TRUE(NavigateToURL(shell(), GetTestUrl("", "title1.html"))); auto expected_path = GetExpectedPath(); @@ -385,8 +378,7 @@ run_loop.Run(); } -// Flaky: crbug.com/1372387 -IN_PROC_BROWSER_TEST_P(EmergencyStopTracingTest, DISABLED_StopOnThreadPoolTwice) { +IN_PROC_BROWSER_TEST_P(EmergencyStopTracingTest, StopOnThreadPoolTwice) { EXPECT_TRUE(NavigateToURL(shell(), GetTestUrl("", "title1.html"))); auto expected_path = GetExpectedPath();
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index 0a0d1a4c8..5ef91442 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -423,7 +423,7 @@ DCHECK(permission_controller); return permission_controller->GetPermissionStatusForCurrentDocument( - blink::PermissionType::WINDOW_PLACEMENT, host) == + blink::PermissionType::WINDOW_MANAGEMENT, host) == blink::mojom::PermissionStatus::GRANTED; }
diff --git a/content/public/browser/BUILD.gn b/content/public/browser/BUILD.gn index 5c7df6d0..67cc385 100644 --- a/content/public/browser/BUILD.gn +++ b/content/public/browser/BUILD.gn
@@ -617,7 +617,6 @@ if (is_chromeos) { sources += [ "lock_screen_storage.h" ] - deps += [ "//ui/ozone:ozone_switches" ] } if (!is_android) {
diff --git a/content/public/browser/DEPS b/content/public/browser/DEPS index 4621d03..2521bea0 100644 --- a/content/public/browser/DEPS +++ b/content/public/browser/DEPS
@@ -41,11 +41,6 @@ ], "gpu_utils\.cc": [ - # For using switch::kPlatformDisallowsChromeOSDirectVideoDecoder. - # TODO(b/192563524): remove it when the legacy video decoder is replaced for - # all devices. - "+ui/ozone/public/ozone_switches.h", - # For using chromeos::BrowserParamsProxy which is needed on LaCrOS to decide # if the GPU process sandbox needs to be started early. "+chromeos/startup/browser_params_proxy.h",
diff --git a/content/public/browser/gpu_utils.cc b/content/public/browser/gpu_utils.cc index 79f4088..2e9fb517 100644 --- a/content/public/browser/gpu_utils.cc +++ b/content/public/browser/gpu_utils.cc
@@ -13,6 +13,7 @@ #include "build/chromeos_buildflags.h" #include "cc/base/switches.h" #include "components/viz/common/features.h" +#include "components/viz/common/switches.h" #include "components/viz/common/viz_utils.h" #include "content/browser/browser_main_loop.h" #include "content/browser/gpu/gpu_process_host.h" @@ -26,12 +27,6 @@ #include "media/media_buildflags.h" #include "ui/gfx/switches.h" -// TODO(b/192563524): remove it when the legacy video decoder is replaced for -// all devices. -#if BUILDFLAG(IS_CHROMEOS) -#include "ui/ozone/public/ozone_switches.h" // nogncheck -#endif // BUILDFLAG(IS_CHROMEOS) - #if BUILDFLAG(IS_CHROMEOS_LACROS) #include "chromeos/startup/browser_params_proxy.h" #endif // BUILDFLAG(IS_CHROMEOS_LACROS)
diff --git a/content/public/browser/prerender_handle.h b/content/public/browser/prerender_handle.h index 0fa8642e..693fcef 100644 --- a/content/public/browser/prerender_handle.h +++ b/content/public/browser/prerender_handle.h
@@ -5,6 +5,8 @@ #ifndef CONTENT_PUBLIC_BROWSER_PRERENDER_HANDLE_H_ #define CONTENT_PUBLIC_BROWSER_PRERENDER_HANDLE_H_ +#include "content/public/browser/preloading_data.h" + namespace content { // PrerenderHandle is the class used to encapsulate prerender resources in @@ -17,6 +19,8 @@ // starting a prerendering page. virtual GURL GetInitialPrerenderingUrl() = 0; virtual base::WeakPtr<PrerenderHandle> GetWeakPtr() = 0; + virtual void SetPreloadingAttemptFailureReason( + PreloadingFailureReason reason) = 0; }; } // namespace content
diff --git a/content/public/browser/render_frame_host.h b/content/public/browser/render_frame_host.h index ef77be9..353b6e1 100644 --- a/content/public/browser/render_frame_host.h +++ b/content/public/browser/render_frame_host.h
@@ -730,6 +730,9 @@ // GetLifecycleState() will crash if it is called on a RenderFrameHost in such // a state. Eventually, we should make sure that embedders only learn about // new RenderFrameHosts when they reach the kPendingCommit state. + // If you want to use GetLifecycleState to check the state for speculative + // RenderFrameHosts, use RenderFrameHost::IsInLifecycleState to avoid crashing + // for speculative RenderFrameHosts. virtual LifecycleState GetLifecycleState() = 0; // Returns true if and only if the `lifecycle_state` matches
diff --git a/content/public/test/preloading_test_util.cc b/content/public/test/preloading_test_util.cc index 448e7ee1..2ded522 100644 --- a/content/public/test/preloading_test_util.cc +++ b/content/public/test/preloading_test_util.cc
@@ -5,6 +5,7 @@ #include "content/public/test/preloading_test_util.h" #include "base/strings/stringprintf.h" +#include "content/browser/preloading/preloading_attempt_impl.h" #include "services/metrics/public/cpp/ukm_builders.h" namespace content::test { @@ -113,4 +114,18 @@ return result; } +PreloadingAttemptAccessor::PreloadingAttemptAccessor( + PreloadingAttempt* preloading_attempt) + : preloading_attempt_(preloading_attempt) {} + +PreloadingTriggeringOutcome PreloadingAttemptAccessor::GetTriggeringOutcome() { + return static_cast<PreloadingAttemptImpl*>(preloading_attempt_) + ->triggering_outcome_; +} + +PreloadingFailureReason PreloadingAttemptAccessor::GetFailureReason() { + return static_cast<PreloadingAttemptImpl*>(preloading_attempt_) + ->failure_reason_; +} + } // namespace content::test
diff --git a/content/public/test/preloading_test_util.h b/content/public/test/preloading_test_util.h index 812fd6d1..00758e9a 100644 --- a/content/public/test/preloading_test_util.h +++ b/content/public/test/preloading_test_util.h
@@ -9,6 +9,7 @@ #include "components/ukm/test_ukm_recorder.h" #include "content/public/browser/preloading.h" +#include "content/public/browser/preloading_data.h" #include "services/metrics/public/cpp/ukm_source_id.h" namespace content::test { @@ -67,6 +68,18 @@ const std::vector<ukm::TestUkmRecorder::HumanReadableUkmEntry>& actual, const std::vector<ukm::TestUkmRecorder::HumanReadableUkmEntry>& expected); +// Utility class to access internal state from a PreloadingAttempt. +class PreloadingAttemptAccessor { + public: + explicit PreloadingAttemptAccessor(PreloadingAttempt* preloading_attempt); + + PreloadingTriggeringOutcome GetTriggeringOutcome(); + PreloadingFailureReason GetFailureReason(); + + private: + PreloadingAttempt* preloading_attempt_; +}; + } // namespace content::test #endif // CONTENT_PUBLIC_TEST_PRELOADING_TEST_UTIL_H_
diff --git a/content/shell/browser/shell_permission_manager.cc b/content/shell/browser/shell_permission_manager.cc index a4fea6a..31db286 100644 --- a/content/shell/browser/shell_permission_manager.cc +++ b/content/shell/browser/shell_permission_manager.cc
@@ -59,7 +59,7 @@ case PermissionType::VR: case PermissionType::AR: case PermissionType::CAMERA_PAN_TILT_ZOOM: - case PermissionType::WINDOW_PLACEMENT: + case PermissionType::WINDOW_MANAGEMENT: case PermissionType::LOCAL_FONTS: case PermissionType::DISPLAY_CAPTURE: return false;
diff --git a/device/bluetooth/BUILD.gn b/device/bluetooth/BUILD.gn index facb18d..bd92e2ce 100644 --- a/device/bluetooth/BUILD.gn +++ b/device/bluetooth/BUILD.gn
@@ -440,10 +440,14 @@ "floss/bluetooth_device_floss.h", "floss/bluetooth_gatt_connection_floss.cc", "floss/bluetooth_gatt_connection_floss.h", + "floss/bluetooth_gatt_service_floss.cc", + "floss/bluetooth_gatt_service_floss.h", "floss/bluetooth_low_energy_scan_session_floss.cc", "floss/bluetooth_low_energy_scan_session_floss.h", "floss/bluetooth_pairing_floss.cc", "floss/bluetooth_pairing_floss.h", + "floss/bluetooth_remote_gatt_service_floss.cc", + "floss/bluetooth_remote_gatt_service_floss.h", "floss/bluetooth_socket_floss.cc", "floss/bluetooth_socket_floss.h", "floss/exported_callback_manager.h", @@ -540,6 +544,8 @@ "floss/fake_floss_adapter_client.h", "floss/fake_floss_advertiser_client.cc", "floss/fake_floss_advertiser_client.h", + "floss/fake_floss_gatt_client.cc", + "floss/fake_floss_gatt_client.h", "floss/fake_floss_lescan_client.cc", "floss/fake_floss_lescan_client.h", "floss/fake_floss_manager_client.cc",
diff --git a/device/bluetooth/floss/bluetooth_device_floss.cc b/device/bluetooth/floss/bluetooth_device_floss.cc index c44eb03..d2d8bbb 100644 --- a/device/bluetooth/floss/bluetooth_device_floss.cc +++ b/device/bluetooth/floss/bluetooth_device_floss.cc
@@ -13,9 +13,12 @@ #include "device/bluetooth/bluetooth_device.h" #include "device/bluetooth/bluetooth_gatt_connection.h" #include "device/bluetooth/floss/bluetooth_adapter_floss.h" +#include "device/bluetooth/floss/bluetooth_gatt_connection_floss.h" +#include "device/bluetooth/floss/bluetooth_remote_gatt_service_floss.h" #include "device/bluetooth/floss/bluetooth_socket_floss.h" #include "device/bluetooth/floss/floss_dbus_client.h" #include "device/bluetooth/floss/floss_dbus_manager.h" +#include "device/bluetooth/floss/floss_gatt_client.h" #include "device/bluetooth/floss/floss_socket_manager.h" #if BUILDFLAG(IS_CHROMEOS) @@ -57,8 +60,6 @@ using AddressType = device::BluetoothDevice::AddressType; using VendorIDSource = device::BluetoothDevice::VendorIDSource; -BluetoothDeviceFloss::~BluetoothDeviceFloss() = default; - uint32_t BluetoothDeviceFloss::GetBluetoothClass() const { return cod_; } @@ -128,9 +129,7 @@ } bool BluetoothDeviceFloss::IsGattConnected() const { - NOTIMPLEMENTED(); - - return false; + return is_gatt_connected_; } bool BluetoothDeviceFloss::IsConnectable() const { @@ -302,19 +301,19 @@ std::unique_ptr<device::BluetoothGattConnection> BluetoothDeviceFloss::CreateBluetoothGattConnectionObject() { - NOTIMPLEMENTED(); - - return nullptr; + return std::make_unique<BluetoothGattConnectionFloss>(adapter_, + AsFlossDeviceId()); } void BluetoothDeviceFloss::SetGattServicesDiscoveryComplete(bool complete) { NOTIMPLEMENTED(); + // This is not necessary for Floss which already knows of discovery complete. } bool BluetoothDeviceFloss::IsGattServicesDiscoveryComplete() const { - NOTIMPLEMENTED(); - - return false; + // Services are only considered resolved if connection was established without + // a specific search uuid or was subsequently upgraded to full discovery. + return svc_resolved_ && !search_uuid.has_value(); } void BluetoothDeviceFloss::Pair( @@ -384,11 +383,48 @@ void BluetoothDeviceFloss::CreateGattConnectionImpl( absl::optional<device::BluetoothUUID> service_uuid) { - NOTIMPLEMENTED(); + if (num_connecting_calls_++ == 0) + adapter()->NotifyDeviceChanged(this); + + // Save the service uuid to trigger service discovery later. + search_uuid = service_uuid; + + // Gatt connections establish over LE. + FlossDBusManager::Get()->GetGattClient()->Connect( + base::BindOnce(&BluetoothDeviceFloss::OnConnectGatt, + weak_ptr_factory_.GetWeakPtr()), + address_, FlossDBusClient::BluetoothTransport::kLe); +} + +void BluetoothDeviceFloss::OnConnectGatt(DBusResult<Void> ret) { + if (!ret.has_value()) { + if (--num_connecting_calls_ == 0) + adapter()->NotifyDeviceChanged(this); + } +} + +void BluetoothDeviceFloss::UpgradeToFullDiscovery() { + if (!search_uuid.has_value()) { + LOG(ERROR) << "Attempting to upgrade to full discovery without having " + "searched any uuid."; + return; + } + + // Clear previous search uuid. + search_uuid.reset(); + + FlossDBusManager::Get()->GetGattClient()->DiscoverAllServices( + base::DoNothing(), address_); } void BluetoothDeviceFloss::DisconnectGatt() { - NOTIMPLEMENTED(); + if (IsPaired()) { + BLUETOOTH_LOG(ERROR) << "Leaking connection to paired device."; + return; + } + + FlossDBusManager::Get()->GetGattClient()->Disconnect(base::DoNothing(), + address_); } BluetoothDeviceFloss::BluetoothDeviceFloss( @@ -401,7 +437,16 @@ name_(device.name), ui_task_runner_(ui_task_runner), socket_thread_(socket_thread) { - // TODO(abps): Add observers and cache data here. + FlossDBusManager::Get()->GetGattClient()->AddObserver(this); + + // Enable service specific discovery. This allows gatt connections to + // immediately trigger service discovery for specific uuids without + // requiring full discovery. + supports_service_specific_discovery_ = true; +} + +BluetoothDeviceFloss::~BluetoothDeviceFloss() { + FlossDBusManager::Get()->GetGattClient()->RemoveObserver(this); } bool BluetoothDeviceFloss::IsBondedImpl() const { @@ -556,4 +601,72 @@ DCHECK(num_pending_properties_ >= 0); } +void BluetoothDeviceFloss::GattClientConnectionState(GattStatus status, + int32_t client_id, + bool connected, + std::string address) { + // We only care about connections for this device. + if (address != address_) + return; + + absl::optional<ConnectErrorCode> err = absl::nullopt; + + if (status == GattStatus::kSuccess) { + is_gatt_connected_ = connected; + } else { + // TODO(b/193686094) - Convert GattStatus to other connect error codes. + err = ERROR_UNKNOWN; + } + + if (--num_connecting_calls_ == 0) + adapter()->NotifyDeviceChanged(this); + + DCHECK(num_connecting_calls_ >= 0); + + // Trigger service discovery. + if (search_uuid.has_value()) { + FlossDBusManager::Get()->GetGattClient()->DiscoverServiceByUuid( + base::DoNothing(), address_, search_uuid.value()); + } else { + FlossDBusManager::Get()->GetGattClient()->DiscoverAllServices( + base::DoNothing(), address_); + } + + // Complete GATT connection callback. + DidConnectGatt(err); +} + +void BluetoothDeviceFloss::GattSearchComplete( + std::string address, + const std::vector<GattService>& services, + GattStatus status) { + if (address != address_) + return; + + if (status != GattStatus::kSuccess) { + LOG(ERROR) << "Failed Gatt service discovery with result: " + << static_cast<uint32_t>(status); + return; + } + + svc_resolved_ = true; + + for (const auto& service : services) { + BLUETOOTH_LOG(EVENT) << "Adding new remote GATT service for device: " + << address_; + + std::unique_ptr<BluetoothRemoteGattServiceFloss> remote_service = + BluetoothRemoteGattServiceFloss::Create(adapter(), this, service, + /*primary=*/true); + + BluetoothRemoteGattServiceFloss* remote_service_ptr = remote_service.get(); + + gatt_services_[remote_service_ptr->GetIdentifier()] = + std::move(remote_service); + DCHECK(remote_service_ptr->GetUUID().IsValid()); + } + + adapter()->NotifyGattServicesDiscovered(this); +} + } // namespace floss
diff --git a/device/bluetooth/floss/bluetooth_device_floss.h b/device/bluetooth/floss/bluetooth_device_floss.h index b252c66..e4c0852 100644 --- a/device/bluetooth/floss/bluetooth_device_floss.h +++ b/device/bluetooth/floss/bluetooth_device_floss.h
@@ -13,20 +13,21 @@ #include "device/bluetooth/bluetooth_device.h" #include "device/bluetooth/bluetooth_export.h" #include "device/bluetooth/bluetooth_socket_thread.h" +#include "device/bluetooth/floss/bluetooth_adapter_floss.h" #include "device/bluetooth/floss/bluetooth_pairing_floss.h" #include "device/bluetooth/floss/floss_adapter_client.h" +#include "device/bluetooth/floss/floss_gatt_client.h" namespace floss { -class BluetoothAdapterFloss; - // BluetoothDeviceFloss implements device::BluetoothDevice for platforms using // Floss (Linux front-end for Fluoride). Objects of this type should be managed // by BluetoothAdapterFloss, which also manages device lifetimes. // // This class is not thread-safe but is only called from the UI thread. class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceFloss - : public device::BluetoothDevice { + : public device::BluetoothDevice, + public FlossGattClientObserver { public: BluetoothDeviceFloss(const BluetoothDeviceFloss&) = delete; BluetoothDeviceFloss& operator=(const BluetoothDeviceFloss&) = delete; @@ -121,10 +122,25 @@ void InitializeDeviceProperties(base::OnceClosure callback); + // FlossGattClientObserver overrides + void GattClientConnectionState(GattStatus status, + int32_t client_id, + bool connected, + std::string address) override; + void GattSearchComplete(std::string address, + const std::vector<GattService>& services, + GattStatus status) override; + + // Returns the adapter which owns this device instance. + BluetoothAdapterFloss* adapter() const { + return static_cast<BluetoothAdapterFloss*>(adapter_); + } + protected: // BluetoothDevice override void CreateGattConnectionImpl( absl::optional<device::BluetoothUUID> service_uuid) override; + void UpgradeToFullDiscovery() override; void DisconnectGatt() override; private: @@ -141,6 +157,7 @@ const std::string& error_message); void TriggerInitDevicePropertiesCallback(); + void OnConnectGatt(DBusResult<Void> ret); absl::optional<ConnectCallback> pending_callback_on_connect_profiles_ = absl::nullopt; @@ -178,6 +195,17 @@ // Updated via |SetIsConnected| only. bool is_acl_connected_ = false; + // Is GATT connected for this device. + bool is_gatt_connected_ = false; + + // Are all services resolved? Only true if full discovery is completed. See + // |IsGattServicesDiscoveryComplete| for more info. + bool svc_resolved_ = false; + + // Specific uuid to search for after gatt connection is established. If this + // is not set, then we do full discovery. + absl::optional<device::BluetoothUUID> search_uuid; + // Similar to is_acl_connected_ but contains the full connection state // (including encryption). This is updated when |SetConnectionState| is called // or when |SetIsConnected| is called.
diff --git a/device/bluetooth/floss/bluetooth_floss_unittest.cc b/device/bluetooth/floss/bluetooth_floss_unittest.cc index dee7eea3..ccaf162 100644 --- a/device/bluetooth/floss/bluetooth_floss_unittest.cc +++ b/device/bluetooth/floss/bluetooth_floss_unittest.cc
@@ -14,6 +14,7 @@ #include "device/bluetooth/floss/bluetooth_device_floss.h" #include "device/bluetooth/floss/fake_floss_adapter_client.h" #include "device/bluetooth/floss/fake_floss_advertiser_client.h" +#include "device/bluetooth/floss/fake_floss_gatt_client.h" #include "device/bluetooth/floss/fake_floss_lescan_client.h" #include "device/bluetooth/floss/fake_floss_manager_client.h" #include "device/bluetooth/floss/fake_floss_socket_manager.h" @@ -88,7 +89,6 @@ auto fake_floss_manager_client = std::make_unique<FakeFlossManagerClient>(); auto fake_floss_adapter_client = std::make_unique<FakeFlossAdapterClient>(); - auto fake_floss_socket_manager = std::make_unique<FakeFlossSocketManager>(); auto fake_floss_lescan_client = std::make_unique<FakeFlossLEScanClient>(); auto fake_floss_advertiser_client = std::make_unique<FakeFlossAdvertiserClient>(); @@ -100,7 +100,9 @@ dbus_setter->SetFlossManagerClient(std::move(fake_floss_manager_client)); dbus_setter->SetFlossAdapterClient(std::move(fake_floss_adapter_client)); - dbus_setter->SetFlossSocketManager(std::move(fake_floss_socket_manager)); + dbus_setter->SetFlossGattClient(std::make_unique<FakeFlossGattClient>()); + dbus_setter->SetFlossSocketManager( + std::make_unique<FakeFlossSocketManager>()); dbus_setter->SetFlossLEScanClient(std::move(fake_floss_lescan_client)); dbus_setter->SetFlossAdvertiserClient( std::move(fake_floss_advertiser_client));
diff --git a/device/bluetooth/floss/bluetooth_gatt_service_floss.cc b/device/bluetooth/floss/bluetooth_gatt_service_floss.cc new file mode 100644 index 0000000..32fb4cc --- /dev/null +++ b/device/bluetooth/floss/bluetooth_gatt_service_floss.cc
@@ -0,0 +1,27 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "device/bluetooth/floss/bluetooth_gatt_service_floss.h" + +namespace floss { + +BluetoothGattServiceFloss::BluetoothGattServiceFloss( + BluetoothAdapterFloss* adapter) + : adapter_(adapter) {} + +BluetoothGattServiceFloss::~BluetoothGattServiceFloss() = default; + +BluetoothAdapterFloss* BluetoothGattServiceFloss::GetAdapter() const { + return adapter_; +} + +// static +device::BluetoothGattService::GattErrorCode +BluetoothGattServiceFloss::GattStatusToServiceError(const GattStatus status) { + DCHECK(status != GattStatus::kSuccess); + + // TODO(b/193686564) - Translate remote service gatt errors to correct values. + return GattErrorCode::kUnknown; +} +} // namespace floss
diff --git a/device/bluetooth/floss/bluetooth_gatt_service_floss.h b/device/bluetooth/floss/bluetooth_gatt_service_floss.h new file mode 100644 index 0000000..23392db8dc --- /dev/null +++ b/device/bluetooth/floss/bluetooth_gatt_service_floss.h
@@ -0,0 +1,40 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +#ifndef DEVICE_BLUETOOTH_FLOSS_BLUETOOTH_GATT_SERVICE_FLOSS_H_ +#define DEVICE_BLUETOOTH_FLOSS_BLUETOOTH_GATT_SERVICE_FLOSS_H_ + +#include "device/bluetooth/bluetooth_gatt_service.h" +#include "device/bluetooth/floss/floss_gatt_client.h" + +namespace floss { + +class BluetoothAdapterFloss; + +// Subclass of |BluetoothGattService| for platforms that use Floss. +class DEVICE_BLUETOOTH_EXPORT BluetoothGattServiceFloss + : public device::BluetoothGattService { + public: + BluetoothGattServiceFloss(const BluetoothGattServiceFloss&) = delete; + BluetoothGattServiceFloss& operator=(const BluetoothGattServiceFloss&) = + delete; + + // Returns the adapter associated with this service. + BluetoothAdapterFloss* GetAdapter() const; + + // Processes a |GattStatus| into a service error code. + static device::BluetoothGattService::GattErrorCode GattStatusToServiceError( + const GattStatus status); + + protected: + explicit BluetoothGattServiceFloss(BluetoothAdapterFloss* adapter); + ~BluetoothGattServiceFloss() override; + + private: + // The adapter associated with (and which indirectly owns) this service. + raw_ptr<BluetoothAdapterFloss> adapter_; +}; + +} // namespace floss + +#endif // DEVICE_BLUETOOTH_FLOSS_BLUETOOTH_GATT_SERVICE_FLOSS_H_
diff --git a/device/bluetooth/floss/bluetooth_remote_gatt_service_floss.cc b/device/bluetooth/floss/bluetooth_remote_gatt_service_floss.cc new file mode 100644 index 0000000..682dc97 --- /dev/null +++ b/device/bluetooth/floss/bluetooth_remote_gatt_service_floss.cc
@@ -0,0 +1,57 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +#include "device/bluetooth/floss/bluetooth_remote_gatt_service_floss.h" + +#include "base/memory/ptr_util.h" +#include "device/bluetooth/floss/bluetooth_device_floss.h" + +namespace floss { + +// static +std::unique_ptr<BluetoothRemoteGattServiceFloss> +BluetoothRemoteGattServiceFloss::Create(BluetoothAdapterFloss* adapter, + BluetoothDeviceFloss* device, + GattService remote_service, + bool primary) { + return base::WrapUnique(new BluetoothRemoteGattServiceFloss( + adapter, device, remote_service, primary)); +} + +BluetoothRemoteGattServiceFloss::BluetoothRemoteGattServiceFloss( + BluetoothAdapterFloss* adapter, + BluetoothDeviceFloss* device, + GattService remote_service, + bool primary) + : BluetoothGattServiceFloss(adapter), + primary_(primary), + remote_service_(remote_service), + device_(device) { + // TODO(b/193685841) - Iterate characteristics +} + +BluetoothRemoteGattServiceFloss::~BluetoothRemoteGattServiceFloss() = default; + +std::string BluetoothRemoteGattServiceFloss::GetIdentifier() const { + return device_->GetAddress() + remote_service_.uuid.canonical_value(); +} + +device::BluetoothUUID BluetoothRemoteGattServiceFloss::GetUUID() const { + return remote_service_.uuid; +} + +device::BluetoothDevice* BluetoothRemoteGattServiceFloss::GetDevice() const { + return static_cast<device::BluetoothDevice*>(device_.get()); +} + +bool BluetoothRemoteGattServiceFloss::IsPrimary() const { + return primary_; +} + +std::vector<device::BluetoothRemoteGattService*> +BluetoothRemoteGattServiceFloss::GetIncludedServices() const { + // TODO(b/193686564) - Iterate secondary services and create more. + return {}; +} + +} // namespace floss
diff --git a/device/bluetooth/floss/bluetooth_remote_gatt_service_floss.h b/device/bluetooth/floss/bluetooth_remote_gatt_service_floss.h new file mode 100644 index 0000000..ef07f21 --- /dev/null +++ b/device/bluetooth/floss/bluetooth_remote_gatt_service_floss.h
@@ -0,0 +1,67 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +#ifndef DEVICE_BLUETOOTH_FLOSS_BLUETOOTH_REMOTE_GATT_SERVICE_FLOSS_H_ +#define DEVICE_BLUETOOTH_FLOSS_BLUETOOTH_REMOTE_GATT_SERVICE_FLOSS_H_ + +#include <memory> + +#include "device/bluetooth/bluetooth_remote_gatt_service.h" +#include "device/bluetooth/floss/bluetooth_gatt_service_floss.h" +#include "device/bluetooth/floss/floss_gatt_client.h" + +namespace device { +class BluetoothDevice; +} + +namespace floss { + +class BluetoothAdapterFloss; +class BluetoothDeviceFloss; + +class BluetoothRemoteGattServiceFloss + : public BluetoothGattServiceFloss, + public device::BluetoothRemoteGattService { + public: + static std::unique_ptr<BluetoothRemoteGattServiceFloss> Create( + BluetoothAdapterFloss* adapter, + BluetoothDeviceFloss* device, + GattService remote_service, + bool primary); + + BluetoothRemoteGattServiceFloss(const BluetoothRemoteGattServiceFloss&) = + delete; + BluetoothRemoteGattServiceFloss& operator=( + const BluetoothRemoteGattServiceFloss&) = delete; + + ~BluetoothRemoteGattServiceFloss() override; + + // device::BluetoothRemoteGattService overrides. + std::string GetIdentifier() const override; + device::BluetoothUUID GetUUID() const override; + device::BluetoothDevice* GetDevice() const override; + bool IsPrimary() const override; + std::vector<device::BluetoothRemoteGattService*> GetIncludedServices() + const override; + + protected: + BluetoothRemoteGattServiceFloss(BluetoothAdapterFloss* adapter, + BluetoothDeviceFloss* device, + GattService remote_service, + bool primary); + + private: + // Is this a primary service? + bool primary_; + + // Data about the remote gatt service represented by this class. + GattService remote_service_; + + // The device this GATT service belongs to. Ok to store raw pointer here since + // |device_| owns this instance. + raw_ptr<BluetoothDeviceFloss> device_; +}; + +} // namespace floss + +#endif // DEVICE_BLUETOOTH_FLOSS_BLUETOOTH_REMOTE_GATT_SERVICE_FLOSS_H_
diff --git a/device/bluetooth/floss/bluetooth_socket_floss_unittest.cc b/device/bluetooth/floss/bluetooth_socket_floss_unittest.cc index c766929..dc5c3c89 100644 --- a/device/bluetooth/floss/bluetooth_socket_floss_unittest.cc +++ b/device/bluetooth/floss/bluetooth_socket_floss_unittest.cc
@@ -20,6 +20,7 @@ #include "device/bluetooth/floss/bluetooth_adapter_floss.h" #include "device/bluetooth/floss/fake_floss_adapter_client.h" #include "device/bluetooth/floss/fake_floss_advertiser_client.h" +#include "device/bluetooth/floss/fake_floss_gatt_client.h" #include "device/bluetooth/floss/fake_floss_lescan_client.h" #include "device/bluetooth/floss/fake_floss_manager_client.h" #include "device/bluetooth/floss/fake_floss_socket_manager.h" @@ -44,20 +45,20 @@ floss::FlossDBusManager::GetSetterForTesting(); auto fake_floss_manager_client = std::make_unique<FakeFlossManagerClient>(); - auto fake_floss_adapter_client = std::make_unique<FakeFlossAdapterClient>(); auto fake_floss_socket_manager = std::make_unique<FakeFlossSocketManager>(); auto fake_floss_lescan_client = std::make_unique<FakeFlossLEScanClient>(); auto fake_floss_advertiser_client = std::make_unique<FakeFlossAdvertiserClient>(); fake_floss_manager_client_ = fake_floss_manager_client.get(); - fake_floss_adapter_client_ = fake_floss_adapter_client.get(); fake_floss_socket_manager_ = fake_floss_socket_manager.get(); fake_floss_lescan_client_ = fake_floss_lescan_client.get(); fake_floss_advertiser_client_ = fake_floss_advertiser_client.get(); dbus_setter->SetFlossManagerClient(std::move(fake_floss_manager_client)); - dbus_setter->SetFlossAdapterClient(std::move(fake_floss_adapter_client)); + dbus_setter->SetFlossAdapterClient( + std::make_unique<FakeFlossAdapterClient>()); + dbus_setter->SetFlossGattClient(std::make_unique<FakeFlossGattClient>()); dbus_setter->SetFlossSocketManager(std::move(fake_floss_socket_manager)); dbus_setter->SetFlossLEScanClient(std::move(fake_floss_lescan_client)); dbus_setter->SetFlossAdvertiserClient( @@ -169,7 +170,6 @@ // Holds pointer to FakeFloss*Client's so that we can manipulate the fake // within tests. raw_ptr<FakeFlossManagerClient> fake_floss_manager_client_; - raw_ptr<FakeFlossAdapterClient> fake_floss_adapter_client_; raw_ptr<FakeFlossSocketManager> fake_floss_socket_manager_; raw_ptr<FakeFlossLEScanClient> fake_floss_lescan_client_; raw_ptr<FakeFlossAdvertiserClient> fake_floss_advertiser_client_;
diff --git a/device/bluetooth/floss/fake_floss_gatt_client.cc b/device/bluetooth/floss/fake_floss_gatt_client.cc new file mode 100644 index 0000000..d5f4ee63 --- /dev/null +++ b/device/bluetooth/floss/fake_floss_gatt_client.cc
@@ -0,0 +1,15 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "device/bluetooth/floss/fake_floss_gatt_client.h" + +namespace floss { + +FakeFlossGattClient::FakeFlossGattClient() = default; +FakeFlossGattClient::~FakeFlossGattClient() = default; + +void FakeFlossGattClient::Init(dbus::Bus* bus, + const std::string& service_name, + const int adapter_index) {} +} // namespace floss
diff --git a/device/bluetooth/floss/fake_floss_gatt_client.h b/device/bluetooth/floss/fake_floss_gatt_client.h new file mode 100644 index 0000000..5060933 --- /dev/null +++ b/device/bluetooth/floss/fake_floss_gatt_client.h
@@ -0,0 +1,23 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +#ifndef DEVICE_BLUETOOTH_FLOSS_FAKE_FLOSS_GATT_CLIENT_H_ +#define DEVICE_BLUETOOTH_FLOSS_FAKE_FLOSS_GATT_CLIENT_H_ + +#include "device/bluetooth/floss/floss_gatt_client.h" + +namespace floss { + +class DEVICE_BLUETOOTH_EXPORT FakeFlossGattClient : public FlossGattClient { + public: + FakeFlossGattClient(); + ~FakeFlossGattClient() override; + + void Init(dbus::Bus* bus, + const std::string& service_name, + const int adapter_index) override; +}; + +} // namespace floss + +#endif // DEVICE_BLUETOOTH_FLOSS_FAKE_FLOSS_GATT_CLIENT_H_
diff --git a/device/bluetooth/floss/floss_dbus_manager.cc b/device/bluetooth/floss/floss_dbus_manager.cc index f71ca96f..21fda4c 100644 --- a/device/bluetooth/floss/floss_dbus_manager.cc +++ b/device/bluetooth/floss/floss_dbus_manager.cc
@@ -15,7 +15,12 @@ #include "dbus/message.h" #include "dbus/object_manager.h" #include "dbus/object_proxy.h" +#include "device/bluetooth/floss/fake_floss_adapter_client.h" +#include "device/bluetooth/floss/fake_floss_advertiser_client.h" +#include "device/bluetooth/floss/fake_floss_gatt_client.h" +#include "device/bluetooth/floss/fake_floss_lescan_client.h" #include "device/bluetooth/floss/fake_floss_manager_client.h" +#include "device/bluetooth/floss/fake_floss_socket_manager.h" #include "device/bluetooth/floss/floss_adapter_client.h" #include "device/bluetooth/floss/floss_advertiser_client.h" #include "device/bluetooth/floss/floss_lescan_client.h" @@ -172,14 +177,18 @@ return active_adapter_ != kInvalidAdapter; } -FlossManagerClient* FlossDBusManager::GetManagerClient() { - return client_bundle_->manager_client(); -} - FlossAdapterClient* FlossDBusManager::GetAdapterClient() { return client_bundle_->adapter_client(); } +FlossGattClient* FlossDBusManager::GetGattClient() { + return client_bundle_->gatt_client(); +} + +FlossManagerClient* FlossDBusManager::GetManagerClient() { + return client_bundle_->manager_client(); +} + FlossSocketManager* FlossDBusManager::GetSocketManager() { return client_bundle_->socket_manager(); } @@ -208,6 +217,8 @@ // Initialize any adapter clients. client_bundle_->adapter_client()->Init(GetSystemBus(), kAdapterService, active_adapter_); + client_bundle_->gatt_client()->Init(GetSystemBus(), kAdapterService, + active_adapter_); client_bundle_->socket_manager()->Init(GetSystemBus(), kAdapterService, active_adapter_); client_bundle_->lescan_client()->Init(GetSystemBus(), kAdapterService, @@ -226,6 +237,11 @@ FlossDBusManager::Get()->client_bundle_->adapter_client_ = std::move(client); } +void FlossDBusManagerSetter::SetFlossGattClient( + std::unique_ptr<FlossGattClient> client) { + FlossDBusManager::Get()->client_bundle_->gatt_client_ = std::move(client); +} + void FlossDBusManagerSetter::SetFlossSocketManager( std::unique_ptr<FlossSocketManager> mgr) { FlossDBusManager::Get()->client_bundle_->socket_manager_ = std::move(mgr); @@ -260,6 +276,7 @@ } adapter_client_ = FlossAdapterClient::Create(); + gatt_client_ = FlossGattClient::Create(); socket_manager_ = FlossSocketManager::Create(); lescan_client_ = FlossLEScanClient::Create(); advertiser_client_ = FlossAdvertiserClient::Create();
diff --git a/device/bluetooth/floss/floss_dbus_manager.h b/device/bluetooth/floss/floss_dbus_manager.h index 85fe9bab..c7c46a8 100644 --- a/device/bluetooth/floss/floss_dbus_manager.h +++ b/device/bluetooth/floss/floss_dbus_manager.h
@@ -29,6 +29,7 @@ class FlossAdapterClient; class FlossClientBundle; class FlossDBusManagerSetter; +class FlossGattClient; class FlossManagerClient; class FlossSocketManager; class FlossLEScanClient; @@ -101,8 +102,9 @@ // All returned objects are owned by FlossDBusManager. Do not use these // pointers after FlossDBusManager has been shut down. - FlossManagerClient* GetManagerClient(); FlossAdapterClient* GetAdapterClient(); + FlossGattClient* GetGattClient(); + FlossManagerClient* GetManagerClient(); FlossSocketManager* GetSocketManager(); FlossLEScanClient* GetLEScanClient(); FlossAdvertiserClient* GetAdvertiserClient(); @@ -155,6 +157,7 @@ void SetFlossSocketManager(std::unique_ptr<FlossSocketManager> manager); void SetFlossLEScanClient(std::unique_ptr<FlossLEScanClient> client); void SetFlossAdvertiserClient(std::unique_ptr<FlossAdvertiserClient> client); + void SetFlossGattClient(std::unique_ptr<FlossGattClient> client); }; // FlossDBusThreadManager manages the D-Bus thread, the thread dedicated to @@ -201,6 +204,8 @@ FlossAdapterClient* adapter_client() { return adapter_client_.get(); } + FlossGattClient* gatt_client() { return gatt_client_.get(); } + FlossSocketManager* socket_manager() { return socket_manager_.get(); } FlossLEScanClient* lescan_client() { return lescan_client_.get(); } @@ -218,6 +223,7 @@ bool use_stubs_; std::unique_ptr<FlossManagerClient> manager_client_; std::unique_ptr<FlossAdapterClient> adapter_client_; + std::unique_ptr<FlossGattClient> gatt_client_; std::unique_ptr<FlossSocketManager> socket_manager_; std::unique_ptr<FlossLEScanClient> lescan_client_; std::unique_ptr<FlossAdvertiserClient> advertiser_client_;
diff --git a/infra/config/generated/builders/reclient/Linux Builder reclient staging untrusted/properties.json b/infra/config/generated/builders/reclient/Linux Builder reclient staging untrusted/properties.json index 0110791..d595fd9 100644 --- a/infra/config/generated/builders/reclient/Linux Builder reclient staging untrusted/properties.json +++ b/infra/config/generated/builders/reclient/Linux Builder reclient staging untrusted/properties.json
@@ -43,6 +43,11 @@ } }, "$build/reclient": { + "bootstrap_env": { + "RBE_deps_cache_mode": "reproxy", + "RBE_experimental_goma_deps_cache": "True", + "RBE_ip_reset_min_delay": "-1s" + }, "instance": "rbe-chromium-untrusted", "metrics_project": "chromium-reclient-metrics" },
diff --git a/infra/config/generated/builders/reclient/Linux Builder reclient staging/properties.json b/infra/config/generated/builders/reclient/Linux Builder reclient staging/properties.json index 6390cc9b..33e5408 100644 --- a/infra/config/generated/builders/reclient/Linux Builder reclient staging/properties.json +++ b/infra/config/generated/builders/reclient/Linux Builder reclient staging/properties.json
@@ -43,6 +43,11 @@ } }, "$build/reclient": { + "bootstrap_env": { + "RBE_deps_cache_mode": "reproxy", + "RBE_experimental_goma_deps_cache": "True", + "RBE_ip_reset_min_delay": "-1s" + }, "instance": "rbe-chromium-trusted", "metrics_project": "chromium-reclient-metrics" },
diff --git a/infra/config/generated/builders/reclient/Linux Builder reclient test untrusted/properties.json b/infra/config/generated/builders/reclient/Linux Builder reclient test untrusted/properties.json index f8baebe..f465e3f 100644 --- a/infra/config/generated/builders/reclient/Linux Builder reclient test untrusted/properties.json +++ b/infra/config/generated/builders/reclient/Linux Builder reclient test untrusted/properties.json
@@ -43,6 +43,11 @@ } }, "$build/reclient": { + "bootstrap_env": { + "RBE_deps_cache_mode": "reproxy", + "RBE_experimental_goma_deps_cache": "True", + "RBE_ip_reset_min_delay": "-1s" + }, "instance": "rbe-chromium-untrusted-test", "metrics_project": "chromium-reclient-metrics" },
diff --git a/infra/config/generated/builders/reclient/Linux Builder reclient test/properties.json b/infra/config/generated/builders/reclient/Linux Builder reclient test/properties.json index 669bb9e..3251bd5 100644 --- a/infra/config/generated/builders/reclient/Linux Builder reclient test/properties.json +++ b/infra/config/generated/builders/reclient/Linux Builder reclient test/properties.json
@@ -43,6 +43,11 @@ } }, "$build/reclient": { + "bootstrap_env": { + "RBE_deps_cache_mode": "reproxy", + "RBE_experimental_goma_deps_cache": "True", + "RBE_ip_reset_min_delay": "-1s" + }, "instance": "rbe-chromium-trusted-test", "metrics_project": "chromium-reclient-metrics" },
diff --git a/infra/config/generated/builders/reclient/Mac Builder reclient staging untrusted/properties.json b/infra/config/generated/builders/reclient/Mac Builder reclient staging untrusted/properties.json index 8fc356e..3e3a7e3 100644 --- a/infra/config/generated/builders/reclient/Mac Builder reclient staging untrusted/properties.json +++ b/infra/config/generated/builders/reclient/Mac Builder reclient staging untrusted/properties.json
@@ -46,7 +46,10 @@ }, "$build/reclient": { "bootstrap_env": { - "GLOG_vmodule": "bridge*=2" + "GLOG_vmodule": "bridge*=2", + "RBE_deps_cache_mode": "reproxy", + "RBE_experimental_goma_deps_cache": "True", + "RBE_ip_reset_min_delay": "-1s" }, "instance": "rbe-chromium-untrusted", "metrics_project": "chromium-reclient-metrics"
diff --git a/infra/config/generated/builders/reclient/Mac Builder reclient staging/properties.json b/infra/config/generated/builders/reclient/Mac Builder reclient staging/properties.json index 32e33a1..0d4238b0 100644 --- a/infra/config/generated/builders/reclient/Mac Builder reclient staging/properties.json +++ b/infra/config/generated/builders/reclient/Mac Builder reclient staging/properties.json
@@ -46,7 +46,10 @@ }, "$build/reclient": { "bootstrap_env": { - "GLOG_vmodule": "bridge*=2" + "GLOG_vmodule": "bridge*=2", + "RBE_deps_cache_mode": "reproxy", + "RBE_experimental_goma_deps_cache": "True", + "RBE_ip_reset_min_delay": "-1s" }, "instance": "rbe-chromium-trusted", "metrics_project": "chromium-reclient-metrics"
diff --git a/infra/config/generated/builders/reclient/Mac Builder reclient test untrusted/properties.json b/infra/config/generated/builders/reclient/Mac Builder reclient test untrusted/properties.json index a6d0939..9b13067 100644 --- a/infra/config/generated/builders/reclient/Mac Builder reclient test untrusted/properties.json +++ b/infra/config/generated/builders/reclient/Mac Builder reclient test untrusted/properties.json
@@ -47,7 +47,9 @@ "$build/reclient": { "bootstrap_env": { "GLOG_vmodule": "bridge*=2", - "RBE_ip_timeout": "-1s" + "RBE_deps_cache_mode": "reproxy", + "RBE_experimental_goma_deps_cache": "True", + "RBE_ip_reset_min_delay": "-1s" }, "instance": "rbe-chromium-untrusted-test", "metrics_project": "chromium-reclient-metrics",
diff --git a/infra/config/generated/builders/reclient/Mac Builder reclient test/properties.json b/infra/config/generated/builders/reclient/Mac Builder reclient test/properties.json index e832b58..926cec5 100644 --- a/infra/config/generated/builders/reclient/Mac Builder reclient test/properties.json +++ b/infra/config/generated/builders/reclient/Mac Builder reclient test/properties.json
@@ -47,7 +47,9 @@ "$build/reclient": { "bootstrap_env": { "GLOG_vmodule": "bridge*=2", - "RBE_ip_timeout": "-1s" + "RBE_deps_cache_mode": "reproxy", + "RBE_experimental_goma_deps_cache": "True", + "RBE_ip_reset_min_delay": "-1s" }, "instance": "rbe-chromium-trusted-test", "metrics_project": "chromium-reclient-metrics",
diff --git a/infra/config/generated/builders/reclient/Simple Chrome Builder reclient staging untrusted/properties.json b/infra/config/generated/builders/reclient/Simple Chrome Builder reclient staging untrusted/properties.json index 81e67ff..ac585631 100644 --- a/infra/config/generated/builders/reclient/Simple Chrome Builder reclient staging untrusted/properties.json +++ b/infra/config/generated/builders/reclient/Simple Chrome Builder reclient staging untrusted/properties.json
@@ -47,6 +47,11 @@ } }, "$build/reclient": { + "bootstrap_env": { + "RBE_deps_cache_mode": "reproxy", + "RBE_experimental_goma_deps_cache": "True", + "RBE_ip_reset_min_delay": "-1s" + }, "instance": "rbe-chromium-untrusted", "metrics_project": "chromium-reclient-metrics" },
diff --git a/infra/config/generated/builders/reclient/Simple Chrome Builder reclient staging/properties.json b/infra/config/generated/builders/reclient/Simple Chrome Builder reclient staging/properties.json index ad84af5..814453a 100644 --- a/infra/config/generated/builders/reclient/Simple Chrome Builder reclient staging/properties.json +++ b/infra/config/generated/builders/reclient/Simple Chrome Builder reclient staging/properties.json
@@ -47,6 +47,11 @@ } }, "$build/reclient": { + "bootstrap_env": { + "RBE_deps_cache_mode": "reproxy", + "RBE_experimental_goma_deps_cache": "True", + "RBE_ip_reset_min_delay": "-1s" + }, "instance": "rbe-chromium-trusted", "metrics_project": "chromium-reclient-metrics" },
diff --git a/infra/config/generated/builders/reclient/Simple Chrome Builder reclient test untrusted/properties.json b/infra/config/generated/builders/reclient/Simple Chrome Builder reclient test untrusted/properties.json index 55d85f6..2e3ff98 100644 --- a/infra/config/generated/builders/reclient/Simple Chrome Builder reclient test untrusted/properties.json +++ b/infra/config/generated/builders/reclient/Simple Chrome Builder reclient test untrusted/properties.json
@@ -47,6 +47,11 @@ } }, "$build/reclient": { + "bootstrap_env": { + "RBE_deps_cache_mode": "reproxy", + "RBE_experimental_goma_deps_cache": "True", + "RBE_ip_reset_min_delay": "-1s" + }, "instance": "rbe-chromium-untrusted-test", "metrics_project": "chromium-reclient-metrics" },
diff --git a/infra/config/generated/builders/reclient/Simple Chrome Builder reclient test/properties.json b/infra/config/generated/builders/reclient/Simple Chrome Builder reclient test/properties.json index 441ce26f1..bb5c3c55 100644 --- a/infra/config/generated/builders/reclient/Simple Chrome Builder reclient test/properties.json +++ b/infra/config/generated/builders/reclient/Simple Chrome Builder reclient test/properties.json
@@ -47,6 +47,11 @@ } }, "$build/reclient": { + "bootstrap_env": { + "RBE_deps_cache_mode": "reproxy", + "RBE_experimental_goma_deps_cache": "True", + "RBE_ip_reset_min_delay": "-1s" + }, "instance": "rbe-chromium-trusted-test", "metrics_project": "chromium-reclient-metrics" },
diff --git a/infra/config/generated/builders/reclient/Win x64 Builder reclient staging untrusted/properties.json b/infra/config/generated/builders/reclient/Win x64 Builder reclient staging untrusted/properties.json index aae9424..75f41352 100644 --- a/infra/config/generated/builders/reclient/Win x64 Builder reclient staging untrusted/properties.json +++ b/infra/config/generated/builders/reclient/Win x64 Builder reclient staging untrusted/properties.json
@@ -44,6 +44,11 @@ } }, "$build/reclient": { + "bootstrap_env": { + "RBE_deps_cache_mode": "reproxy", + "RBE_experimental_goma_deps_cache": "True", + "RBE_ip_reset_min_delay": "-1s" + }, "instance": "rbe-chromium-untrusted", "metrics_project": "chromium-reclient-metrics" },
diff --git a/infra/config/generated/builders/reclient/Win x64 Builder reclient staging/properties.json b/infra/config/generated/builders/reclient/Win x64 Builder reclient staging/properties.json index 46100e66..2df7067 100644 --- a/infra/config/generated/builders/reclient/Win x64 Builder reclient staging/properties.json +++ b/infra/config/generated/builders/reclient/Win x64 Builder reclient staging/properties.json
@@ -44,6 +44,11 @@ } }, "$build/reclient": { + "bootstrap_env": { + "RBE_deps_cache_mode": "reproxy", + "RBE_experimental_goma_deps_cache": "True", + "RBE_ip_reset_min_delay": "-1s" + }, "instance": "rbe-chromium-trusted", "metrics_project": "chromium-reclient-metrics" },
diff --git a/infra/config/generated/builders/reclient/Win x64 Builder reclient test untrusted/properties.json b/infra/config/generated/builders/reclient/Win x64 Builder reclient test untrusted/properties.json index 977f7697..b67556f 100644 --- a/infra/config/generated/builders/reclient/Win x64 Builder reclient test untrusted/properties.json +++ b/infra/config/generated/builders/reclient/Win x64 Builder reclient test untrusted/properties.json
@@ -44,6 +44,11 @@ } }, "$build/reclient": { + "bootstrap_env": { + "RBE_deps_cache_mode": "reproxy", + "RBE_experimental_goma_deps_cache": "True", + "RBE_ip_reset_min_delay": "-1s" + }, "instance": "rbe-chromium-untrusted-test", "metrics_project": "chromium-reclient-metrics" },
diff --git a/infra/config/generated/builders/reclient/Win x64 Builder reclient test/properties.json b/infra/config/generated/builders/reclient/Win x64 Builder reclient test/properties.json index 2e0af97c..fb7bce9 100644 --- a/infra/config/generated/builders/reclient/Win x64 Builder reclient test/properties.json +++ b/infra/config/generated/builders/reclient/Win x64 Builder reclient test/properties.json
@@ -44,6 +44,11 @@ } }, "$build/reclient": { + "bootstrap_env": { + "RBE_deps_cache_mode": "reproxy", + "RBE_experimental_goma_deps_cache": "True", + "RBE_ip_reset_min_delay": "-1s" + }, "instance": "rbe-chromium-trusted-test", "metrics_project": "chromium-reclient-metrics" },
diff --git a/infra/config/generated/builders/reclient/ios-simulator reclient staging untrusted/properties.json b/infra/config/generated/builders/reclient/ios-simulator reclient staging untrusted/properties.json index 777bbb3..a28954a 100644 --- a/infra/config/generated/builders/reclient/ios-simulator reclient staging untrusted/properties.json +++ b/infra/config/generated/builders/reclient/ios-simulator reclient staging untrusted/properties.json
@@ -46,7 +46,10 @@ }, "$build/reclient": { "bootstrap_env": { - "GLOG_vmodule": "bridge*=2" + "GLOG_vmodule": "bridge*=2", + "RBE_deps_cache_mode": "reproxy", + "RBE_experimental_goma_deps_cache": "True", + "RBE_ip_reset_min_delay": "-1s" }, "instance": "rbe-chromium-untrusted", "metrics_project": "chromium-reclient-metrics"
diff --git a/infra/config/generated/builders/reclient/ios-simulator reclient staging/properties.json b/infra/config/generated/builders/reclient/ios-simulator reclient staging/properties.json index c9df000..4b54900 100644 --- a/infra/config/generated/builders/reclient/ios-simulator reclient staging/properties.json +++ b/infra/config/generated/builders/reclient/ios-simulator reclient staging/properties.json
@@ -46,7 +46,10 @@ }, "$build/reclient": { "bootstrap_env": { - "GLOG_vmodule": "bridge*=2" + "GLOG_vmodule": "bridge*=2", + "RBE_deps_cache_mode": "reproxy", + "RBE_experimental_goma_deps_cache": "True", + "RBE_ip_reset_min_delay": "-1s" }, "instance": "rbe-chromium-trusted", "metrics_project": "chromium-reclient-metrics"
diff --git a/infra/config/generated/builders/reclient/ios-simulator reclient test untrusted/properties.json b/infra/config/generated/builders/reclient/ios-simulator reclient test untrusted/properties.json index ce61745..84b5084 100644 --- a/infra/config/generated/builders/reclient/ios-simulator reclient test untrusted/properties.json +++ b/infra/config/generated/builders/reclient/ios-simulator reclient test untrusted/properties.json
@@ -47,7 +47,9 @@ "$build/reclient": { "bootstrap_env": { "GLOG_vmodule": "bridge*=2", - "RBE_ip_timeout": "-1s" + "RBE_deps_cache_mode": "reproxy", + "RBE_experimental_goma_deps_cache": "True", + "RBE_ip_reset_min_delay": "-1s" }, "instance": "rbe-chromium-untrusted-test", "metrics_project": "chromium-reclient-metrics"
diff --git a/infra/config/generated/builders/reclient/ios-simulator reclient test/properties.json b/infra/config/generated/builders/reclient/ios-simulator reclient test/properties.json index 03a24d3f..8b2bd75 100644 --- a/infra/config/generated/builders/reclient/ios-simulator reclient test/properties.json +++ b/infra/config/generated/builders/reclient/ios-simulator reclient test/properties.json
@@ -47,7 +47,9 @@ "$build/reclient": { "bootstrap_env": { "GLOG_vmodule": "bridge*=2", - "RBE_ip_timeout": "-1s" + "RBE_deps_cache_mode": "reproxy", + "RBE_experimental_goma_deps_cache": "True", + "RBE_ip_reset_min_delay": "-1s" }, "instance": "rbe-chromium-trusted-test", "metrics_project": "chromium-reclient-metrics"
diff --git a/infra/config/generated/builders/reclient/mac-arm64-rel reclient staging untrusted/properties.json b/infra/config/generated/builders/reclient/mac-arm64-rel reclient staging untrusted/properties.json index a3eaca6b..63f61888 100644 --- a/infra/config/generated/builders/reclient/mac-arm64-rel reclient staging untrusted/properties.json +++ b/infra/config/generated/builders/reclient/mac-arm64-rel reclient staging untrusted/properties.json
@@ -45,7 +45,10 @@ }, "$build/reclient": { "bootstrap_env": { - "GLOG_vmodule": "bridge*=2" + "GLOG_vmodule": "bridge*=2", + "RBE_deps_cache_mode": "reproxy", + "RBE_experimental_goma_deps_cache": "True", + "RBE_ip_reset_min_delay": "-1s" }, "instance": "rbe-chromium-untrusted", "metrics_project": "chromium-reclient-metrics"
diff --git a/infra/config/generated/builders/reclient/mac-arm64-rel reclient staging/properties.json b/infra/config/generated/builders/reclient/mac-arm64-rel reclient staging/properties.json index 62488d6..33c4a5d0 100644 --- a/infra/config/generated/builders/reclient/mac-arm64-rel reclient staging/properties.json +++ b/infra/config/generated/builders/reclient/mac-arm64-rel reclient staging/properties.json
@@ -45,7 +45,10 @@ }, "$build/reclient": { "bootstrap_env": { - "GLOG_vmodule": "bridge*=2" + "GLOG_vmodule": "bridge*=2", + "RBE_deps_cache_mode": "reproxy", + "RBE_experimental_goma_deps_cache": "True", + "RBE_ip_reset_min_delay": "-1s" }, "instance": "rbe-chromium-trusted", "metrics_project": "chromium-reclient-metrics"
diff --git a/infra/config/generated/builders/reclient/mac-arm64-rel reclient test untrusted/properties.json b/infra/config/generated/builders/reclient/mac-arm64-rel reclient test untrusted/properties.json index 1698692..288d6a1 100644 --- a/infra/config/generated/builders/reclient/mac-arm64-rel reclient test untrusted/properties.json +++ b/infra/config/generated/builders/reclient/mac-arm64-rel reclient test untrusted/properties.json
@@ -46,7 +46,9 @@ "$build/reclient": { "bootstrap_env": { "GLOG_vmodule": "bridge*=2", - "RBE_ip_timeout": "-1s" + "RBE_deps_cache_mode": "reproxy", + "RBE_experimental_goma_deps_cache": "True", + "RBE_ip_reset_min_delay": "-1s" }, "instance": "rbe-chromium-untrusted-test", "metrics_project": "chromium-reclient-metrics"
diff --git a/infra/config/generated/builders/reclient/mac-arm64-rel reclient test/properties.json b/infra/config/generated/builders/reclient/mac-arm64-rel reclient test/properties.json index 5c5eac4c..536feab 100644 --- a/infra/config/generated/builders/reclient/mac-arm64-rel reclient test/properties.json +++ b/infra/config/generated/builders/reclient/mac-arm64-rel reclient test/properties.json
@@ -46,7 +46,9 @@ "$build/reclient": { "bootstrap_env": { "GLOG_vmodule": "bridge*=2", - "RBE_ip_timeout": "-1s" + "RBE_deps_cache_mode": "reproxy", + "RBE_experimental_goma_deps_cache": "True", + "RBE_ip_reset_min_delay": "-1s" }, "instance": "rbe-chromium-trusted-test", "metrics_project": "chromium-reclient-metrics"
diff --git a/infra/config/generated/luci/cr-buildbucket.cfg b/infra/config/generated/luci/cr-buildbucket.cfg index f675d685..c3b3c23 100644 --- a/infra/config/generated/luci/cr-buildbucket.cfg +++ b/infra/config/generated/luci/cr-buildbucket.cfg
@@ -1009,6 +1009,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -1096,6 +1100,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -1180,6 +1188,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -1267,6 +1279,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -1354,6 +1370,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -1441,6 +1461,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -1528,6 +1552,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -1615,6 +1643,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -3367,6 +3399,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -3454,6 +3490,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -3541,6 +3581,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -3689,6 +3733,11 @@ ' "use_luci_auth": true' ' },' ' "$build/reclient": {' + ' "bootstrap_env": {' + ' "RBE_deps_cache_mode": "reproxy",' + ' "RBE_experimental_goma_deps_cache": "true",' + ' "RBE_ip_reset_min_delay": "-1s"' + ' },' ' "cache_silo": "Comparison Android - cache siloed",' ' "instance": "rbe-chromium-trusted",' ' "jobs": 250,' @@ -3780,7 +3829,9 @@ ' },' ' "$build/reclient": {' ' "bootstrap_env": {' - ' "RBE_experimental_goma_deps_cache": "true"' + ' "RBE_deps_cache_mode": "reproxy",' + ' "RBE_experimental_goma_deps_cache": "true",' + ' "RBE_ip_reset_min_delay": "-1s"' ' },' ' "cache_silo": "Comparison Android (reproxy cache) - cache siloed",' ' "instance": "rbe-chromium-trusted",' @@ -3873,7 +3924,9 @@ ' },' ' "$build/reclient": {' ' "bootstrap_env": {' - ' "RBE_experimental_goma_deps_cache": "true"' + ' "RBE_deps_cache_mode": "reproxy",' + ' "RBE_experimental_goma_deps_cache": "true",' + ' "RBE_ip_reset_min_delay": "-1s"' ' },' ' "cache_silo": "Comparison Android CQ - cache siloed",' ' "instance": "rbe-chromium-untrusted-test",' @@ -3966,7 +4019,9 @@ ' },' ' "$build/reclient": {' ' "bootstrap_env": {' - ' "RBE_experimental_goma_deps_cache": "true"' + ' "RBE_deps_cache_mode": "reproxy",' + ' "RBE_experimental_goma_deps_cache": "true",' + ' "RBE_ip_reset_min_delay": "-1s"' ' },' ' "cache_silo": "Comparison Linux - cache siloed",' ' "instance": "rbe-chromium-trusted",' @@ -4058,7 +4113,9 @@ ' },' ' "$build/reclient": {' ' "bootstrap_env": {' - ' "RBE_experimental_goma_deps_cache": "true"' + ' "RBE_deps_cache_mode": "reproxy",' + ' "RBE_experimental_goma_deps_cache": "true",' + ' "RBE_ip_reset_min_delay": "-1s"' ' },' ' "cache_silo": "Comparison Linux CQ - cache siloed",' ' "instance": "rbe-chromium-untrusted-test",' @@ -4149,8 +4206,9 @@ ' "$build/reclient": {' ' "bootstrap_env": {' ' "GLOG_vmodule": "bridge*=2",' + ' "RBE_deps_cache_mode": "reproxy",' ' "RBE_experimental_goma_deps_cache": "true",' - ' "RBE_ip_timeout": "-1s"' + ' "RBE_ip_reset_min_delay": "-1s"' ' },' ' "cache_silo": "Comparison Mac - cache siloed",' ' "instance": "rbe-chromium-trusted-test",' @@ -4241,7 +4299,9 @@ ' "$build/reclient": {' ' "bootstrap_env": {' ' "GLOG_vmodule": "bridge*=2",' - ' "RBE_experimental_goma_deps_cache": "true"' + ' "RBE_deps_cache_mode": "reproxy",' + ' "RBE_experimental_goma_deps_cache": "true",' + ' "RBE_ip_reset_min_delay": "-1s"' ' },' ' "cache_silo": "Comparison Mac CQ - cache siloed",' ' "instance": "rbe-chromium-untrusted-test",' @@ -4332,7 +4392,9 @@ ' "$build/reclient": {' ' "bootstrap_env": {' ' "GLOG_vmodule": "bridge*=2",' - ' "RBE_experimental_goma_deps_cache": "true"' + ' "RBE_deps_cache_mode": "reproxy",' + ' "RBE_experimental_goma_deps_cache": "true",' + ' "RBE_ip_reset_min_delay": "-1s"' ' },' ' "cache_silo": "Comparison Mac - cache siloed",' ' "instance": "rbe-chromium-trusted-test",' @@ -4422,7 +4484,9 @@ ' "$build/reclient": {' ' "bootstrap_env": {' ' "GLOG_vmodule": "bridge*=2",' - ' "RBE_experimental_goma_deps_cache": "true"' + ' "RBE_deps_cache_mode": "reproxy",' + ' "RBE_experimental_goma_deps_cache": "true",' + ' "RBE_ip_reset_min_delay": "-1s"' ' },' ' "cache_silo": "Comparison Mac - cache siloed",' ' "instance": "rbe-chromium-trusted-test",' @@ -4513,6 +4577,11 @@ ' "use_luci_auth": true' ' },' ' "$build/reclient": {' + ' "bootstrap_env": {' + ' "RBE_deps_cache_mode": "reproxy",' + ' "RBE_experimental_goma_deps_cache": "true",' + ' "RBE_ip_reset_min_delay": "-1s"' + ' },' ' "cache_silo": "Comparison Simple Chrome - cache siloed",' ' "instance": "rbe-chromium-trusted",' ' "jobs": 250,' @@ -4603,7 +4672,9 @@ ' },' ' "$build/reclient": {' ' "bootstrap_env": {' - ' "RBE_experimental_goma_deps_cache": "true"' + ' "RBE_deps_cache_mode": "reproxy",' + ' "RBE_experimental_goma_deps_cache": "true",' + ' "RBE_ip_reset_min_delay": "-1s"' ' },' ' "cache_silo": "Comparison Simple Chrome CQ - cache siloed",' ' "instance": "rbe-chromium-untrusted-test",' @@ -4696,7 +4767,9 @@ ' },' ' "$build/reclient": {' ' "bootstrap_env": {' - ' "RBE_experimental_goma_deps_cache": "true"' + ' "RBE_deps_cache_mode": "reproxy",' + ' "RBE_experimental_goma_deps_cache": "true",' + ' "RBE_ip_reset_min_delay": "-1s"' ' },' ' "cache_silo": "Comparison Windows 8 cores - cache siloed",' ' "instance": "rbe-chromium-trusted",' @@ -4788,7 +4861,9 @@ ' },' ' "$build/reclient": {' ' "bootstrap_env": {' - ' "RBE_experimental_goma_deps_cache": "true"' + ' "RBE_deps_cache_mode": "reproxy",' + ' "RBE_experimental_goma_deps_cache": "true",' + ' "RBE_ip_reset_min_delay": "-1s"' ' },' ' "cache_silo": "Comparison Windows - cache siloed",' ' "instance": "rbe-chromium-trusted",' @@ -4880,7 +4955,9 @@ ' },' ' "$build/reclient": {' ' "bootstrap_env": {' - ' "RBE_experimental_goma_deps_cache": "true"' + ' "RBE_deps_cache_mode": "reproxy",' + ' "RBE_experimental_goma_deps_cache": "true",' + ' "RBE_ip_reset_min_delay": "-1s"' ' },' ' "cache_silo": "Comparison Windows CQ - cache siloed",' ' "instance": "rbe-chromium-untrusted-test",' @@ -4970,7 +5047,9 @@ ' },' ' "$build/reclient": {' ' "bootstrap_env": {' - ' "RBE_experimental_goma_deps_cache": "true"' + ' "RBE_deps_cache_mode": "reproxy",' + ' "RBE_experimental_goma_deps_cache": "true",' + ' "RBE_ip_reset_min_delay": "-1s"' ' },' ' "cache_silo": "Comparison ios - cache siloed",' ' "instance": "rbe-chromium-trusted-test",' @@ -5065,7 +5144,9 @@ ' },' ' "$build/reclient": {' ' "bootstrap_env": {' - ' "RBE_experimental_goma_deps_cache": "true"' + ' "RBE_deps_cache_mode": "reproxy",' + ' "RBE_experimental_goma_deps_cache": "true",' + ' "RBE_ip_reset_min_delay": "-1s"' ' },' ' "cache_silo": "Comparison ios CQ - cache siloed",' ' "instance": "rbe-chromium-untrusted-test",' @@ -8206,6 +8287,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -8293,6 +8378,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -8380,6 +8469,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -8467,6 +8560,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -8554,6 +8651,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -8639,6 +8740,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -8724,6 +8829,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -8809,6 +8918,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -8894,6 +9007,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -8981,6 +9098,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -9068,6 +9189,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -9155,6 +9280,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -9242,6 +9371,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -9329,6 +9462,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -9416,6 +9553,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -9503,6 +9644,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -10099,6 +10244,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -10186,6 +10335,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -13128,6 +13281,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -13215,6 +13372,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -13302,6 +13463,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -13389,6 +13554,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -13476,6 +13645,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -13563,6 +13736,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -13650,6 +13827,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -15668,6 +15849,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -15755,6 +15940,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -15842,6 +16031,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -15929,6 +16122,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -16016,6 +16213,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -16103,6 +16304,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -16190,6 +16395,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -16277,6 +16486,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -16364,6 +16577,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -16451,6 +16668,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -16538,6 +16759,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -16625,6 +16850,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -16712,6 +16941,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -16799,6 +17032,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -23358,6 +23595,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -23445,6 +23686,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -23532,6 +23777,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -23619,6 +23868,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -23706,6 +23959,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -23793,6 +24050,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -23880,6 +24141,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -23967,6 +24232,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -24054,6 +24323,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -24141,6 +24414,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -33104,6 +33381,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -33191,6 +33472,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -33278,6 +33563,10 @@ value: 10 } experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { key: "luci.recipes.use_python3" value: 100 } @@ -53903,13 +54192,6 @@ ' {' ' "builder_id": {' ' "bucket": "ci",' - ' "builder": "fuchsia-fyi-x64-rel",' - ' "project": "chromium"' - ' }' - ' },' - ' {' - ' "builder_id": {' - ' "bucket": "ci",' ' "builder": "fuchsia-fyi-arm64-dbg",' ' "project": "chromium"' ' }'
diff --git a/infra/config/lib/nodes.star b/infra/config/lib/nodes.star index d5f4ee1a..01baffa 100644 --- a/infra/config/lib/nodes.star +++ b/infra/config/lib/nodes.star
@@ -5,7 +5,7 @@ """Utility library for working with lucicfg graph nodes.""" load("@stdlib//internal/graph.star", "graph") -load("@stdlib//internal/luci/common.star", "keys", "kinds") +load("@stdlib//internal/luci/common.star", "builder_ref", "keys", "kinds") _CHROMIUM_NS_KIND = "@chromium" @@ -203,6 +203,16 @@ follow_ref = follow_ref, ) +# A node-type for access to lucicfg standard builder nodes. It doesn't provide +# full access because it doesn't allow for the creation of new nodes, but it can +# be used as a node type when creating link node types. +_BUILDER = struct( + kind = kinds.BUILDER, + ref_kind = kinds.BUILDER_REF, + add_ref = lambda key, ref: graph.add_edge(key, keys.builder_ref(ref)), + follow_ref = builder_ref.follow, +) + def _create_link_node_type(kind, parent_node_type, child_node_type): """Create a link node type. @@ -309,6 +319,7 @@ ) nodes = struct( + BUILDER = _BUILDER, create_unscoped_node_type = _create_unscoped_node_type, create_bucket_scoped_node_type = _create_bucket_scoped_node_type, create_node_type_with_builder_ref = _create_node_type_with_builder_ref,
diff --git a/infra/config/lib/polymorphic.star b/infra/config/lib/polymorphic.star new file mode 100644 index 0000000..e2288560 --- /dev/null +++ b/infra/config/lib/polymorphic.star
@@ -0,0 +1,80 @@ +# Copyright 2022 The Chromium Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Library for defining polymorphic builders.""" + +load("./builders.star", "builder", "defaults") +load("./nodes.star", "nodes") +load("//project.star", "settings") + +_LAUNCHER = nodes.create_bucket_scoped_node_type("polymorphic-launcher") +_RUNNER = nodes.create_link_node_type("polymorphic-runner", _LAUNCHER, nodes.BUILDER) +_TARGET_BUILDER = nodes.create_link_node_type("polymorphic-target", _LAUNCHER, nodes.BUILDER) + +def _builder_ref_to_builder_id(ref): + bucket, builder = ref.split("/", 1) + return dict( + project = settings.project, + bucket = bucket, + builder = builder, + ) + +def launcher( + *, + name, + runner, + target_builders, + **kwargs): + """Define a polymorphic launcher builder. + + The executable will default to the `chromium_polymorphic/launcher` recipe + and the properties will be updated to set the `runner_builder` and + `target_builder` properties as required by the recipe. + + Args: + name: (str) The name of the builder. + runner: (str) Bucket-qualified reference to the builder that performs + the polymorphic runs. + target_builders: (list[str]) Bucket-qualified references to the target + builders. + **kwargs: Additional keyword arguments to be passed onto + `builders.builder`. + + Returns: + The lucicfg keyset for the builder + """ + if not target_builders: + fail("target_builders must not be empty") + bucket = defaults.get_value_from_kwargs("bucket", kwargs) + + launcher_key = _LAUNCHER.add(bucket, name) + + # Create links to the runner and target builders. We don't actually do + # anything with the links, but lucicfg will check that the nodes that are + # linked to were actually added (i.e. that the referenced builders actually + # exist). + _RUNNER.link(launcher_key, runner) + for t in target_builders: + _TARGET_BUILDER.link(launcher_key, t) + + properties = dict(kwargs.pop("properties", {})) + properties.update({ + "runner_builder": _builder_ref_to_builder_id(runner), + "target_builders": [ + {"builder_id": _builder_ref_to_builder_id(t)} + for t in target_builders + ], + }) + + kwargs.setdefault("executable", "recipe:chromium_polymorphic/launcher") + + return builder( + name = name, + properties = properties, + **kwargs + ) + +polymorphic = struct( + launcher = launcher, +)
diff --git a/infra/config/subprojects/chromium/ci/chromium.fyi.star b/infra/config/subprojects/chromium/ci/chromium.fyi.star index 0c2bfed..7f90d1c 100644 --- a/infra/config/subprojects/chromium/ci/chromium.fyi.star +++ b/infra/config/subprojects/chromium/ci/chromium.fyi.star
@@ -1058,6 +1058,11 @@ # Target luci-chromium-ci-bionic-us-central1-b-ssd-16-*. ssd = True, cores = 16, + reclient_bootstrap_env = { + "RBE_ip_reset_min_delay": "-1s", + "RBE_experimental_goma_deps_cache": "true", + "RBE_deps_cache_mode": "reproxy", + }, ) ci.builder( @@ -1081,7 +1086,9 @@ ssd = True, cores = 16, reclient_bootstrap_env = { + "RBE_ip_reset_min_delay": "-1s", "RBE_experimental_goma_deps_cache": "true", + "RBE_deps_cache_mode": "reproxy", }, ) @@ -1099,7 +1106,9 @@ reclient_jobs = 250, os = os.LINUX_DEFAULT, reclient_bootstrap_env = { + "RBE_ip_reset_min_delay": "-1s", "RBE_experimental_goma_deps_cache": "true", + "RBE_deps_cache_mode": "reproxy", }, ) @@ -1119,9 +1128,10 @@ os = os.MAC_DEFAULT, cores = None, reclient_bootstrap_env = { - "RBE_ip_timeout": "-1s", + "RBE_ip_reset_min_delay": "-1s", "GLOG_vmodule": "bridge*=2", "RBE_experimental_goma_deps_cache": "true", + "RBE_deps_cache_mode": "reproxy", }, ) @@ -1141,8 +1151,10 @@ os = os.MAC_DEFAULT, cores = None, reclient_bootstrap_env = { + "RBE_ip_reset_min_delay": "-1s", "GLOG_vmodule": "bridge*=2", "RBE_experimental_goma_deps_cache": "true", + "RBE_deps_cache_mode": "reproxy", }, ) @@ -1163,8 +1175,10 @@ cores = None, cpu = cpu.ARM64, reclient_bootstrap_env = { + "RBE_ip_reset_min_delay": "-1s", "GLOG_vmodule": "bridge*=2", "RBE_experimental_goma_deps_cache": "true", + "RBE_deps_cache_mode": "reproxy", }, ) @@ -1184,7 +1198,9 @@ os = os.WINDOWS_DEFAULT, free_space = builders.free_space.high, reclient_bootstrap_env = { + "RBE_ip_reset_min_delay": "-1s", "RBE_experimental_goma_deps_cache": "true", + "RBE_deps_cache_mode": "reproxy", }, ) @@ -1205,7 +1221,9 @@ os = os.WINDOWS_DEFAULT, free_space = builders.free_space.high, reclient_bootstrap_env = { + "RBE_ip_reset_min_delay": "-1s", "RBE_experimental_goma_deps_cache": "true", + "RBE_deps_cache_mode": "reproxy", }, ) @@ -1223,6 +1241,11 @@ reclient_instance = reclient.instance.DEFAULT_TRUSTED, reclient_jobs = 250, os = os.LINUX_DEFAULT, + reclient_bootstrap_env = { + "RBE_ip_reset_min_delay": "-1s", + "RBE_experimental_goma_deps_cache": "true", + "RBE_deps_cache_mode": "reproxy", + }, ) ci.builder( @@ -1242,7 +1265,9 @@ cores = None, xcode = xcode.x14main, reclient_bootstrap_env = { + "RBE_ip_reset_min_delay": "-1s", "RBE_experimental_goma_deps_cache": "true", + "RBE_deps_cache_mode": "reproxy", }, ) @@ -1266,7 +1291,9 @@ cores = 32, ssd = True, reclient_bootstrap_env = { + "RBE_ip_reset_min_delay": "-1s", "RBE_experimental_goma_deps_cache": "true", + "RBE_deps_cache_mode": "reproxy", }, ) @@ -1290,7 +1317,9 @@ cores = 16, ssd = True, reclient_bootstrap_env = { + "RBE_ip_reset_min_delay": "-1s", "RBE_experimental_goma_deps_cache": "true", + "RBE_deps_cache_mode": "reproxy", }, ) @@ -1316,7 +1345,9 @@ cores = None, reclient_bootstrap_env = { "GLOG_vmodule": "bridge*=2", + "RBE_ip_reset_min_delay": "-1s", "RBE_experimental_goma_deps_cache": "true", + "RBE_deps_cache_mode": "reproxy", }, ) @@ -1342,7 +1373,9 @@ ssd = True, cores = 32, reclient_bootstrap_env = { + "RBE_ip_reset_min_delay": "-1s", "RBE_experimental_goma_deps_cache": "true", + "RBE_deps_cache_mode": "reproxy", }, ) @@ -1367,7 +1400,9 @@ cores = 32, ssd = True, reclient_bootstrap_env = { + "RBE_ip_reset_min_delay": "-1s", "RBE_experimental_goma_deps_cache": "true", + "RBE_deps_cache_mode": "reproxy", }, ) @@ -1393,7 +1428,9 @@ ssd = True, xcode = xcode.x14main, reclient_bootstrap_env = { + "RBE_ip_reset_min_delay": "-1s", "RBE_experimental_goma_deps_cache": "true", + "RBE_deps_cache_mode": "reproxy", }, )
diff --git a/infra/config/subprojects/chromium/ci/chromium.gpu.fyi.star b/infra/config/subprojects/chromium/ci/chromium.gpu.fyi.star index 4ea97d6..1ef05f80 100644 --- a/infra/config/subprojects/chromium/ci/chromium.gpu.fyi.star +++ b/infra/config/subprojects/chromium/ci/chromium.gpu.fyi.star
@@ -22,9 +22,6 @@ service_account = ci.gpu.SERVICE_ACCOUNT, sheriff_rotations = sheriff_rotations.CHROMIUM_GPU, thin_tester_cores = 2, - - # TODO(crbug.com/1362440): remove this. - omit_python2 = False, ) consoles.console_view(
diff --git a/infra/config/subprojects/reclient/reclient.star b/infra/config/subprojects/reclient/reclient.star index e1b9cdd..5b9e4e5 100644 --- a/infra/config/subprojects/reclient/reclient.star +++ b/infra/config/subprojects/reclient/reclient.star
@@ -66,6 +66,14 @@ **kwargs): trusted_instance = reclient_instance % "trusted" unstrusted_instance = reclient_instance % "untrusted" + reclient_bootstrap_env = kwargs.pop("reclient_bootstrap_env", {}) + + # TODO(b/233275188) remove once reproxy 0.83.0 is rolled out + reclient_bootstrap_env.update({ + "RBE_experimental_goma_deps_cache": "True", + "RBE_ip_reset_min_delay": "-1s", + "RBE_deps_cache_mode": "reproxy", + }) return [ ci.builder( name = name, @@ -76,6 +84,7 @@ category = "rbe|" + console_view_category, short_name = "rcs", ), + reclient_bootstrap_env = reclient_bootstrap_env, **kwargs ), ci.builder( @@ -88,6 +97,7 @@ short_name = "rcs", ), service_account = untrusted_service_account, + reclient_bootstrap_env = reclient_bootstrap_env, **kwargs ), ] @@ -192,7 +202,6 @@ cores = None, priority = 35, reclient_bootstrap_env = { - "RBE_ip_timeout": "-1s", "GLOG_vmodule": "bridge*=2", }, reclient_profiler_service = "reclient-mac", @@ -309,7 +318,6 @@ xcode = xcode.x13main, priority = 35, reclient_bootstrap_env = { - "RBE_ip_timeout": "-1s", "GLOG_vmodule": "bridge*=2", }, ) @@ -389,7 +397,6 @@ cores = None, priority = 35, reclient_bootstrap_env = { - "RBE_ip_timeout": "-1s", "GLOG_vmodule": "bridge*=2", }, )
diff --git a/infra/config/subprojects/reviver/reviver.star b/infra/config/subprojects/reviver/reviver.star index 0d31945..a7b099d 100644 --- a/infra/config/subprojects/reviver/reviver.star +++ b/infra/config/subprojects/reviver/reviver.star
@@ -5,6 +5,7 @@ load("//lib/builders.star", "builder", "cpu", "defaults", "free_space", "os") load("//lib/ci.star", "ci") load("//lib/consoles.star", "consoles") +load("//lib/polymorphic.star", "polymorphic") luci.bucket( name = "reviver", @@ -42,64 +43,30 @@ omit_python2 = False, ) -def target_builder(*, name): - return { - "builder_id": { - "project": "chromium", - "bucket": "ci", - "builder": name, - }, - } - -builder( +polymorphic.launcher( name = "android-launcher", - executable = "recipe:chromium_polymorphic/launcher", + runner = "reviver/runner", + target_builders = [ + "ci/android-nougat-x86-rel", + "ci/android-12-x64-rel", + ], os = os.LINUX_DEFAULT, - pool = "luci.chromium.ci", - properties = { - "runner_builder": { - "project": "chromium", - "bucket": "reviver", - "builder": "runner", - }, - "target_builders": [ - target_builder( - name = "android-nougat-x86-rel", - ), - target_builder( - name = "android-12-x64-rel", - ), - ], - }, + pool = ci.DEFAULT_POOL, # To avoid peak hours, we run it at 1 AM, 4 AM, 7 AM, 10AM, 1 PM UTC. schedule = "0 1,4,7,10,13 * * *", ) # A coordinator of slightly aggressive scheduling with effectively unlimited # test bot capacity for fuchsia. -builder( +polymorphic.launcher( name = "fuchsia-coordinator", - executable = "recipe:chromium_polymorphic/launcher", + runner = "reviver/runner", + target_builders = [ + "ci/fuchsia-fyi-arm64-dbg", + "ci/fuchsia-fyi-x64-asan", + ], os = os.LINUX_DEFAULT, - pool = "luci.chromium.ci", - properties = { - "runner_builder": { - "project": "chromium", - "bucket": "reviver", - "builder": "runner", - }, - "target_builders": [ - target_builder( - name = "fuchsia-fyi-x64-rel", - ), - target_builder( - name = "fuchsia-fyi-arm64-dbg", - ), - target_builder( - name = "fuchsia-fyi-x64-asan", - ), - ], - }, + pool = ci.DEFAULT_POOL, # Avoid peak hours. schedule = "0 1,3,5,7,9,11,13 * * *", )
diff --git a/ios/chrome/browser/overlays/public/infobar_banner/tailored_security_service_infobar_banner_overlay_request_config.mm b/ios/chrome/browser/overlays/public/infobar_banner/tailored_security_service_infobar_banner_overlay_request_config.mm index 79b07fb..2c92023e 100644 --- a/ios/chrome/browser/overlays/public/infobar_banner/tailored_security_service_infobar_banner_overlay_request_config.mm +++ b/ios/chrome/browser/overlays/public/infobar_banner/tailored_security_service_infobar_banner_overlay_request_config.mm
@@ -18,7 +18,7 @@ namespace { // TODO(crbug.com/1358296): Replace placeholder when icon png is added. // The name of the icon image for the tailored security service banner. -NSString* const kIconImageName = @"icon_image"; +NSString* const kIconImageName = @"legacy_password_key"; } // namespace namespace tailored_security_service_infobar_overlays { @@ -36,7 +36,6 @@ button_label_text_ = delegate->GetMessageActionText(); description_ = delegate->GetDescription(); icon_image_name_ = kIconImageName; - has_badge_ = delegate->IsConsented(); } TailoredSecurityServiceBannerRequestConfig::
diff --git a/ios/chrome/browser/passwords/ios_chrome_password_store_factory.mm b/ios/chrome/browser/passwords/ios_chrome_password_store_factory.mm index c1289de..4f42a7a 100644 --- a/ios/chrome/browser/passwords/ios_chrome_password_store_factory.mm +++ b/ios/chrome/browser/passwords/ios_chrome_password_store_factory.mm
@@ -25,7 +25,6 @@ #import "ios/chrome/browser/passwords/ios_chrome_affiliation_service_factory.h" #import "ios/chrome/browser/passwords/ios_password_store_utils.h" #import "ios/chrome/browser/sync/sync_service_factory.h" -#import "ios/chrome/browser/webdata_services/web_data_service_factory.h" #import "services/network/public/cpp/shared_url_loader_factory.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -62,7 +61,6 @@ "PasswordStore", BrowserStateDependencyManager::GetInstance()) { DependsOn(IOSChromeAffiliationServiceFactory::GetInstance()); - DependsOn(ios::WebDataServiceFactory::GetInstance()); } IOSChromePasswordStoreFactory::~IOSChromePasswordStoreFactory() {} @@ -84,13 +82,8 @@ std::unique_ptr<AffiliatedMatchHelper> affiliated_match_helper = std::make_unique<AffiliatedMatchHelper>(affiliation_service); - if (!store->Init(ChromeBrowserState::FromBrowserState(context)->GetPrefs(), - std::move(affiliated_match_helper))) { - // TODO(crbug.com/479725): Remove the LOG once this error is visible in the - // UI. - LOG(WARNING) << "Could not initialize password store."; - return nullptr; - } + store->Init(ChromeBrowserState::FromBrowserState(context)->GetPrefs(), + std::move(affiliated_match_helper)); password_manager_util::RemoveUselessCredentials( CredentialsCleanerRunnerFactory::GetForBrowserState(context), store,
diff --git a/ios/chrome/browser/safe_browsing/tailored_security/BUILD.gn b/ios/chrome/browser/safe_browsing/tailored_security/BUILD.gn index 2a6fbc6..6b0bc4d 100644 --- a/ios/chrome/browser/safe_browsing/tailored_security/BUILD.gn +++ b/ios/chrome/browser/safe_browsing/tailored_security/BUILD.gn
@@ -13,6 +13,8 @@ "tailored_security_tab_helper.mm", ] deps = [ + ":infobar_delegates", + "//components/infobars/core", "//components/keyed_service/ios", "//components/prefs", "//components/safe_browsing/core/browser/tailored_security_service", @@ -21,7 +23,10 @@ "//components/safe_browsing/core/common:safe_browsing_prefs", "//components/signin/public/identity_manager", "//ios/chrome/browser/browser_state", + "//ios/chrome/browser/infobars", + "//ios/chrome/browser/overlays", "//ios/chrome/browser/signin", + "//ios/components/security_interstitials/safe_browsing", ] } @@ -56,6 +61,7 @@ "//components/sync_preferences:sync_preferences", "//components/sync_preferences:test_support", "//ios/chrome/browser/browser_state:test_support", + "//ios/chrome/browser/infobars", "//ios/chrome/browser/prefs:browser_prefs", "//ios/chrome/browser/safe_browsing/tailored_security/test", "//ios/web/public/test",
diff --git a/ios/chrome/browser/safe_browsing/tailored_security/tailored_security_tab_helper.h b/ios/chrome/browser/safe_browsing/tailored_security/tailored_security_tab_helper.h index 2b96df7..7e1ab48 100644 --- a/ios/chrome/browser/safe_browsing/tailored_security/tailored_security_tab_helper.h +++ b/ios/chrome/browser/safe_browsing/tailored_security/tailored_security_tab_helper.h
@@ -5,18 +5,22 @@ #ifndef IOS_CHROME_BROWSER_SAFE_BROWSING_TAILORED_SECURITY_TAILORED_SECURITY_TAB_HELPER_H_ #define IOS_CHROME_BROWSER_SAFE_BROWSING_TAILORED_SECURITY_TAILORED_SECURITY_TAB_HELPER_H_ +#import "base/scoped_observation.h" +#import "components/infobars/core/infobar_manager.h" #import "components/safe_browsing/core/browser/tailored_security_service/tailored_security_service_observer.h" #import "ios/web/public/web_state_observer.h" #import "ios/web/public/web_state_user_data.h" namespace safe_browsing { class TailoredSecurityService; -} +enum class TailoredSecurityServiceMessageState; +} // namespace safe_browsing // A tab helper that uses Tailored Security Service for promoting users to // enable better levels of Safe Browsing. class TailoredSecurityTabHelper - : public safe_browsing::TailoredSecurityServiceObserver, + : public infobars::InfoBarManager::Observer, + public safe_browsing::TailoredSecurityServiceObserver, public web::WebStateObserver, public web::WebStateUserData<TailoredSecurityTabHelper> { public: @@ -40,11 +44,17 @@ void OnTailoredSecurityServiceDestroyed() override; void OnSyncNotificationMessageRequest(bool is_enabled) override; + // infobars::InfoBarManager::Observer implementation. + void OnInfoBarRemoved(infobars::InfoBar* infobar, bool animate) override; + private: friend class web::WebStateUserData<TailoredSecurityTabHelper>; void UpdateFocusAndURL(bool focused, const GURL& url); + void ShowInfoBar( + safe_browsing::TailoredSecurityServiceMessageState message_state); + WEB_STATE_USER_DATA_KEY_DECL(); // Reference to the TailoredSecurityService for the BrowserState. @@ -60,7 +70,15 @@ bool has_query_request_ = false; // Associated WebState. - web::WebState* web_state_; + web::WebState* web_state_ = nullptr; + + // The currently displayed infobar. + infobars::InfoBar* infobar_ = nullptr; + + // Scoped observer that facilitates observing the infobar manager. + base::ScopedObservation<infobars::InfoBarManager, + infobars::InfoBarManager::Observer> + infobar_manager_scoped_observation_{this}; }; #endif // IOS_CHROME_BROWSER_SAFE_BROWSING_TAILORED_SECURITY_TAILORED_SECURITY_TAB_HELPER_H_
diff --git a/ios/chrome/browser/safe_browsing/tailored_security/tailored_security_tab_helper.mm b/ios/chrome/browser/safe_browsing/tailored_security/tailored_security_tab_helper.mm index 70438c4..8ddcc75 100644 --- a/ios/chrome/browser/safe_browsing/tailored_security/tailored_security_tab_helper.mm +++ b/ios/chrome/browser/safe_browsing/tailored_security/tailored_security_tab_helper.mm
@@ -4,6 +4,7 @@ #import "ios/chrome/browser/safe_browsing/tailored_security/tailored_security_tab_helper.h" +#import "components/prefs/pref_service.h" #import "components/safe_browsing/core/browser/tailored_security_service/tailored_security_notification_result.h" #import "components/safe_browsing/core/browser/tailored_security_service/tailored_security_service.h" #import "components/safe_browsing/core/browser/tailored_security_service/tailored_security_service_observer_util.h" @@ -11,7 +12,11 @@ #import "components/safe_browsing/core/common/safe_browsing_prefs.h" #import "components/signin/public/identity_manager/identity_manager.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h" +#import "ios/chrome/browser/infobars/infobar_ios.h" +#import "ios/chrome/browser/infobars/infobar_manager_impl.h" +#import "ios/chrome/browser/safe_browsing/tailored_security/tailored_security_service_infobar_delegate.h" #import "ios/chrome/browser/signin/identity_manager_factory.h" +#import "ios/components/security_interstitials/safe_browsing/safe_browsing_tab_helper.h" #import "ios/web/public/navigation/navigation_context.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -33,8 +38,8 @@ if (web_state_) { web_state_->AddObserver(this); focused = web_state_->IsVisible(); + UpdateFocusAndURL(focused, web_state_->GetLastCommittedURL()); } - UpdateFocusAndURL(focused, web_state_->GetLastCommittedURL()); } TailoredSecurityTabHelper::~TailoredSecurityTabHelper() { @@ -62,9 +67,12 @@ identity_manager, browser_state->GetPrefs())) return; + browser_state->GetPrefs()->SetBoolean( + prefs::kAccountTailoredSecurityShownNotification, true); if (base::Time::NowFromSystemTime() - previous_update <= base::Minutes(safe_browsing::kThresholdForInFlowNotificationMinutes)) { - // TODO(crbug.com/1353363): Send signal to show InfoBar. + ShowInfoBar(safe_browsing::TailoredSecurityServiceMessageState:: + kUnconsentedAndFlowEnabled); } } @@ -92,7 +100,13 @@ : safe_browsing::SafeBrowsingState::STANDARD_PROTECTION, /*is_esb_enabled_in_sync=*/is_enabled); - // TODO(crbug.com/1353363): Send output to create InfoBar message. + if (is_enabled) { + ShowInfoBar(safe_browsing::TailoredSecurityServiceMessageState:: + kConsentedAndFlowEnabled); + } else { + ShowInfoBar(safe_browsing::TailoredSecurityServiceMessageState:: + kConsentedAndFlowDisabled); + } if (is_enabled) { safe_browsing::RecordEnabledNotificationResult( @@ -123,6 +137,16 @@ web_state_ = nullptr; } +#pragma mark - infobars::InfoBarManager::Observer + +void TailoredSecurityTabHelper::OnInfoBarRemoved(infobars::InfoBar* infobar, + bool animate) { + if (infobar == infobar_) { + infobar_manager_scoped_observation_.Reset(); + infobar_ = nullptr; + } +} + #pragma mark - Private methods void TailoredSecurityTabHelper::UpdateFocusAndURL(bool focused, @@ -156,3 +180,28 @@ focused_ = focused; last_url_ = url; } + +void TailoredSecurityTabHelper::ShowInfoBar( + safe_browsing::TailoredSecurityServiceMessageState message_state) { + infobars::InfoBarManager* infobar_manager = + InfoBarManagerImpl::FromWebState(web_state_); + if (infobar_) { + // Previous infobars can continue to exist if the infobar was dismissed + // without any user action. For example, this happens when an infobar has an + // expired dismissal. Therefore, we remove it to ensure the new infobar is + // properly observed. + infobar_manager->RemoveInfoBar(infobar_); + DCHECK(!infobar_); + } + infobar_manager_scoped_observation_.Observe(infobar_manager); + + std::unique_ptr<safe_browsing::TailoredSecurityServiceInfobarDelegate> + delegate = std::make_unique< + safe_browsing::TailoredSecurityServiceInfobarDelegate>(message_state, + web_state_); + + std::unique_ptr<infobars::InfoBar> infobar = std::make_unique<InfoBarIOS>( + InfobarType::kInfobarTypeTailoredSecurityService, std::move(delegate)); + infobar_ = infobar_manager->AddInfoBar(std::move(infobar), + /*replace_existing=*/true); +}
diff --git a/ios/chrome/browser/safe_browsing/tailored_security/tailored_security_tab_helper_unittest.mm b/ios/chrome/browser/safe_browsing/tailored_security/tailored_security_tab_helper_unittest.mm index da58436..dd1ea69e 100644 --- a/ios/chrome/browser/safe_browsing/tailored_security/tailored_security_tab_helper_unittest.mm +++ b/ios/chrome/browser/safe_browsing/tailored_security/tailored_security_tab_helper_unittest.mm
@@ -10,8 +10,10 @@ #import "components/sync_preferences/pref_service_mock_factory.h" #import "components/sync_preferences/pref_service_syncable.h" #import "ios/chrome/browser/browser_state/test_chrome_browser_state.h" +#import "ios/chrome/browser/infobars/infobar_manager_impl.h" #import "ios/chrome/browser/prefs/browser_prefs.h" #import "ios/web/public/test/fakes/fake_navigation_context.h" +#import "ios/web/public/test/fakes/fake_navigation_manager.h" #import "ios/web/public/test/fakes/fake_web_state.h" #import "services/network/public/cpp/shared_url_loader_factory.h" #import "testing/gmock/include/gmock/gmock.h" @@ -61,6 +63,9 @@ test_cbs_builder.SetPrefService(factory.CreateSyncable(registry.get())); chrome_browser_state_ = test_cbs_builder.Build(); web_state_.SetBrowserState(chrome_browser_state_.get()); + // Needed to create InfoBarManager. + web_state_.SetNavigationManager( + std::make_unique<web::FakeNavigationManager>()); } base::test::TaskEnvironment task_environment_; @@ -87,6 +92,7 @@ TEST_F(TailoredSecurityTabHelperTest, QueryRequestOnNavigation) { MockTailoredSecurityService mock_service; TailoredSecurityTabHelper::CreateForWebState(&web_state_, &mock_service); + TailoredSecurityTabHelper* tab_helper = TailoredSecurityTabHelper::FromWebState(&web_state_); @@ -99,19 +105,96 @@ PerformFakeNavigation("https://example.com", &web_state_); } -// Tests how the tab helper responds an observer call. -TEST_F(TailoredSecurityTabHelperTest, SyncNotificationCalled) { +// Tests how the tab helper responds an observer call for a consented and +// enabled message prompt. +TEST_F(TailoredSecurityTabHelperTest, + SyncNotificationForConsentedEnabledMessage) { MockTailoredSecurityService mock_service; TailoredSecurityTabHelper::CreateForWebState(&web_state_, &mock_service); + InfoBarManagerImpl::CreateForWebState(&web_state_); TailoredSecurityTabHelper* tab_helper = TailoredSecurityTabHelper::FromWebState(&web_state_); // When a sync notification request is sent and the user is synced, the // SafeBrowsingState should automatically change to Enhanced Protection. - tab_helper->OnSyncNotificationMessageRequest(/*is_enabled*/ true); + tab_helper->OnSyncNotificationMessageRequest(/*is_enabled=*/true); EXPECT_TRUE( safe_browsing::GetSafeBrowsingState(*chrome_browser_state_->GetPrefs()) == safe_browsing::SafeBrowsingState::ENHANCED_PROTECTION); } +// Tests how the tab helper responds an observer call for a consented and +// disabled message prompt. +TEST_F(TailoredSecurityTabHelperTest, + SyncNotificationForConsentedDisabledMessage) { + MockTailoredSecurityService mock_service; + TailoredSecurityTabHelper::CreateForWebState(&web_state_, &mock_service); + InfoBarManagerImpl::CreateForWebState(&web_state_); + TailoredSecurityTabHelper* tab_helper = + TailoredSecurityTabHelper::FromWebState(&web_state_); + + // When a sync notification request is sent and the user is synced, the + // SafeBrowsingState should automatically change to Standard Protection. + tab_helper->OnSyncNotificationMessageRequest(/*is_enabled=*/false); + EXPECT_TRUE( + safe_browsing::GetSafeBrowsingState(*chrome_browser_state_->GetPrefs()) == + safe_browsing::SafeBrowsingState::STANDARD_PROTECTION); +} + +// Tests that method early returns if the WebState is null and doesn't change +// the SafeBrowsingState. +TEST_F(TailoredSecurityTabHelperTest, OnSyncNotificationRequestEarlyReturn) { + MockTailoredSecurityService mock_service; + TailoredSecurityTabHelper tab_helper = + TailoredSecurityTabHelper(nullptr, &mock_service); + + // When a sync notification request is sent and the user is synced, the + // SafeBrowsingState should automatically change to Standard Protection. + tab_helper.OnSyncNotificationMessageRequest(/*is_enabled=*/true); + EXPECT_TRUE( + safe_browsing::GetSafeBrowsingState(*chrome_browser_state_->GetPrefs()) == + safe_browsing::SafeBrowsingState::STANDARD_PROTECTION); +} + +// Tests that an infobar is created when the tailored security bit is changed to +// true. +TEST_F(TailoredSecurityTabHelperTest, + InfoBarCreatedOnTailoredSecurityBitChanged) { + MockTailoredSecurityService mock_service; + TailoredSecurityTabHelper::CreateForWebState(&web_state_, &mock_service); + InfoBarManagerImpl::CreateForWebState(&web_state_); + TailoredSecurityTabHelper* tab_helper = + TailoredSecurityTabHelper::FromWebState(&web_state_); + InfoBarManagerImpl* infobar_manager = + InfoBarManagerImpl::FromWebState(&web_state_); + + // When a sync notification request is sent and the user is synced, the + // SafeBrowsingState should automatically change to Standard Protection. + tab_helper->OnTailoredSecurityBitChanged(/*enabled=*/true, + base::Time::NowFromSystemTime()); + EXPECT_TRUE(infobar_manager->infobar_count() == 1); + EXPECT_TRUE(chrome_browser_state_->GetPrefs()->GetBoolean( + prefs::kAccountTailoredSecurityShownNotification)); +} + +// Tests that an infobar isn't created when the tailored security bit is changed +// to false. +TEST_F(TailoredSecurityTabHelperTest, EarlyReturnOnTailoredSecurityBitChanged) { + MockTailoredSecurityService mock_service; + TailoredSecurityTabHelper::CreateForWebState(&web_state_, &mock_service); + InfoBarManagerImpl::CreateForWebState(&web_state_); + TailoredSecurityTabHelper* tab_helper = + TailoredSecurityTabHelper::FromWebState(&web_state_); + InfoBarManagerImpl* infobar_manager = + InfoBarManagerImpl::FromWebState(&web_state_); + + // When a sync notification request is sent and the user is synced, the + // SafeBrowsingState should automatically change to Standard Protection. + tab_helper->OnTailoredSecurityBitChanged(/*enabled=*/false, + base::Time::NowFromSystemTime()); + EXPECT_TRUE(infobar_manager->infobar_count() == 0); + EXPECT_FALSE(chrome_browser_state_->GetPrefs()->GetBoolean( + prefs::kAccountTailoredSecurityShownNotification)); +} + } // namespace safe_browsing
diff --git a/ios/chrome/browser/tabs/BUILD.gn b/ios/chrome/browser/tabs/BUILD.gn index 4e535d0..2b2b247d 100644 --- a/ios/chrome/browser/tabs/BUILD.gn +++ b/ios/chrome/browser/tabs/BUILD.gn
@@ -89,6 +89,7 @@ "//ios/chrome/browser/prerender", "//ios/chrome/browser/reading_list", "//ios/chrome/browser/safe_browsing", + "//ios/chrome/browser/safe_browsing/tailored_security", "//ios/chrome/browser/search_engines", "//ios/chrome/browser/sessions", "//ios/chrome/browser/sessions:restoration_agent",
diff --git a/ios/chrome/browser/tabs/tab_helper_util.mm b/ios/chrome/browser/tabs/tab_helper_util.mm index cb0cfae..af019cb9 100644 --- a/ios/chrome/browser/tabs/tab_helper_util.mm +++ b/ios/chrome/browser/tabs/tab_helper_util.mm
@@ -71,6 +71,8 @@ #import "ios/chrome/browser/reading_list/reading_list_model_factory.h" #import "ios/chrome/browser/reading_list/reading_list_web_state_observer.h" #import "ios/chrome/browser/safe_browsing/safe_browsing_client_factory.h" +#import "ios/chrome/browser/safe_browsing/tailored_security/tailored_security_service_factory.h" +#import "ios/chrome/browser/safe_browsing/tailored_security/tailored_security_tab_helper.h" #import "ios/chrome/browser/search_engines/search_engine_tab_helper.h" #import "ios/chrome/browser/sessions/ios_chrome_session_tab_helper.h" #import "ios/chrome/browser/snapshots/snapshot_tab_helper.h" @@ -168,6 +170,13 @@ SafeBrowsingUrlAllowList::CreateForWebState(web_state); SafeBrowsingUnsafeResourceContainer::CreateForWebState(web_state); + if (base::FeatureList::IsEnabled( + safe_browsing::kTailoredSecurityIntegration)) { + TailoredSecurityTabHelper::CreateForWebState( + web_state, + TailoredSecurityServiceFactory::GetForBrowserState(browser_state)); + } + PolicyUrlBlockingTabHelper::CreateForWebState(web_state); ImageFetchTabHelper::CreateForWebState(web_state);
diff --git a/ios/chrome/browser/ui/autofill/form_input_accessory/branding_view_controller.mm b/ios/chrome/browser/ui/autofill/form_input_accessory/branding_view_controller.mm index fa215f52..fdc2492 100644 --- a/ios/chrome/browser/ui/autofill/form_input_accessory/branding_view_controller.mm +++ b/ios/chrome/browser/ui/autofill/form_input_accessory/branding_view_controller.mm
@@ -4,6 +4,7 @@ #import "ios/chrome/browser/ui/autofill/form_input_accessory/branding_view_controller.h" +#import "base/mac/foundation_util.h" #import "base/notreached.h" #import "base/threading/sequenced_task_runner_handle.h" #import "base/time/time.h" @@ -113,9 +114,10 @@ - (void)setDelegate:(id<BrandingViewControllerDelegate>)delegate { _delegate = delegate; if (_delegate != nil) { - [(UIButton*)self.view addTarget:_delegate - action:@selector(brandingIconPressed) - forControlEvents:UIControlEventTouchUpInside]; + [base::mac::ObjCCast<UIButton>(self.view) + addTarget:_delegate + action:@selector(brandingIconPressed) + forControlEvents:UIControlEventTouchUpInside]; } } @@ -126,7 +128,7 @@ - (void)configureBrandingWithImageName:(NSString*)name { UIImage* logo = [[UIImage imageNamed:name] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; - UIButton* button = (UIButton*)self.view; + UIButton* button = base::mac::ObjCCast<UIButton>(self.view); [button setImage:logo forState:UIControlStateNormal]; [button setImage:logo forState:UIControlStateHighlighted]; button.imageView.contentMode = UIViewContentModeScaleAspectFit;
diff --git a/ios/chrome/browser/ui/history/history_coordinator.mm b/ios/chrome/browser/ui/history/history_coordinator.mm index 68d2882c..17c6513 100644 --- a/ios/chrome/browser/ui/history/history_coordinator.mm +++ b/ios/chrome/browser/ui/history/history_coordinator.mm
@@ -137,6 +137,10 @@ [self stopWithCompletion:nil]; } +- (void)dealloc { + self.historyTableViewController.historyService = nullptr; +} + // This method should always execute the `completionHandler`. - (void)stopWithCompletion:(ProceduralBlock)completionHandler { [self.sharingCoordinator stop]; @@ -168,6 +172,7 @@ completion:completion]; self.historyNavigationController = nil; self.historyClearBrowsingDataCoordinator = nil; + self.historyTableViewController.historyService = nullptr; _browsingHistoryDriver = nullptr; _browsingHistoryService = nullptr; _browsingHistoryDriverDelegate = nullptr;
diff --git a/ios/chrome/browser/ui/history/history_table_view_controller.mm b/ios/chrome/browser/ui/history/history_table_view_controller.mm index 880f7460..9f028a6 100644 --- a/ios/chrome/browser/ui/history/history_table_view_controller.mm +++ b/ios/chrome/browser/ui/history/history_table_view_controller.mm
@@ -533,6 +533,9 @@ if (!self.browser) return; + if (!self.historyService) + return; + NSArray* toDeleteIndexPaths = self.tableView.indexPathsForSelectedRows; // Delete items from Browser History. @@ -751,6 +754,9 @@ if (!self.browser) return; + if (!self.historyService) + return; + self.loading = YES; // Add loading indicator if no items are shown. if (self.empty && !self.searchInProgress) {
diff --git a/ios/chrome/browser/ui/keyboard/features.mm b/ios/chrome/browser/ui/keyboard/features.mm index 7733575..d9f23a3 100644 --- a/ios/chrome/browser/ui/keyboard/features.mm +++ b/ios/chrome/browser/ui/keyboard/features.mm
@@ -13,5 +13,9 @@ base::FEATURE_DISABLED_BY_DEFAULT); bool IsKeyboardShortcutsMenuEnabled() { - return base::FeatureList::IsEnabled(kKeyboardShortcutsMenu); + if (@available(iOS 15.0, *)) { + return base::FeatureList::IsEnabled(kKeyboardShortcutsMenu); + } else { + return false; + } }
diff --git a/ios/chrome/browser/ui/overlays/infobar_banner/tailored_security/tailored_security_infobar_banner_overlay_mediator_unittest.mm b/ios/chrome/browser/ui/overlays/infobar_banner/tailored_security/tailored_security_infobar_banner_overlay_mediator_unittest.mm index 74729237..a4e62ad 100644 --- a/ios/chrome/browser/ui/overlays/infobar_banner/tailored_security/tailored_security_infobar_banner_overlay_mediator_unittest.mm +++ b/ios/chrome/browser/ui/overlays/infobar_banner/tailored_security/tailored_security_infobar_banner_overlay_mediator_unittest.mm
@@ -59,6 +59,6 @@ EXPECT_NSEQ(buttonText, consumer.buttonText); EXPECT_NSEQ(title, consumer.titleText); EXPECT_NSEQ(subtitle, consumer.subtitleText); - EXPECT_NSEQ([UIImage imageNamed:@"icon_image"], consumer.iconImage); - EXPECT_TRUE(consumer.presentsModal); + EXPECT_NSEQ([UIImage imageNamed:@"legacy_password_key"], consumer.iconImage); + EXPECT_FALSE(consumer.presentsModal); }
diff --git a/ios/chrome/browser/ui/price_notifications/cells/BUILD.gn b/ios/chrome/browser/ui/price_notifications/cells/BUILD.gn index 8479b91b..59397387 100644 --- a/ios/chrome/browser/ui/price_notifications/cells/BUILD.gn +++ b/ios/chrome/browser/ui/price_notifications/cells/BUILD.gn
@@ -5,6 +5,8 @@ source_set("cells") { configs += [ "//build/config/compiler:enable_arc" ] sources = [ + "price_notifications_price_chip_view.h", + "price_notifications_price_chip_view.mm", "price_notifications_table_view_item.h", "price_notifications_table_view_item.mm", "price_notifications_track_button.h", @@ -16,6 +18,7 @@ "//ios/chrome/browser/ui/price_notifications:constants", "//ios/chrome/browser/ui/table_view:styler", "//ios/chrome/browser/ui/table_view/cells", + "//ios/chrome/browser/ui/util", "//ios/chrome/common/ui/colors", "//ios/chrome/common/ui/table_view:cells_constants", "//ios/chrome/common/ui/util",
diff --git a/ios/chrome/browser/ui/price_notifications/cells/price_notifications_price_chip_view.h b/ios/chrome/browser/ui/price_notifications/cells/price_notifications_price_chip_view.h new file mode 100644 index 0000000..ce2f917 --- /dev/null +++ b/ios/chrome/browser/ui/price_notifications/cells/price_notifications_price_chip_view.h
@@ -0,0 +1,21 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_UI_PRICE_NOTIFICATIONS_CELLS_PRICE_NOTIFICATIONS_PRICE_CHIP_VIEW_H_ +#define IOS_CHROME_BROWSER_UI_PRICE_NOTIFICATIONS_CELLS_PRICE_NOTIFICATIONS_PRICE_CHIP_VIEW_H_ + +#import <UIKit/UIKit.h> + +// A UIView that displays either the item's current price or a side-by-side +// comparison of the item's current price to the price at which the user began +// price tracking. +@interface PriceNotificationsPriceChipView : UIView + +// Sets the price drop and displays the price comparison UI. +- (void)setPriceDrop:(NSString*)currentPrice + previousPrice:(NSString*)previousPrice; + +@end + +#endif // IOS_CHROME_BROWSER_UI_PRICE_NOTIFICATIONS_CELLS_PRICE_NOTIFICATIONS_PRICE_CHIP_VIEW_H_ \ No newline at end of file
diff --git a/ios/chrome/browser/ui/price_notifications/cells/price_notifications_price_chip_view.mm b/ios/chrome/browser/ui/price_notifications/cells/price_notifications_price_chip_view.mm new file mode 100644 index 0000000..1d3f711 --- /dev/null +++ b/ios/chrome/browser/ui/price_notifications/cells/price_notifications_price_chip_view.mm
@@ -0,0 +1,128 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/browser/ui/price_notifications/cells/price_notifications_price_chip_view.h" + +#import "ios/chrome/browser/ui/price_notifications/price_notifications_constants.h" +#import "ios/chrome/browser/ui/util/uikit_ui_util.h" +#import "ios/chrome/common/ui/colors/semantic_color_names.h" +#import "ios/chrome/common/ui/util/constraints_ui_util.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +namespace { +const CGFloat kPriceChipVerticalIndent = 2.0; +const CGFloat kPriceChipLeadingIndent = 8.0; +const CGFloat kPriceChipHorizontalSpacing = 4.0; +} // namespace + +@interface PriceNotificationsPriceChipView () +// Label containing the current price. +@property(nonatomic, strong) UILabel* currentPriceLabel; +// Label containing the previous price. +@property(nonatomic, strong) UILabel* previousPriceLabel; + +@end + +@implementation PriceNotificationsPriceChipView + +- (void)setPriceDrop:(NSString*)currentPrice + previousPrice:(NSString*)previousPrice { + [self prepareForReuse]; + + self.currentPriceLabel.text = currentPrice; + self.previousPriceLabel.text = previousPrice; + + [self addSubview:self.previousPriceLabel]; + + // The leading anchor will be constrained later based on `previousPrice` + // existence. + [NSLayoutConstraint activateConstraints:@[ + [self.previousPriceLabel.topAnchor + constraintEqualToAnchor:self.topAnchor + constant:kPriceChipVerticalIndent], + [self.trailingAnchor + constraintGreaterThanOrEqualToAnchor:self.previousPriceLabel + .trailingAnchor + constant:kPriceChipLeadingIndent], + [self.bottomAnchor + constraintEqualToAnchor:self.previousPriceLabel.bottomAnchor + constant:kPriceChipVerticalIndent], + ]]; + + if (currentPrice) { + [self addSubview:self.currentPriceLabel]; + [NSLayoutConstraint activateConstraints:@[ + [self.previousPriceLabel.leadingAnchor + constraintGreaterThanOrEqualToAnchor:self.currentPriceLabel + .trailingAnchor + constant:kPriceChipHorizontalSpacing], + + [self.currentPriceLabel.topAnchor + constraintEqualToAnchor:self.topAnchor + constant:kPriceChipVerticalIndent], + [self.currentPriceLabel.leadingAnchor + constraintEqualToAnchor:self.leadingAnchor + constant:kPriceChipLeadingIndent], + [self.bottomAnchor + constraintEqualToAnchor:self.currentPriceLabel.bottomAnchor + constant:kPriceChipVerticalIndent], + ]]; + self.backgroundColor = [UIColor colorNamed:kGreen100Color]; + } else { + self.backgroundColor = [UIColor colorNamed:kGrey100Color]; + [self.previousPriceLabel.leadingAnchor + constraintEqualToAnchor:self.leadingAnchor + constant:kPriceChipLeadingIndent] + .active = YES; + } +} + +#pragma mark - Properties + +- (UILabel*)currentPriceLabel { + if (!_currentPriceLabel) { + UILabel* priceLabel = [[UILabel alloc] init]; + priceLabel.translatesAutoresizingMaskIntoConstraints = NO; + priceLabel.adjustsFontForContentSizeCategory = YES; + priceLabel.font = + CreateDynamicFont(UIFontTextStyleFootnote, UIFontWeightBold); + priceLabel.textColor = [UIColor colorNamed:kGreen800Color]; + _currentPriceLabel = priceLabel; + } + return _currentPriceLabel; +} + +- (UILabel*)previousPriceLabel { + if (!_previousPriceLabel) { + UILabel* priceLabel = [[UILabel alloc] init]; + priceLabel.translatesAutoresizingMaskIntoConstraints = NO; + priceLabel.adjustsFontForContentSizeCategory = YES; + priceLabel.font = + [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote]; + priceLabel.textColor = [UIColor colorNamed:kTextSecondaryColor]; + _previousPriceLabel = priceLabel; + } + return _previousPriceLabel; +} + +#pragma mark - UIView + +- (void)layoutSubviews { + [super layoutSubviews]; + self.layer.cornerRadius = self.bounds.size.height / 2.0; + self.clipsToBounds = YES; +} + +#pragma mark - Private + +// Resets the price chip by removing the chip's UILabels from the view. +- (void)prepareForReuse { + [self.currentPriceLabel removeFromSuperview]; + [self.previousPriceLabel removeFromSuperview]; +} + +@end
diff --git a/ios/chrome/browser/ui/price_notifications/cells/price_notifications_table_view_item.h b/ios/chrome/browser/ui/price_notifications/cells/price_notifications_table_view_item.h index 4f8363d..8a006a5 100644 --- a/ios/chrome/browser/ui/price_notifications/cells/price_notifications_table_view_item.h +++ b/ios/chrome/browser/ui/price_notifications/cells/price_notifications_table_view_item.h
@@ -9,6 +9,8 @@ #import "ios/chrome/browser/ui/table_view/cells/table_view_item.h" +@class PriceNotificationsPriceChipView; + // A table view item used to represent a `PriceNotificationsListItem`. @interface PriceNotificationsTableViewItem : TableViewItem @@ -35,6 +37,9 @@ @property(nonatomic, strong) UILabel* titleLabel; // The host URL associated with this cell. @property(nonatomic, strong) UILabel* URLLabel; +// The custom UIView that displays the item's current and previous prices. +@property(nonatomic, strong) + PriceNotificationsPriceChipView* priceNotificationsChip; // The status of whether the user is tracking the item. @property(nonatomic, assign) BOOL tracking; // The button that starts the price tracking process.
diff --git a/ios/chrome/browser/ui/price_notifications/cells/price_notifications_table_view_item.mm b/ios/chrome/browser/ui/price_notifications/cells/price_notifications_table_view_item.mm index fe72808..5b92964 100644 --- a/ios/chrome/browser/ui/price_notifications/cells/price_notifications_table_view_item.mm +++ b/ios/chrome/browser/ui/price_notifications/cells/price_notifications_table_view_item.mm
@@ -4,8 +4,11 @@ #import "ios/chrome/browser/ui/price_notifications/cells/price_notifications_table_view_item.h" +#import "ios/chrome/browser/ui/price_notifications/cells/price_notifications_price_chip_view.h" #import "ios/chrome/browser/ui/price_notifications/cells/price_notifications_track_button.h" +#import "ios/chrome/browser/ui/price_notifications/price_notifications_constants.h" #import "ios/chrome/browser/ui/table_view/chrome_table_view_styler.h" +#import "ios/chrome/browser/ui/util/uikit_ui_util.h" #import "ios/chrome/common/ui/colors/semantic_color_names.h" #import "ios/chrome/common/ui/table_view/table_view_cells_constants.h" #import "ios/chrome/common/ui/util/constraints_ui_util.h" @@ -35,6 +38,8 @@ tableCell.titleLabel.text = self.title; tableCell.URLLabel.text = self.entryURL; + [tableCell.priceNotificationsChip setPriceDrop:self.currentPrice + previousPrice:self.previousPrice]; tableCell.tracking = self.tracking; tableCell.accessibilityTraits |= UIAccessibilityTraitButton; } @@ -60,19 +65,23 @@ // need to be adapted to integrate the UI elements in to the table cell. _titleLabel = [[UILabel alloc] init]; - _URLLabel = [[UILabel alloc] init]; - _trackButton = [[PriceNotificationsTrackButton alloc] init]; - _titleLabel.font = - [self preferredFontWithTextStyle:UIFontTextStyleSubheadline - weight:UIFontWeightSemibold]; + CreateDynamicFont(UIFontTextStyleSubheadline, UIFontWeightSemibold); _titleLabel.adjustsFontForContentSizeCategory = YES; + _URLLabel = [[UILabel alloc] init]; _URLLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote]; _URLLabel.adjustsFontForContentSizeCategory = YES; _URLLabel.textColor = [UIColor colorNamed:kTextSecondaryColor]; + _trackButton = [[PriceNotificationsTrackButton alloc] init]; + _priceNotificationsChip = [[PriceNotificationsPriceChipView alloc] init]; + _priceNotificationsChip.translatesAutoresizingMaskIntoConstraints = NO; - UIStackView* verticalStack = [[UIStackView alloc] - initWithArrangedSubviews:@[ self.titleLabel, self.URLLabel ]]; + // Use stack views to layout the subviews except for the Price Notification + // Image. + UIStackView* verticalStack = + [[UIStackView alloc] initWithArrangedSubviews:@[ + self.titleLabel, self.URLLabel, self.priceNotificationsChip + ]]; verticalStack.axis = UILayoutConstraintAxisVertical; verticalStack.distribution = UIStackViewDistributionEqualSpacing; verticalStack.alignment = UIStackViewAlignmentLeading; @@ -107,6 +116,8 @@ [horizontalStack.topAnchor constraintGreaterThanOrEqualToAnchor:self.contentView.topAnchor constant:kCellContentSpacing], + [horizontalStack.centerYAnchor + constraintEqualToAnchor:self.contentView.centerYAnchor], [horizontalStack.bottomAnchor constraintGreaterThanOrEqualToAnchor:self.contentView.bottomAnchor constant:-kCellContentSpacing], @@ -126,17 +137,4 @@ _tracking = tracking; } -#pragma mark - Helpers - -// Creates a dynamically scablable custom font based on the given parameters. -- (UIFont*)preferredFontWithTextStyle:(UIFontTextStyle)style - weight:(UIFontWeight)weight { - UIFontMetrics* fontMetrics = [[UIFontMetrics alloc] initForTextStyle:style]; - UIFontDescriptor* fontDescriptor = - [UIFontDescriptor preferredFontDescriptorWithTextStyle:style]; - UIFont* font = [UIFont systemFontOfSize:fontDescriptor.pointSize - weight:weight]; - return [fontMetrics scaledFontForFont:font]; -} - @end
diff --git a/ios/chrome/browser/ui/util/uikit_ui_util.h b/ios/chrome/browser/ui/util/uikit_ui_util.h index 482891c9..dd8da523 100644 --- a/ios/chrome/browser/ui/util/uikit_ui_util.h +++ b/ios/chrome/browser/ui/util/uikit_ui_util.h
@@ -36,6 +36,8 @@ void MaybeSetUITextFieldScaledFont(BOOL maybe, UITextField* textField, UIFont* font); +// Creates a dynamically scablable custom font based on the given parameters. +UIFont* CreateDynamicFont(UIFontTextStyle style, UIFontWeight weight); typedef enum CaptureViewOption { kNoCaptureOption, // Equivalent to calling CaptureView without options.
diff --git a/ios/chrome/browser/ui/util/uikit_ui_util.mm b/ios/chrome/browser/ui/util/uikit_ui_util.mm index a7fe8754..d7ef172 100644 --- a/ios/chrome/browser/ui/util/uikit_ui_util.mm +++ b/ios/chrome/browser/ui/util/uikit_ui_util.mm
@@ -69,6 +69,12 @@ } } +UIFont* CreateDynamicFont(UIFontTextStyle style, UIFontWeight weight) { + UIFontDescriptor* fontDescriptor = + [UIFontDescriptor preferredFontDescriptorWithTextStyle:style]; + return [UIFont systemFontOfSize:fontDescriptor.pointSize weight:weight]; +} + UIImage* CaptureViewWithOption(UIView* view, CGFloat scale, CaptureViewOption option) {
diff --git a/ios/chrome/common/ui/colors/resources/BUILD.gn b/ios/chrome/common/ui/colors/resources/BUILD.gn index ff64a99..364a891 100644 --- a/ios/chrome/common/ui/colors/resources/BUILD.gn +++ b/ios/chrome/common/ui/colors/resources/BUILD.gn
@@ -16,9 +16,11 @@ ":darker_scrim_background_color", ":disabled_tint_color", ":favicon_background_color", + ":green_100_color", ":green_500_color", ":green_50_color", ":green_700_color", + ":green_800_color", ":green_color", ":grey_100_color", ":grey_200_color", @@ -109,6 +111,10 @@ sources = [ "green_50_color.colorset/Contents.json" ] } +colorset("green_100_color") { + sources = [ "green_100_color.colorset/Contents.json" ] +} + colorset("green_500_color") { sources = [ "green_500_color.colorset/Contents.json" ] } @@ -117,6 +123,10 @@ sources = [ "green_700_color.colorset/Contents.json" ] } +colorset("green_800_color") { + sources = [ "green_800_color.colorset/Contents.json" ] +} + colorset("grey_50_color") { sources = [ "grey_50_color.colorset/Contents.json" ] }
diff --git a/ios/chrome/common/ui/colors/resources/green_100_color.colorset/Contents.json b/ios/chrome/common/ui/colors/resources/green_100_color.colorset/Contents.json new file mode 100644 index 0000000..7dfd2a0 --- /dev/null +++ b/ios/chrome/common/ui/colors/resources/green_100_color.colorset/Contents.json
@@ -0,0 +1,38 @@ +{ + "info": { + "version": 1, + "author": "xcode" + }, + "colors": [ + { + "idiom": "universal", + "color": { + "color-space": "display-p3", + "components": { + "alpha": "1.000", + "red": "0xCE", + "green": "0xEA", + "blue": "0xD6" + } + } + }, + { + "idiom" : "universal", + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "display-p3", + "components" : { + "alpha" : "1.000", + "red" : "0x13", + "green" : "0x73", + "blue" : "0x33" + } + } + } + ] +}
diff --git a/ios/chrome/common/ui/colors/resources/green_800_color.colorset/Contents.json b/ios/chrome/common/ui/colors/resources/green_800_color.colorset/Contents.json new file mode 100644 index 0000000..e03f3fe --- /dev/null +++ b/ios/chrome/common/ui/colors/resources/green_800_color.colorset/Contents.json
@@ -0,0 +1,38 @@ +{ + "info": { + "version": 1, + "author": "xcode" + }, + "colors": [ + { + "idiom": "universal", + "color" : { + "color-space" : "display-p3", + "components" : { + "alpha" : "1.000", + "red" : "0x13", + "green" : "0x73", + "blue" : "0x33" + } + } + }, + { + "idiom" : "universal", + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color": { + "color-space": "display-p3", + "components": { + "alpha": "1.000", + "red": "0xCE", + "green": "0xEA", + "blue": "0xD6" + } + } + } + ] +}
diff --git a/ios/chrome/common/ui/colors/semantic_color_names.h b/ios/chrome/common/ui/colors/semantic_color_names.h index 5316810f0..5bf5a8a 100644 --- a/ios/chrome/common/ui/colors/semantic_color_names.h +++ b/ios/chrome/common/ui/colors/semantic_color_names.h
@@ -72,8 +72,10 @@ // Green palette. extern NSString* const kGreen50Color; +extern NSString* const kGreen100Color; extern NSString* const kGreen500Color; extern NSString* const kGreen700Color; +extern NSString* const kGreen800Color; // Standard red color. This is most commonly used for the tint color on // destructive controls.
diff --git a/ios/chrome/common/ui/colors/semantic_color_names.mm b/ios/chrome/common/ui/colors/semantic_color_names.mm index da8744c..4b71939 100644 --- a/ios/chrome/common/ui/colors/semantic_color_names.mm +++ b/ios/chrome/common/ui/colors/semantic_color_names.mm
@@ -52,8 +52,10 @@ NSString* const kBlue700Color = @"blue_700_color"; NSString* const kGreenColor = @"green_color"; NSString* const kGreen50Color = @"green_50_color"; +NSString* const kGreen100Color = @"green_100_color"; NSString* const kGreen500Color = @"green_500_color"; NSString* const kGreen700Color = @"green_700_color"; +NSString* const kGreen800Color = @"green_800_color"; NSString* const kRedColor = kRed600Color; NSString* const kRed500Color = @"red_500_color"; NSString* const kRed600Color = @"red_600_color";
diff --git a/ios/web_view/internal/passwords/web_view_account_password_store_factory.mm b/ios/web_view/internal/passwords/web_view_account_password_store_factory.mm index f57274c..c70e8ab 100644 --- a/ios/web_view/internal/passwords/web_view_account_password_store_factory.mm +++ b/ios/web_view/internal/passwords/web_view_account_password_store_factory.mm
@@ -20,7 +20,6 @@ #include "components/prefs/pref_service.h" #include "ios/web/public/thread/web_task_traits.h" #include "ios/web/public/thread/web_thread.h" -#include "ios/web_view/internal/webdata_services/web_view_web_data_service_wrapper_factory.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -85,9 +84,7 @@ WebViewAccountPasswordStoreFactory::WebViewAccountPasswordStoreFactory() : RefcountedBrowserStateKeyedServiceFactory( "AccountPasswordStore", - BrowserStateDependencyManager::GetInstance()) { - DependsOn(WebViewWebDataServiceWrapperFactory::GetInstance()); -} + BrowserStateDependencyManager::GetInstance()) {} WebViewAccountPasswordStoreFactory::~WebViewAccountPasswordStoreFactory() {} @@ -108,14 +105,9 @@ new password_manager::PasswordStore( std::make_unique<password_manager::PasswordStoreBuiltInBackend>( std::move(login_db))); - if (!ps->Init(browser_state->GetPrefs(), - /*affiliated_match_helper=*/nullptr, - base::BindRepeating(&SyncEnabledOrDisabled, browser_state))) { - // TODO(crbug.com/479725): Remove the LOG once this error is visible in the - // UI. - LOG(WARNING) << "Could not initialize password store."; - return nullptr; - } + ps->Init(browser_state->GetPrefs(), + /*affiliated_match_helper=*/nullptr, + base::BindRepeating(&SyncEnabledOrDisabled, browser_state)); return ps; }
diff --git a/ios/web_view/internal/passwords/web_view_password_store_factory.mm b/ios/web_view/internal/passwords/web_view_password_store_factory.mm index 8b6ec054..934133f 100644 --- a/ios/web_view/internal/passwords/web_view_password_store_factory.mm +++ b/ios/web_view/internal/passwords/web_view_password_store_factory.mm
@@ -21,7 +21,6 @@ #include "components/sync/driver/sync_service.h" #include "ios/web_view/internal/app/application_context.h" #include "ios/web_view/internal/web_view_browser_state.h" -#include "ios/web_view/internal/webdata_services/web_view_web_data_service_wrapper_factory.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -55,9 +54,7 @@ WebViewPasswordStoreFactory::WebViewPasswordStoreFactory() : RefcountedBrowserStateKeyedServiceFactory( "PasswordStore", - BrowserStateDependencyManager::GetInstance()) { - DependsOn(WebViewWebDataServiceWrapperFactory::GetInstance()); -} + BrowserStateDependencyManager::GetInstance()) {} WebViewPasswordStoreFactory::~WebViewPasswordStoreFactory() {} @@ -81,12 +78,7 @@ new password_manager::PasswordStore( std::make_unique<password_manager::PasswordStoreBuiltInBackend>( std::move(login_db))); - if (!store->Init(/*prefs=*/nullptr, /*affiliated_match_helper=*/nullptr)) { - // TODO(crbug.com/479725): Remove the LOG once this error is visible in the - // UI. - LOG(WARNING) << "Could not initialize password store."; - return nullptr; - } + store->Init(/*prefs=*/nullptr, /*affiliated_match_helper=*/nullptr); return store; }
diff --git a/media/mojo/services/BUILD.gn b/media/mojo/services/BUILD.gn index b248b4c..efaad72 100644 --- a/media/mojo/services/BUILD.gn +++ b/media/mojo/services/BUILD.gn
@@ -197,8 +197,8 @@ public_deps += [ "//media/mojo/mojom/stable:stable_video_decoder" ] deps += [ + "//components/viz/common", "//media/gpu/chromeos", - "//ui/ozone:ozone_switches", ] } }
diff --git a/media/mojo/services/DEPS b/media/mojo/services/DEPS index 3b5b92e..abd6c22 100644 --- a/media/mojo/services/DEPS +++ b/media/mojo/services/DEPS
@@ -11,6 +11,9 @@ "stable_video_decoder_service\.h": [ "+chromeos/components/cdm_factory_daemon/remote_cdm_context.h", ], + "stable_video_decoder_factory_service\.cc": [ + "+components/viz/common/switches.h", + ], "webrtc_video_perf_mojolpm_fuzzer\.cc": [ "+third_party/libprotobuf-mutator/src/src", "+components/leveldb_proto/testing/fake_db.h",
diff --git a/media/mojo/services/stable_video_decoder_factory_service.cc b/media/mojo/services/stable_video_decoder_factory_service.cc index 80dba079..030f2a44 100644 --- a/media/mojo/services/stable_video_decoder_factory_service.cc +++ b/media/mojo/services/stable_video_decoder_factory_service.cc
@@ -6,6 +6,7 @@ #include "base/command_line.h" #include "base/task/thread_pool.h" +#include "components/viz/common/switches.h" #include "gpu/config/gpu_driver_bug_workarounds.h" #include "gpu/config/gpu_preferences.h" #include "media/base/media_log.h" @@ -23,7 +24,6 @@ #include "media/mojo/services/stable_video_decoder_service.h" #include "media/video/video_decode_accelerator.h" #include "mojo/public/cpp/bindings/self_owned_receiver.h" -#include "ui/ozone/public/ozone_switches.h" namespace media { @@ -70,10 +70,12 @@ return configs.value_or(std::vector<SupportedVideoDecoderConfig>{}); } VideoDecoderType GetDecoderImplementationType() final { +#if BUILDFLAG(IS_CHROMEOS) if (base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kPlatformDisallowsChromeOSDirectVideoDecoder)) { + ::switches::kPlatformDisallowsChromeOSDirectVideoDecoder)) { return VideoDecoderType::kVda; } +#endif // BUILDFLAG(IS_CHROMEOS) // TODO(b/195769334): how can we keep this in sync with // VideoDecoderPipeline::GetDecoderType()?
diff --git a/net/cookies/cookie_inclusion_status.cc b/net/cookies/cookie_inclusion_status.cc index a73548db3..0a7633e1 100644 --- a/net/cookies/cookie_inclusion_status.cc +++ b/net/cookies/cookie_inclusion_status.cc
@@ -313,4 +313,14 @@ return status; } +bool CookieInclusionStatus::ExcludedByUserPreferences() const { + if (HasOnlyExclusionReason(ExclusionReason::EXCLUDE_USER_PREFERENCES)) + return true; + return exclusion_reasons_.count() == 2 && + exclusion_reasons_[ExclusionReason::EXCLUDE_USER_PREFERENCES] && + exclusion_reasons_ + [ExclusionReason:: + EXCLUDE_THIRD_PARTY_BLOCKED_WITHIN_FIRST_PARTY_SET]; +} + } // namespace net
diff --git a/net/cookies/cookie_inclusion_status.h b/net/cookies/cookie_inclusion_status.h index 5f289dd..51fb970 100644 --- a/net/cookies/cookie_inclusion_status.h +++ b/net/cookies/cookie_inclusion_status.h
@@ -353,6 +353,14 @@ std::vector<ExclusionReason> reasons, std::vector<WarningReason> warnings = std::vector<WarningReason>()); + // Returns true if the cookie was excluded because of user preferences. + // HasOnlyExclusionReason(EXCLUDE_USER_PREFERENCES) will not return true for + // third-party cookies blocked in sites in the same First-Party Set (note: + // this is not the same as the cookie being blocked in a same-party context, + // which takes the entire ancestor chain into account). See + // https://crbug.com/1366868. + bool ExcludedByUserPreferences() const; + private: // Returns the `exclusion_reasons_` with the given `reasons` unset. ExclusionReasonBitset ExclusionReasonsWithout(
diff --git a/net/cookies/cookie_inclusion_status_unittest.cc b/net/cookies/cookie_inclusion_status_unittest.cc index 09523c4..3873bc4 100644 --- a/net/cookies/cookie_inclusion_status_unittest.cc +++ b/net/cookies/cookie_inclusion_status_unittest.cc
@@ -274,4 +274,45 @@ exclusion_reasons, warning_reasons)); } +TEST(CookieInclusionStatusTest, ExcludedByUserPreferences) { + CookieInclusionStatus status = + CookieInclusionStatus::MakeFromReasonsForTesting( + {CookieInclusionStatus::ExclusionReason::EXCLUDE_USER_PREFERENCES}); + EXPECT_TRUE(status.ExcludedByUserPreferences()); + + status = CookieInclusionStatus::MakeFromReasonsForTesting({ + CookieInclusionStatus::ExclusionReason::EXCLUDE_USER_PREFERENCES, + CookieInclusionStatus::ExclusionReason::EXCLUDE_FAILURE_TO_STORE, + }); + EXPECT_FALSE(status.ExcludedByUserPreferences()); + + status = CookieInclusionStatus::MakeFromReasonsForTesting({ + CookieInclusionStatus::ExclusionReason::EXCLUDE_USER_PREFERENCES, + CookieInclusionStatus::ExclusionReason:: + EXCLUDE_THIRD_PARTY_BLOCKED_WITHIN_FIRST_PARTY_SET, + }); + EXPECT_TRUE(status.ExcludedByUserPreferences()); + + status = CookieInclusionStatus::MakeFromReasonsForTesting({ + CookieInclusionStatus::ExclusionReason:: + EXCLUDE_THIRD_PARTY_BLOCKED_WITHIN_FIRST_PARTY_SET, + }); + EXPECT_FALSE(status.ExcludedByUserPreferences()); + + status = CookieInclusionStatus::MakeFromReasonsForTesting({ + CookieInclusionStatus::ExclusionReason:: + EXCLUDE_THIRD_PARTY_BLOCKED_WITHIN_FIRST_PARTY_SET, + CookieInclusionStatus::ExclusionReason::EXCLUDE_FAILURE_TO_STORE, + }); + EXPECT_FALSE(status.ExcludedByUserPreferences()); + + status = CookieInclusionStatus::MakeFromReasonsForTesting({ + CookieInclusionStatus::ExclusionReason::EXCLUDE_USER_PREFERENCES, + CookieInclusionStatus::ExclusionReason:: + EXCLUDE_THIRD_PARTY_BLOCKED_WITHIN_FIRST_PARTY_SET, + CookieInclusionStatus::ExclusionReason::EXCLUDE_FAILURE_TO_STORE, + }); + EXPECT_FALSE(status.ExcludedByUserPreferences()); +} + } // namespace net
diff --git a/services/network/restricted_cookie_manager.cc b/services/network/restricted_cookie_manager.cc index 092b92c..aa78bda 100644 --- a/services/network/restricted_cookie_manager.cc +++ b/services/network/restricted_cookie_manager.cc
@@ -479,8 +479,8 @@ // warning reasons once samesite tightening up is rolled out. for (const auto& cookie_and_access_result : excluded_cookies) { if (!cookie_and_access_result.access_result.status.ShouldWarn() && - !cookie_and_access_result.access_result.status.HasOnlyExclusionReason( - net::CookieInclusionStatus::EXCLUDE_USER_PREFERENCES)) { + !cookie_and_access_result.access_result.status + .ExcludedByUserPreferences()) { continue; }
diff --git a/testing/buildbot/chrome.json b/testing/buildbot/chrome.json index c7a61a0..af67599 100644 --- a/testing/buildbot/chrome.json +++ b/testing/buildbot/chrome.json
@@ -1766,7 +1766,7 @@ "chrome", "linux_symbols", "symupload", - "strip_chrome_binary" + "strip_lacros_files" ], "gtest_tests": [ { @@ -1866,7 +1866,7 @@ "chrome", "linux_symbols", "symupload", - "strip_chrome_binary" + "strip_lacros_files" ], "skylab_tests": [ { @@ -2004,7 +2004,7 @@ "chrome", "linux_symbols", "symupload", - "strip_chrome_binary" + "strip_lacros_files" ], "gtest_tests": [ { @@ -2073,7 +2073,7 @@ "chrome", "linux_symbols", "symupload", - "strip_chrome_binary" + "strip_lacros_files" ], "skylab_tests": [ { @@ -2147,7 +2147,7 @@ "chrome", "linux_symbols", "symupload", - "strip_chrome_binary" + "strip_lacros_files" ], "isolated_scripts": [ { @@ -2178,7 +2178,7 @@ "chrome", "linux_symbols", "symupload", - "strip_chrome_binary" + "strip_lacros_files" ], "skylab_tests": [ {
diff --git a/testing/buildbot/chromium.angle.json b/testing/buildbot/chromium.angle.json index 2eeb153..8984b64a 100644 --- a/testing/buildbot/chromium.angle.json +++ b/testing/buildbot/chromium.angle.json
@@ -711,49 +711,6 @@ "--passthrough", "-v", "--stable-jobs", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-gl=angle --use-angle=gl --use-cmd-decoder=passthrough --force_high_performance_gpu", - "--webgl-conformance-version=2.0.1", - "--read-abbreviated-json-results-from=../../content/test/data/gpu/webgl2_conformance_tests_output.json", - "--jobs=4" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgl2_conformance_gl_passthrough_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "cpu": "x86-64", - "display_attached": "1", - "gpu": "1002:6821", - "hidpi": "1", - "os": "Mac-12.1", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 20 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "webgl_conformance", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--stable-jobs", "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-gl=angle --use-angle=metal --use-cmd-decoder=passthrough --force_high_performance_gpu", "--webgl-conformance-version=2.0.1", "--read-abbreviated-json-results-from=../../content/test/data/gpu/webgl2_conformance_tests_output.json",
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index 708ac6a..0289138 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -5654,7 +5654,6 @@ "args": [ "--num-retries=3", "--skipped=always", - "--test-list=../../testing/buildbot/filters/gpu.skiarenderer_vulkan_blink_web_tests.filter", "--flag-specific=skia-vulkan-swiftshader", "--write-run-histories-to=${ISOLATED_OUTDIR}/run_histories.json", "--git-revision=${got_revision}" @@ -96478,6 +96477,7 @@ { "args": [ "--flag-specific=highdpi", + "--skipped=always", "--num-retries=3", "--write-run-histories-to=${ISOLATED_OUTDIR}/run_histories.json", "--git-revision=${got_revision}" @@ -96515,6 +96515,7 @@ { "args": [ "--flag-specific=highdpi", + "--skipped=always", "--num-retries=3", "--write-run-histories-to=${ISOLATED_OUTDIR}/run_histories.json", "--git-revision=${got_revision}" @@ -96755,7 +96756,6 @@ "args": [ "--num-retries=3", "--skipped=always", - "--test-list=../../testing/buildbot/filters/gpu.skiarenderer_vulkan_blink_web_tests.filter", "--flag-specific=skia-vulkan-swiftshader", "--write-run-histories-to=${ISOLATED_OUTDIR}/run_histories.json", "--git-revision=${got_revision}" @@ -104519,6 +104519,7 @@ { "args": [ "--flag-specific=highdpi", + "--skipped=always", "--num-retries=3", "--write-run-histories-to=${ISOLATED_OUTDIR}/run_histories.json", "--git-revision=${got_revision}" @@ -104558,6 +104559,7 @@ { "args": [ "--flag-specific=highdpi", + "--skipped=always", "--num-retries=3", "--write-run-histories-to=${ISOLATED_OUTDIR}/run_histories.json", "--git-revision=${got_revision}" @@ -104840,7 +104842,6 @@ "args": [ "--num-retries=3", "--skipped=always", - "--test-list=../../testing/buildbot/filters/gpu.skiarenderer_vulkan_blink_web_tests.filter", "--flag-specific=skia-vulkan-swiftshader", "--write-run-histories-to=${ISOLATED_OUTDIR}/run_histories.json", "--git-revision=${got_revision}"
diff --git a/testing/buildbot/chromium.gpu.fyi.json b/testing/buildbot/chromium.gpu.fyi.json index 874753b2..e7b2632 100644 --- a/testing/buildbot/chromium.gpu.fyi.json +++ b/testing/buildbot/chromium.gpu.fyi.json
@@ -14032,49 +14032,6 @@ "-v", "--stable-jobs", "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-gl=angle --use-angle=gl --use-cmd-decoder=passthrough --force_high_performance_gpu", - "--webgl-conformance-version=2.0.1", - "--read-abbreviated-json-results-from=../../content/test/data/gpu/webgl2_conformance_tests_output.json", - "--jobs=4" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgl2_conformance_gl_passthrough_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "cpu": "x86-64", - "display_attached": "1", - "gpu": "1002:6821", - "hidpi": "1", - "os": "Mac-12.1", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 20 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "webgl_conformance", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--stable-jobs", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-gl=angle --use-angle=gl --use-cmd-decoder=passthrough --force_high_performance_gpu", "--read-abbreviated-json-results-from=../../content/test/data/gpu/webgl_conformance_tests_output.json", "--jobs=4" ], @@ -15794,49 +15751,6 @@ "--passthrough", "-v", "--stable-jobs", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-gl=angle --use-angle=gl --use-cmd-decoder=passthrough --force_high_performance_gpu", - "--webgl-conformance-version=2.0.1", - "--read-abbreviated-json-results-from=../../content/test/data/gpu/webgl2_conformance_tests_output.json", - "--jobs=4" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgl2_conformance_gl_passthrough_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "cpu": "x86-64", - "display_attached": "1", - "gpu": "1002:6821", - "hidpi": "1", - "os": "Mac-12.1", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 20 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "webgl_conformance", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--stable-jobs", "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-gl=angle --use-angle=metal --use-cmd-decoder=passthrough --force_high_performance_gpu", "--webgl-conformance-version=2.0.1", "--read-abbreviated-json-results-from=../../content/test/data/gpu/webgl2_conformance_tests_output.json",
diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json index ed2a7898..fd56d81 100644 --- a/testing/buildbot/chromium.linux.json +++ b/testing/buildbot/chromium.linux.json
@@ -3775,6 +3775,7 @@ { "args": [ "--flag-specific=highdpi", + "--skipped=always", "--num-retries=3", "--write-run-histories-to=${ISOLATED_OUTDIR}/run_histories.json", "--git-revision=${got_revision}" @@ -3812,6 +3813,7 @@ { "args": [ "--flag-specific=highdpi", + "--skipped=always", "--num-retries=3", "--write-run-histories-to=${ISOLATED_OUTDIR}/run_histories.json", "--git-revision=${got_revision}" @@ -4078,7 +4080,6 @@ "args": [ "--num-retries=3", "--skipped=always", - "--test-list=../../testing/buildbot/filters/gpu.skiarenderer_vulkan_blink_web_tests.filter", "--flag-specific=skia-vulkan-swiftshader", "--write-run-histories-to=${ISOLATED_OUTDIR}/run_histories.json", "--git-revision=${got_revision}"
diff --git a/testing/buildbot/filters/BUILD.gn b/testing/buildbot/filters/BUILD.gn index 1f26401..52d997a 100644 --- a/testing/buildbot/filters/BUILD.gn +++ b/testing/buildbot/filters/BUILD.gn
@@ -45,9 +45,7 @@ source_set("blink_web_tests_filter") { testonly = true - data = [ - "//testing/buildbot/filters/gpu.skiarenderer_vulkan_blink_web_tests.filter", - ] + data = [] } source_set("browser_tests_filters") {
diff --git a/testing/buildbot/gn_isolate_map.pyl b/testing/buildbot/gn_isolate_map.pyl index e462da3..785532f 100644 --- a/testing/buildbot/gn_isolate_map.pyl +++ b/testing/buildbot/gn_isolate_map.pyl
@@ -1653,8 +1653,8 @@ "label": "//sql:sql_unittests", "type": "console_test_launcher", }, - "strip_chrome_binary": { - "label": "//chrome:strip_chrome_binary", + "strip_lacros_files": { + "label": "//chrome:strip_lacros_files", "type": "additional_compile_target", }, "storage_unittests": {
diff --git a/testing/buildbot/test_suite_exceptions.pyl b/testing/buildbot/test_suite_exceptions.pyl index 598e595..f73c2f2 100644 --- a/testing/buildbot/test_suite_exceptions.pyl +++ b/testing/buildbot/test_suite_exceptions.pyl
@@ -3678,6 +3678,14 @@ 'Linux Tests', # https://crbug.com/929689, https://crbug.com/936557 ], }, + 'webgl2_conformance_gl_passthrough_tests': { + 'remove_from': [ + # Not enough capacity on Mac AMD https://crbug.com/1375306. + 'Mac FYI Retina ASAN (AMD)', + 'Mac FYI Retina Release (AMD)', + 'mac-angle-chromium-amd', + ], + }, 'webgl2_conformance_gles_passthrough_tests': { 'remove_from': [ # Currently not enough capacity to run these tests on this config.
diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index 4de501c..7e5ee49 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl
@@ -1305,6 +1305,7 @@ # running Layout Tests with forced device scale factor. 'args': [ '--flag-specific=highdpi', + '--skipped=always', # layout test failures are retried 3 times when '--test-list' is not # passed, but 0 times when '--test-list' is passed. We want to always @@ -1337,6 +1338,7 @@ # running Layout Tests with forced device scale factor. 'args': [ '--flag-specific=highdpi', + '--skipped=always', # layout test failures are retried 3 times when '--test-list' is not # passed, but 0 times when '--test-list' is passed. We want to always @@ -4755,7 +4757,6 @@ 'args': [ '--num-retries=3', '--skipped=always', - '--test-list=../../testing/buildbot/filters/gpu.skiarenderer_vulkan_blink_web_tests.filter', '--flag-specific=skia-vulkan-swiftshader', ], 'isolate_name': 'blink_web_tests', @@ -7008,7 +7009,8 @@ 'gpu_webgl2_conformance_gl_passthrough_telemetry_tests': { 'variants': [ 'MAC_MINI_INTEL_GPU_STABLE', - 'MAC_RETINA_AMD_GPU_STABLE', + # Not enough capacity on Mac AMD https://crbug.com/1375306. + # 'MAC_RETINA_AMD_GPU_STABLE', ], }, 'gpu_webgl_conformance_gl_passthrough_telemetry_tests': {
diff --git a/testing/buildbot/tryserver.chromium.mac.json b/testing/buildbot/tryserver.chromium.mac.json index 9100533..1f123e4 100644 --- a/testing/buildbot/tryserver.chromium.mac.json +++ b/testing/buildbot/tryserver.chromium.mac.json
@@ -1211,49 +1211,6 @@ "args": [], "script": "//testing/merge_scripts/standard_isolated_script_merge.py" }, - "name": "webgl2_conformance_gl_passthrough_tests 1002:6821", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86-64", - "display_attached": "1", - "gpu": "1002:6821", - "hidpi": "1", - "os": "Mac-12.1", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 20 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/", - "variant_id": "1002:6821" - }, - { - "args": [ - "webgl_conformance", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--stable-jobs", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --use-gl=angle --use-angle=gl --use-cmd-decoder=passthrough --force_high_performance_gpu", - "--webgl-conformance-version=2.0.1", - "--read-abbreviated-json-results-from=../../content/test/data/gpu/webgl2_conformance_tests_output.json", - "--jobs=4" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, "name": "webgl2_conformance_gl_passthrough_tests 8086:3e9b", "resultdb": { "enable": true,
diff --git a/testing/buildbot/waterfalls.pyl b/testing/buildbot/waterfalls.pyl index a2e4fc2..b3537c0 100644 --- a/testing/buildbot/waterfalls.pyl +++ b/testing/buildbot/waterfalls.pyl
@@ -193,7 +193,7 @@ 'chrome', 'linux_symbols', 'symupload', - 'strip_chrome_binary', + 'strip_lacros_files', ], 'mixins': [ 'chrome-swarming-pool', @@ -213,7 +213,7 @@ 'chrome', 'linux_symbols', 'symupload', - 'strip_chrome_binary', + 'strip_lacros_files', ], 'mixins': [ 'chrome-swarming-pool', @@ -228,7 +228,7 @@ 'chrome', 'linux_symbols', 'symupload', - 'strip_chrome_binary' + 'strip_lacros_files' ], 'mixins': [ 'chrome-swarming-pool', @@ -246,7 +246,7 @@ 'chrome', 'linux_symbols', 'symupload', - 'strip_chrome_binary' + 'strip_lacros_files' ], 'mixins': [ 'chrome-swarming-pool', @@ -261,7 +261,7 @@ 'chrome', 'linux_symbols', 'symupload', - 'strip_chrome_binary' + 'strip_lacros_files' ], 'mixins': [ 'chrome-swarming-pool', @@ -276,7 +276,7 @@ 'chrome', 'linux_symbols', 'symupload', - 'strip_chrome_binary' + 'strip_lacros_files' ], 'mixins': [ 'chrome-swarming-pool',
diff --git a/testing/test.gni b/testing/test.gni index c4199b224..cf815b49 100644 --- a/testing/test.gni +++ b/testing/test.gni
@@ -106,13 +106,6 @@ # use_raw_android_executable: Use mixed_executable() rather than # android_apk(). # use_native_activity: Test implements ANativeActivity_onCreate(). -# use_cfv2: (Fuchsia, optional): build the test as a framework v2 component; -# see https://fuchsia.dev/fuchsia-src/concepts/components/v2 for details. -# The default value is true; set it to false explicitly to omit a .cm -# manifest from the package. -# use_cfv1: (Fuchsia, optional): build the test as a framework v1 component. -# The default value is false; set it to true explicitly to include a .cmx -# manifest from the package. # test_runner_shard: (Fuchsia, optional): for CFv2 tests, use the given test # runner shard rather than the default shard for the ELF runner. This is # useful, for example, to use the elf_test_ambient_exec_runner for tests @@ -444,134 +437,66 @@ } else if (is_fuchsia) { assert(!defined(invoker.use_xvfb) || !invoker.use_xvfb) - _use_cfv1 = defined(invoker.use_cfv1) && invoker.use_cfv1 # opt-in - _use_cfv2 = !defined(invoker.use_cfv2) || invoker.use_cfv2 # opt-out - - # It's meaningless to omit both types of manifest from the package. - assert(_use_cfv1 || _use_cfv2) - _output_name = invoker.target_name _pkg_target = "${_output_name}_pkg" _exec_target = "${_output_name}__exec" _program_name = get_label_info(":${_exec_target}", "name") - _test_component_targets = [] - # Generate a CFv2 manifest unless the target opts-out via `use_cfv2=false`. - if (_use_cfv2) { - # Generate a CML fragment that provides the program name. - _test_program_fragment_target = "${target_name}_program-fragment" - _test_program_fragment = - "${target_out_dir}/${target_name}_program.test-cml" - generated_file(_test_program_fragment_target) { - contents = { - program = { - binary = _program_name - } + # Generate a CML fragment that provides the program name. + _test_program_fragment_target = "${target_name}_program-fragment" + _test_program_fragment = "${target_out_dir}/${target_name}_program.test-cml" + generated_file(_test_program_fragment_target) { + contents = { + program = { + binary = _program_name } - outputs = [ _test_program_fragment ] - output_conversion = "json" } - - _test_runner_shard = - "//build/config/fuchsia/test/elf_test_runner.shard.test-cml" - if (defined(invoker.test_runner_shard)) { - _test_runner_shard = invoker.test_runner_shard - } - - # Collate the complete set of elements to include in the test component's - # manifest. - _manifest_fragments = [ - "//build/config/fuchsia/test/chromium_test_facet.shard.test-cml", - "//build/config/fuchsia/test/minimum.shard.test-cml", - _test_program_fragment, - _test_runner_shard, - ] - - _test_component_manifest = "${target_out_dir}/${target_name}.cml" - _merged_manifest_name = "${_output_name}.cml" - - if (defined(invoker.additional_manifest_fragments)) { - _manifest_fragments += - filter_include(invoker.additional_manifest_fragments, - [ - "*.cml", - "*.test-cml", - ]) - } - - # Generate the test component manifest from the specified elements. - _test_component_manifest_target = "${target_name}_component-manifest" - cmc_merge(_test_component_manifest_target) { - sources = _manifest_fragments - output_name = "${_merged_manifest_name}" - deps = [ ":${_test_program_fragment_target}" ] - } - - # Define the test component, dependent on the generated manifest, and the - # test executable target. - _test_component_target = "${target_name}_component" - fuchsia_component(_test_component_target) { - deps = [ ":$_test_component_manifest_target" ] - data_deps = [ ":$_exec_target" ] - manifest = _test_component_manifest - visibility = [ ":*" ] - } - - _test_component_targets += [ ":${_test_component_target}" ] + outputs = [ _test_program_fragment ] + output_conversion = "json" } - # Generate a CFv1 manifest if the target opts-in via `use_cfv1=true`. - if (_use_cfv1) { - # Generate a CMX fragment that provides the program name. - _test_program_fragment_target_v1 = "${target_name}_program-fragment_v1" - _test_program_fragment_v1 = - "${target_out_dir}/${target_name}_program.test-cmx" - generated_file(_test_program_fragment_target_v1) { - contents = "{ \"program\": { \"binary\": \"${_program_name}\"}}" - outputs = [ _test_program_fragment_v1 ] - } - - # Collate the complete set of elements to include in the test component's - # manifest. - _manifest_fragments_v1 = [ - "//build/config/fuchsia/test/minimum_capabilities.test-cmx", - _test_program_fragment_v1, - ] - - _test_component_manifest_v1 = "${target_out_dir}/${target_name}.cmx" - _merged_manifest_name_v1 = "${_output_name}.cmx" - - if (defined(invoker.additional_manifest_fragments)) { - _manifest_fragments_v1 += - filter_include(invoker.additional_manifest_fragments, - [ - "*.cmx", - "*.test-cmx", - ]) - } - - # Generate the test component manifest from the specified elements. - _test_component_manifest_target_v1 = - "${target_name}_component-manifest_v1" - cmc_merge(_test_component_manifest_target_v1) { - sources = _manifest_fragments_v1 - output_name = "${_merged_manifest_name_v1}" - deps = [ ":${_test_program_fragment_target_v1}" ] - } - - # Define the test component, dependent on the generated manifest, and the - # test executable target. - _test_component_target_v1 = "${target_name}_component_v1" - fuchsia_component(_test_component_target_v1) { - deps = [ ":$_test_component_manifest_target_v1" ] - data_deps = [ ":$_exec_target" ] - manifest = _test_component_manifest_v1 - visibility = [ ":*" ] - } - - _test_component_targets += [ ":${_test_component_target_v1}" ] + _test_runner_shard = + "//build/config/fuchsia/test/elf_test_runner.shard.test-cml" + if (defined(invoker.test_runner_shard)) { + _test_runner_shard = invoker.test_runner_shard } + # Collate the complete set of elements to include in the test component's + # manifest. + _manifest_fragments = [ + "//build/config/fuchsia/test/chromium_test_facet.shard.test-cml", + "//build/config/fuchsia/test/minimum.shard.test-cml", + _test_program_fragment, + _test_runner_shard, + ] + + _test_component_manifest = "${target_out_dir}/${target_name}.cml" + _merged_manifest_name = "${_output_name}.cml" + + if (defined(invoker.additional_manifest_fragments)) { + _manifest_fragments += invoker.additional_manifest_fragments + } + + # Generate the test component manifest from the specified elements. + _test_component_manifest_target = "${target_name}_component-manifest" + cmc_merge(_test_component_manifest_target) { + sources = _manifest_fragments + output_name = "${_merged_manifest_name}" + deps = [ ":${_test_program_fragment_target}" ] + } + + # Define the test component, dependent on the generated manifest, and the + # test executable target. + _test_component_target = "${target_name}_component" + fuchsia_component(_test_component_target) { + deps = [ ":$_test_component_manifest_target" ] + data_deps = [ ":$_exec_target" ] + manifest = _test_component_manifest + visibility = [ ":*" ] + } + + _test_component_targets = [ ":${_test_component_target}" ] + # Define components for each entry in |additional_manifests|, if any. Since # manifests may themselves depend-on the outputs of |deps|, these components # must each individually depend on |invoker.deps|.
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index d036633c..8b928949 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -8637,6 +8637,31 @@ ] } ], + "ProcessHtmlDataImmediately": [ + { + "platforms": [ + "android", + "android_weblayer", + "chromeos", + "chromeos_lacros", + "linux", + "mac", + "windows" + ], + "experiments": [ + { + "name": "AllChunks", + "params": { + "first": "true", + "rest": "true" + }, + "enable_features": [ + "ProcessHtmlDataImmediately" + ] + } + ] + } + ], "ProductivityLauncherStudy": [ { "platforms": [
diff --git a/third_party/blink/common/permissions/permission_utils.cc b/third_party/blink/common/permissions/permission_utils.cc index c5de113..d0236182 100644 --- a/third_party/blink/common/permissions/permission_utils.cc +++ b/third_party/blink/common/permissions/permission_utils.cc
@@ -75,7 +75,7 @@ return "StorageAccess"; case PermissionType::CAMERA_PAN_TILT_ZOOM: return "CameraPanTiltZoom"; - case PermissionType::WINDOW_PLACEMENT: + case PermissionType::WINDOW_MANAGEMENT: return "WindowPlacement"; case PermissionType::LOCAL_FONTS: return "LocalFonts"; @@ -191,7 +191,7 @@ case PermissionName::STORAGE_ACCESS: return PermissionType::STORAGE_ACCESS_GRANT; case PermissionName::WINDOW_MANAGEMENT: - return PermissionType::WINDOW_PLACEMENT; + return PermissionType::WINDOW_MANAGEMENT; case PermissionName::LOCAL_FONTS: return PermissionType::LOCAL_FONTS; case PermissionName::DISPLAY_CAPTURE:
diff --git a/third_party/blink/public/common/permissions/permission_utils.h b/third_party/blink/public/common/permissions/permission_utils.h index e9354cbc..420a538 100644 --- a/third_party/blink/public/common/permissions/permission_utils.h +++ b/third_party/blink/public/common/permissions/permission_utils.h
@@ -49,7 +49,7 @@ AR = 26, STORAGE_ACCESS_GRANT = 27, CAMERA_PAN_TILT_ZOOM = 28, - WINDOW_PLACEMENT = 29, + WINDOW_MANAGEMENT = 29, LOCAL_FONTS = 30, DISPLAY_CAPTURE = 31, // FILE_HANDLING = 32, // Removed in M98.
diff --git a/third_party/blink/public/mojom/subapps/sub_apps_service.mojom b/third_party/blink/public/mojom/subapps/sub_apps_service.mojom index fa20fd1..cfc652b0 100644 --- a/third_party/blink/public/mojom/subapps/sub_apps_service.mojom +++ b/third_party/blink/public/mojom/subapps/sub_apps_service.mojom
@@ -44,7 +44,12 @@ struct SubAppsServiceListResult { SubAppsServiceResult code; - array<string> sub_app_ids; + array<SubAppsServiceListInfo> sub_apps; +}; + +struct SubAppsServiceListInfo { + string unhashed_app_id; + string app_name; }; // Sub Apps APIs allow installed PWAs to install shortcuts to their various
diff --git a/third_party/blink/renderer/bindings/generated_in_modules.gni b/third_party/blink/renderer/bindings/generated_in_modules.gni index 9116844..1733690 100644 --- a/third_party/blink/renderer/bindings/generated_in_modules.gni +++ b/third_party/blink/renderer/bindings/generated_in_modules.gni
@@ -927,6 +927,8 @@ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_storage_usage_details.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_sub_apps_add_options.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_sub_apps_add_options.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_sub_apps_list_info.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_sub_apps_list_info.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_svc_output_metadata.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_svc_output_metadata.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_sync_event_init.cc",
diff --git a/third_party/blink/renderer/bindings/idl_in_modules.gni b/third_party/blink/renderer/bindings/idl_in_modules.gni index 398a2ee..f0b5908 100644 --- a/third_party/blink/renderer/bindings/idl_in_modules.gni +++ b/third_party/blink/renderer/bindings/idl_in_modules.gni
@@ -744,6 +744,7 @@ "//third_party/blink/renderer/modules/subapps/navigator_sub_apps.idl", "//third_party/blink/renderer/modules/subapps/sub_apps.idl", "//third_party/blink/renderer/modules/subapps/sub_apps_add_options.idl", + "//third_party/blink/renderer/modules/subapps/sub_apps_list_info.idl", "//third_party/blink/renderer/modules/url_pattern/url_pattern.idl", "//third_party/blink/renderer/modules/url_pattern/url_pattern_component_result.idl", "//third_party/blink/renderer/modules/url_pattern/url_pattern_init.idl",
diff --git a/third_party/blink/renderer/core/css/css_global_rule_set.cc b/third_party/blink/renderer/core/css/css_global_rule_set.cc index 5ebcd75..47e84512 100644 --- a/third_party/blink/renderer/core/css/css_global_rule_set.cc +++ b/third_party/blink/renderer/core/css/css_global_rule_set.cc
@@ -23,8 +23,10 @@ if (!watched_selectors.size()) return; watched_selectors_rule_set_ = MakeGarbageCollected<RuleSet>(); + MediaQueryEvaluator* medium = + MakeGarbageCollected<MediaQueryEvaluator>(document.GetFrame()); for (unsigned i = 0; i < watched_selectors.size(); ++i) { - watched_selectors_rule_set_->AddStyleRule(watched_selectors[i], + watched_selectors_rule_set_->AddStyleRule(watched_selectors[i], *medium, kRuleHasNoSpecialState); } }
diff --git a/third_party/blink/renderer/core/css/css_style_rule.cc b/third_party/blink/renderer/core/css/css_style_rule.cc index eb89c74..c1b4eea 100644 --- a/third_party/blink/renderer/core/css/css_style_rule.cc +++ b/third_party/blink/renderer/core/css/css_style_rule.cc
@@ -101,7 +101,7 @@ // If we have any nested rules, update their parent selector(s) to point to // our newly created StyleRule instead of the old one. if (style_rule_->ChildRules()) { - for (StyleRule* child_rule : *style_rule_->ChildRules()) { + for (StyleRuleBase* child_rule : *style_rule_->ChildRules()) { child_rule->Reparent(style_rule_, new_style_rule); } }
diff --git a/third_party/blink/renderer/core/css/element_rule_collector.h b/third_party/blink/renderer/core/css/element_rule_collector.h index c247d7e..afc4cf1 100644 --- a/third_party/blink/renderer/core/css/element_rule_collector.h +++ b/third_party/blink/renderer/core/css/element_rule_collector.h
@@ -100,6 +100,7 @@ friend class ElementRuleCollector; FRIEND_TEST_ALL_PREFIXES(ElementRuleCollectorTest, DirectNesting); FRIEND_TEST_ALL_PREFIXES(ElementRuleCollectorTest, AtNest); + FRIEND_TEST_ALL_PREFIXES(ElementRuleCollectorTest, NestedRulesInMediaQuery); }; } // namespace blink
diff --git a/third_party/blink/renderer/core/css/element_rule_collector_test.cc b/third_party/blink/renderer/core/css/element_rule_collector_test.cc index 54d1aa9c..6125120e 100644 --- a/third_party/blink/renderer/core/css/element_rule_collector_test.cc +++ b/third_party/blink/renderer/core/css/element_rule_collector_test.cc
@@ -29,7 +29,9 @@ return nullptr; } RuleSet* rule_set = MakeGarbageCollected<RuleSet>(); - rule_set->AddStyleRule(style_rule, kRuleHasNoSpecialState); + MediaQueryEvaluator* medium = + MakeGarbageCollected<MediaQueryEvaluator>(document.GetFrame()); + rule_set->AddStyleRule(style_rule, *medium, kRuleHasNoSpecialState); return rule_set; } @@ -298,11 +300,12 @@ sheet->ParserAddNamespace("bar", "http://example.org/bar"); if (defaultNamespace) sheet->ParserAddNamespace(g_null_atom, *defaultNamespace); - RuleSet& rules = sheet->EnsureRuleSet( - MediaQueryEvaluator(GetDocument().GetFrame()), kRuleHasNoSpecialState); + MediaQueryEvaluator* medium = + MakeGarbageCollected<MediaQueryEvaluator>(GetDocument().GetFrame()); + RuleSet& rules = sheet->EnsureRuleSet(*medium, kRuleHasNoSpecialState); auto* rule = To<StyleRule>(CSSParser::ParseRule( sheet->ParserContext(), sheet, selector + " { color: green }")); - rules.AddStyleRule(rule, kRuleHasNoSpecialState); + rules.AddStyleRule(rule, *medium, kRuleHasNoSpecialState); MatchResult result; auto style = GetDocument().GetStyleResolver().CreateComputedStyle(); @@ -446,4 +449,39 @@ EXPECT_EQ(0u, foo_rules.size()); } +TEST_F(ElementRuleCollectorTest, NestedRulesInMediaQuery) { + SetBodyInnerHTML(R"HTML( + <div id="foo"><div id="bar" class="c"></div></div> + <div id="baz"></div> + )HTML"); + String rule = R"CSS( + #foo { + color: oldlace; + @media screen { + & .c { color: palegoldenrod; } + } + } + )CSS"; + RuleSet* rule_set = RuleSetFromSingleRule(GetDocument(), rule); + ASSERT_NE(nullptr, rule_set); + + Element* foo = GetDocument().getElementById("foo"); + Element* bar = GetDocument().getElementById("bar"); + Element* baz = GetDocument().getElementById("baz"); + ASSERT_NE(nullptr, foo); + ASSERT_NE(nullptr, bar); + ASSERT_NE(nullptr, baz); + + Vector<MatchedRule> foo_rules = GetAllMatchedRules(foo, rule_set); + ASSERT_EQ(1u, foo_rules.size()); + EXPECT_EQ("#foo", foo_rules[0].GetRuleData()->Selector().SelectorText()); + + Vector<MatchedRule> bar_rules = GetAllMatchedRules(bar, rule_set); + ASSERT_EQ(1u, bar_rules.size()); + EXPECT_EQ("& .c", bar_rules[0].GetRuleData()->Selector().SelectorText()); + + Vector<MatchedRule> baz_rules = GetAllMatchedRules(baz, rule_set); + EXPECT_EQ(0u, baz_rules.size()); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/css/parser/css_parser.cc b/third_party/blink/renderer/core/css/parser/css_parser.cc index 5f59feb..8a9cb3d0 100644 --- a/third_party/blink/renderer/core/css/parser/css_parser.cc +++ b/third_party/blink/renderer/core/css/parser/css_parser.cc
@@ -69,8 +69,9 @@ StyleRuleBase* CSSParser::ParseRule(const CSSParserContext* context, StyleSheetContents* style_sheet, const String& rule) { - return CSSParserImpl::ParseRule(rule, context, style_sheet, - CSSParserImpl::kAllowImportRules); + return CSSParserImpl::ParseRule( + rule, context, /*parent_rule_for_nesting=*/nullptr, style_sheet, + CSSParserImpl::kAllowImportRules); } ParseSheetResult CSSParser::ParseSheet( @@ -222,7 +223,8 @@ StyleRuleKeyframe* CSSParser::ParseKeyframeRule(const CSSParserContext* context, const String& rule) { StyleRuleBase* keyframe = CSSParserImpl::ParseRule( - rule, context, nullptr, CSSParserImpl::kKeyframeRules); + rule, context, /*parent_rule_for_nesting=*/nullptr, nullptr, + CSSParserImpl::kKeyframeRules); return To<StyleRuleKeyframe>(keyframe); }
diff --git a/third_party/blink/renderer/core/css/parser/css_parser_impl.cc b/third_party/blink/renderer/core/css/parser/css_parser_impl.cc index 7e1679d3..4ea5bf0 100644 --- a/third_party/blink/renderer/core/css/parser/css_parser_impl.cc +++ b/third_party/blink/renderer/core/css/parser/css_parser_impl.cc
@@ -267,6 +267,7 @@ StyleRuleBase* CSSParserImpl::ParseRule(const String& string, const CSSParserContext* context, + StyleRule* parent_rule_for_nesting, StyleSheetContents* style_sheet, AllowedRulesType allowed_rules) { CSSParserImpl parser(context, style_sheet); @@ -276,10 +277,13 @@ if (stream.UncheckedAtEnd()) return nullptr; // Parse error, empty rule StyleRuleBase* rule; - if (stream.UncheckedPeek().GetType() == kAtKeywordToken) - rule = parser.ConsumeAtRule(stream, allowed_rules); - else - rule = parser.ConsumeQualifiedRule(stream, allowed_rules); + if (stream.UncheckedPeek().GetType() == kAtKeywordToken) { + rule = parser.ConsumeAtRule(stream, allowed_rules, + /*parent_rule_for_nesting=*/nullptr); + } else { + rule = parser.ConsumeQualifiedRule(stream, allowed_rules, + parent_rule_for_nesting); + } if (!rule) return nullptr; // Parse error, failed to consume rule stream.ConsumeWhitespace(); @@ -323,7 +327,7 @@ } ParseSheetResult result = ParseSheetResult::kSucceeded; bool first_rule_valid = parser.ConsumeRuleList( - stream, kTopLevelRuleList, + stream, kTopLevelRuleList, /*parent_rule_for_nesting=*/nullptr, [&style_sheet, &result, allow_import_rules, context](StyleRuleBase* rule) { if (rule->IsCharsetRule()) @@ -437,7 +441,8 @@ CSSTokenizer tokenizer(string); CSSParserTokenStream stream(tokenizer); bool first_rule_valid = parser.ConsumeRuleList( - stream, kTopLevelRuleList, [&style_sheet](StyleRuleBase* rule) { + stream, kTopLevelRuleList, /*parent_rule_for_nesting=*/nullptr, + [&style_sheet](StyleRuleBase* rule) { if (rule->IsCharsetRule()) return; style_sheet->ParserAppendRule(rule); @@ -491,6 +496,7 @@ template <typename T> bool CSSParserImpl::ConsumeRuleList(CSSParserTokenStream& stream, RuleListType rule_list_type, + StyleRule* parent_rule_for_nesting, const T callback) { AllowedRulesType allowed_rules = kRegularRules; switch (rule_list_type) { @@ -522,7 +528,7 @@ stream.UncheckedConsume(); continue; case kAtKeywordToken: - rule = ConsumeAtRule(stream, allowed_rules); + rule = ConsumeAtRule(stream, allowed_rules, parent_rule_for_nesting); break; case kCDOToken: case kCDCToken: @@ -532,7 +538,8 @@ } [[fallthrough]]; default: - rule = ConsumeQualifiedRule(stream, allowed_rules); + rule = ConsumeQualifiedRule(stream, allowed_rules, + parent_rule_for_nesting); break; } if (!seen_rule) { @@ -585,13 +592,34 @@ } } -StyleRuleBase* CSSParserImpl::ConsumeAtRule(CSSParserTokenStream& stream, - AllowedRulesType allowed_rules) { +StyleRuleBase* CSSParserImpl::ConsumeAtRule( + CSSParserTokenStream& stream, + AllowedRulesType allowed_rules, + StyleRule* parent_rule_for_nesting) { DCHECK_EQ(stream.Peek().GetType(), kAtKeywordToken); CSSParserToken name_token = stream.ConsumeIncludingWhitespace(); // Must live until CssAtRuleID(). const StringView name = name_token.Value(); const CSSAtRuleID id = CssAtRuleID(name); + return ConsumeAtRuleContents(id, stream, allowed_rules, + parent_rule_for_nesting); +} + +StyleRuleBase* CSSParserImpl::ConsumeAtRuleContents( + CSSAtRuleID id, + CSSParserTokenStream& stream, + AllowedRulesType allowed_rules, + StyleRule* parent_rule_for_nesting) { + if (allowed_rules == kConditionalGroupRules) { + if (id != CSSAtRuleID::kCSSAtRuleMedia && // [css-conditional-3] + id != CSSAtRuleID::kCSSAtRuleSupports && // [css-conditional-3] + id != CSSAtRuleID::kCSSAtRuleContainer // [css-contain-3] + ) { + ConsumeErroneousAtRule(stream); + return nullptr; + } + allowed_rules = kRegularRules; + } // @import rules have a URI component that is not technically part of the // prelude. @@ -634,11 +662,11 @@ switch (id) { case CSSAtRuleID::kCSSAtRuleContainer: - return ConsumeContainerRule(stream); + return ConsumeContainerRule(stream, parent_rule_for_nesting); case CSSAtRuleID::kCSSAtRuleMedia: - return ConsumeMediaRule(stream); + return ConsumeMediaRule(stream, parent_rule_for_nesting); case CSSAtRuleID::kCSSAtRuleSupports: - return ConsumeSupportsRule(stream); + return ConsumeSupportsRule(stream, parent_rule_for_nesting); case CSSAtRuleID::kCSSAtRuleFontFace: return ConsumeFontFaceRule(stream); case CSSAtRuleID::kCSSAtRuleFontPaletteValues: @@ -674,9 +702,10 @@ StyleRuleBase* CSSParserImpl::ConsumeQualifiedRule( CSSParserTokenStream& stream, - AllowedRulesType allowed_rules) { + AllowedRulesType allowed_rules, + StyleRule* parent_rule_for_nesting) { if (allowed_rules <= kRegularRules) { - return ConsumeStyleRule(stream, /*parent_rule_for_nesting=*/nullptr); + return ConsumeStyleRule(stream, parent_rule_for_nesting); } if (allowed_rules == kKeyframeRules) { @@ -831,7 +860,9 @@ return MakeGarbageCollected<StyleRuleNamespace>(namespace_prefix, uri); } -StyleRuleMedia* CSSParserImpl::ConsumeMediaRule(CSSParserTokenStream& stream) { +StyleRuleMedia* CSSParserImpl::ConsumeMediaRule( + CSSParserTokenStream& stream, + StyleRule* parent_rule_for_nesting) { wtf_size_t prelude_offset_start = stream.LookAheadOffset(); CSSParserTokenRange prelude = ConsumeAtRulePrelude(stream); wtf_size_t prelude_offset_end = stream.LookAheadOffset(); @@ -858,7 +889,7 @@ const MediaQuerySet* media = CachedMediaQuerySet(prelude_string, prelude); DCHECK(media); - ConsumeRuleList(stream, kRegularRuleList, + ConsumeRuleList(stream, kRegularRuleList, parent_rule_for_nesting, [&rules](StyleRuleBase* rule) { rules.push_back(rule); }); if (observer_) @@ -868,7 +899,8 @@ } StyleRuleSupports* CSSParserImpl::ConsumeSupportsRule( - CSSParserTokenStream& stream) { + CSSParserTokenStream& stream, + StyleRule* parent_rule_for_nesting) { wtf_size_t prelude_offset_start = stream.LookAheadOffset(); CSSSupportsParser::Result supported = CSSSupportsParser::ConsumeSupportsCondition(stream, *this); @@ -900,7 +932,7 @@ .SimplifyWhiteSpace(); HeapVector<Member<StyleRuleBase>> rules; - ConsumeRuleList(stream, kRegularRuleList, + ConsumeRuleList(stream, kRegularRuleList, parent_rule_for_nesting, [&rules](StyleRuleBase* rule) { rules.push_back(rule); }); if (observer_) @@ -972,7 +1004,8 @@ auto* keyframe_rule = MakeGarbageCollected<StyleRuleKeyframes>(); ConsumeRuleList( - stream, kKeyframesRuleList, [keyframe_rule](StyleRuleBase* keyframe) { + stream, kKeyframesRuleList, /*parent_rule_for_nesting=*/nullptr, + [keyframe_rule](StyleRuleBase* keyframe) { keyframe_rule->ParserAppendKeyframe(To<StyleRuleKeyframe>(keyframe)); }); keyframe_rule->SetName(name); @@ -1118,7 +1151,7 @@ observer_->StartRuleBody(stream.Offset()); HeapVector<Member<StyleRuleBase>> rules; - ConsumeRuleList(stream, kRegularRuleList, + ConsumeRuleList(stream, kRegularRuleList, /*parent_rule_for_nesting=*/nullptr, [&rules](StyleRuleBase* rule) { rules.push_back(rule); }); if (observer_) @@ -1128,7 +1161,8 @@ } StyleRuleContainer* CSSParserImpl::ConsumeContainerRule( - CSSParserTokenStream& stream) { + CSSParserTokenStream& stream, + StyleRule* parent_rule_for_nesting) { wtf_size_t prelude_offset_start = stream.LookAheadOffset(); CSSParserTokenRange prelude = ConsumeAtRulePrelude(stream); wtf_size_t prelude_offset_end = stream.LookAheadOffset(); @@ -1162,7 +1196,7 @@ observer_->StartRuleBody(stream.Offset()); HeapVector<Member<StyleRuleBase>> rules; - ConsumeRuleList(stream, kRegularRuleList, + ConsumeRuleList(stream, kRegularRuleList, parent_rule_for_nesting, [&rules](StyleRuleBase* rule) { rules.push_back(rule); }); if (observer_) @@ -1228,7 +1262,7 @@ } HeapVector<Member<StyleRuleBase>> rules; - ConsumeRuleList(stream, kRegularRuleList, + ConsumeRuleList(stream, kRegularRuleList, /*parent_rule_for_nesting=*/nullptr, [&rules](StyleRuleBase* rule) { rules.push_back(rule); }); if (observer_) @@ -1269,7 +1303,7 @@ auto* position_fallback_rule = MakeGarbageCollected<StyleRulePositionFallback>(AtomicString(name)); ConsumeRuleList( - stream, kPositionFallbackRuleList, + stream, kPositionFallbackRuleList, /*parent_rule_for_nesting=*/nullptr, [position_fallback_rule](StyleRuleBase* try_rule) { position_fallback_rule->ParserAppendTryRule(To<StyleRuleTry>(try_rule)); }); @@ -1500,8 +1534,21 @@ const CSSAtRuleID id = CssAtRuleID(name); if (id == CSSAtRuleID::kCSSAtRuleNest) { ConsumeNestedRule(stream, parent_rule_for_nesting); - break; + } else { + // An at-rule within a style rule. We handle this similarly to + // nested style rules (ConsumeNestedRule()). Only conditional group + // rules are allowed here; ConsumeAtRuleContents() will check for us + // since we give in kConditionalGroupRules. + HeapVector<CSSPropertyValue, 64> outer_parsed_properties; + swap(parsed_properties_, outer_parsed_properties); + StyleRuleBase* child = ConsumeAtRuleContents( + id, stream, kConditionalGroupRules, parent_rule_for_nesting); + if (child && parent_rule_for_nesting) { + parent_rule_for_nesting->AddChildRule(child); + } + parsed_properties_ = std::move(outer_parsed_properties); } + break; } // Consume the remainder of the declaration (if any) for error // recovery.
diff --git a/third_party/blink/renderer/core/css/parser/css_parser_impl.h b/third_party/blink/renderer/core/css/parser/css_parser_impl.h index c6e5444d..35b06afc 100644 --- a/third_party/blink/renderer/core/css/parser/css_parser_impl.h +++ b/third_party/blink/renderer/core/css/parser/css_parser_impl.h
@@ -7,6 +7,7 @@ #include <memory> +#include "css_at_rule_id.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/css_property_source_data.h" @@ -74,7 +75,8 @@ kKeyframeRules, kFontFeatureRules, kTryRules, - kNoRules, // For parsing at-rules inside declaration lists + kNoRules, // For parsing at-rules inside declaration lists + kConditionalGroupRules, // @media etc., see [css-conditional-3] }; // Represents the start and end offsets of a CSSParserTokenRange. @@ -116,6 +118,7 @@ const CSSParserContext*); static StyleRuleBase* ParseRule(const String&, const CSSParserContext*, + StyleRule* parent_rule_for_nesting, StyleSheetContents*, AllowedRulesType); static ParseSheetResult ParseStyleSheet( @@ -166,18 +169,31 @@ // Returns whether the first encountered rule was valid template <typename T> - bool ConsumeRuleList(CSSParserTokenStream&, RuleListType, T callback); + bool ConsumeRuleList(CSSParserTokenStream&, + RuleListType, + StyleRule* parent_rule_for_nesting, + T callback); // These functions update the range/stream they're given - StyleRuleBase* ConsumeAtRule(CSSParserTokenStream&, AllowedRulesType); - StyleRuleBase* ConsumeQualifiedRule(CSSParserTokenStream&, AllowedRulesType); + StyleRuleBase* ConsumeAtRule(CSSParserTokenStream&, + AllowedRulesType, + StyleRule* parent_rule_for_nesting); + StyleRuleBase* ConsumeAtRuleContents(CSSAtRuleID id, + CSSParserTokenStream& stream, + AllowedRulesType allowed_rules, + StyleRule* parent_rule_for_nesting); + StyleRuleBase* ConsumeQualifiedRule(CSSParserTokenStream&, + AllowedRulesType, + StyleRule* parent_rule_for_nesting); static StyleRuleCharset* ConsumeCharsetRule(CSSParserTokenStream&); StyleRuleImport* ConsumeImportRule(const AtomicString& prelude_uri, CSSParserTokenStream&); StyleRuleNamespace* ConsumeNamespaceRule(CSSParserTokenStream&); - StyleRuleMedia* ConsumeMediaRule(CSSParserTokenStream&); - StyleRuleSupports* ConsumeSupportsRule(CSSParserTokenStream&); + StyleRuleMedia* ConsumeMediaRule(CSSParserTokenStream& stream, + StyleRule* parent_rule_for_nesting); + StyleRuleSupports* ConsumeSupportsRule(CSSParserTokenStream& stream, + StyleRule* parent_rule_for_nesting); StyleRuleFontFace* ConsumeFontFaceRule(CSSParserTokenStream&); StyleRuleFontPaletteValues* ConsumeFontPaletteValuesRule( CSSParserTokenStream&); @@ -187,7 +203,8 @@ StyleRuleProperty* ConsumePropertyRule(CSSParserTokenStream&); StyleRuleCounterStyle* ConsumeCounterStyleRule(CSSParserTokenStream&); StyleRuleBase* ConsumeScopeRule(CSSParserTokenStream&); - StyleRuleContainer* ConsumeContainerRule(CSSParserTokenStream&); + StyleRuleContainer* ConsumeContainerRule(CSSParserTokenStream& stream, + StyleRule* parent_rule_for_nesting); StyleRuleBase* ConsumeLayerRule(CSSParserTokenStream&); StyleRulePositionFallback* ConsumePositionFallbackRule(CSSParserTokenStream&); StyleRuleTry* ConsumeTryRule(CSSParserTokenStream&);
diff --git a/third_party/blink/renderer/core/css/parser/css_parser_impl_test.cc b/third_party/blink/renderer/core/css/parser/css_parser_impl_test.cc index 3e0f3c0..6d90e49 100644 --- a/third_party/blink/renderer/core/css/parser/css_parser_impl_test.cc +++ b/third_party/blink/renderer/core/css/parser/css_parser_impl_test.cc
@@ -232,7 +232,9 @@ EXPECT_EQ(".element", parent->SelectorsText()); ASSERT_EQ(1u, parent->ChildRules()->size()); - const StyleRule* child = (*parent->ChildRules())[0].Get(); + const StyleRule* child = + DynamicTo<StyleRule>((*parent->ChildRules())[0].Get()); + ASSERT_NE(nullptr, child); EXPECT_EQ("color: red; margin-left: 10px;", child->Properties().AsText()); EXPECT_EQ("&.other", child->SelectorsText()); } @@ -256,7 +258,9 @@ EXPECT_EQ(".element", parent->SelectorsText()); ASSERT_EQ(1u, parent->ChildRules()->size()); - const StyleRule* child = (*parent->ChildRules())[0].Get(); + const StyleRule* child = + DynamicTo<StyleRule>((*parent->ChildRules())[0].Get()); + ASSERT_NE(nullptr, child); EXPECT_EQ("color: red;", child->Properties().AsText()); // FIXME(sesse): In the current spec, this should have been @nest .outer &, // but we don't serialize the @nest yet. This part of the spec is somewhat @@ -280,6 +284,46 @@ EXPECT_EQ("&.element", rule->SelectorsText()); } +// NOTE: We currently don't support _properties_ within nested media queries. +TEST(CSSParserImplTest, NestedRulesInsideMediaQueries) { + ScopedCSSNestingForTest enabled(true); + String sheet_text = R"CSS( + .element { + color: green; + @media (width < 1000px) { + & + #foo { color: red; } + } + } + )CSS"; + + auto* context = MakeGarbageCollected<CSSParserContext>( + kHTMLStandardMode, SecureContextMode::kInsecureContext); + auto* sheet = MakeGarbageCollected<StyleSheetContents>(context); + TestCSSParserObserver test_css_parser_observer; + CSSParserImpl::ParseStyleSheetForInspector(sheet_text, context, sheet, + test_css_parser_observer); + + ASSERT_EQ(1u, sheet->ChildRules().size()); + StyleRule* parent = DynamicTo<StyleRule>(sheet->ChildRules()[0].Get()); + ASSERT_NE(nullptr, parent); + EXPECT_EQ("color: green;", parent->Properties().AsText()); + EXPECT_EQ(".element", parent->SelectorsText()); + + ASSERT_NE(nullptr, parent->ChildRules()); + ASSERT_EQ(1u, parent->ChildRules()->size()); + const StyleRuleMedia* media_query = + DynamicTo<StyleRuleMedia>((*parent->ChildRules())[0].Get()); + ASSERT_NE(nullptr, media_query); + + ASSERT_EQ(1u, media_query->ChildRules().size()); + const StyleRule* child = + DynamicTo<StyleRule>(media_query->ChildRules()[0].Get()); + ASSERT_NE(nullptr, child); + + EXPECT_EQ("color: red;", child->Properties().AsText()); + EXPECT_EQ("& + #foo", child->SelectorsText()); +} + TEST(CSSParserImplTest, RemoveImportantAnnotationIfPresent) { struct TestCase { String input;
diff --git a/third_party/blink/renderer/core/css/rule_set.cc b/third_party/blink/renderer/core/css/rule_set.cc index 9a56f47..6218130 100644 --- a/third_party/blink/renderer/core/css/rule_set.cc +++ b/third_party/blink/renderer/core/css/rule_set.cc
@@ -502,8 +502,8 @@ StyleRuleBase* rule = rules[i].Get(); if (auto* style_rule = DynamicTo<StyleRule>(rule)) { - AddStyleRule(style_rule, add_rule_flags, container_query, cascade_layer, - style_scope); + AddStyleRule(style_rule, medium, add_rule_flags, container_query, + cascade_layer, style_scope); } else if (auto* page_rule = DynamicTo<StyleRulePage>(rule)) { page_rule->SetCascadeLayer(cascade_layer); AddPageRule(page_rule); @@ -613,6 +613,7 @@ } void RuleSet::AddStyleRule(StyleRule* style_rule, + const MediaQueryEvaluator& medium, AddRuleFlags add_rule_flags, const ContainerQuery* container_query, CascadeLayer* cascade_layer, @@ -626,10 +627,8 @@ // Nested rules are taken to be added immediately after their parent rule. if (style_rule->ChildRules() != nullptr) { - for (StyleRule* child_rule : *style_rule->ChildRules()) { - AddStyleRule(child_rule, add_rule_flags, container_query, cascade_layer, - style_scope); - } + AddChildRules(*style_rule->ChildRules(), medium, add_rule_flags, + container_query, cascade_layer, style_scope); } }
diff --git a/third_party/blink/renderer/core/css/rule_set.h b/third_party/blink/renderer/core/css/rule_set.h index 2037e830..b347b6d5 100644 --- a/third_party/blink/renderer/core/css/rule_set.h +++ b/third_party/blink/renderer/core/css/rule_set.h
@@ -355,6 +355,7 @@ AddRuleFlags = kRuleHasNoSpecialState, CascadeLayer* = nullptr); void AddStyleRule(StyleRule* style_rule, + const MediaQueryEvaluator& medium, AddRuleFlags add_rule_flags, const ContainerQuery* container_query = nullptr, CascadeLayer* cascade_layer = nullptr,
diff --git a/third_party/blink/renderer/core/css/style_rule.cc b/third_party/blink/renderer/core/css/style_rule.cc index c42b06e..8947941 100644 --- a/third_party/blink/renderer/core/css/style_rule.cc +++ b/third_party/blink/renderer/core/css/style_rule.cc
@@ -423,12 +423,42 @@ StyleRuleBase::TraceAfterDispatch(visitor); } -void StyleRule::Reparent(StyleRule* old_parent, StyleRule* new_parent) { - for (CSSSelector* s = SelectorArray(); s; s = CSSSelectorList::Next(*s)) { - if (s->Match() == CSSSelector::kPseudoClass && - s->GetPseudoType() == CSSSelector::kPseudoParent) { - s->Reparent(old_parent, new_parent); - } +void StyleRuleBase::Reparent(StyleRule* old_parent, StyleRule* new_parent) { + switch (GetType()) { + case kStyle: + for (CSSSelector* s = DynamicTo<StyleRule>(this)->SelectorArray(); s; + s = CSSSelectorList::Next(*s)) { + if (s->Match() == CSSSelector::kPseudoClass && + s->GetPseudoType() == CSSSelector::kPseudoParent) { + s->Reparent(old_parent, new_parent); + } + } + break; + case kScope: + case kLayerBlock: + case kContainer: + case kMedia: + case kSupports: + for (StyleRuleBase* child : + DynamicTo<StyleRuleGroup>(this)->ChildRules()) { + child->Reparent(old_parent, new_parent); + } + break; + case kPage: + case kProperty: + case kFontFace: + case kFontPaletteValues: + case kImport: + case kKeyframes: + case kLayerStatement: + case kNamespace: + case kCounterStyle: + case kPositionFallback: + case kTry: + case kKeyframe: + case kCharset: + // Cannot have any child rules. + break; } }
diff --git a/third_party/blink/renderer/core/css/style_rule.h b/third_party/blink/renderer/core/css/style_rule.h index 4ac74b67..f08da37 100644 --- a/third_party/blink/renderer/core/css/style_rule.h +++ b/third_party/blink/renderer/core/css/style_rule.h
@@ -106,6 +106,12 @@ CSSRule* CreateCSSOMWrapper(wtf_size_t position_hint, CSSRule* parent_rule) const; + // Move this rule from being a child of old_parent (which is only given for + // sake of DCHECK) to being a child of new_parent, updating parent pointers + // in the selector. This happens only when we need to reallocate a StyleRule + // because its selector changed. + void Reparent(StyleRule* old_parent, StyleRule* new_parent); + void Trace(Visitor*) const; void TraceAfterDispatch(blink::Visitor* visitor) const {} void FinalizeGarbageCollectedObject(); @@ -241,25 +247,20 @@ void TraceAfterDispatch(blink::Visitor*) const; - const HeapVector<Member<StyleRule>>* ChildRules() const { + const HeapVector<Member<StyleRuleBase>>* ChildRules() const { return child_rules_.Get(); } - void AddChildRule(StyleRule* child) { + void AddChildRule(StyleRuleBase* child) { // Allocate the child rule vector only when we need it, // since most rules won't have children (almost by definition). if (child_rules_ == nullptr) { - child_rules_ = MakeGarbageCollected<HeapVector<Member<StyleRule>>>(); + child_rules_ = MakeGarbageCollected<HeapVector<Member<StyleRuleBase>>>(); } child_rules_->push_back(child); } - // Move this rule from being a child of old_parent (which is only given for - // sake of DCHECK) to being a child of new_parent, updating parent pointers - // in the selector. This happens only when we need to reallocate a StyleRule - // because its selector changed. - void Reparent(StyleRule* old_parent, StyleRule* new_parent); - private: + friend class StyleRuleBase; friend class CSSLazyParsingTest; bool HasParsedProperties() const; @@ -273,7 +274,7 @@ mutable Member<CSSPropertyValueSet> properties_; mutable Member<CSSLazyPropertyParser> lazy_property_parser_; - Member<HeapVector<Member<StyleRule>>> child_rules_; + Member<HeapVector<Member<StyleRuleBase>>> child_rules_; }; class CORE_EXPORT StyleRuleFontFace : public StyleRuleBase {
diff --git a/third_party/blink/renderer/core/inspector/inspector_network_agent.cc b/third_party/blink/renderer/core/inspector/inspector_network_agent.cc index 7b8475c..a5663fd5 100644 --- a/third_party/blink/renderer/core/inspector/inspector_network_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_network_agent.cc
@@ -1055,8 +1055,12 @@ } } response_object->setProtocol(protocol); - response_object->setAlternateProtocolUsage( - AlternateProtocolUsageToString(response.AlternateProtocolUsage())); + if (response.AlternateProtocolUsage() != + net::AlternateProtocolUsage:: + ALTERNATE_PROTOCOL_USAGE_UNSPECIFIED_REASON) { + response_object->setAlternateProtocolUsage( + AlternateProtocolUsageToString(response.AlternateProtocolUsage())); + } const absl::optional<net::SSLInfo>& ssl_info = response.GetSSLInfo(); if (ssl_info.has_value()) {
diff --git a/third_party/blink/renderer/core/layout/ng/table/ng_table_section_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/table/ng_table_section_layout_algorithm.cc index 9cd727a..eb4442c 100644 --- a/third_party/blink/renderer/core/layout/ng/table/ng_table_section_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/table/ng_table_section_layout_algorithm.cc
@@ -102,15 +102,19 @@ DCHECK_EQ(break_status, NGBreakStatus::kContinue); } - const NGBoxFragment fragment( - table_data.table_writing_direction, - To<NGPhysicalBoxFragment>(row_result->PhysicalFragment())); + const auto& physical_fragment = + To<NGPhysicalBoxFragment>(row_result->PhysicalFragment()); + const NGBoxFragment fragment(table_data.table_writing_direction, + physical_fragment); + // TODO(crbug.com/736093): Due to inconsistent writing-direction of + // table-parts these DCHECKs may fail. When the above bug is fixed use the + // logical fragment instead of the physical. DCHECK(fragment.FirstBaseline()); DCHECK(fragment.LastBaseline()); if (!first_baseline) - first_baseline = offset.block_offset + *fragment.FirstBaseline(); - last_baseline = offset.block_offset + *fragment.LastBaseline(); + first_baseline = offset.block_offset + *physical_fragment.FirstBaseline(); + last_baseline = offset.block_offset + *physical_fragment.LastBaseline(); container_builder_.AddResult(*row_result, offset); offset.block_offset += fragment.BlockSize();
diff --git a/third_party/blink/renderer/modules/direct_sockets/tcp_readable_stream_wrapper_unittest.cc b/third_party/blink/renderer/modules/direct_sockets/tcp_readable_stream_wrapper_unittest.cc index 9321950..9650329 100644 --- a/third_party/blink/renderer/modules/direct_sockets/tcp_readable_stream_wrapper_unittest.cc +++ b/third_party/blink/renderer/modules/direct_sockets/tcp_readable_stream_wrapper_unittest.cc
@@ -29,11 +29,7 @@ class StreamCreator : public GarbageCollected<StreamCreator> { public: StreamCreator() = default; - ~StreamCreator() { - // Let the TCPReadableStreamWrapper object respond to the closure if it - // needs to. - test::RunPendingTasks(); - } + ~StreamCreator() = default; // The default value of |capacity| means some sensible value selected by mojo. TCPReadableStreamWrapper* Create(const V8TestingScope& scope, @@ -128,6 +124,8 @@ void Trace(Visitor* visitor) const { visitor->Trace(stream_wrapper_); } + void Cleanup() { data_pipe_producer_.reset(); } + private: void Close(ScriptValue exception) { close_called_with_ = !exception.IsEmpty(); @@ -138,10 +136,23 @@ Member<TCPReadableStreamWrapper> stream_wrapper_; }; +class ScopedStreamCreator { + public: + explicit ScopedStreamCreator(StreamCreator* stream_creator) + : stream_creator_(stream_creator) {} + + ~ScopedStreamCreator() { stream_creator_->Cleanup(); } + + StreamCreator* operator->() const { return stream_creator_; } + + private: + Persistent<StreamCreator> stream_creator_; +}; + TEST(TCPReadableStreamWrapperTest, Create) { V8TestingScope scope; - auto* stream_creator = MakeGarbageCollected<StreamCreator>(); + ScopedStreamCreator stream_creator(MakeGarbageCollected<StreamCreator>()); auto* tcp_readable_stream_wrapper = stream_creator->Create(scope); EXPECT_TRUE(tcp_readable_stream_wrapper->Readable()); @@ -150,7 +161,7 @@ TEST(TCPReadableStreamWrapperTest, ReadArrayBuffer) { V8TestingScope scope; - auto* stream_creator = MakeGarbageCollected<StreamCreator>(); + ScopedStreamCreator stream_creator(MakeGarbageCollected<StreamCreator>()); auto* tcp_readable_stream_wrapper = stream_creator->Create(scope); auto* script_state = scope.GetScriptState(); @@ -167,7 +178,7 @@ TEST(TCPReadableStreamWrapperTest, WriteToPipeWithPendingRead) { V8TestingScope scope; - auto* stream_creator = MakeGarbageCollected<StreamCreator>(); + ScopedStreamCreator stream_creator(MakeGarbageCollected<StreamCreator>()); auto* tcp_readable_stream_wrapper = stream_creator->Create(scope); auto* script_state = scope.GetScriptState(); @@ -200,7 +211,7 @@ TEST_P(TCPReadableStreamWrapperCloseTest, TriggerClose) { V8TestingScope scope; - auto* stream_creator = MakeGarbageCollected<StreamCreator>(); + ScopedStreamCreator stream_creator(MakeGarbageCollected<StreamCreator>()); auto* tcp_readable_stream_wrapper = stream_creator->Create(scope); auto* script_state = scope.GetScriptState(); @@ -234,7 +245,7 @@ TEST_P(TCPReadableStreamWrapperCloseTest, TriggerCloseInReverseOrder) { V8TestingScope scope; - auto* stream_creator = MakeGarbageCollected<StreamCreator>(); + ScopedStreamCreator stream_creator(MakeGarbageCollected<StreamCreator>()); auto* tcp_readable_stream_wrapper = stream_creator->Create(scope); auto* script_state = scope.GetScriptState(); @@ -269,7 +280,7 @@ TEST_P(TCPReadableStreamWrapperCloseTest, ErrorCancelReset) { V8TestingScope scope; - auto* stream_creator = MakeGarbageCollected<StreamCreator>(); + ScopedStreamCreator stream_creator(MakeGarbageCollected<StreamCreator>()); auto* tcp_readable_stream_wrapper = stream_creator->Create(scope); auto* script_state = scope.GetScriptState(); @@ -299,7 +310,7 @@ TEST_P(TCPReadableStreamWrapperCloseTest, ResetCancelError) { V8TestingScope scope; - auto* stream_creator = MakeGarbageCollected<StreamCreator>(); + ScopedStreamCreator stream_creator(MakeGarbageCollected<StreamCreator>()); auto* tcp_readable_stream_wrapper = stream_creator->Create(scope); auto* script_state = scope.GetScriptState();
diff --git a/third_party/blink/renderer/modules/direct_sockets/udp_writable_stream_wrapper_unittest.cc b/third_party/blink/renderer/modules/direct_sockets/udp_writable_stream_wrapper_unittest.cc index 27ace2f..69ea081 100644 --- a/third_party/blink/renderer/modules/direct_sockets/udp_writable_stream_wrapper_unittest.cc +++ b/third_party/blink/renderer/modules/direct_sockets/udp_writable_stream_wrapper_unittest.cc
@@ -62,7 +62,7 @@ : fake_udp_socket_(std::move(socket)), receiver_{fake_udp_socket_.get()} {} - ~StreamCreator() { test::RunPendingTasks(); } + ~StreamCreator() = default; UDPWritableStreamWrapper* Create(const V8TestingScope& scope) { auto* udp_socket = @@ -85,6 +85,11 @@ bool CloseCalledWith(bool error) { return close_called_with_ == error; } + void Cleanup() { + fake_udp_socket_.reset(); + receiver_.reset(); + } + private: void Close(ScriptValue exception) { close_called_with_ = !exception.IsEmpty(); @@ -96,10 +101,23 @@ Member<UDPWritableStreamWrapper> stream_wrapper_; }; +class ScopedStreamCreator { + public: + explicit ScopedStreamCreator(StreamCreator* stream_creator) + : stream_creator_(stream_creator) {} + + ~ScopedStreamCreator() { stream_creator_->Cleanup(); } + + StreamCreator* operator->() const { return stream_creator_; } + + private: + Persistent<StreamCreator> stream_creator_; +}; + TEST(UDPWritableStreamWrapperTest, Create) { V8TestingScope scope; - auto* stream_creator = MakeGarbageCollected<StreamCreator>(); + ScopedStreamCreator stream_creator(MakeGarbageCollected<StreamCreator>()); auto* udp_writable_stream_wrapper = stream_creator->Create(scope); EXPECT_TRUE(udp_writable_stream_wrapper->Writable()); @@ -108,7 +126,7 @@ TEST(UDPWritableStreamWrapperTest, WriteUdpMessage) { V8TestingScope scope; - auto* stream_creator = MakeGarbageCollected<StreamCreator>(); + ScopedStreamCreator stream_creator(MakeGarbageCollected<StreamCreator>()); auto* udp_writable_stream_wrapper = stream_creator->Create(scope); auto* script_state = scope.GetScriptState(); @@ -137,7 +155,7 @@ TEST(UDPWritableStreamWrapperTest, WriteUdpMessageFromTypedArray) { V8TestingScope scope; - auto* stream_creator = MakeGarbageCollected<StreamCreator>(); + ScopedStreamCreator stream_creator(MakeGarbageCollected<StreamCreator>()); auto* udp_writable_stream_wrapper = stream_creator->Create(scope); auto* script_state = scope.GetScriptState(); @@ -169,7 +187,7 @@ TEST(UDPWritableStreamWrapperTest, WriteUdpMessageWithEmptyDataField) { V8TestingScope scope; - auto* stream_creator = MakeGarbageCollected<StreamCreator>(); + ScopedStreamCreator stream_creator(MakeGarbageCollected<StreamCreator>()); auto* udp_writable_stream_wrapper = stream_creator->Create(scope); auto* script_state = scope.GetScriptState(); @@ -201,7 +219,7 @@ TEST(UDPWritableStreamWrapperTest, WriteUdpMessageWithoutDataField) { V8TestingScope scope; - auto* stream_creator = MakeGarbageCollected<StreamCreator>(); + ScopedStreamCreator stream_creator(MakeGarbageCollected<StreamCreator>()); auto* udp_writable_stream_wrapper = stream_creator->Create(scope); auto* script_state = scope.GetScriptState(); @@ -233,7 +251,7 @@ TEST(UDPWritableStreamWrapperTest, WriteAfterFinishedWrite) { V8TestingScope scope; - auto* stream_creator = MakeGarbageCollected<StreamCreator>(); + ScopedStreamCreator stream_creator(MakeGarbageCollected<StreamCreator>()); auto* udp_writable_stream_wrapper = stream_creator->Create(scope); auto* script_state = scope.GetScriptState(); @@ -265,7 +283,7 @@ TEST(UDPWritableStreamWrapperTest, WriteAfterClose) { V8TestingScope scope; - auto* stream_creator = MakeGarbageCollected<StreamCreator>(); + ScopedStreamCreator stream_creator(MakeGarbageCollected<StreamCreator>()); auto* udp_writable_stream_wrapper = stream_creator->Create(scope); auto* script_state = scope.GetScriptState(); @@ -315,8 +333,8 @@ V8TestingScope scope; - auto* stream_creator = MakeGarbageCollected<StreamCreator>( - std::make_unique<FailingFakeDirectUDPSocket>()); + ScopedStreamCreator stream_creator(MakeGarbageCollected<StreamCreator>( + std::make_unique<FailingFakeDirectUDPSocket>())); auto* udp_writable_stream_wrapper = stream_creator->Create(scope); auto* script_state = scope.GetScriptState();
diff --git a/third_party/blink/renderer/modules/subapps/sub_apps.cc b/third_party/blink/renderer/modules/subapps/sub_apps.cc index 39b3b39c..58d917c 100644 --- a/third_party/blink/renderer/modules/subapps/sub_apps.cc +++ b/third_party/blink/renderer/modules/subapps/sub_apps.cc
@@ -11,7 +11,7 @@ #include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" #include "third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_sub_apps_add_options.h" -#include "third_party/blink/renderer/core/dom/dom_exception.h" +#include "third_party/blink/renderer/bindings/modules/v8/v8_sub_apps_list_info.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h" @@ -30,6 +30,7 @@ using mojom::blink::SubAppsServiceAddInfoPtr; using mojom::blink::SubAppsServiceAddResultCode; using mojom::blink::SubAppsServiceAddResultPtr; +using mojom::blink::SubAppsServiceListInfoPtr; using mojom::blink::SubAppsServiceListResultPtr; using mojom::blink::SubAppsServiceResult; @@ -82,6 +83,17 @@ return sub_apps_mojo; } +HeapVector<std::pair<String, Member<SubAppsListInfo>>> ListResultsFromMojo( + Vector<SubAppsServiceListInfoPtr> sub_apps_mojo) { + HeapVector<std::pair<String, Member<SubAppsListInfo>>> subapps; + for (auto& sub_app : sub_apps_mojo) { + SubAppsListInfo* list_info = SubAppsListInfo::Create(); + list_info->setAppName(std::move(sub_app->app_name)); + subapps.emplace_back(std::move(sub_app->unhashed_app_id), list_info); + } + return subapps; +} + } // namespace // static @@ -186,7 +198,7 @@ GetService()->List(resolver->WrapCallbackInScriptScope(WTF::BindOnce( [](ScriptPromiseResolver* resolver, SubAppsServiceListResultPtr result) { if (result->code == SubAppsServiceResult::kSuccess) { - resolver->Resolve(result->sub_app_ids); + resolver->Resolve(ListResultsFromMojo(std::move(result->sub_apps))); } else { resolver->Reject(V8ThrowDOMException::CreateOrDie( resolver->GetScriptState()->GetIsolate(),
diff --git a/third_party/blink/renderer/modules/subapps/sub_apps.idl b/third_party/blink/renderer/modules/subapps/sub_apps.idl index a63c78d..2dad10a 100644 --- a/third_party/blink/renderer/modules/subapps/sub_apps.idl +++ b/third_party/blink/renderer/modules/subapps/sub_apps.idl
@@ -25,6 +25,6 @@ RuntimeEnabled=DesktopPWAsSubApps ] interface SubApps { [CallWith=ScriptState, RaisesException] Promise<record<DOMString, SubAppsServiceAddResultCode>> add(record<DOMString, SubAppsAddOptions> sub_apps); - [CallWith=ScriptState, RaisesException] Promise<FrozenArray<DOMString>> list(); + [CallWith=ScriptState, RaisesException] Promise<record<DOMString, SubAppsListInfo>> list(); [CallWith=ScriptState, RaisesException] Promise<void> remove(DOMString app_id); };
diff --git a/third_party/blink/renderer/modules/subapps/sub_apps_list_info.idl b/third_party/blink/renderer/modules/subapps/sub_apps_list_info.idl new file mode 100644 index 0000000..861d01e --- /dev/null +++ b/third_party/blink/renderer/modules/subapps/sub_apps_list_info.idl
@@ -0,0 +1,9 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://github.com/ivansandrk/multi-apps/blob/main/explainer.md + +dictionary SubAppsListInfo { + required DOMString app_name; +}; \ No newline at end of file
diff --git a/third_party/blink/renderer/platform/image-decoders/image_decoder.cc b/third_party/blink/renderer/platform/image-decoders/image_decoder.cc index d71b75c..eeb1bee 100644 --- a/third_party/blink/renderer/platform/image-decoders/image_decoder.cc +++ b/third_party/blink/renderer/platform/image-decoders/image_decoder.cc
@@ -34,6 +34,7 @@ #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/renderer/platform/graphics/bitmap_image_metrics.h" #include "third_party/blink/renderer/platform/image-decoders/bmp/bmp_image_decoder.h" +#include "third_party/blink/renderer/platform/image-decoders/exif_reader.h" #include "third_party/blink/renderer/platform/image-decoders/fast_shared_buffer_reader.h" #include "third_party/blink/renderer/platform/image-decoders/gif/gif_image_decoder.h" #include "third_party/blink/renderer/platform/image-decoders/ico/ico_image_decoder.h" @@ -44,6 +45,7 @@ #include "third_party/blink/renderer/platform/network/mime/mime_type_registry.h" #include "third_party/skia/include/core/SkColorSpace.h" #include "ui/gfx/geometry/size.h" +#include "ui/gfx/geometry/size_conversions.h" #if BUILDFLAG(ENABLE_AV1_DECODER) #include "third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder.h" @@ -98,6 +100,32 @@ return std::min(8 * num_pixels, max_decoded_bytes); } +// Compute the density corrected size based on |metadata| and the physical size +// of the associated image. +gfx::Size ExtractDensityCorrectedSize(const DecodedImageMetaData& metadata, + const gfx::Size& physical_size) { + const unsigned kDefaultResolution = 72; + const unsigned kResolutionUnitDpi = 2; + + if (metadata.resolution_unit != kResolutionUnitDpi || + metadata.resolution.IsEmpty() || metadata.size.IsEmpty()) { + return physical_size; + } + CHECK(!metadata.resolution.IsEmpty()); + + // Division by zero is not possible since we check for empty resolution + // earlier. + gfx::SizeF size_from_resolution( + physical_size.width() * kDefaultResolution / metadata.resolution.width(), + physical_size.height() * kDefaultResolution / + metadata.resolution.height()); + + if (gfx::ToRoundedSize(size_from_resolution) == metadata.size) + return metadata.size; + + return physical_size; +} + inline bool MatchesJPEGSignature(const char* contents) { return !memcmp(contents, "\xFF\xD8\xFF", 3); } @@ -780,6 +808,14 @@ } } +void ImageDecoder::ApplyMetadata(const DecodedImageMetaData& metadata, + const gfx::Size& physical_size) { + DCHECK(IsDecodedSizeAvailable()); + orientation_ = metadata.orientation; + density_corrected_size_ = + ExtractDensityCorrectedSize(metadata, physical_size); +} + ImagePlanes::ImagePlanes() { color_type_ = kUnknown_SkColorType; for (int i = 0; i < cc::kNumYUVPlanes; ++i) {
diff --git a/third_party/blink/renderer/platform/image-decoders/image_decoder.h b/third_party/blink/renderer/platform/image-decoders/image_decoder.h index 5ba7f1a..090d17f1 100644 --- a/third_party/blink/renderer/platform/image-decoders/image_decoder.h +++ b/third_party/blink/renderer/platform/image-decoders/image_decoder.h
@@ -50,6 +50,8 @@ namespace blink { +struct DecodedImageMetaData; + #if SK_B32_SHIFT inline skcms_PixelFormat XformColorFormat() { return skcms_PixelFormat_RGBA_8888; @@ -363,6 +365,10 @@ ImageOrientation Orientation() const { return orientation_; } gfx::Size DensityCorrectedSize() const { return density_corrected_size_; } + // Updates orientation, pixel density etc based on |metadata|. + void ApplyMetadata(const DecodedImageMetaData& metadata, + const gfx::Size& physical_size); + bool IgnoresColorSpace() const { return color_behavior_.IsIgnore(); } const ColorBehavior& GetColorBehavior() const { return color_behavior_; }
diff --git a/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.cc b/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.cc index 30d8c75..d2e94297 100644 --- a/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.cc +++ b/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.cc
@@ -48,7 +48,6 @@ #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/skia/include/core/SkColorSpace.h" -#include "ui/gfx/geometry/size_conversions.h" extern "C" { #include <stdio.h> // jpeglib.h needs stdio FILE. @@ -214,30 +213,6 @@ void error_exit(j_common_ptr cinfo); void emit_message(j_common_ptr cinfo, int msg_level); -static gfx::Size ExtractDensityCorrectedSize( - const DecodedImageMetaData& metadata, - const gfx::Size& physical_size) { - const unsigned kDefaultResolution = 72; - const unsigned kresolution_unitDPI = 2; - - if (metadata.resolution_unit != kresolution_unitDPI || metadata.resolution.IsEmpty() || metadata.size.IsEmpty()) - return physical_size; - - CHECK(metadata.resolution.width()); - CHECK(metadata.resolution.height()); - - // Division by zero is not possible since we check for empty resolution earlier. - gfx::SizeF size_from_resolution( - physical_size.width() * kDefaultResolution / metadata.resolution.width(), - physical_size.height() * kDefaultResolution / - metadata.resolution.height()); - - if (gfx::ToRoundedSize(size_from_resolution) == metadata.size) - return metadata.size; - - return physical_size; -} - static bool IsExifData(jpeg_saved_marker_ptr marker) { // For EXIF data, the APP1 block is followed by 'E', 'x', 'i', 'f', '\0', // then a fill byte, and then a TIFF file that contains the metadata. @@ -526,9 +501,8 @@ DecodedImageMetaData metadata; ReadImageMetaData(Info(), metadata); - decoder_->SetOrientation(metadata.orientation); - decoder_->SetDensityCorrectedSize(ExtractDensityCorrectedSize( - metadata, gfx::Size(info_.output_width, info_.output_height))); + decoder_->ApplyMetadata( + metadata, gfx::Size(info_.output_width, info_.output_height)); // Allow color management of the decoded RGBA pixels if possible. if (!decoder_->IgnoresColorSpace()) {
diff --git a/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc b/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc index a19098d5..3bee1c7 100644 --- a/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc +++ b/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc
@@ -734,7 +734,6 @@ if (!ConvertKbpsToBps(bitrate, &bitrate_bps)) { LogAndNotifyError(FROM_HERE, "Overflow converting bitrate from kbps to bps", media::VideoEncodeAccelerator::kInvalidArgumentError); - async_init_event_.SetAndReset(WEBRTC_VIDEO_CODEC_ERR_PARAMETER); return; } @@ -1403,7 +1402,6 @@ if (!frame) { LogAndNotifyError(FROM_HERE, "failed to create frame", media::VideoEncodeAccelerator::kPlatformFailureError); - async_encode_event_.SetAndReset(WEBRTC_VIDEO_CODEC_ERROR); return; } @@ -1429,7 +1427,6 @@ libyuv::kFilterBox)) { LogAndNotifyError(FROM_HERE, "Failed to copy buffer", media::VideoEncodeAccelerator::kPlatformFailureError); - async_encode_event_.SetAndReset(WEBRTC_VIDEO_CODEC_ERROR); return; } @@ -1496,7 +1493,6 @@ frame->set_timestamp(base::Microseconds(next_frame->timestamp_us())); if (frame->storage_type() != media::VideoFrame::STORAGE_GPU_MEMORY_BUFFER) { - async_encode_event_.SetAndReset(WEBRTC_VIDEO_CODEC_ERROR); LogAndNotifyError(FROM_HERE, "frame isn't GpuMemoryBuffer based VideoFrame", media::VideoEncodeAccelerator::kPlatformFailureError); return;
diff --git a/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder_test.cc b/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder_test.cc index 43cb20b..78203b31 100644 --- a/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder_test.cc +++ b/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder_test.cc
@@ -15,6 +15,7 @@ #include "build/chromeos_buildflags.h" #include "media/base/media_log.h" #include "media/base/media_switches.h" +#include "media/capture/capture_switches.h" #include "media/video/mock_gpu_video_accelerator_factories.h" #include "media/video/mock_video_encode_accelerator.h" #include "testing/gtest/include/gtest/gtest.h" @@ -517,6 +518,37 @@ &frame_types)); } +TEST_F(RTCVideoEncoderTest, SoftwareFallbackOnBadEncodeInput) { + // Make RTCVideoEncoder expect native input. + base::CommandLine::ForCurrentProcess()->AppendSwitch( + switches::kVideoCaptureUseGpuMemoryBuffer); + + const webrtc::VideoCodecType codec_type = webrtc::kVideoCodecVP8; + CreateEncoder(codec_type); + webrtc::VideoCodec codec = GetDefaultCodec(); + codec.codecType = codec_type; + ASSERT_EQ(WEBRTC_VIDEO_CODEC_OK, + rtc_encoder_->InitEncode(&codec, kVideoEncoderSettings)); + + auto frame = media::VideoFrame::CreateBlackFrame( + gfx::Size(kInputFrameWidth, kInputFrameHeight)); + frame->set_timestamp(base::Milliseconds(1)); + rtc::scoped_refptr<webrtc::VideoFrameBuffer> frame_adapter( + new rtc::RefCountedObject<WebRtcVideoFrameAdapter>( + frame, std::vector<scoped_refptr<media::VideoFrame>>(), + new WebRtcVideoFrameAdapter::SharedResources(nullptr))); + std::vector<webrtc::VideoFrameType> frame_types; + // Expect SW fallback because the frame isn't a GpuMemoryBuffer-based frame. + EXPECT_EQ(WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE, + rtc_encoder_->Encode(webrtc::VideoFrame::Builder() + .set_video_frame_buffer(frame_adapter) + .set_timestamp_rtp(1000) + .set_timestamp_us(2000) + .set_rotation(webrtc::kVideoRotation_0) + .build(), + &frame_types)); +} + TEST_F(RTCVideoEncoderTest, EncodeScaledFrame) { const webrtc::VideoCodecType codec_type = webrtc::kVideoCodecVP8; CreateEncoder(codec_type);
diff --git a/third_party/blink/renderer/platform/testing/unit_test_helpers.cc b/third_party/blink/renderer/platform/testing/unit_test_helpers.cc index c8bd695..b7d6f996 100644 --- a/third_party/blink/renderer/platform/testing/unit_test_helpers.cc +++ b/third_party/blink/renderer/platform/testing/unit_test_helpers.cc
@@ -61,12 +61,18 @@ } // namespace void RunPendingTasks() { + // If we are already in a RunLoop fail. A posted task to exit the another + // nested run loop will never execute and lead to a timeout. + DCHECK(!base::RunLoop::IsRunningOnCurrentThread()); Thread::Current()->GetDeprecatedTaskRunner()->PostTask( FROM_HERE, WTF::BindOnce(&ExitRunLoop)); EnterRunLoop(); } void RunDelayedTasks(base::TimeDelta delay) { + // If we are already in a RunLoop fail. A posted task to exit the another + // nested run loop will never execute and lead to a timeout. + DCHECK(!base::RunLoop::IsRunningOnCurrentThread()); Thread::Current()->GetDeprecatedTaskRunner()->PostDelayedTask( FROM_HERE, WTF::BindOnce(&ExitRunLoop), delay); EnterRunLoop();
diff --git a/third_party/blink/tools/blinkpy/common/checkout/baseline_optimizer_unittest.py b/third_party/blink/tools/blinkpy/common/checkout/baseline_optimizer_unittest.py index 63a1e974..22180d1e 100644 --- a/third_party/blink/tools/blinkpy/common/checkout/baseline_optimizer_unittest.py +++ b/third_party/blink/tools/blinkpy/common/checkout/baseline_optimizer_unittest.py
@@ -177,23 +177,25 @@ suffix='png') def test_linux_redundant_with_win(self): - self._assert_optimization({ - 'platform/win': '1', - 'platform/linux': '1', - }, { - 'platform/win': '1', - }) - - def test_covers_mac_win_linux(self): self._assert_optimization( { - 'platform/mac': '1', 'platform/win': '1', 'platform/linux': '1', }, { - '': '1', + 'platform/win': '1', + 'platform/linux': None, }) + def test_covers_mac_win(self): + self._assert_optimization({ + 'platform/mac': '1', + 'platform/win': '1', + }, { + '': '1', + 'platform/mac': None, + 'platform/win': None, + }) + def test_overwrites_root(self): self._assert_optimization( { @@ -203,6 +205,9 @@ '': '2', }, { '': '1', + 'platform/mac': None, + 'platform/win': None, + 'platform/linux': None, }) def test_no_new_common_directory(self): @@ -218,25 +223,29 @@ }) def test_local_optimization(self): - self._assert_optimization({ - 'platform/mac': '1', - 'platform/linux': '1', - 'platform/mac-mac10.14': '1', - }, { - 'platform/mac': '1', - 'platform/linux': '1', - }) + self._assert_optimization( + { + 'platform/mac': '1', + 'platform/linux': '1', + 'platform/mac-mac10.14': '1', + }, { + 'platform/mac': '1', + 'platform/linux': '1', + 'platform/mac-mac10.14': None, + }) def test_local_optimization_skipping_a_port_in_the_middle(self): # mac-mac10.13 -> mac-mac10.14 -> mac - self._assert_optimization({ - 'platform/mac': '1', - 'platform/linux': '1', - 'platform/mac-mac10.13': '1', - }, { - 'platform/mac': '1', - 'platform/linux': '1', - }) + self._assert_optimization( + { + 'platform/mac': '1', + 'platform/linux': '1', + 'platform/mac-mac10.13': '1', + }, { + 'platform/mac': '1', + 'platform/linux': '1', + 'platform/mac-mac10.13': None, + }) def test_baseline_redundant_with_root(self): self._assert_optimization( @@ -246,6 +255,7 @@ '': '2', }, { 'platform/mac': '1', + 'platform/win': None, '': '2', }) @@ -270,13 +280,15 @@ }) def test_virtual_baseline_redundant_with_non_virtual(self): - self._assert_optimization({ - 'platform/win/virtual/gpu/fast/canvas': '2', - 'platform/win/fast/canvas': '2', - }, { - 'platform/win/fast/canvas': '2', - }, - baseline_dirname='virtual/gpu/fast/canvas') + self._assert_optimization( + { + 'platform/win/virtual/gpu/fast/canvas': '2', + 'platform/win/fast/canvas': '2', + }, { + 'platform/win/fast/canvas': '2', + 'platform/win/virtual/gpu/fast/canvas': None, + }, + baseline_dirname='virtual/gpu/fast/canvas') def test_virtual_baseline_redundant_with_non_virtual_fallback(self): # virtual linux -> virtual win -> virtual root -> linux -> win @@ -298,6 +310,25 @@ 'fast/canvas': '2', }, { 'fast/canvas': '2', + 'platform/win/virtual/gpu/fast/canvas': None, + }, + baseline_dirname='virtual/gpu/fast/canvas') + + def test_virtual_baseline_not_redundant_with_actual_root(self): + # baseline optimization supprisingly added one baseline in this case. + # This is because we are patching the virtual subtree first. + # TODO(crbug/1375568): consider do away with the patching virtual subtree operation. + self._assert_optimization( + { + 'platform/mac-mac11/virtual/gpu/fast/canvas': '1', + 'platform/mac-mac11/fast/canvas': '1', + 'fast/canvas': '2', + }, { + 'platform/mac-mac11/virtual/gpu/fast/canvas': '1', + 'platform/mac-mac/virtual/gpu/fast/canvas': None, + 'platform/mac-mac11/fast/canvas': '1', + 'virtual/gpu/fast/canvas': '2', + 'fast/canvas': '2', }, baseline_dirname='virtual/gpu/fast/canvas') @@ -308,6 +339,7 @@ 'fast/canvas': '2', }, { 'fast/canvas': '2', + 'virtual/gpu/fast/canvas': None, }, baseline_dirname='virtual/gpu/fast/canvas') @@ -319,6 +351,9 @@ 'platform/win/fast/canvas': '2', }, { 'fast/canvas': '2', + 'virtual/gpu/fast/canvas': None, + 'platform/mac/fast/canvas': None, + 'platform/win/fast/canvas': None, }, baseline_dirname='virtual/gpu/fast/canvas') @@ -333,14 +368,15 @@ }, baseline_dirname='virtual/gpu/fast/canvas') - def test_virtual_covers_mac_win_linux(self): + def test_virtual_covers_mac_win(self): self._assert_optimization( { 'platform/mac/virtual/gpu/fast/canvas': '1', 'platform/win/virtual/gpu/fast/canvas': '1', - 'platform/linux/virtual/gpu/fast/canvas': '1', }, { 'virtual/gpu/fast/canvas': '1', + 'platform/mac/virtual/gpu/fast/canvas': None, + 'platform/win/virtual/gpu/fast/canvas': None, }, baseline_dirname='virtual/gpu/fast/canvas')
diff --git a/third_party/blink/web_tests/FlagSpecificConfig b/third_party/blink/web_tests/FlagSpecificConfig index 623cc3f..d026e292 100644 --- a/third_party/blink/web_tests/FlagSpecificConfig +++ b/third_party/blink/web_tests/FlagSpecificConfig
@@ -43,7 +43,8 @@ "--enable-features=Vulkan", "--use-vulkan=swiftshader", "--disable-vulkan-fallback-to-gl-for-testing" - ] + ], + "smoke_file": "SmokeTests/skia-vulkan-swiftshader" }, { "name": "webgpu",
diff --git a/testing/buildbot/filters/gpu.skiarenderer_vulkan_blink_web_tests.filter b/third_party/blink/web_tests/SmokeTests/skia-vulkan-swiftshader similarity index 93% rename from testing/buildbot/filters/gpu.skiarenderer_vulkan_blink_web_tests.filter rename to third_party/blink/web_tests/SmokeTests/skia-vulkan-swiftshader index 54f6aa9..8961998 100644 --- a/testing/buildbot/filters/gpu.skiarenderer_vulkan_blink_web_tests.filter +++ b/third_party/blink/web_tests/SmokeTests/skia-vulkan-swiftshader
@@ -45,7 +45,6 @@ compositing/overflow/scrollbar-layer-placement-negative-z-index-child-positioned.html compositing/overflow/scrollbar-layer-placement.html compositing/shadows/shadow-drawing.html -compositing/video-frame-size-change.html css2.1/t090501-c414-flt-02-d-g.html css2.1/t090501-c414-flt-03-b-g.html css2.1/t100304-c43-rpl-bbx-00-d-g.html @@ -203,8 +202,6 @@ compositing/webgl/webgl-reflection.html css3/blending/mix-blend-mode-with-masking.html css3/filters/composited-reflected.html -css3/filters/effect-reference-add-hw.html -css3/filters/effect-reference-source-alpha-hw.html css3/filters/filter-change-repaint-composited.html css3/filters/filter-change-repaint.html css3/filters/filter-repaint-composited-fallback-crash.html @@ -386,11 +383,7 @@ animations/change-in-animation-frame.html animations/change-keyframes.html animations/change-one-anim.html -animations/composition/border-top-width-composition.html animations/composition/font-size-composition.html -animations/composition/rotate-composition.html -animations/composition/shape-outside-composition.html -animations/composition/word-spacing-composition.html animations/composition/x-composition.html animations/cross-fade-border-image-source.html animations/custom-properties/color-type-interpolation.html @@ -403,10 +396,6 @@ animations/hit-testing/inline-element-animation-end-hit-test.html animations/import.html animations/inline-transform.html -animations/interpolation/display-interpolation.html -animations/interpolation/font-variation-settings-interpolation.html -animations/interpolation/perspective-interpolation.html -animations/interpolation/text-shadow-interpolation.html animations/interpolation/webkit-mask-box-image-slice-interpolation.html animations/interpolation/webkit-mask-box-image-source-interpolation.html animations/interpolation/webkit-text-stroke-color-interpolation.html @@ -420,10 +409,6 @@ animations/prefixed/keyframes-cssom-unprefixed-01.html animations/prefixed/keyframes-unprefixed-01.html animations/prefixed/string-keyframes-identifier-prefixed.html -animations/responsive/animations-responsive-columnCount.html -animations/responsive/animations-responsive-opacity.html -animations/responsive/animations-responsive-shapeMargin.html -animations/responsive/animations-responsive-transform.html animations/responsive/interpolation/box-shadow-responsive.html animations/responsive/responsive-neutral-keyframes.html animations/responsive/svg-responsive-to-timing-updates.html @@ -463,9 +448,7 @@ compositing/background-color/background-color-outside-document.html compositing/background-color/background-color-text-change.html compositing/color-matching/image-color-matching.html -compositing/columns/geometry-map-paginated-assert.html compositing/contents-opaque/layer-opacity.html -compositing/culling/clear-fixed-iframe.html compositing/document-background-color.html compositing/geometry/bounds-ignores-hidden-dynamic.html compositing/geometry/limit-layer-bounds-positioned-transition.html @@ -503,11 +486,9 @@ compositing/overflow/fixed-pos-escape-clip-having-non-stacking-context-clipping-container.html compositing/overflow/mask-with-small-content-rect.html compositing/overflow/overflow-overlay-with-touch.html -compositing/overflow/overflow-scroll-with-pointer-events-toggle.html compositing/overflow/scrolling-content-layer-should-not-be-clipped.html compositing/overflow/textarea-scroll-touch.html compositing/perspective-origin-with-scrollbars.html -compositing/reflections/reflection-ordering.html compositing/reflections/remove-reflection.html compositing/render-surface-alpha-blending.html compositing/scrollbars/composited-custom-scrollbar.html @@ -603,26 +584,17 @@ css3/calc/border.html css3/calc/calc-errors.html css3/calc/calc-numbers.html -css3/calc/catch-divide-by-0.html css3/calc/getComputedStyle-border-radius.html css3/calc/img-size.html css3/calc/letter-spacing.html css3/calc/simple-calcs-prefixed.html css3/calc/transition-crash3.html css3/calc/transition-crash4.html -css3/device-adapt/opera/constrain-001.html -css3/device-adapt/opera/constrain-003.html -css3/device-adapt/opera/constrain-006.html -css3/device-adapt/opera/syntax-003.html -css3/device-adapt/viewport-initial-height-zero.html css3/filters/composited-during-transition-layertree.html css3/filters/effect-contrast-hw.html css3/filters/effect-grayscale-hw.html -css3/filters/effect-reference-after.html css3/filters/effect-reference-colorspace.html css3/filters/effect-reference-delete-crash.html -css3/filters/effect-reference-displacement-negative-scale.html -css3/filters/effect-reference-reset-style-delete-crash.html css3/filters/effect-reference-subregion.html css3/filters/feoffset-region-zoom.html css3/filters/filter-animation-multi-hw.html @@ -631,15 +603,8 @@ css3/filters/huge-region.html css3/filters/multiple-filters-invalidation.html css3/filters/nested-filter.html -css3/flexbox/align-baseline.html -css3/flexbox/auto-height-column-with-border-and-padding.html -css3/flexbox/box-sizing-min-max-sizes.html -css3/flexbox/bug633212.html css3/flexbox/button.html -css3/flexbox/change-column-flex-width.html -css3/flexbox/column-flex-child-with-overflow-scroll.html css3/flexbox/columns-auto-size.html -css3/flexbox/columns-center-with-margins-and-wrap.html css3/flexbox/css-properties.html css3/flexbox/definite-main-size.html css3/flexbox/flex-align-vertical-writing-mode.html @@ -647,11 +612,8 @@ css3/flexbox/flex-longhand-parsing.html css3/flexbox/flexbox-ignore-firstLetter.html css3/flexbox/flexbox-width-with-overflow-auto.html -css3/flexbox/max-width-violation.html -css3/flexbox/relpos-with-percentage-top.html css3/flexbox/writing-modes.html css3/font-weight.html -css3/masking/clip-path-css-transform-mutated.html css3/masking/clip-path-reference-userSpaceOnUse.html css3/masking/parsing-clip-path-iri.html css3/motion-path/offset-anchor-rotation.html @@ -671,7 +633,6 @@ css3/selectors3/html/css3-modsel-73.html css3/selectors3/html/css3-modsel-77b.html css3/selectors3/html/css3-modsel-81b.html -css3/selectors3/html/css3-modsel-83.html css3/supports-crash.html css3/tab-size-span.html css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-getStyle.html @@ -707,7 +668,6 @@ fast/canvas/canvas-fill-zeroSizeGradient.html fast/canvas/canvas-fillPath-gradient-shadow.html fast/canvas/canvas-fillPath-pattern-shadow.html -fast/canvas/canvas-fillStyle-strokeStyle-stringification.html fast/canvas/canvas-filter-fill-liveness.html fast/canvas/canvas-filter-frameless-document.html fast/canvas/canvas-filter-liveness.html @@ -796,8 +756,6 @@ media/controls/accessibility-time-element.html media/controls/audio-element-should-not-propagate-click-events.html media/controls/closed-captions-on-off.html -media/controls/modern/doubletap-to-jump-backwards-at-start.html -media/controls/modern/doubletap-to-jump-forwards-too-short.html media/controls/overflow-menu-visibility.html media/controls/panel-removes-transparent-class-when-controls-are-not-shown.html media/controls/toggle-class-with-state-cast.html @@ -818,7 +776,6 @@ media/media-load-event.html media/media-play-promise.html media/media-source-append-multiple.html -media/mediasession/mojo/callback-alive-after-gc.html media/track/cue-style-invalidation.html media/track/media-element-enqueue-event-crash.html media/track/text-track-cue-is-reachable.html
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index c69e4c0..6eb7336 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -2610,14 +2610,8 @@ crbug.com/706350 external/wpt/html/browsers/browsing-the-web/history-traversal/window-name-after-same-origin-aux-frame-navigation.sub.html [ Skip ] crbug.com/706350 external/wpt/html/browsers/browsing-the-web/history-traversal/window-name-after-same-origin-sub-frame-navigation.sub.html [ Skip ] -crbug.com/1236768 external/wpt/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/cross-document-traversal-cross-document-traversal.html [ Timeout ] -crbug.com/1236768 external/wpt/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/same-document-traversal-same-document-traversal-hashchange.html [ Timeout ] -crbug.com/1236768 external/wpt/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/same-document-traversal-same-document-traversal-pushstate.html [ Timeout ] - -# These two are like the above but some bots seem to give timeouts that count as failures according to the -expected.txt, -# while other bots give actual timeouts. -crbug.com/1236768 external/wpt/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/cross-document-traversal-same-document-nav.html [ Failure Timeout ] -crbug.com/1236768 external/wpt/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/same-document-traversal-same-document-nav.html [ Failure Timeout ] +crbug.com/1236768 external/wpt/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/same-document-traversal-same-document-traversal-hashchange.html [ Timeout ] +crbug.com/1236768 external/wpt/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/same-document-traversal-same-document-traversal-pushstate.html [ Timeout ] crbug.com/876485 fast/performance/performance-measure-null-exception.html [ Failure ] @@ -3338,8 +3332,6 @@ crbug.com/626703 [ Win ] virtual/partitioned-cookies/http/tests/inspector-protocol/network/disabled-cache-navigation.js [ Failure ] # ====== New tests from wpt-importer added here ====== -crbug.com/626703 external/wpt/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/same-document-traversal-same-document-traversal-hashchange.html [ Timeout ] -crbug.com/626703 external/wpt/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/same-document-traversal-same-document-traversal-pushstate.html [ Timeout ] crbug.com/626703 external/wpt/screen-orientation/non-fully-active.html [ Timeout ] crbug.com/626703 [ Mac ] external/wpt/screen-orientation/lock-basic.html [ Failure ] crbug.com/626703 [ Mac ] external/wpt/screen-orientation/lock-sandboxed-iframe.html [ Failure ] @@ -7327,6 +7319,7 @@ crbug.com/1362106 [ Win ] virtual/media-foundation-for-clear-frameserver/media/controls/paint-controls-webkit-appearance-none-custom-bg.html [ Skip ] crbug.com/1362106 [ Win ] virtual/media-foundation-for-clear-frameserver/media/controls/paint-controls-webkit-appearance-none.html [ Skip ] crbug.com/1362106 [ Win ] virtual/media-foundation-for-clear-frameserver/media/track/track-cue-rendering-rtl.html [ Skip ] +crbug.com/1362106 [ Win ] virtual/media-foundation-for-clear-frameserver/media/track/track-cue-rendering-vertical.html [ Skip ] crbug.com/1362106 [ Win ] virtual/media-foundation-for-clear-frameserver/media/video-currentTime-delay.html [ Skip ] crbug.com/1362106 [ Win ] virtual/media-foundation-for-clear-frameserver/media/video-layer-crash.html [ Skip ] crbug.com/1362106 [ Win ] virtual/media-foundation-for-clear-frameserver/media/video-persistence.html [ Skip ]
diff --git a/third_party/blink/web_tests/external/wpt/css/css-align/content-distribution/parse-align-content-001.html.ini b/third_party/blink/web_tests/external/wpt/css/css-align/content-distribution/parse-align-content-001.html.ini new file mode 100644 index 0000000..5561dbc0 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-align/content-distribution/parse-align-content-001.html.ini
@@ -0,0 +1,3 @@ +[parse-align-content-001.html] + [Checking align-content: last baseline] + expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/css/css-align/content-distribution/parse-align-content-003.html.ini b/third_party/blink/web_tests/external/wpt/css/css-align/content-distribution/parse-align-content-003.html.ini new file mode 100644 index 0000000..84cd2b66 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-align/content-distribution/parse-align-content-003.html.ini
@@ -0,0 +1,3 @@ +[parse-align-content-003.html] + [Checking align-content: last baseline] + expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/css/css-align/content-distribution/place-content-shorthand-002.html.ini b/third_party/blink/web_tests/external/wpt/css/css-align/content-distribution/place-content-shorthand-002.html.ini new file mode 100644 index 0000000..62f9bcd --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-align/content-distribution/place-content-shorthand-002.html.ini
@@ -0,0 +1,36 @@ +[place-content-shorthand-002.html] + [Checking place-content: last baseline normal] + expected: FAIL + + [Checking place-content: last baseline left] + expected: FAIL + + [Checking place-content: last baseline right] + expected: FAIL + + [Checking place-content: last baseline start] + expected: FAIL + + [Checking place-content: last baseline end] + expected: FAIL + + [Checking place-content: last baseline center] + expected: FAIL + + [Checking place-content: last baseline flex-start] + expected: FAIL + + [Checking place-content: last baseline flex-end] + expected: FAIL + + [Checking place-content: last baseline stretch] + expected: FAIL + + [Checking place-content: last baseline space-around] + expected: FAIL + + [Checking place-content: last baseline space-between] + expected: FAIL + + [Checking place-content: last baseline space-evenly] + expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/css/css-align/content-distribution/place-content-shorthand-006.html.ini b/third_party/blink/web_tests/external/wpt/css/css-align/content-distribution/place-content-shorthand-006.html.ini new file mode 100644 index 0000000..1fe7b562 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-align/content-distribution/place-content-shorthand-006.html.ini
@@ -0,0 +1,36 @@ +[place-content-shorthand-006.html] + [Checking place-content: last baseline normal] + expected: FAIL + + [Checking place-content: last baseline left] + expected: FAIL + + [Checking place-content: last baseline right] + expected: FAIL + + [Checking place-content: last baseline start] + expected: FAIL + + [Checking place-content: last baseline end] + expected: FAIL + + [Checking place-content: last baseline center] + expected: FAIL + + [Checking place-content: last baseline flex-start] + expected: FAIL + + [Checking place-content: last baseline flex-end] + expected: FAIL + + [Checking place-content: last baseline stretch] + expected: FAIL + + [Checking place-content: last baseline space-around] + expected: FAIL + + [Checking place-content: last baseline space-between] + expected: FAIL + + [Checking place-content: last baseline space-evenly] + expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/css/css-align/inheritance.html.ini b/third_party/blink/web_tests/external/wpt/css/css-align/inheritance.html.ini new file mode 100644 index 0000000..40fa0307 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-align/inheritance.html.ini
@@ -0,0 +1,3 @@ +[inheritance.html] + [Property align-content does not inherit] + expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/css/css-align/parsing/align-content-computed.html.ini b/third_party/blink/web_tests/external/wpt/css/css-align/parsing/align-content-computed.html.ini new file mode 100644 index 0000000..95b3cfd --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-align/parsing/align-content-computed.html.ini
@@ -0,0 +1,3 @@ +[align-content-computed.html] + [Property align-content value 'last baseline'] + expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/css/css-align/parsing/align-content-valid.html.ini b/third_party/blink/web_tests/external/wpt/css/css-align/parsing/align-content-valid.html.ini new file mode 100644 index 0000000..7858805 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-align/parsing/align-content-valid.html.ini
@@ -0,0 +1,3 @@ +[align-content-valid.html] + [e.style['align-content'\] = "last baseline" should set the property value] + expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/css/css-align/parsing/place-content-computed.html.ini b/third_party/blink/web_tests/external/wpt/css/css-align/parsing/place-content-computed.html.ini new file mode 100644 index 0000000..ea69725 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-align/parsing/place-content-computed.html.ini
@@ -0,0 +1,6 @@ +[place-content-computed.html] + [Property place-content value 'last baseline'] + expected: FAIL + + [Property place-content value 'last baseline flex-start'] + expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/css/css-align/parsing/place-content-shorthand.html.ini b/third_party/blink/web_tests/external/wpt/css/css-align/parsing/place-content-shorthand.html.ini new file mode 100644 index 0000000..aa952acf --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-align/parsing/place-content-shorthand.html.ini
@@ -0,0 +1,9 @@ +[place-content-shorthand.html] + [e.style['place-content'\] = "last baseline flex-start" should set align-content] + expected: FAIL + + [e.style['place-content'\] = "last baseline flex-start" should set justify-content] + expected: FAIL + + [e.style['place-content'\] = "last baseline flex-start" should not set unrelated longhands] + expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/css/css-align/parsing/place-content-valid.html.ini b/third_party/blink/web_tests/external/wpt/css/css-align/parsing/place-content-valid.html.ini new file mode 100644 index 0000000..e7c0b6f0 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-align/parsing/place-content-valid.html.ini
@@ -0,0 +1,6 @@ +[place-content-valid.html] + [e.style['place-content'\] = "last baseline" should set the property value] + expected: FAIL + + [e.style['place-content'\] = "last baseline flex-start" should set the property value] + expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/css/css-align/self-alignment/self-align-safe-unsafe-flex-001.html.ini b/third_party/blink/web_tests/external/wpt/css/css-align/self-alignment/self-align-safe-unsafe-flex-001.html.ini new file mode 100644 index 0000000..3caf510d9 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-align/self-alignment/self-align-safe-unsafe-flex-001.html.ini
@@ -0,0 +1,2 @@ +[self-align-safe-unsafe-flex-001.html] + expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/css/css-align/self-alignment/self-align-safe-unsafe-flex-002.html.ini b/third_party/blink/web_tests/external/wpt/css/css-align/self-alignment/self-align-safe-unsafe-flex-002.html.ini new file mode 100644 index 0000000..722b70a --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-align/self-alignment/self-align-safe-unsafe-flex-002.html.ini
@@ -0,0 +1,2 @@ +[self-align-safe-unsafe-flex-002.html] + expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/css/css-align/self-alignment/self-align-safe-unsafe-flex-003.html.ini b/third_party/blink/web_tests/external/wpt/css/css-align/self-alignment/self-align-safe-unsafe-flex-003.html.ini new file mode 100644 index 0000000..5abadcf --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-align/self-alignment/self-align-safe-unsafe-flex-003.html.ini
@@ -0,0 +1,2 @@ +[self-align-safe-unsafe-flex-003.html] + expected: FAIL
diff --git a/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/cross-document-traversal-same-document-nav-expected.txt b/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/cross-document-traversal-same-document-nav-expected.txt deleted file mode 100644 index 4ceed77..0000000 --- a/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/cross-document-traversal-same-document-nav-expected.txt +++ /dev/null
@@ -1,5 +0,0 @@ -This is a testharness.js-based test. -FAIL same-document traversals are not canceled by fragment navigations step_wait_func: Timed out waiting on condition -FAIL same-document traversals are not canceled by pushState() step_wait_func: Timed out waiting on condition -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/cross-document-traversal-same-document-traversal-expected.txt b/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/cross-document-traversal-same-document-traversal-expected.txt deleted file mode 100644 index acbb5ee1..0000000 --- a/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/cross-document-traversal-same-document-traversal-expected.txt +++ /dev/null
@@ -1,5 +0,0 @@ -This is a testharness.js-based test. -FAIL traversals in the same (back) direction: the second is ignored assert_equals: first load event must be going back (hash) expected "#2" but got "" -FAIL traversals in the same (forward) direction: the second is ignored assert_equals: first load event must be going forward (hash) expected "" but got "#3" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/nav-cancelation-1-expected.txt b/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/nav-cancelation-1-expected.txt deleted file mode 100644 index 16fb3502..0000000 --- a/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/nav-cancelation-1-expected.txt +++ /dev/null
@@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL parent cancels a pending navigation in a same-origin child assert_false: <iframe> load event does not fire until subsequent navigation is complete expected false got true -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/nav-cancelation-2.sub-expected.txt b/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/nav-cancelation-2.sub-expected.txt deleted file mode 100644 index d02213b..0000000 --- a/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/nav-cancelation-2.sub-expected.txt +++ /dev/null
@@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL grandparent cancels a pending navigation in a cross-origin grandchild assert_false: Grandchild <iframe> load event doesn't fire before grandparent's load event expected false got true -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/same-document-traversal-same-document-nav-expected.txt b/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/same-document-traversal-same-document-nav-expected.txt deleted file mode 100644 index 4ceed77..0000000 --- a/third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/same-document-traversal-same-document-nav-expected.txt +++ /dev/null
@@ -1,5 +0,0 @@ -This is a testharness.js-based test. -FAIL same-document traversals are not canceled by fragment navigations step_wait_func: Timed out waiting on condition -FAIL same-document traversals are not canceled by pushState() step_wait_func: Timed out waiting on condition -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/resources/chromium/mock-subapps.js b/third_party/blink/web_tests/external/wpt/resources/chromium/mock-subapps.js index d8b3f08..467d932 100644 --- a/third_party/blink/web_tests/external/wpt/resources/chromium/mock-subapps.js +++ b/third_party/blink/web_tests/external/wpt/resources/chromium/mock-subapps.js
@@ -30,7 +30,7 @@ return Promise.resolve({ result: { code: testInternal.serviceResultCode, - subAppIds: [] + subApps: testInternal.listCallReturnValue, } }); } @@ -46,7 +46,8 @@ initialized: false, mockSubAppsService: null, serviceResultCode: 0, - addCallReturnValue: [] + addCallReturnValue: [], + listCallReturnValue: [], } class SubAppsServiceTestChromium { @@ -54,13 +55,14 @@ Object.freeze(this); // Make it immutable. } - initialize(service_result_code, add_call_return_value) { + initialize(service_result_code, add_call_return_value, list_call_return_value) { if (!testInternal.initialized) { testInternal = { mockSubAppsService: new MockSubAppsService(), initialized: true, serviceResultCode: service_result_code, addCallReturnValue: add_call_return_value, + listCallReturnValue: list_call_return_value, }; }; } @@ -72,7 +74,8 @@ mockSubAppsService: null, initialized: false, serviceResultCode: 0, - addCallReturnValue: [] + addCallReturnValue: [], + listCallReturnValue: [], }; await new Promise(resolve => setTimeout(resolve, 0)); }
diff --git a/third_party/blink/web_tests/external/wpt/subapps/list-error.tentative.https.html b/third_party/blink/web_tests/external/wpt/subapps/list-error.tentative.https.html index b5aa4cba..1161318 100644 --- a/third_party/blink/web_tests/external/wpt/subapps/list-error.tentative.https.html +++ b/third_party/blink/web_tests/external/wpt/subapps/list-error.tentative.https.html
@@ -39,7 +39,7 @@ await mockSubAppsService.reset(); mockSubAppsService = null; }); - await createMockSubAppsService(Status.FAILURE, []); + await createMockSubAppsService(Status.FAILURE, [], []); return promise_rejects_dom(t, 'OperationError', navigator.subApps.list()); }, 'List call failed.');
diff --git a/third_party/blink/web_tests/external/wpt/subapps/list-success.tentative.https.html b/third_party/blink/web_tests/external/wpt/subapps/list-success.tentative.https.html index 7622ac9..0ee02230 100644 --- a/third_party/blink/web_tests/external/wpt/subapps/list-success.tentative.https.html +++ b/third_party/blink/web_tests/external/wpt/subapps/list-success.tentative.https.html
@@ -5,9 +5,49 @@ <script src="resources/subapps-helpers.js"></script> <script> -subapps_test(async (t, mockSubAppsService) => { - const result = await navigator.subApps.list(); - assert_array_equals(result, []); -}, 'List API call works.'); +promise_test(async t => { + t.add_cleanup(async () => { + await mockSubAppsService.reset(); + mockSubAppsService = null; + }); -</script> + const url_1 = document.location.origin + '/sub-app-1'; + const url_2 = document.location.origin + '/sub-app-2'; + const mocked_response = [{ unhashedAppId: url_1, appName: "App 1" }, { unhashedAppId: url_2, appName: "App 2" }]; + + let expected_results = {}; + expected_results[url_1] = { "app_name": "App 1" }; + expected_results[url_2] = { "app_name": "App 2" }; + + await createMockSubAppsService(Status.SUCCESS, [], mocked_response); + + await navigator.subApps.list() + .catch(e => { + assert_unreached("Should not have rejected."); + }) + .then(result => { + for (const app_id in expected_results) { + assert_own_property(result, app_id, "Return results are missing entry for subapp.") + assert_equals(JSON.stringify(result[app_id]), JSON.stringify(expected_results[app_id]), "Return results are not as expected.") + } + }) +}, 'List API call works with 2 sub apps.'); + +promise_test(async t => { + t.add_cleanup(async () => { + await mockSubAppsService.reset(); + mockSubAppsService = null; + }); + + let mocked_response = []; + await createMockSubAppsService(Status.SUCCESS, [], mocked_response); + await navigator.subApps.list() + .catch(e => { + assert_unreached("Should not have rejected."); + }) + .then(result => { + assert_equals(Object.keys(result).length, 0); + }) +}, 'List API call works with no sub apps.'); + +</script> \ No newline at end of file
diff --git a/third_party/blink/web_tests/external/wpt/subapps/remove-error.tentative.https.html b/third_party/blink/web_tests/external/wpt/subapps/remove-error.tentative.https.html index 45b44655a..05305c4f 100644 --- a/third_party/blink/web_tests/external/wpt/subapps/remove-error.tentative.https.html +++ b/third_party/blink/web_tests/external/wpt/subapps/remove-error.tentative.https.html
@@ -39,7 +39,7 @@ await mockSubAppsService.reset(); mockSubAppsService = null; }); - await createMockSubAppsService(Status.FAILURE, []); + await createMockSubAppsService(Status.FAILURE, [], []); return promise_rejects_dom(t, 'OperationError', navigator.subApps.remove('sub-app-id')); }, 'Remove call failed.');
diff --git a/third_party/blink/web_tests/external/wpt/subapps/resources/subapps-helpers.js b/third_party/blink/web_tests/external/wpt/subapps/resources/subapps-helpers.js index 4a79d21b..1d50c40 100644 --- a/third_party/blink/web_tests/external/wpt/subapps/resources/subapps-helpers.js +++ b/third_party/blink/web_tests/external/wpt/subapps/resources/subapps-helpers.js
@@ -24,7 +24,7 @@ FAILURE: 7, } -async function createMockSubAppsService(service_result_code, add_call_return_value) { +async function createMockSubAppsService(service_result_code, add_call_return_value, list_call_return_value) { if (typeof SubAppsServiceTest === 'undefined') { // Load test-only API helpers. const script = document.createElement('script'); @@ -48,7 +48,7 @@ if (mockSubAppsService === null) { mockSubAppsService = new SubAppsServiceTest(); - mockSubAppsService.initialize(service_result_code, add_call_return_value); + mockSubAppsService.initialize(service_result_code, add_call_return_value, list_call_return_value); } } @@ -58,7 +58,7 @@ await mockSubAppsService.reset(); mockSubAppsService = null; }); - await createMockSubAppsService(Status.SUCCESS, []); + await createMockSubAppsService(Status.SUCCESS, [], []); await func(test, mockSubAppsService); }, description); } @@ -69,7 +69,7 @@ mockSubAppsService = null; }); - await createMockSubAppsService(Status.FAILURE, mocked_response); + await createMockSubAppsService(Status.FAILURE, mocked_response, []); await navigator.subApps.add(add_call_params) .then(result => { assert_unreached("Should have rejected."); @@ -99,4 +99,4 @@ assert_equals(result[app_id], expected_results[app_id], "Return results are not as expected.") } }) -} \ No newline at end of file +}
diff --git a/tools/android/test_health/java_test_utils.py b/tools/android/test_health/java_test_utils.py index a1cd9f138..7efaba85 100644 --- a/tools/android/test_health/java_test_utils.py +++ b/tools/android/test_health/java_test_utils.py
@@ -45,8 +45,6 @@ """The number of test cases annotated with @DisabledTest.""" disable_if_tests_count: int """The number of test cases annotated with @DisableIf.""" - flaky_tests_count: int - """The number of test cases annotated with the removed @FlakyTest, now always 0.""" def get_java_test_health(test_path: pathlib.Path) -> JavaTestHealth: @@ -106,8 +104,7 @@ return JavaTestHealth( java_package=_get_java_package_name(java_ast), disabled_tests_count=annotation_counter[_DISABLED_TEST_ANNOTATION], - disable_if_tests_count=annotation_counter[_DISABLE_IF_TEST_ANNOTATION], - flaky_tests_count=0) + disable_if_tests_count=annotation_counter[_DISABLE_IF_TEST_ANNOTATION]) def _get_java_package_name(java_ast: CompilationUnit) -> Optional[str]:
diff --git a/tools/android/test_health/java_test_utils_unittest.py b/tools/android/test_health/java_test_utils_unittest.py index 1cdce9e..63872391 100755 --- a/tools/android/test_health/java_test_utils_unittest.py +++ b/tools/android/test_health/java_test_utils_unittest.py
@@ -49,8 +49,6 @@ self.assertEqual(_JAVA_PACKAGE_HEALTHY_TESTS, test_health.java_package) self.assertEqual(0, test_health.disabled_tests_count) self.assertEqual(0, test_health.disable_if_tests_count) - self.assertEqual(0, test_health.flaky_tests_count) - def test_get_java_test_health_stats_healthy_tests_no_java_package(self): test_health = java_test_utils.get_java_test_health( _HEALTHY_NO_PKG_TEST_PATH) @@ -58,7 +56,6 @@ self.assertIsNone(test_health.java_package) self.assertEqual(0, test_health.disabled_tests_count) self.assertEqual(0, test_health.disable_if_tests_count) - self.assertEqual(0, test_health.flaky_tests_count) def test_get_java_test_health_stats_unhealthy_tests(self): test_health = java_test_utils.get_java_test_health( @@ -68,7 +65,6 @@ test_health.java_package) self.assertEqual(1, test_health.disabled_tests_count) self.assertEqual(1, test_health.disable_if_tests_count) - self.assertEqual(0, test_health.flaky_tests_count) def test_get_java_test_health_stats_disabled_tests(self): test_health = java_test_utils.get_java_test_health(_DISABLED_TEST_PATH) @@ -77,7 +73,6 @@ test_health.java_package) self.assertEqual(2, test_health.disabled_tests_count) self.assertEqual(0, test_health.disable_if_tests_count) - self.assertEqual(0, test_health.flaky_tests_count) def test_get_java_test_health_stats_disable_if_tests(self): test_health = java_test_utils.get_java_test_health( @@ -87,7 +82,6 @@ test_health.java_package) self.assertEqual(0, test_health.disabled_tests_count) self.assertEqual(2, test_health.disable_if_tests_count) - self.assertEqual(0, test_health.flaky_tests_count) def test_get_java_test_health_invalid_test_syntax(self): expected_filename = str(
diff --git a/tools/android/test_health/test_health_exporter.py b/tools/android/test_health/test_health_exporter.py index 8b115451..d6e3a6b 100644 --- a/tools/android/test_health/test_health_exporter.py +++ b/tools/android/test_health/test_health_exporter.py
@@ -82,8 +82,7 @@ test_dict.update( dict(disabled_tests_count=java_test_health.disabled_tests_count, - disable_if_tests_count=java_test_health.disable_if_tests_count, - flaky_tests_count=java_test_health.flaky_tests_count)) + disable_if_tests_count=java_test_health.disable_if_tests_count)) return test_dict
diff --git a/tools/android/test_health/test_health_exporter_unittest.py b/tools/android/test_health/test_health_exporter_unittest.py index dd91bd6..1ad416d9 100755 --- a/tools/android/test_health/test_health_exporter_unittest.py +++ b/tools/android/test_health/test_health_exporter_unittest.py
@@ -28,8 +28,7 @@ _JAVA_TEST_HEALTH = JavaTestHealth(java_package=_JAVA_PACKAGE, disabled_tests_count=1, - disable_if_tests_count=2, - flaky_tests_count=3) + disable_if_tests_count=2) _TEST_HEALTH_INFO = TestHealthInfo(_JAVA_TEST_NAME, test_dir=pathlib.Path(_JAVA_TEST_DIR), test_filename=_JAVA_TEST_FILENAME, @@ -43,7 +42,6 @@ java_package=_JAVA_PACKAGE, disabled_tests_count=1, disable_if_tests_count=2, - flaky_tests_count=3, git_head_hash=_GIT_HEAD_HASH, git_head_timestamp=_GIT_HEAD_TIME) @@ -90,8 +88,7 @@ def test_to_json_file_java_package_omitted(self): java_test_health = JavaTestHealth(java_package=None, disabled_tests_count=1, - disable_if_tests_count=2, - flaky_tests_count=3) + disable_if_tests_count=2) test_health_info = TestHealthInfo( _JAVA_TEST_NAME, test_dir=pathlib.Path(_JAVA_TEST_DIR),
diff --git a/tools/android/test_health/test_health_extractor_unittest.py b/tools/android/test_health/test_health_extractor_unittest.py index 5318ddb..a257571 100755 --- a/tools/android/test_health/test_health_extractor_unittest.py +++ b/tools/android/test_health/test_health_extractor_unittest.py
@@ -50,8 +50,7 @@ java_test_health=java_test_utils.JavaTestHealth( java_package=_JAVA_PACKAGE_HEALTHY_TESTS, disabled_tests_count=0, - disable_if_tests_count=0, - flaky_tests_count=0), + disable_if_tests_count=0), git_repo_info=_CHROMIUM_REPO_INFO) test_health_infos = test_health_extractor.get_repo_test_health( @@ -73,8 +72,7 @@ java_test_health=java_test_utils.JavaTestHealth( java_package=_JAVA_PACKAGE_UNHEALTHY_TESTS, disabled_tests_count=1, - disable_if_tests_count=1, - flaky_tests_count=0), + disable_if_tests_count=1), git_repo_info=_CHROMIUM_REPO_INFO) test_health_infos = test_health_extractor.get_repo_test_health(
diff --git a/tools/boilerplate.py b/tools/boilerplate.py index 044cf128..5808c75 100755 --- a/tools/boilerplate.py +++ b/tools/boilerplate.py
@@ -158,6 +158,14 @@ print('A file at path %s already exists' % f, file=sys.stderr) return 2 + # TODO(crbug.com/1375793): Remove this check. + if _IsIOSFile(f) and f.endswith('.js'): + print( + 'Invalid file type for %s. (Please use \'.ts\' for new iOS scripts.)' + % f, + file=sys.stderr) + return 2 + for f in files: _CreateFile(f)
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 5ca67b9..be14c0c 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -96166,6 +96166,12 @@ <int value="1" label="Switch to tab from filtered search tab list"/> </enum> +<enum name="TabSelectionEditorShareActionState"> + <int value="0" label="UNKNOWN_SHARE_STATE"/> + <int value="1" label="SUCCESSFULLY_SHARED_TABS"/> + <int value="2" label="FAILED_SHARE_ALL_TABS_FILTERED"/> +</enum> + <enum name="TabStatus"> <int value="0" label="Memory resident"/> <int value="1" label="Evicted and reloaded"/> @@ -98679,6 +98685,15 @@ <int value="1" label="Second attempt"/> </enum> +<enum name="TrustedVaultFileReadStatus"> + <int value="0" label="Success"/> + <int value="1" label="File not found"/> + <int value="2" label="File read failed"/> + <int value="3" label="MD5 digest mismatch"/> + <int value="4" label="File proto deserialization failed"/> + <int value="5" label="Data proto deserialization failed"/> +</enum> + <enum name="TrustedVaultUserActionTrigger"> <int value="0" label="Settings page"/> <int value="1" label="Profile menu"/>
diff --git a/tools/metrics/histograms/metadata/accessibility/histograms.xml b/tools/metrics/histograms/metadata/accessibility/histograms.xml index a9cce571..208356c 100644 --- a/tools/metrics/histograms/metadata/accessibility/histograms.xml +++ b/tools/metrics/histograms/metadata/accessibility/histograms.xml
@@ -1419,6 +1419,20 @@ </summary> </histogram> +<histogram name="Accessibility.Performance.AXTree.Destroy" units="ms" + expires_after="2023-03-26"> + <owner>agarwaltushar@google.com</owner> + <owner>olivierli@chromium.org</owner> + <summary> + Tracks time spent in AXTree::Destroy. + + The primary use is to measure the impact of https://crrev.com/c/3937946, + which updates AXTree to internally use a std::map instead of a + base::flat_map. Please see the CL description for more context and a + performance profile. + </summary> +</histogram> + <histogram name="Accessibility.Performance.BrowserAccessibilityManager::OnAccessibilityEvents" units="ms" expires_after="2023-03-26">
diff --git a/tools/metrics/histograms/metadata/android/histograms.xml b/tools/metrics/histograms/metadata/android/histograms.xml index e0dc1d7..a3d4d8be 100644 --- a/tools/metrics/histograms/metadata/android/histograms.xml +++ b/tools/metrics/histograms/metadata/android/histograms.xml
@@ -3651,6 +3651,16 @@ </summary> </histogram> +<histogram name="Android.TabMultiSelectV2.SharingState" + enum="TabSelectionEditorShareActionState" expires_after="2023-10-14"> + <owner>ckitagawa@chromium.org</owner> + <owner>bjfong@google.com</owner> + <summary> + The result of the share action taken from the TabSelectionEditor. Record + once per user attempt to share tabs in the Tab Selection Editor. + </summary> +</histogram> + <histogram name="Android.TabNavigationInterceptResult.For{ProtocolType}" enum="NavigationInterceptResult" expires_after="2023-03-24"> <owner>blundell@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/arc/histograms.xml b/tools/metrics/histograms/metadata/arc/histograms.xml index eb68c155..d470479 100644 --- a/tools/metrics/histograms/metadata/arc/histograms.xml +++ b/tools/metrics/histograms/metadata/arc/histograms.xml
@@ -2142,8 +2142,7 @@ </histogram> <histogram name="Arc.VolumeMounter.MountFailureCount" units="failures" - expires_after="2022-10-19"> - <owner>risan@google.com</owner> + expires_after="2023-04-19"> <owner>youkichihosoi@google.com</owner> <owner>arc-storage@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/history/histograms.xml b/tools/metrics/histograms/metadata/history/histograms.xml index 99b67c51..b001731 100644 --- a/tools/metrics/histograms/metadata/history/histograms.xml +++ b/tools/metrics/histograms/metadata/history/histograms.xml
@@ -1730,7 +1730,7 @@ </histogram> <histogram name="History.MigrateFailureFromVersion" units="units" - expires_after="M77"> + expires_after="2023-10-01"> <owner>sky@chromium.org</owner> <owner>sdefresne@chromium.org</owner> <component>UI>Browser>History</component> @@ -1738,6 +1738,8 @@ History database version from which history migration failed. If there are higher than normal migration failures, this histogram will indicate which migration step failed. + + Warning: this histogram was expired from M77 to M108; data may be missing. </summary> </histogram>
diff --git a/tools/metrics/histograms/metadata/others/histograms.xml b/tools/metrics/histograms/metadata/others/histograms.xml index 995fe1f0..05d94b46 100644 --- a/tools/metrics/histograms/metadata/others/histograms.xml +++ b/tools/metrics/histograms/metadata/others/histograms.xml
@@ -3668,6 +3668,12 @@ <histogram name="Conversions.DebugReport.HttpResponseOrNetErrorCode" enum="CombinedHttpResponseAndNetErrorCode" expires_after="M117"> + <obsolete> + Split between with + Conversions.DebugReport.HttpResponseOrNetErrorCodeEventLevel and + Conversions.DebugReport.HttpResponseOrNetErrorCodeAggregatable to help debug + report loss issues, Oct 2022. + </obsolete> <owner>apaseltiner@chromium.org</owner> <owner>johnidel@chromium.org</owner> <owner>measurement-api-dev+metrics@google.com</owner> @@ -3679,8 +3685,40 @@ </summary> </histogram> +<histogram + name="Conversions.DebugReport.HttpResponseOrNetErrorCodeAggregatable" + enum="CombinedHttpResponseAndNetErrorCode" expires_after="M117"> + <owner>anthonygarant@chromium.org</owner> + <owner>johnidel@chromium.org</owner> + <owner>measurement-api-dev+metrics@google.com</owner> + <summary> + Error info for sending a debug attribution report, recorded for each sent + aggregatable report. The HTTP response code is recorded if there is no net + error code for the request, or the net error code indicates there was a + response code failure. + </summary> +</histogram> + +<histogram name="Conversions.DebugReport.HttpResponseOrNetErrorCodeEventLevel" + enum="CombinedHttpResponseAndNetErrorCode" expires_after="M117"> + <owner>anthonygarant@chromium.org</owner> + <owner>johnidel@chromium.org</owner> + <owner>measurement-api-dev+metrics@google.com</owner> + <summary> + Error info for sending a debug attribution report, recorded for each sent + event-level report. The HTTP response code is recorded if there is no net + error code for the request, or the net error code indicates there was a + response code failure. + </summary> +</histogram> + <histogram name="Conversions.DebugReport.ReportRetrySucceed" enum="BooleanSuccess" expires_after="M117"> + <obsolete> + Split between with Conversions.DebugReport.ReportRetrySucceedEventLevel and + Conversions.DebugReport.ReportRetrySucceedAggregatable to help debug report + loss issues, Oct 2022. + </obsolete> <owner>apaseltiner@chromium.org</owner> <owner>johnidel@chromium.org</owner> <owner>measurement-api-dev+metrics@google.com</owner> @@ -3690,8 +3728,37 @@ </summary> </histogram> +<histogram name="Conversions.DebugReport.ReportRetrySucceedAggregatable" + enum="BooleanSuccess" expires_after="M117"> + <owner>anthonygarant@chromium.org</owner> + <owner>johnidel@chromium.org</owner> + <owner>measurement-api-dev+metrics@google.com</owner> + <summary> + Records whether a particular aggregatable debug attribution report was + successful. Emitted for all aggregatable debug attribution reports that + retry. + </summary> +</histogram> + +<histogram name="Conversions.DebugReport.ReportRetrySucceedEventLevel" + enum="BooleanSuccess" expires_after="M117"> + <owner>anthonygarant@chromium.org</owner> + <owner>johnidel@chromium.org</owner> + <owner>measurement-api-dev+metrics@google.com</owner> + <summary> + Records whether a particular event-level debug attribution report was + successful. Emitted for all event-level debug attribution reports that + retry. + </summary> +</histogram> + <histogram name="Conversions.DebugReport.ReportStatus" enum="ConversionReportStatus" expires_after="M117"> + <obsolete> + Split between with Conversions.DebugReport.ReportStatusEventLevel and + Conversions.DebugReport.ReportStatusAggregatable to help debug report loss + issues, Oct 2022. + </obsolete> <owner>apaseltiner@chromium.org</owner> <owner>johnidel@chromium.org</owner> <owner>measurement-api-dev+metrics@google.com</owner> @@ -3701,6 +3768,28 @@ </summary> </histogram> +<histogram name="Conversions.DebugReport.ReportStatusAggregatable" + enum="ConversionReportStatus" expires_after="M117"> + <owner>anthonygarant@chromium.org</owner> + <owner>johnidel@chromium.org</owner> + <owner>measurement-api-dev+metrics@google.com</owner> + <summary> + Records the high-level request status of an aggregatable debug attribution + report. Recorded for every debug aggregatable attribution report sent. + </summary> +</histogram> + +<histogram name="Conversions.DebugReport.ReportStatusEventLevel" + enum="ConversionReportStatus" expires_after="M117"> + <owner>anthonygarant@chromium.org</owner> + <owner>johnidel@chromium.org</owner> + <owner>measurement-api-dev+metrics@google.com</owner> + <summary> + Records the high-level request status of an event-level debug attribution + report. Recorded for every debug event-level attribution report sent. + </summary> +</histogram> + <histogram name="Conversions.DeleteSentReportOperation" enum="ConversionPostSendReportDeleteEvent" expires_after="M105"> <obsolete> @@ -3771,6 +3860,32 @@ </summary> </histogram> +<histogram name="Conversions.HttpResponseOrNetErrorCodeAggregatable" + enum="CombinedHttpResponseAndNetErrorCode" expires_after="M117"> + <owner>anthonygarant@chromium.org</owner> + <owner>johnidel@chromium.org</owner> + <owner>measurement-api-dev+metrics@google.com</owner> + <summary> + Error info for sending an attribution report, recorded for each sent + aggregatable report. The HTTP response code is recorded if there is no net + error code for the request, or the net error code indicates there was a + response code failure. + </summary> +</histogram> + +<histogram name="Conversions.HttpResponseOrNetErrorCodeEventLevel" + enum="CombinedHttpResponseAndNetErrorCode" expires_after="M117"> + <owner>anthonygarant@chromium.org</owner> + <owner>johnidel@chromium.org</owner> + <owner>measurement-api-dev+metrics@google.com</owner> + <summary> + Error info for sending an attribution report, recorded for each sent + event-level report. The HTTP response code is recorded if there is no net + error code for the request, or the net error code indicates there was a + response code failure. + </summary> +</histogram> + <histogram name="Conversions.ImpressionIgnoredByFeaturePolicy" enum="BooleanIgnored" expires_after="M105"> <obsolete> @@ -3914,6 +4029,11 @@ <histogram name="Conversions.Report.HttpResponseOrNetErrorCode" enum="CombinedHttpResponseAndNetErrorCode" expires_after="M117"> + <obsolete> + Split between with Conversions.HttpResponseOrNetErrorCodeEventLevel and + Conversions.HttpResponseOrNetErrorCodeAggregatable to help debug report loss + issues, Oct 2022. + </obsolete> <owner>johnidel@chromium.org</owner> <owner>measurement-api-dev+metrics@google.com</owner> <summary> @@ -3940,6 +4060,11 @@ <histogram name="Conversions.ReportRetrySucceed2" enum="BooleanSuccess" expires_after="M117"> + <obsolete> + Split between with Conversions.ReportRetrySucceedEventLevel and + Conversions.ReportRetrySucceedAggregatable to help debug report loss issues, + Oct 2022. + </obsolete> <owner>johnidel@chromium.org</owner> <owner>csharrison@chromium.org</owner> <owner>linnan@chromium.org</owner> @@ -3949,6 +4074,28 @@ </summary> </histogram> +<histogram name="Conversions.ReportRetrySucceedAggregatable" + enum="BooleanSuccess" expires_after="M117"> + <owner>anthonygarant@chromium.org</owner> + <owner>johnidel@chromium.org</owner> + <owner>measurement-api-dev+metrics@google.com</owner> + <summary> + Records whether a particular aggregatable attribution report was successful. + Emitted for all conversion aggregatable reports which retry. + </summary> +</histogram> + +<histogram name="Conversions.ReportRetrySucceedEventLevel" + enum="BooleanSuccess" expires_after="M117"> + <owner>anthonygarant@chromium.org</owner> + <owner>johnidel@chromium.org</owner> + <owner>measurement-api-dev+metrics@google.com</owner> + <summary> + Records whether a particular event-level attribution report was successful. + Emitted for all attribution event-level reports which retry. + </summary> +</histogram> + <histogram name="Conversions.ReportsDeletedInDataClearOperation" units="conversions" expires_after="2023-02-12"> <obsolete> @@ -4047,6 +4194,11 @@ <histogram name="Conversions.ReportStatus2" enum="ConversionReportStatus" expires_after="M117"> + <obsolete> + Split between with Conversions.ReportStatusEventLevel and + Conversions.ReportStatusAggregatable to help debug report loss issues, Oct + 2022. + </obsolete> <owner>johnidel@chromium.org</owner> <owner>csharrison@chromium.org</owner> <summary> @@ -4056,6 +4208,30 @@ </summary> </histogram> +<histogram name="Conversions.ReportStatusAggregatable" + enum="ConversionReportStatus" expires_after="M117"> + <owner>anthonygarant@chromium.org</owner> + <owner>johnidel@chromium.org</owner> + <owner>measurement-api-dev+metrics@google.com</owner> + <summary> + Records the high level request status of an attribution report. Recorded for + every aggregatable attribution report sent. For attribution report that has + been retried, every retry will be counted. + </summary> +</histogram> + +<histogram name="Conversions.ReportStatusEventLevel" + enum="ConversionReportStatus" expires_after="M117"> + <owner>anthonygarant@chromium.org</owner> + <owner>johnidel@chromium.org</owner> + <owner>measurement-api-dev+metrics@google.com</owner> + <summary> + Records the high level request status of an attribution report. Recorded for + every event-level attribution report sent. For attribution report that has + been retried, every retry will be counted. + </summary> +</histogram> + <histogram name="Conversions.SchedulerReportDelay" units="ms" expires_after="M117"> <owner>linnan@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/privacy/histograms.xml b/tools/metrics/histograms/metadata/privacy/histograms.xml index 04c36ea4..cd501d3a 100644 --- a/tools/metrics/histograms/metadata/privacy/histograms.xml +++ b/tools/metrics/histograms/metadata/privacy/histograms.xml
@@ -287,7 +287,7 @@ <histogram name="PrivacySandbox.AggregationService.KeyFetcher.HttpResponseOrNetErrorCode" - enum="NetErrorCodes" expires_after="2023-02-23"> + enum="NetErrorCodes" expires_after="M117"> <owner>alexmt@chromium.org</owner> <owner>linnan@chromium.org</owner> <summary> @@ -312,7 +312,7 @@ <histogram name="PrivacySandbox.AggregationService.KeyFetcher.Status2" enum="PrivacySandboxAggregationServiceKeyFetcherStatus" - expires_after="2023-03-05"> + expires_after="M117"> <owner>alexmt@chromium.org</owner> <owner>linnan@chromium.org</owner> <summary> @@ -322,7 +322,7 @@ <histogram name="PrivacySandbox.AggregationService.ReportAssembler.Status" enum="PrivacySandboxAggregationServiceReportAssemblerStatus" - expires_after="2023-03-05"> + expires_after="M117"> <owner>alexmt@chromium.org</owner> <owner>linnan@chromium.org</owner> <summary> @@ -334,7 +334,7 @@ <histogram name="PrivacySandbox.AggregationService.ReportSender.HttpResponseOrNetErrorCode" - enum="CombinedHttpResponseAndNetErrorCode" expires_after="2023-02-23"> + enum="CombinedHttpResponseAndNetErrorCode" expires_after="M117"> <owner>alexmt@chromium.org</owner> <owner>linnan@chromium.org</owner> <summary> @@ -346,7 +346,7 @@ <histogram name="PrivacySandbox.AggregationService.ReportSender.Status" enum="PrivacySandboxAggregationServiceReportSenderStatus" - expires_after="2023-02-23"> + expires_after="M117"> <owner>alexmt@chromium.org</owner> <owner>linnan@chromium.org</owner> <summary> @@ -394,7 +394,7 @@ </histogram> <histogram name="PrivacySandbox.AggregationService.Storage.Sql.CreationTime2" - units="ms" expires_after="2023-02-23"> + units="ms" expires_after="M117"> <owner>alexmt@chromium.org</owner> <owner>linnan@chromium.org</owner> <summary> @@ -407,7 +407,7 @@ <histogram name="PrivacySandbox.AggregationService.Storage.Sql.InitStatus" enum="PrivacySandboxAggregationServiceStorageSqlInitStatus" - expires_after="2022-10-23"> + expires_after="M117"> <owner>alexmt@chromium.org</owner> <owner>linnan@chromium.org</owner> <summary> @@ -418,7 +418,7 @@ <histogram name="PrivacySandbox.AggregationService.Storage.Sql.StoreRequestHasCapacity" - enum="Boolean" expires_after="2023-02-24"> + enum="Boolean" expires_after="M117"> <owner>alexmt@chromium.org</owner> <owner>linnan@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/sync/histograms.xml b/tools/metrics/histograms/metadata/sync/histograms.xml index dea969ba..2ed8c4d 100644 --- a/tools/metrics/histograms/metadata/sync/histograms.xml +++ b/tools/metrics/histograms/metadata/sync/histograms.xml
@@ -1446,6 +1446,24 @@ <summary>Recorded when fetching trusted vault keys is attempted.</summary> </histogram> +<histogram name="Sync.TrustedVaultFileReadStatus" + enum="TrustedVaultFileReadStatus" expires_after="2023-04-09"> + <owner>mmoskvitin@google.com</owner> + <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> + <summary>Recorded when reading local trusted vault file.</summary> +</histogram> + +<histogram name="Sync.TrustedVaultFileWriteSuccess" enum="Boolean" + expires_after="2023-04-09"> + <owner>mmoskvitin@google.com</owner> + <owner>mastiz@chromium.org</owner> + <component>Services>Sync</component> + <summary> + Records whether writing local trusted vault file upon each write. + </summary> +</histogram> + <histogram name="Sync.TrustedVaultKeyRetrievalTrigger" enum="TrustedVaultUserActionTrigger" expires_after="2023-04-09"> <owner>mmoskvitin@google.com</owner>
diff --git a/tools/metrics/histograms/metadata/tab/histograms.xml b/tools/metrics/histograms/metadata/tab/histograms.xml index 5ac2422f..211a56f 100644 --- a/tools/metrics/histograms/metadata/tab/histograms.xml +++ b/tools/metrics/histograms/metadata/tab/histograms.xml
@@ -2116,7 +2116,7 @@ </histogram> <histogram name="Tabs.Suggestions.NumSuggestionsChanged{TabSuggestionType}" - units="count" expires_after="2022-10-17"> + units="count" expires_after="2023-10-16"> <owner>yusufo@chromium.org</owner> <owner>davidjm@chromium.org</owner> <owner>meiliang@chromium.org</owner> @@ -3019,7 +3019,7 @@ </histogram> <histogram name="TabStrip.Tab.{Framework}.ActivationAction" - enum="TabActivationTypes" expires_after="2022-10-16"> + enum="TabActivationTypes" expires_after="2023-01-16"> <owner>yuhengh@chromium.org</owner> <owner>tluk@chromium.org</owner> <owner>romanarora@chromium.org</owner>
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index 0859f245..fef7692b 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -5,16 +5,16 @@ "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux_arm64/49b4b5dcbc312d8d2c3751cf29238b8efeb4e494/trace_processor_shell" }, "win": { - "hash": "2848fa01bc7e4ded5498624333b41925e546e28e", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/win/5796e68068b5b5f822fab257f4d82c61eb0f5af9/trace_processor_shell.exe" + "hash": "81de3e2ff2291a39145a0c358d03905de370dfd8", + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/win/96db79eeca95ba3068331ab1642e757b5879828e/trace_processor_shell.exe" }, "linux_arm": { "hash": "58893933be305d3bfe0a72ebebcacde2ac3ca893", "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux_arm/49b4b5dcbc312d8d2c3751cf29238b8efeb4e494/trace_processor_shell" }, "mac": { - "hash": "1d812572b02e4418cc49f1442d813d543f2f42dc", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/mac/4a49f938a9f4027bb5585e827365d1785e1e4d3c/trace_processor_shell" + "hash": "c885cd5b4d630c1eff5d0688fc4631cae1b4e96a", + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/mac/96db79eeca95ba3068331ab1642e757b5879828e/trace_processor_shell" }, "mac_arm64": { "hash": "92318bea34f5c9beec69d2d826a9a92ec9d3cdcd", @@ -22,7 +22,7 @@ }, "linux": { "hash": "22917ad477215e268434b73428d8d66a71949182", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux/d905018c08900932c36d228953cf1c0dc8fdf31f/trace_processor_shell" + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux/96db79eeca95ba3068331ab1642e757b5879828e/trace_processor_shell" } }, "power_profile.sql": {
diff --git a/ui/gfx/render_text_harfbuzz.cc b/ui/gfx/render_text_harfbuzz.cc index a1267320..f4a7a5f 100644 --- a/ui/gfx/render_text_harfbuzz.cc +++ b/ui/gfx/render_text_harfbuzz.cc
@@ -580,7 +580,7 @@ size_t cutoff_pos = GetCutoffPos(remaining_segment); SkScalar width = run.GetGlyphWidthForCharRange( Range(remaining_segment.char_range.start(), cutoff_pos)); - if (width > 0) { + if (remaining_segment.char_range.start() != cutoff_pos) { internal::LineSegment cut_segment; cut_segment.run = remaining_segment.run; cut_segment.char_range = @@ -690,7 +690,8 @@ // need to put at least one character in the line. Note that, we should // not separate surrogate pair or combining characters. // See RenderTextHarfBuzzTest.Multiline_MinWidth for an example. - if (width == 0 && available_width_ == max_width_) { + if (width == 0 && available_width_ == max_width_ && + end_pos < segment.char_range.end()) { end_pos = std::min(segment.char_range.end(), FindValidBoundaryAfter(text_, end_pos + 1)); }
diff --git a/ui/gfx/render_text_unittest.cc b/ui/gfx/render_text_unittest.cc index 3d1b2e7..f963c8f7 100644 --- a/ui/gfx/render_text_unittest.cc +++ b/ui/gfx/render_text_unittest.cc
@@ -6285,6 +6285,16 @@ test_api()->lines()[j].segments[segment_size - 1].char_range.end()); EXPECT_EQ(char_ranges[j], line_range); } + + for (const std::u16string test_text : {u"\u200b", u"A\u200bB", u"A\u200b"}) { + for (int width = 1; width <= 5; width++) { + SCOPED_TRACE(testing::Message() + << "String: '" << test_text << "' width: " << width); + render_text->SetText(test_text); + render_text->SetDisplayRect(Rect(0, 0, width, 0)); + render_text->Draw(canvas()); + } + } } TEST_F(RenderTextTest, Multiline_ZeroWidthNewline) {
diff --git a/ui/ozone/BUILD.gn b/ui/ozone/BUILD.gn index 0358710..45bf099 100644 --- a/ui/ozone/BUILD.gn +++ b/ui/ozone/BUILD.gn
@@ -243,7 +243,6 @@ visibility += [ "//chrome/test:browser_tests_runner", - "//content/public/browser:browser_sources", "//media/mojo/services", ] }
diff --git a/ui/ozone/public/ozone_switches.cc b/ui/ozone/public/ozone_switches.cc index 8a52289..3eb66a2 100644 --- a/ui/ozone/public/ozone_switches.cc +++ b/ui/ozone/public/ozone_switches.cc
@@ -39,10 +39,4 @@ // Specifies ozone screen size. const char kOzoneOverrideScreenSize[] = "ozone-override-screen-size"; -// ChromeOS uses one of two VideoDecoder implementations based on SoC/board -// specific configurations that are signalled via this command line flag. -// TODO(b/159825227): remove when the "old" video decoder is fully launched. -const char kPlatformDisallowsChromeOSDirectVideoDecoder[] = - "platform-disallows-chromeos-direct-video-decoder"; - } // namespace switches
diff --git a/ui/ozone/public/ozone_switches.h b/ui/ozone/public/ozone_switches.h index f40c5947c..114e375 100644 --- a/ui/ozone/public/ozone_switches.h +++ b/ui/ozone/public/ozone_switches.h
@@ -33,9 +33,6 @@ COMPONENT_EXPORT(OZONE_SWITCHES) extern const char kOzoneOverrideScreenSize[]; -COMPONENT_EXPORT(OZONE_SWITCHES) -extern const char kPlatformDisallowsChromeOSDirectVideoDecoder[]; - } // namespace switches #endif // UI_OZONE_PUBLIC_OZONE_SWITCHES_H_
diff --git a/ui/views/bubble/bubble_dialog_delegate_view.cc b/ui/views/bubble/bubble_dialog_delegate_view.cc index a5ce0c7a..8abcf25 100644 --- a/ui/views/bubble/bubble_dialog_delegate_view.cc +++ b/ui/views/bubble/bubble_dialog_delegate_view.cc
@@ -682,10 +682,11 @@ gfx::Rect BubbleDialogDelegate::GetAnchorRect() const { // TODO(tluk) eliminate the need for GetAnchorRect() to return an empty rect // if neither an |anchor_rect_| or an anchor view have been set. - if (!GetAnchorView()) + View* anchor_view = GetAnchorView(); + if (!anchor_view) return anchor_rect_.value_or(gfx::Rect()); - anchor_rect_ = GetAnchorView()->GetAnchorBoundsInScreen(); + anchor_rect_ = anchor_view->GetAnchorBoundsInScreen(); #if !BUILDFLAG(IS_MAC) // GetAnchorBoundsInScreen returns values that take anchor widget's @@ -693,8 +694,8 @@ // apply transforms on windows such as ChromeOS overview mode will see bubbles // offset. // TODO(sammiequon): Investigate if we can remove |anchor_widget_| and just - // replace its calls with GetAnchorView()->GetWidget(). - DCHECK_EQ(anchor_widget_, GetAnchorView()->GetWidget()); + // replace its calls with anchor_view->GetWidget(). + DCHECK_EQ(anchor_widget_, anchor_view->GetWidget()); if (anchor_widget_) { gfx::Transform transform = anchor_widget_->GetNativeWindow()->layer()->GetTargetTransform(); @@ -704,6 +705,15 @@ } #endif + // Remove additional whitespace padding that was added to the view + // so that anchor_rect centers on the anchor and not skewed by the whitespace + BubbleFrameView* frame_view = GetBubbleFrameView(); + if (frame_view && frame_view->GetDisplayVisibleArrow()) { + gfx::Insets* padding = anchor_view->GetProperty(kInternalPaddingKey); + if (padding != nullptr) + anchor_rect_->Inset(*padding); + } + return anchor_rect_.value(); }
diff --git a/ui/views/test/views_test_base.h b/ui/views/test/views_test_base.h index 223be7d..05c777c 100644 --- a/ui/views/test/views_test_base.h +++ b/ui/views/test/views_test_base.h
@@ -189,7 +189,7 @@ }; // A helper that makes it easier to declare basic views tests that want to test -// desktop native widgets. See |ViewsTestBase::native_wiget_type_| and +// desktop native widgets. See |ViewsTestBase::native_widget_type_| and // |ViewsTestBase::CreateNativeWidgetForTest|. In short, for Aura, this will // result in most Widgets automatically being backed by a // DesktopNativeWidgetAura. For Mac, it has no impact as a NativeWidgetMac is
diff --git a/ui/views/view.cc b/ui/views/view.cc index 6a285b8..fdabbc4 100644 --- a/ui/views/view.cc +++ b/ui/views/view.cc
@@ -4,6 +4,7 @@ #include "ui/views/view.h" +#include <algorithm> #include <memory> #include <utility>
diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc index 1209461..fedb76a 100644 --- a/ui/views/widget/widget.cc +++ b/ui/views/widget/widget.cc
@@ -249,6 +249,9 @@ // static Widget* Widget::GetWidgetForNativeView(gfx::NativeView native_view) { + if (!native_view) + return nullptr; + internal::NativeWidgetPrivate* native_widget = internal::NativeWidgetPrivate::GetNativeWidgetForNativeView(native_view); return native_widget ? native_widget->GetWidget() : nullptr; @@ -256,6 +259,9 @@ // static Widget* Widget::GetWidgetForNativeWindow(gfx::NativeWindow native_window) { + if (!native_window) + return nullptr; + internal::NativeWidgetPrivate* native_widget = internal::NativeWidgetPrivate::GetNativeWidgetForNativeWindow( native_window); @@ -264,6 +270,9 @@ // static Widget* Widget::GetTopLevelWidgetForNativeView(gfx::NativeView native_view) { + if (!native_view) + return nullptr; + internal::NativeWidgetPrivate* native_widget = internal::NativeWidgetPrivate::GetTopLevelNativeWidget(native_view); return native_widget ? native_widget->GetWidget() : nullptr; @@ -272,11 +281,17 @@ // static void Widget::GetAllChildWidgets(gfx::NativeView native_view, Widgets* children) { + if (!native_view) + return; + internal::NativeWidgetPrivate::GetAllChildWidgets(native_view, children); } // static void Widget::GetAllOwnedWidgets(gfx::NativeView native_view, Widgets* owned) { + if (!native_view) + return; + internal::NativeWidgetPrivate::GetAllOwnedWidgets(native_view, owned); } @@ -602,6 +617,9 @@ } std::string Widget::GetWorkspace() const { + if (native_widget_destroyed_) + return ""; + return native_widget_->GetWorkspace(); } @@ -614,6 +632,9 @@ } void Widget::CenterWindow(const gfx::Size& size) { + if (native_widget_destroyed_) + return; + native_widget_->CenterWindow(size); } @@ -813,6 +834,9 @@ } int Widget::GetZOrderSublevel() const { + if (!sublevel_manager_) + return 0; + return sublevel_manager_->GetSublevel(); } @@ -1076,10 +1100,15 @@ } void Widget::ClearNativeFocus() { + if (native_widget_destroyed_) + return; + native_widget_->ClearNativeFocus(); } std::unique_ptr<NonClientFrameView> Widget::CreateNonClientFrameView() { + if (native_widget_destroyed_) + return nullptr; auto frame_view = widget_delegate_->CreateNonClientFrameView(this); if (!frame_view) frame_view = native_widget_->CreateNonClientFrameView(); @@ -1104,6 +1133,9 @@ } void Widget::DebugToggleFrameType() { + if (native_widget_destroyed_) + return; + if (frame_type_ == FrameType::kDefault) { frame_type_ = ShouldUseNativeFrame() ? FrameType::kForceCustom : FrameType::kForceNative; @@ -1116,6 +1148,9 @@ } void Widget::FrameTypeChanged() { + if (native_widget_destroyed_) + return; + native_widget_->FrameTypeChanged(); } @@ -1686,6 +1721,9 @@ } bool Widget::ExecuteCommand(int command_id) { + if (!widget_delegate_) + return false; + return widget_delegate_->ExecuteWindowsCommand(command_id); } @@ -1697,6 +1735,9 @@ } void Widget::GetHitTestMask(SkPath* mask) const { + if (!widget_delegate_) + return; + DCHECK(mask); widget_delegate_->GetWidgetHitTestMask(mask); }
diff --git a/ui/views/widget/widget_unittest.cc b/ui/views/widget/widget_unittest.cc index 066e37af..1b5eb3b 100644 --- a/ui/views/widget/widget_unittest.cc +++ b/ui/views/widget/widget_unittest.cc
@@ -935,9 +935,8 @@ } //////////////////////////////////////////////////////////////////////////////// -// Test to verify using various Widget methods doesn't crash when the underlying +// Tests to verify using various Widget methods don't crash when the underlying // NativeView is destroyed. -// class WidgetWithDestroyedNativeViewTest : public ViewsTestBaseWithNativeWidgetType { @@ -970,27 +969,137 @@ widget()->Activate(); } +TEST_P(WidgetWithDestroyedNativeViewTest, AddAndRemoveObserver) { + // Constructor calls |AddObserver()| + TestWidgetObserver observer(widget()); + widget()->RemoveObserver(&observer); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, AddAndRemoveRemovalsObserver) { + TestWidgetRemovalsObserver removals_observer; + widget()->AddRemovalsObserver(&removals_observer); + widget()->RemoveRemovalsObserver(&removals_observer); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, AsWidget) { + widget()->AsWidget(); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, CanActivate) { + widget()->CanActivate(); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, CenterWindow) { + widget()->CenterWindow(gfx::Size()); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, ClearNativeFocus) { + widget()->ClearNativeFocus(); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, ClientView) { + widget()->client_view(); +} + TEST_P(WidgetWithDestroyedNativeViewTest, Close) { widget()->Close(); } +TEST_P(WidgetWithDestroyedNativeViewTest, CloseAllSecondaryWidgets) { + widget()->CloseAllSecondaryWidgets(); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, CloseNow) { + widget()->CloseNow(); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, ClosedReason) { + widget()->closed_reason(); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, CloseWithReason) { + widget()->CloseWithReason(views::Widget::ClosedReason::kUnspecified); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, CreateNonClientFrameView) { + widget()->CreateNonClientFrameView(); +} + TEST_P(WidgetWithDestroyedNativeViewTest, Deactivate) { widget()->Deactivate(); } +TEST_P(WidgetWithDestroyedNativeViewTest, DebugToggleFrameType) { + widget()->DebugToggleFrameType(); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, DraggedView) { + widget()->dragged_view(); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, EndMoveLoop) { + widget()->EndMoveLoop(); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, ExecuteCommand) { + widget()->ExecuteCommand(0); +} + TEST_P(WidgetWithDestroyedNativeViewTest, FlashFrame) { widget()->FlashFrame(true); } +TEST_P(WidgetWithDestroyedNativeViewTest, FrameType) { + widget()->frame_type(); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, FrameTypeChanged) { + widget()->FrameTypeChanged(); +} + TEST_P(WidgetWithDestroyedNativeViewTest, GetAccelerator) { ui::Accelerator accelerator; widget()->GetAccelerator(0, &accelerator); } +TEST_P(WidgetWithDestroyedNativeViewTest, GetAllChildWidgets) { + views::Widget::Widgets widgets; + Widget::GetAllChildWidgets(widget()->GetNativeView(), &widgets); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, GetAllOwnedWidgets) { + views::Widget::Widgets widgets; + Widget::GetAllOwnedWidgets(widget()->GetNativeView(), &widgets); +} + TEST_P(WidgetWithDestroyedNativeViewTest, GetClientAreaBoundsInScreen) { widget()->GetClientAreaBoundsInScreen(); } +TEST_P(WidgetWithDestroyedNativeViewTest, GetColorProvider) { + widget()->GetColorProvider(); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, GetCompositor) { + widget()->GetCompositor(); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, GetContentsView) { + widget()->GetContentsView(); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, GetCustomTheme) { + widget()->GetCustomTheme(); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, GetEventSink) { + widget()->GetEventSink(); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, GetFocusSearch) { + widget()->GetFocusSearch(); +} + TEST_P(WidgetWithDestroyedNativeViewTest, GetFocusManager) { widget()->GetFocusManager(); } @@ -999,10 +1108,39 @@ widget()->GetFocusTraversable(); } +TEST_P(WidgetWithDestroyedNativeViewTest, GetGestureConsumer) { + widget()->GetGestureConsumer(); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, GetGestureRecognizer) { + widget()->GetGestureRecognizer(); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, GetHitTestMask) { + SkPath mask; + widget()->GetHitTestMask(&mask); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, GetInputMethod) { + widget()->GetInputMethod(); +} + TEST_P(WidgetWithDestroyedNativeViewTest, GetLayer) { widget()->GetLayer(); } +TEST_P(WidgetWithDestroyedNativeViewTest, GetMinimumSize) { + widget()->GetMinimumSize(); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, GetMaximumSize) { + widget()->GetMaximumSize(); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, GetName) { + widget()->GetName(); +} + TEST_P(WidgetWithDestroyedNativeViewTest, GetNativeTheme) { widget()->GetNativeTheme(); } @@ -1019,14 +1157,55 @@ widget()->GetNativeWindowProperty("xx"); } +TEST_P(WidgetWithDestroyedNativeViewTest, GetNonClientComponent) { + gfx::Point point; + widget()->GetNonClientComponent(point); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, GetPrimaryWindowWidget) { + widget()->GetPrimaryWindowWidget(); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, GetRestoredBounds) { + widget()->GetRestoredBounds(); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, GetRootView) { + widget()->GetRootView(); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, GetSublevelManager) { + widget()->GetSublevelManager(); +} + TEST_P(WidgetWithDestroyedNativeViewTest, GetThemeProvider) { widget()->GetThemeProvider(); } +TEST_P(WidgetWithDestroyedNativeViewTest, GetTooltipManager) { + widget()->GetTooltipManager(); +} + TEST_P(WidgetWithDestroyedNativeViewTest, GetTopLevelWidget) { widget()->GetTopLevelWidget(); } +TEST_P(WidgetWithDestroyedNativeViewTest, GetTopLevelWidgetForNativeView) { + Widget::GetTopLevelWidgetForNativeView(widget()->GetNativeView()); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, GetWeakPtr) { + widget()->GetWeakPtr(); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, GetWidgetForNativeView) { + Widget::GetWidgetForNativeView(widget()->GetNativeView()); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, GetWidgetForNativeWindow) { + Widget::GetWidgetForNativeWindow(widget()->GetNativeWindow()); +} + TEST_P(WidgetWithDestroyedNativeViewTest, GetWindowBoundsInScreen) { widget()->GetWindowBoundsInScreen(); } @@ -1035,6 +1214,14 @@ widget()->GetWorkAreaBoundsInScreen(); } +TEST_P(WidgetWithDestroyedNativeViewTest, GetWorkspace) { + widget()->GetWorkspace(); +} + +TEST_P(WidgetWithDestroyedNativeViewTest, GetZOrderSublevel) { + widget()->GetZOrderSublevel(); +} + TEST_P(WidgetWithDestroyedNativeViewTest, HasCapture) { widget()->HasCapture(); }
diff --git a/weblayer/browser/android/javatests/AndroidManifest.xml b/weblayer/browser/android/javatests/AndroidManifest.xml index 58d3e4e3..09782a5 100644 --- a/weblayer/browser/android/javatests/AndroidManifest.xml +++ b/weblayer/browser/android/javatests/AndroidManifest.xml
@@ -8,7 +8,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="org.chromium.weblayer.tests"> + package="org.chromium.browserfragment.tests"> <uses-permission android:name="android.permission.RUN_INSTRUMENTATION" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <!-- We add an application tag here just so that we can indicate that this @@ -21,6 +21,6 @@ </application> <instrumentation android:name="org.chromium.base.test.BaseChromiumAndroidJUnitRunner" - android:targetPackage="org.chromium.weblayer.shell" - android:label="JUnit4-based tests for org.chromium.weblayer.shell" /> + android:targetPackage="org.chromium.browserfragment.shell" + android:label="JUnit4-based tests for org.chromium.browserfragment.shell" /> </manifest>
diff --git a/weblayer/browser/android/javatests/AndroidManifest_bundle.xml b/weblayer/browser/android/javatests/AndroidManifest_bundle.xml deleted file mode 100644 index 90eba0d8..0000000 --- a/weblayer/browser/android/javatests/AndroidManifest_bundle.xml +++ /dev/null
@@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- -Copyright 2020 The Chromium Authors -Use of this source code is governed by a BSD-style license that can be -found in the LICENSE file. ---> - - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="org.chromium.weblayer.tests"> - <uses-permission android:name="android.permission.RUN_INSTRUMENTATION" /> - <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> - - <!-- Starting from Android 11 not all packages are visible by default and this stops us - from starting an EmbeddedTestServer. Request visibility by using an intent - filter signature - (https://developer.android.com/training/package-visibility/declaring#intent-filter-signature) - --> - <queries> - <intent> - <action android:name="org.chromium.net.test.EMBEDDED_TEST_SERVER_SERVICE" /> - </intent> - </queries> - - <!-- We add an application tag here just so that we can indicate that this - package needs to link against the android.test library, which is - needed when building test cases. --> - <application> - <activity android:name="org.chromium.test.broker.OnDeviceInstrumentationBroker" - android:exported="true"/> - <activity android:name="org.chromium.weblayer.shell.InstrumentationActivity" - android:theme="@style/Theme.AppCompat.DayNight" /> - </application> - - <instrumentation android:name="org.chromium.base.test.BaseChromiumAndroidJUnitRunner" - android:targetPackage="org.chromium.weblayer.tests" /> -</manifest>
diff --git a/weblayer/browser/android/javatests/BUILD.gn b/weblayer/browser/android/javatests/BUILD.gn index 1043cf3..d48def8 100644 --- a/weblayer/browser/android/javatests/BUILD.gn +++ b/weblayer/browser/android/javatests/BUILD.gn
@@ -6,55 +6,18 @@ import("//build/config/android/config.gni") import("//build/config/android/rules.gni") -android_library("weblayer_java_tests") { +android_library("browserfragment_java_tests") { testonly = true - sources = [ - "src/org/chromium/weblayer/test/BrowserFragmentLifecycleTest.java", - "src/org/chromium/weblayer/test/BrowserTest.java", - "src/org/chromium/weblayer/test/CookieManagerTest.java", - "src/org/chromium/weblayer/test/CrashReporterTest.java", - "src/org/chromium/weblayer/test/DarkModeTest.java", - "src/org/chromium/weblayer/test/DataClearingTest.java", - "src/org/chromium/weblayer/test/DisplayCutoutTest.java", - "src/org/chromium/weblayer/test/DowngradeTest.java", - "src/org/chromium/weblayer/test/DownloadCallbackTest.java", - "src/org/chromium/weblayer/test/ErrorPageCallbackTest.java", - "src/org/chromium/weblayer/test/ExecuteScriptTest.java", - "src/org/chromium/weblayer/test/ExternalNavigationTest.java", - "src/org/chromium/weblayer/test/FaviconFetcherTest.java", - "src/org/chromium/weblayer/test/FindInPageTest.java", - "src/org/chromium/weblayer/test/FullscreenCallbackTest.java", - "src/org/chromium/weblayer/test/FullscreenSizeTest.java", - "src/org/chromium/weblayer/test/GoogleAccountsTest.java", - "src/org/chromium/weblayer/test/InputTypesTest.java", - "src/org/chromium/weblayer/test/MediaSessionTest.java", - "src/org/chromium/weblayer/test/NavigationTest.java", - "src/org/chromium/weblayer/test/NewTabCallbackTest.java", - "src/org/chromium/weblayer/test/OnTabRemovedTabListCallbackImpl.java", - "src/org/chromium/weblayer/test/PrerenderControllerTest.java", - "src/org/chromium/weblayer/test/ProfileTest.java", - "src/org/chromium/weblayer/test/RegisterExternalExperimentIdsTest.java", - "src/org/chromium/weblayer/test/ScrollOffsetCallbackTest.java", - "src/org/chromium/weblayer/test/SmokeTest.java", - "src/org/chromium/weblayer/test/TabCallbackTest.java", - "src/org/chromium/weblayer/test/TabListCallbackTest.java", - "src/org/chromium/weblayer/test/TabTest.java", - "src/org/chromium/weblayer/test/WebLayerLoadingTest.java", - "src/org/chromium/weblayer/test/WebLayerTest.java", - "src/org/chromium/weblayer/test/WebMessageTest.java", - "src/org/chromium/weblayer/test/WebViewCompatibilityTest.java", - "src/org/chromium/weblayer/test/XClientDataTest.java", - ] + sources = [ "src/org/chromium/browserfragment/test/BrowserFragmentTest.java" ] deps = [ - ":weblayer_java_test_support", + ":browserfragment_java_test_support", "//base:base_java", "//base:base_java_test_support", "//components/browser_ui/share/android:java", "//components/safe_browsing/android:safe_browsing_java", "//content/public/android:content_java", "//content/public/test/android:content_java_test_support", - "//net/android:net_java_test_support", - "//third_party/android_deps:espresso_java", + "//third_party/android_deps:com_google_guava_listenablefuture_java", "//third_party/android_support_test_runner:rules_java", "//third_party/android_support_test_runner:runner_java", "//third_party/androidx:androidx_activity_activity_java", @@ -64,84 +27,19 @@ "//third_party/androidx:androidx_fragment_fragment_java", "//third_party/androidx:androidx_test_runner_java", "//third_party/blink/public/common:common_java", - "//third_party/hamcrest:hamcrest_java", "//third_party/junit:junit", - "//weblayer/browser/java:interfaces_java", - "//weblayer/public/java", + "//weblayer/public/java:browserfragment_java", "//weblayer/public/javatests:weblayer_public_javatests", - "//weblayer/shell/android:weblayer_shell_java", + "//weblayer/shell/android:browserfragment_shell_java", ] } -android_library("weblayer_private_java_tests") { +android_library("browserfragment_java_test_support") { testonly = true sources = [ - "src/org/chromium/weblayer/test/AccessibilityTest.java", - "src/org/chromium/weblayer/test/AutofillTest.java", - "src/org/chromium/weblayer/test/BackgroundFetchTest.java", - "src/org/chromium/weblayer/test/BrowserControlsOffsetCallbackTest.java", - "src/org/chromium/weblayer/test/BrowserControlsTest.java", - "src/org/chromium/weblayer/test/ContentCaptureTest.java", - "src/org/chromium/weblayer/test/FullscreenCallbackPrivateTest.java", - "src/org/chromium/weblayer/test/GeolocationTest.java", - "src/org/chromium/weblayer/test/GoogleAccountAccessTokenFetcherTest.java", - "src/org/chromium/weblayer/test/InfoBarTest.java", - "src/org/chromium/weblayer/test/MediaCaptureTest.java", - "src/org/chromium/weblayer/test/MediaRouterTest.java", - "src/org/chromium/weblayer/test/NetworkChangeNotifierTest.java", - "src/org/chromium/weblayer/test/PageInfoTest.java", - "src/org/chromium/weblayer/test/PopupTest.java", - "src/org/chromium/weblayer/test/ResourceLoadingTest.java", - "src/org/chromium/weblayer/test/SiteSettingsTest.java", - "src/org/chromium/weblayer/test/TabPrivateTest.java", - "src/org/chromium/weblayer/test/TranslateTest.java", - "src/org/chromium/weblayer/test/UrlBarControllerTest.java", - "src/org/chromium/weblayer/test/WebAuthnTest.java", - ] - deps = [ - ":weblayer_java_private_test_support", - ":weblayer_java_test_support", - "//base:base_java", - "//base:base_java_test_support", - "//content/public/android:content_java", - "//content/public/test/android:content_java_test_support", - "//net/android:net_java_test_support", - "//third_party/android_deps:espresso_java", - "//third_party/android_sdk:android_test_base_java", - "//third_party/android_support_test_runner:rules_java", - "//third_party/android_support_test_runner:runner_java", - "//third_party/androidx:androidx_annotation_annotation_java", - "//third_party/androidx:androidx_core_core_java", - "//third_party/androidx:androidx_fragment_fragment_java", - "//third_party/androidx:androidx_test_runner_java", - "//third_party/google-truth:google_truth_java", - "//third_party/hamcrest:hamcrest_java", - "//third_party/junit:junit", - "//ui/android:ui_java_test_support", - "//weblayer/browser/java:test_interfaces_java", - "//weblayer/browser/java:upstream_java", - "//weblayer/public/java", - "//weblayer/public/javatestutil:test_java", - "//weblayer/shell/android:weblayer_shell_java", - ] - - srcjar_deps = [ "//weblayer/browser/java:weblayer_product_config" ] -} - -android_library("weblayer_java_test_support") { - testonly = true - sources = [ - "src/org/chromium/weblayer/test/BoundedCountDownLatch.java", - "src/org/chromium/weblayer/test/EventUtils.java", - "src/org/chromium/weblayer/test/InstrumentationActivityTestRule.java", - "src/org/chromium/weblayer/test/MinWebLayerVersion.java", - "src/org/chromium/weblayer/test/MinWebLayerVersionSkipCheck.java", - "src/org/chromium/weblayer/test/NavigationWaiter.java", - "src/org/chromium/weblayer/test/NewTabCallbackImpl.java", - "src/org/chromium/weblayer/test/ResourceUtil.java", - "src/org/chromium/weblayer/test/TestFullscreenCallback.java", - "src/org/chromium/weblayer/test/WebLayerActivityTestRule.java", - "src/org/chromium/weblayer/test/WebLayerJUnit4ClassRunner.java", + "src/org/chromium/browserfragment/test/BrowserFragmentActivityTestRule.java", + "src/org/chromium/browserfragment/test/BrowserFragmentJUnit4ClassRunner.java", + "src/org/chromium/browserfragment/test/InstrumentationActivityTestRule.java", ] deps = [ "//base:base_java", @@ -151,35 +49,14 @@ "//third_party/android_support_test_runner:rules_java", "//third_party/android_support_test_runner:runner_java", "//third_party/androidx:androidx_fragment_fragment_java", - "//third_party/hamcrest:hamcrest_java", "//third_party/junit:junit", "//ui/android:ui_java_test_support", - "//weblayer/public/java", - "//weblayer/shell/android:weblayer_shell_java", + "//weblayer/public/java:browserfragment_java", + "//weblayer/shell/android:browserfragment_shell_java", ] } -android_library("weblayer_java_private_test_support") { - testonly = true - sources = [ - "src/org/chromium/weblayer/test/BrowserControlsHelper.java", - "src/org/chromium/weblayer/test/SettingsActivityTestRule.java", - ] - deps = [ - ":weblayer_java_test_support", - "//base:base_java", - "//base:base_java_test_support", - "//content/public/test/android:content_java_test_support", - "//third_party/android_support_test_runner:runner_java", - "//third_party/hamcrest:hamcrest_java", - "//third_party/junit:junit", - "//weblayer/public/java", - "//weblayer/public/javatestutil:test_java", - "//weblayer/shell/android:weblayer_shell_java", - ] -} - -template("weblayer_instrumentation") { +template("browserfragment_instrumentation") { instrumentation_test_apk(target_name) { forward_variables_from(invoker, "*") @@ -198,162 +75,13 @@ } } -# Runs the instrumentation tests loading the implementation from the default -# WebView provider. This is the loading path that is used in production. -# TODO(crbug.com/1033070): Figure out why the test infrastructure fails on some -# Android versions. -weblayer_instrumentation("weblayer_instrumentation_test_apk") { - apk_name = "WebLayerInstrumentationTest" - apk_under_test = "//weblayer/shell/android:weblayer_shell_system_webview_apk" - use_webview_provider = system_webview_apk_target - - deps = [ ":weblayer_java_tests" ] -} - -# This target compiles Chrome as well as the WebLayer instrumentation test -# apk. Use this target for builders that use devices which do not have -# Chrome installed like Android Marshmallow x86 emulators. If your device -# does not have Chrome installed, then you can use this target when running -# tests locally also. -weblayer_instrumentation("weblayer_instrumentation_test_with_chrome_apk") { - apk_name = "WebLayerInstrumentationTestWithChrome" - apk_under_test = "//weblayer/shell/android:weblayer_shell_system_webview_apk" - use_webview_provider = system_webview_apk_target - - deps = [ - ":weblayer_java_tests", - "//chrome/android/:chrome_public_apk", - ] - - data_deps = [ "//chrome/android/:chrome_public_apk" ] -} - # Runs the instrumentation tests loading the implementation from the WebLayer # support library. -weblayer_instrumentation("weblayer_support_instrumentation_test_apk") { - apk_name = "WebLayerSupportInstrumentationTest" - apk_under_test = "//weblayer/shell/android:weblayer_shell_apk" +browserfragment_instrumentation( + "browserfragment_support_instrumentation_test_apk") { + apk_name = "BrowserFragmentSupportInstrumentationTest" + apk_under_test = "//weblayer/shell/android:browserfragment_shell_local_apk" additional_apks = [ "//weblayer/shell/android:weblayer_support_apk" ] - deps = [ ":weblayer_java_tests" ] -} - -weblayer_instrumentation("weblayer_private_instrumentation_test_apk") { - apk_name = "WebLayerPrivateInstrumentationTest" - apk_under_test = "//weblayer/shell/android:weblayer_shell_apk" - additional_apks = [ - "//weblayer/shell/android:weblayer_support_apk", - "//components/media_router/test/android/media_router_test_support:media_router_test_support_apk", - ] - - deps = [ ":weblayer_private_java_tests" ] -} - -# Runs WebLayer instrumentation tests against arbitrary versions of the -# client and implementation libraries. -# -# Example usage, testing M80 tests and client against master implementation: -# autoninja -C out/Release weblayer_instrumentation_test_versions_apk -# cipd install --root /tmp/M80 chromium/testing/weblayer-x86 m80 -# out/Release/bin/run_weblayer_instrumentation_tests_versions_apk \ -# --test-runner-outdir out/Release -# --client-outdir /tmp/M80/out/Release -# --implementation-outdir out/Release -copy("weblayer_skew_tests") { - testonly = true - - sources = [ "weblayer_instrumentation_test_versions.py" ] - - outputs = [ "$root_build_dir/bin/run_weblayer_skew_tests" ] - - # Also explicitly list the output as data so it gets isolated on bots. - data = [ - "$root_build_dir/bin/run_weblayer_skew_tests", - "//third_party/catapult/third_party/typ/", - "//weblayer/browser/android/javatests/skew/expectations.txt", - ] - - deps = [ ":weblayer_instrumentation_test_apk" ] - - data_deps = [ ":weblayer_instrumentation_test_apk" ] -} - -# Runs WebLayer instrumentation tests against arbitrary versions of the -# client and implementation libraries. This target also compiles -# Chrome for devices that do not come with Chrome installed. For usage -# please see the comment above. -copy("weblayer_skew_tests_with_chrome") { - testonly = true - - sources = [ "weblayer_instrumentation_test_versions.py" ] - - outputs = [ "$root_build_dir/bin/run_weblayer_skew_tests_with_chrome" ] - - # Also explicitly list the output as data so it gets isolated on bots. - data = [ - "$root_build_dir/bin/run_weblayer_skew_tests_with_chrome", - "//third_party/catapult/third_party/typ/", - "//weblayer/browser/android/javatests/skew/expectations.txt", - ] - - deps = [ - ":weblayer_instrumentation_test_apk", - "//chrome/android/:chrome_public_apk", - ] - - data_deps = [ - ":weblayer_instrumentation_test_apk", - "//chrome/android/:chrome_public_apk", - ] -} - -android_test_apk("weblayer_bundle_test_apk") { - apk_name = "WebLayerBundleTest" - android_manifest = "AndroidManifest_bundle.xml" - sources = [ - "src/org/chromium/weblayer/test/BundleLanguageTest.java", - - # This is run both in the bundle tests and the standard instrumentation - # tests to make sure bundles don't do anything weird with WebLayer/WebView - # compatibility. - "src/org/chromium/weblayer/test/WebViewCompatibilityTest.java", - ] - deps = [ - ":weblayer_java_test_support", - "//base:base_java", - "//base:base_java_test_support", - "//content/public/test/android:content_java_test_support", - "//third_party/android_support_test_runner:rules_java", - "//third_party/android_support_test_runner:runner_java", - "//third_party/androidx:androidx_test_runner_java", - "//third_party/junit:junit", - "//weblayer/public/java", - "//weblayer/public/javatestutil:test_java", - "//weblayer/shell/android:weblayer_shell_java", - ] - never_incremental = true -} - -instrumentation_test_runner("weblayer_bundle_test") { - if (android_64bit_target_cpu && skip_secondary_abi_for_cq) { - apk_under_test = "//android_webview:system_webview_64_bundle_apks" - } else { - apk_under_test = "//android_webview:system_webview_bundle_apks" - } - - # TODO(cduvall): use_webview_provider is needed to make sure a custom WebView - # is installable. Unfortunately, bundles are not currently supported for the - # use_webview_provider arg, so the APK is specified. It will end up being - # replaced by the bundle in apk_under_test. - use_webview_provider = system_webview_apk_target - data_deps = [ system_webview_apk_target ] - - additional_locales = [ - "es-ES", - "fr-CA", - ] - android_test_apk = ":weblayer_bundle_test_apk" - additional_apks = [ "//net/android:net_test_support_apk" ] - data = [ "//weblayer/test/data/" ] - never_incremental = true + deps = [ ":browserfragment_java_tests" ] }
diff --git a/weblayer/browser/android/javatests/DEPS b/weblayer/browser/android/javatests/DEPS index aee953057..ce42e25 100644 --- a/weblayer/browser/android/javatests/DEPS +++ b/weblayer/browser/android/javatests/DEPS
@@ -2,12 +2,12 @@ "-content/public", "+content/public/test", - # WebLayerJUnit4ClassRunner should be used for all tests since it has logic to + # BrowserFragmentJUnit4ClassRunner should be used for all tests since it has logic to # make command line flags work in WebLayer. "-base/test/android/javatests/src/org/chromium/base/test/BaseJUnit4ClassRunner.java", ] specific_include_rules = { - "WebLayerJUnit4ClassRunner.java": [ + "BrowserFragmentJUnit4ClassRunner.java": [ "+base/test/android/javatests/src/org/chromium/base/test/BaseJUnit4ClassRunner.java", ] }
diff --git a/weblayer/browser/android/javatests/src/org/chromium/browserfragment/test/BrowserFragmentActivityTestRule.java b/weblayer/browser/android/javatests/src/org/chromium/browserfragment/test/BrowserFragmentActivityTestRule.java new file mode 100644 index 0000000..a60da4483 --- /dev/null +++ b/weblayer/browser/android/javatests/src/org/chromium/browserfragment/test/BrowserFragmentActivityTestRule.java
@@ -0,0 +1,68 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.browserfragment.test; + +import android.app.Activity; +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.text.TextUtils; + +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import org.chromium.base.CommandLine; +import org.chromium.base.test.BaseActivityTestRule; + +import java.io.File; +import java.io.OutputStreamWriter; +import java.io.Writer; + +/** + * Base ActivityTestRule for BrowserFragment instrumentation tests. + * + * This rule contains some common setup needed to deal with BrowserFragment's multiple classloaders. + */ +abstract class BrowserFragmentActivityTestRule<T extends Activity> extends BaseActivityTestRule<T> { + private static final String COMMAND_LINE_FILE = "weblayer-command-line"; + + public BrowserFragmentActivityTestRule(Class<T> clazz) { + super(clazz); + } + + /** + * Writes the command line file. This can be useful if a test needs to dynamically add command + * line arguments before WebLayer has been loaded. + */ + public void writeCommandLineFile() throws Exception { + // The CommandLine instance we have here will not be picked up in the + // implementation since they use different class loaders, so we need to write + // all the switches to the WebLayer command line file. + try (Writer writer = new OutputStreamWriter( + InstrumentationRegistry.getInstrumentation().getTargetContext().openFileOutput( + COMMAND_LINE_FILE, Context.MODE_PRIVATE), + "UTF-8")) { + writer.write(TextUtils.join(" ", CommandLine.getJavaSwitchesOrNull())); + } + } + + @Override + public Statement apply(final Statement base, Description description) { + return new Statement() { + @Override + public void evaluate() throws Throwable { + try { + writeCommandLineFile(); + base.evaluate(); + } finally { + new File(InstrumentationRegistry.getInstrumentation() + .getTargetContext() + .getFilesDir(), + COMMAND_LINE_FILE) + .delete(); + } + } + }; + } +}
diff --git a/weblayer/browser/android/javatests/src/org/chromium/browserfragment/test/BrowserFragmentJUnit4ClassRunner.java b/weblayer/browser/android/javatests/src/org/chromium/browserfragment/test/BrowserFragmentJUnit4ClassRunner.java new file mode 100644 index 0000000..ebdebd0 --- /dev/null +++ b/weblayer/browser/android/javatests/src/org/chromium/browserfragment/test/BrowserFragmentJUnit4ClassRunner.java
@@ -0,0 +1,32 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.browserfragment.test; + +import org.junit.runners.model.InitializationError; + +import org.chromium.base.test.BaseJUnit4ClassRunner; +import org.chromium.base.test.util.SkipCheck; + +import java.util.List; + +/** + * A custom runner for //weblayer JUnit4 tests. + */ +public class BrowserFragmentJUnit4ClassRunner extends BaseJUnit4ClassRunner { + /** + * Create a BrowserFragmentJUnit4ClassRunner to run {@code klass} and initialize values. + * + * @throws InitializationError if the test class malformed + */ + public BrowserFragmentJUnit4ClassRunner(final Class<?> klass) throws InitializationError { + super(klass); + } + + @Override + protected List<SkipCheck> getSkipChecks() { + // TODO(rayankans): Add SkipChecks. + return super.getSkipChecks(); + } +}
diff --git a/weblayer/browser/android/javatests/src/org/chromium/browserfragment/test/BrowserFragmentTest.java b/weblayer/browser/android/javatests/src/org/chromium/browserfragment/test/BrowserFragmentTest.java new file mode 100644 index 0000000..1e24169 --- /dev/null +++ b/weblayer/browser/android/javatests/src/org/chromium/browserfragment/test/BrowserFragmentTest.java
@@ -0,0 +1,45 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.browserfragment.test; + +import static org.chromium.content_public.browser.test.util.TestThreadUtils.runOnUiThreadBlockingNoException; + +import androidx.test.filters.SmallTest; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.chromium.base.test.util.Batch; +import org.chromium.browserfragment.Browser; +import org.chromium.browserfragment.shell.InstrumentationActivity; + +/** + * Tests that fragment lifecycle works as expected. + */ +@RunWith(BrowserFragmentJUnit4ClassRunner.class) +@Batch(Batch.UNIT_TESTS) +public class BrowserFragmentTest { + @Rule + public InstrumentationActivityTestRule mActivityTestRule = + new InstrumentationActivityTestRule(); + + private Browser mBrowser; + + @Before + public void setUp() throws Throwable { + InstrumentationActivity activity = mActivityTestRule.launchShell(); + mBrowser = activity.getBrowserFuture().get(); + } + + @Test + @SmallTest + public void successfullyCreateFragment() { + Assert.assertNotNull(mBrowser); + Assert.assertNotNull(runOnUiThreadBlockingNoException(() -> mBrowser.createFragment())); + } +}
diff --git a/weblayer/browser/android/javatests/src/org/chromium/browserfragment/test/InstrumentationActivityTestRule.java b/weblayer/browser/android/javatests/src/org/chromium/browserfragment/test/InstrumentationActivityTestRule.java new file mode 100644 index 0000000..84cebd7 --- /dev/null +++ b/weblayer/browser/android/javatests/src/org/chromium/browserfragment/test/InstrumentationActivityTestRule.java
@@ -0,0 +1,52 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.browserfragment.test; + +import android.content.ComponentName; +import android.content.Intent; +import android.support.test.InstrumentationRegistry; + +import org.junit.Rule; + +import org.chromium.browserfragment.shell.InstrumentationActivity; +import org.chromium.net.test.EmbeddedTestServer; +import org.chromium.net.test.EmbeddedTestServerRule; + +/** + * ActivityTestRule for InstrumentationActivity. + * + * Test can use this ActivityTestRule to launch or get InstrumentationActivity. + */ +public class InstrumentationActivityTestRule + extends BrowserFragmentActivityTestRule<InstrumentationActivity> { + @Rule + private EmbeddedTestServerRule mTestServerRule = new EmbeddedTestServerRule(); + + public InstrumentationActivityTestRule() { + super(InstrumentationActivity.class); + } + + /** + * Starts the BrowserFragment Instrumentation activity. + */ + public InstrumentationActivity launchShell() { + Intent intent = new Intent(Intent.ACTION_MAIN); + intent.addCategory(Intent.CATEGORY_LAUNCHER); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent.setComponent( + new ComponentName(InstrumentationRegistry.getInstrumentation().getTargetContext(), + InstrumentationActivity.class)); + launchActivity(intent); + return getActivity(); + } + + public EmbeddedTestServer getTestServer() { + return mTestServerRule.getServer(); + } + + public String getTestDataURL(String path) { + return getTestServer().getURL("/weblayer/test/data/" + path); + } +}
diff --git a/weblayer/shell/android/BUILD.gn b/weblayer/shell/android/BUILD.gn index e42345a..136dccf 100644 --- a/weblayer/shell/android/BUILD.gn +++ b/weblayer/shell/android/BUILD.gn
@@ -130,7 +130,10 @@ testonly = true resources_package = "org.chromium.browserfragment.shell" - sources = [ "browserfragment_shell_apk/src/org/chromium/browserfragment/shell/BrowserFragmentShellActivity.java" ] + sources = [ + "browserfragment_shell_apk/src/org/chromium/browserfragment/shell/BrowserFragmentShellActivity.java", + "browserfragment_shell_apk/src/org/chromium/browserfragment/shell/InstrumentationActivity.java", + ] deps = [ ":browserfragment_service_provider_resources",
diff --git a/weblayer/shell/android/browserfragment_shell_apk/AndroidManifest.xml b/weblayer/shell/android/browserfragment_shell_apk/AndroidManifest.xml index 6db87b6..6e140311 100644 --- a/weblayer/shell/android/browserfragment_shell_apk/AndroidManifest.xml +++ b/weblayer/shell/android/browserfragment_shell_apk/AndroidManifest.xml
@@ -25,6 +25,12 @@ <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> + <activity android:name="InstrumentationActivity" + android:launchMode="singleTask" + android:theme="@style/ShellTheme" + android:windowSoftInputMode="adjustResize" + android:exported="true"> + </activity> <meta-data android:name="asset_statements" android:resource="@string/asset_statements" />
diff --git a/weblayer/shell/android/browserfragment_shell_apk/src/org/chromium/browserfragment/shell/InstrumentationActivity.java b/weblayer/shell/android/browserfragment_shell_apk/src/org/chromium/browserfragment/shell/InstrumentationActivity.java new file mode 100644 index 0000000..e74cb536 --- /dev/null +++ b/weblayer/shell/android/browserfragment_shell_apk/src/org/chromium/browserfragment/shell/InstrumentationActivity.java
@@ -0,0 +1,32 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.browserfragment.shell; + +import android.os.Bundle; + +import androidx.appcompat.app.AppCompatActivity; + +import com.google.common.util.concurrent.ListenableFuture; + +import org.chromium.browserfragment.Browser; + +/** + * Activity for running instrumentation tests. + */ +public class InstrumentationActivity extends AppCompatActivity { + private ListenableFuture<Browser> mBrowserFuture; + + @Override + protected void onCreate(final Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.main); + + mBrowserFuture = Browser.create(getApplicationContext()); + } + + public ListenableFuture<Browser> getBrowserFuture() { + return mBrowserFuture; + } +} \ No newline at end of file