M124 stage 6

This commit is contained in:
Alexander Frick 2024-05-12 09:57:32 -05:00
parent 3c76b59ab5
commit c6c07c27b0
5 changed files with 77 additions and 116 deletions

View file

@ -897,9 +897,10 @@ Browser::WarnBeforeClosingResult Browser::MaybeWarnBeforeClosing(
// before-unload handlers by setting `force_skip_warning_user_on_close_` to
// true or there are no pending downloads we need to prompt about) then
// there's no need to warn.
if (force_skip_warning_user_on_close_ || CanCloseWithInProgressDownloads())
if (force_skip_warning_user_on_close_ || CanCloseWithInProgressDownloads()) {
if (CanCloseWithMultipleTabs())
return WarnBeforeClosingResult::kOkToClose;
}
DCHECK(!warn_before_closing_callback_)
<< "Tried to close window during close warning; dialog should be modal.";
@ -1320,14 +1321,16 @@ void Browser::OnTabGroupChanged(const TabGroupChange& change) {
tab_strip_model_->group_model()
->GetTabGroup(change.group)
->visual_data();
const SavedTabGroupKeyedService* const saved_tab_group_keyed_service =
base::FeatureList::IsEnabled(features::kTabGroupsSave)
? SavedTabGroupServiceFactory::GetForProfile(profile_)
: nullptr;
const tab_groups::SavedTabGroupKeyedService* const
saved_tab_group_keyed_service =
base::FeatureList::IsEnabled(features::kTabGroupsSave)
? tab_groups::SavedTabGroupServiceFactory::GetForProfile(
profile_)
: nullptr;
std::optional<std::string> saved_guid;
if (saved_tab_group_keyed_service) {
const SavedTabGroup* const saved_group =
const tab_groups::SavedTabGroup* const saved_group =
saved_tab_group_keyed_service->model()->Get(change.group);
if (saved_group) {
saved_guid = saved_group->saved_guid().AsLowercaseString();
@ -1613,10 +1616,6 @@ void Browser::MediaWatchTimeChanged(
const content::MediaPlayerWatchTime& watch_time) {
}
base::WeakPtr<content::WebContentsDelegate> Browser::GetDelegateWeakPtr() {
return AsWeakPtr();
}
bool Browser::IsPointerLocked() const {
return exclusive_access_manager_->pointer_lock_controller()
->IsPointerLocked();
@ -2309,7 +2308,8 @@ void Browser::RequestPointerLock(WebContents* web_contents,
}
void Browser::LostPointerLock() {
exclusive_access_manager_->pointer_lock_controller()->LostPointerLock();
exclusive_access_manager_->pointer_lock_controller()
->ExitExclusiveAccessToPreviousState();
}
void Browser::RequestKeyboardLock(WebContents* web_contents,
@ -2389,18 +2389,25 @@ void Browser::SetWebContentsBlocked(content::WebContents* web_contents,
return;
}
// For security, if the WebContents is in fullscreen, have it drop fullscreen.
// This gives the user the context they need in order to make informed
// decisions.
if (web_contents->IsFullscreen()) {
// FullscreenWithinTab mode exception: In this case, the browser window is
// in its normal layout and not fullscreen (tab content rendering is in a
// "simulated fullscreen" state for the benefit of screen capture). Thus,
// the user has the same context as they would in any non-fullscreen
// scenario. See "FullscreenWithinTab note" in FullscreenController's
// class-level comments for further details.
if (!exclusive_access_manager_->fullscreen_controller()
->IsFullscreenWithinTab(web_contents)) {
// Drop HTML fullscreen to give users context for making informed decisions.
// Skip browser-fullscreen, which is more expressly user-initiated.
// Skip fullscreen-within-tab, which shows the browser frame.
if (blocked && GetFullscreenState(web_contents).target_mode ==
content::FullscreenMode::kContent) {
bool exit_fullscreen = true;
if (base::FeatureList::IsEnabled(
features::kAutomaticFullscreenContentSetting)) {
// Skip URLs with the automatic fullscreen content setting granted.
const GURL& url = web_contents->GetLastCommittedURL();
const HostContentSettingsMap* const content_settings =
HostContentSettingsMapFactory::GetForProfile(
web_contents->GetBrowserContext());
exit_fullscreen =
content_settings->GetContentSetting(
url, url, ContentSettingsType::AUTOMATIC_FULLSCREEN) !=
CONTENT_SETTING_ALLOW;
}
if (exit_fullscreen) {
web_contents->ExitFullscreen(true);
}
}

View file

@ -772,7 +772,6 @@ class Browser : public TabStripModelObserver,
bool ShouldShowStaleContentOnEviction(content::WebContents* source) override;
void MediaWatchTimeChanged(
const content::MediaPlayerWatchTime& watch_time) override;
base::WeakPtr<content::WebContentsDelegate> GetDelegateWeakPtr() override;
std::unique_ptr<content::EyeDropper> OpenEyeDropper(
content::RenderFrameHost* frame,
content::EyeDropperListener* listener) override;

View file

@ -18,8 +18,8 @@
#include "chrome/app/chrome_command_ids.h"
#include "components/lens/buildflags.h"
#include "components/lens/lens_features.h"
#include "components/services/screen_ai/buildflags/buildflags.h"
#include "printing/buildflags/buildflags.h"
#include "services/screen_ai/buildflags/buildflags.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/ui_base_features.h"
#include "ui/events/event_constants.h"

View file

@ -74,7 +74,7 @@
#include "chrome/browser/ui/views/toolbar/app_menu.h"
#include "chrome/browser/ui/views/toolbar/back_forward_button.h"
#include "chrome/browser/ui/views/toolbar/browser_app_menu_button.h"
#include "chrome/browser/ui/views/toolbar/chrome_labs_button.h"
#include "chrome/browser/ui/views/toolbar/chrome_labs/chrome_labs_button.h"
#include "chrome/browser/ui/views/toolbar/home_button.h"
#include "chrome/browser/ui/views/toolbar/pinned_toolbar_actions_container.h"
#include "chrome/browser/ui/views/toolbar/reload_button.h"
@ -1212,9 +1212,17 @@ DownloadToolbarButtonView* ToolbarView::GetDownloadButton() {
return download_button();
}
BrowserRootView::DropIndex ToolbarView::GetDropIndex(
const ui::DropTargetEvent& event) {
return {browser_->tab_strip_model()->active_index(), false};
std::optional<BrowserRootView::DropIndex> ToolbarView::GetDropIndex(
const ui::DropTargetEvent& event,
bool allow_replacement) {
if (!allow_replacement) {
return std::nullopt;
}
return BrowserRootView::DropIndex{
.index = browser_->tab_strip_model()->active_index(),
.relative_to_index =
BrowserRootView::DropIndex::RelativeToIndex::kReplaceIndex};
}
BrowserRootView::DropTarget* ToolbarView::GetDropTarget(

View file

@ -97,7 +97,6 @@ source_set("browser") {
"//components/payments/mojom",
"//components/power_monitor",
"//components/services/filesystem:lib",
"//components/services/screen_ai/buildflags",
"//components/services/storage",
"//components/services/storage:filesystem_proxy_factory",
"//components/services/storage/dom_storage:local_storage_proto",
@ -131,7 +130,7 @@ source_set("browser") {
"//content/browser/devtools:protocol_sources",
"//content/browser/download:proto",
"//content/browser/file_system_access:proto",
"//content/browser/indexed_db:mojo_bindings",
"//content/browser/indexed_db:internals_mojo_bindings",
"//content/browser/interest_group:interest_group_proto",
"//content/browser/notifications:notification_proto",
"//content/browser/payments:payment_app_proto",
@ -210,6 +209,7 @@ source_set("browser") {
"//services/network/public/mojom",
"//services/resource_coordinator:lib",
"//services/resource_coordinator/public/cpp:resource_coordinator_cpp",
"//services/screen_ai/buildflags",
"//services/service_manager/public/cpp",
"//services/service_manager/public/mojom",
"//services/shape_detection:lib",
@ -251,7 +251,6 @@ source_set("browser") {
"//third_party/sqlite",
"//third_party/webrtc_overrides:webrtc_component",
"//third_party/zlib",
"//third_party/zlib/google:zip",
"//tools/v8_context_snapshot:buildflags",
"//ui/accessibility",
"//ui/accessibility:ax_enums_mojo",
@ -297,8 +296,10 @@ source_set("browser") {
public_deps = [
"//base",
"//components/memory_pressure",
"//content/browser/indexed_db",
"//ipc",
"//media/mojo/mojom:remoting",
"//skia:skia_switches",
"//third_party/blink/public/mojom:embedded_frame_sink_mojo_bindings",
"//third_party/leveldatabase",
"//ui/base/cursor",
@ -378,7 +379,6 @@ source_set("browser") {
"accessibility/render_accessibility_host.h",
"accessibility/scoped_mode_collection.cc",
"accessibility/scoped_mode_collection.h",
"accessibility/web_ax_platform_tree_manager_delegate.h",
"accessibility/web_contents_accessibility.h",
"after_startup_task_utils.cc",
"after_startup_task_utils.h",
@ -474,8 +474,6 @@ source_set("browser") {
"attribution_reporting/create_report_result.h",
"attribution_reporting/os_registration.cc",
"attribution_reporting/os_registration.h",
"attribution_reporting/privacy_math.cc",
"attribution_reporting/privacy_math.h",
"attribution_reporting/rate_limit_result.h",
"attribution_reporting/rate_limit_table.cc",
"attribution_reporting/rate_limit_table.h",
@ -984,8 +982,6 @@ source_set("browser") {
"file_system_access/file_system_access_access_handle_host_impl.h",
"file_system_access/file_system_access_bucket_path_watcher.cc",
"file_system_access/file_system_access_bucket_path_watcher.h",
"file_system_access/file_system_access_capacity_allocation_host_impl.cc",
"file_system_access/file_system_access_capacity_allocation_host_impl.h",
"file_system_access/file_system_access_change_source.cc",
"file_system_access/file_system_access_change_source.h",
"file_system_access/file_system_access_data_transfer_token_impl.cc",
@ -998,6 +994,8 @@ source_set("browser") {
"file_system_access/file_system_access_file_delegate_host_impl.h",
"file_system_access/file_system_access_file_handle_impl.cc",
"file_system_access/file_system_access_file_handle_impl.h",
"file_system_access/file_system_access_file_modification_host_impl.cc",
"file_system_access/file_system_access_file_modification_host_impl.h",
"file_system_access/file_system_access_file_writer_impl.cc",
"file_system_access/file_system_access_file_writer_impl.h",
"file_system_access/file_system_access_handle_base.cc",
@ -1094,80 +1092,8 @@ source_set("browser") {
"idle/idle_manager_impl.h",
"image_capture/image_capture_impl.cc",
"image_capture/image_capture_impl.h",
"indexed_db/database_impl.cc",
"indexed_db/database_impl.h",
"indexed_db/file_path_util.cc",
"indexed_db/file_path_util.h",
"indexed_db/file_stream_reader_to_data_pipe.cc",
"indexed_db/file_stream_reader_to_data_pipe.h",
"indexed_db/indexed_db.h",
"indexed_db/indexed_db_active_blob_registry.cc",
"indexed_db/indexed_db_active_blob_registry.h",
"indexed_db/indexed_db_backing_store.cc",
"indexed_db/indexed_db_backing_store.h",
"indexed_db/indexed_db_bucket_context.cc",
"indexed_db/indexed_db_bucket_context.h",
"indexed_db/indexed_db_bucket_context_handle.cc",
"indexed_db/indexed_db_bucket_context_handle.h",
"indexed_db/indexed_db_callback_helpers.cc",
"indexed_db/indexed_db_callback_helpers.h",
"indexed_db/indexed_db_compaction_task.cc",
"indexed_db/indexed_db_compaction_task.h",
"indexed_db/indexed_db_connection.cc",
"indexed_db/indexed_db_connection.h",
"indexed_db/indexed_db_connection_coordinator.cc",
"indexed_db/indexed_db_connection_coordinator.h",
"indexed_db/indexed_db_context_impl.cc",
"indexed_db/indexed_db_context_impl.h",
"indexed_db/indexed_db_control_wrapper.cc",
"indexed_db/indexed_db_control_wrapper.h",
"indexed_db/indexed_db_cursor.cc",
"indexed_db/indexed_db_cursor.h",
"indexed_db/indexed_db_data_format_version.cc",
"indexed_db/indexed_db_data_format_version.h",
"indexed_db/indexed_db_data_loss_info.h",
"indexed_db/indexed_db_database.cc",
"indexed_db/indexed_db_database.h",
"indexed_db/indexed_db_database_callbacks.cc",
"indexed_db/indexed_db_database_callbacks.h",
"indexed_db/indexed_db_database_error.cc",
"indexed_db/indexed_db_database_error.h",
"indexed_db/indexed_db_external_object.cc",
"indexed_db/indexed_db_external_object.h",
"indexed_db/indexed_db_external_object_storage.cc",
"indexed_db/indexed_db_external_object_storage.h",
"indexed_db/indexed_db_factory_client.cc",
"indexed_db/indexed_db_factory_client.h",
"indexed_db/indexed_db_index_writer.cc",
"indexed_db/indexed_db_index_writer.h",
"indexed_db/indexed_db_internals_ui.cc",
"indexed_db/indexed_db_internals_ui.h",
"indexed_db/indexed_db_leveldb_coding.cc",
"indexed_db/indexed_db_leveldb_coding.h",
"indexed_db/indexed_db_leveldb_operations.cc",
"indexed_db/indexed_db_leveldb_operations.h",
"indexed_db/indexed_db_lock_request_data.cc",
"indexed_db/indexed_db_lock_request_data.h",
"indexed_db/indexed_db_pending_connection.cc",
"indexed_db/indexed_db_pending_connection.h",
"indexed_db/indexed_db_pre_close_task_queue.cc",
"indexed_db/indexed_db_pre_close_task_queue.h",
"indexed_db/indexed_db_quota_client.cc",
"indexed_db/indexed_db_quota_client.h",
"indexed_db/indexed_db_reporting.cc",
"indexed_db/indexed_db_reporting.h",
"indexed_db/indexed_db_return_value.cc",
"indexed_db/indexed_db_return_value.h",
"indexed_db/indexed_db_task_helper.h",
"indexed_db/indexed_db_tombstone_sweeper.cc",
"indexed_db/indexed_db_tombstone_sweeper.h",
"indexed_db/indexed_db_transaction.cc",
"indexed_db/indexed_db_transaction.h",
"indexed_db/indexed_db_value.cc",
"indexed_db/indexed_db_value.h",
"indexed_db/list_set.h",
"indexed_db/mock_browsertest_indexed_db_class_factory.cc",
"indexed_db/mock_browsertest_indexed_db_class_factory.h",
"installedapp/installed_app_provider_impl.cc",
"installedapp/installed_app_provider_impl.h",
"interest_group/ad_auction_document_data.cc",
@ -1864,6 +1790,8 @@ source_set("browser") {
"renderer_host/navigation_request.h",
"renderer_host/navigation_request_info.cc",
"renderer_host/navigation_request_info.h",
"renderer_host/navigation_state_keep_alive.cc",
"renderer_host/navigation_state_keep_alive.h",
"renderer_host/navigation_throttle_runner.cc",
"renderer_host/navigation_throttle_runner.h",
"renderer_host/navigation_transitions/navigation_entry_screenshot.cc",
@ -1961,6 +1889,8 @@ source_set("browser") {
"renderer_host/renderer_cancellation_throttle.h",
"renderer_host/renderer_sandboxed_process_launcher_delegate.cc",
"renderer_host/renderer_sandboxed_process_launcher_delegate.h",
"renderer_host/scoped_view_transition_resources.cc",
"renderer_host/scoped_view_transition_resources.h",
"renderer_host/should_swap_browsing_instance.h",
"renderer_host/spare_render_process_host_manager.cc",
"renderer_host/spare_render_process_host_manager.h",
@ -2311,8 +2241,8 @@ source_set("browser") {
"webauth/client_data_json.h",
"webauth/webauth_request_security_checker.cc",
"webauth/webauth_request_security_checker.h",
"webid/digital_credentials/digital_identity_provider.cc",
"webid/digital_credentials/digital_identity_provider.h",
"webid/digital_credentials/digital_identity_provider_utils.cc",
"webid/digital_credentials/digital_identity_provider_utils.h",
"webid/digital_credentials/digital_identity_request_impl.cc",
"webid/digital_credentials/digital_identity_request_impl.h",
"webid/fake_identity_request_dialog_controller.cc",
@ -2573,7 +2503,7 @@ source_set("browser") {
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.accessibility.semantics:fuchsia.accessibility.semantics_cpp",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.mediacodec:fuchsia.mediacodec_hlcpp",
"//third_party/fuchsia-sdk/sdk/pkg/inspect",
"//third_party/fuchsia-sdk/sdk/pkg/sys_inspect_cpp",
"//third_party/fuchsia-sdk/sdk/pkg/inspect_component_cpp",
"//third_party/fuchsia-sdk/sdk/pkg/zx",
"//ui/accessibility",
]
@ -2707,7 +2637,7 @@ source_set("browser") {
]
} else if (is_ios) {
sources += [
"child_process_launcher_helper_ios.cc",
"child_process_launcher_helper_ios.mm",
"date_time_chooser/ios/date_time_chooser_coordinator.h",
"date_time_chooser/ios/date_time_chooser_coordinator.mm",
"date_time_chooser/ios/date_time_chooser_delegate.h",
@ -2736,8 +2666,14 @@ source_set("browser") {
"web_contents/web_contents_view_ios.h",
"web_contents/web_contents_view_ios.mm",
]
frameworks += [ "IOSurface.framework" ]
deps += [ "//ui/accelerated_widget_mac" ]
frameworks += [
"BrowserEngineKit.framework",
"IOSurface.framework",
]
deps += [
"//build:ios_buildflags",
"//ui/accelerated_widget_mac",
]
} else {
# Not Mac.
deps += [ "//sandbox" ]
@ -2848,6 +2784,8 @@ source_set("browser") {
"child_process_launcher_helper_win.cc",
"device_posture/device_posture_platform_provider_win.cc",
"device_posture/device_posture_platform_provider_win.h",
"device_posture/device_posture_registry_watcher_win.cc",
"device_posture/device_posture_registry_watcher_win.h",
"font_access/font_enumeration_data_source_win.cc",
"font_access/font_enumeration_data_source_win.h",
"installedapp/installed_app_provider_impl_win.cc",
@ -2885,8 +2823,8 @@ source_set("browser") {
"__ATLHOST_H__",
]
deps += [
"//components/services/screen_ai/public/cpp:utilities",
"//content/utility:delegate_data",
"//services/screen_ai/public/cpp:utilities",
"//third_party/blink/public/common:font_unique_name_table_proto",
"//third_party/iaccessible2",
"//third_party/isimpledom",
@ -3071,6 +3009,8 @@ source_set("browser") {
"accessibility/accessibility_tree_formatter_android.h",
"accessibility/accessibility_tree_formatter_android_external.cc",
"accessibility/accessibility_tree_formatter_android_external.h",
"accessibility/accessibility_tree_snapshot_combiner.cc",
"accessibility/accessibility_tree_snapshot_combiner.h",
"accessibility/browser_accessibility_android.cc",
"accessibility/browser_accessibility_android.h",
"accessibility/browser_accessibility_manager_android.cc",
@ -3330,6 +3270,8 @@ source_set("browser") {
"speech/endpointer/energy_endpointer.h",
"speech/endpointer/energy_endpointer_params.cc",
"speech/endpointer/energy_endpointer_params.h",
"speech/network_speech_recognition_engine_impl.cc",
"speech/network_speech_recognition_engine_impl.h",
"speech/speech_recognition_engine.cc",
"speech/speech_recognition_engine.h",
"speech/speech_recognizer_impl.cc",
@ -3385,6 +3327,10 @@ source_set("browser") {
deps += [ "//content/browser/devtools:devtools_resources_extern" ]
}
if (is_win) {
deps += [ "//ui/base/ime/win" ]
}
if (use_aura) {
deps += [
"//ui/aura",
@ -3527,6 +3473,7 @@ if (is_android) {
# See comment at the top of //content/BUILD.gn for how this works.
group("for_content_tests") {
visibility = [
"//content/browser/indexed_db:unit_tests",
"//content/public/test/android/*",
"//content/test/*",
"//content/web_test:web_test_browser",