chromium/content/browser/web_contents/web_contents_view_aura.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/web_contents/web_contents_view_aura.h"

#include <stddef.h>
#include <stdint.h>

#include <memory>
#include <string>
#include <utility>

#include "base/auto_reset.h"
#include "base/command_line.h"
#include "base/containers/flat_set.h"
#include "base/feature_list.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/no_destructor.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/current_thread.h"
#include "base/task/thread_pool.h"
#include "build/build_config.h"
#include "components/input/render_widget_host_input_event_router.h"
#include "components/viz/common/features.h"
#include "content/browser/browser_plugin/browser_plugin_guest.h"
#include "content/browser/download/drag_download_util.h"
#include "content/browser/renderer_host/dip_util.h"
#include "content/browser/renderer_host/input/touch_selection_controller_client_aura.h"
#include "content/browser/renderer_host/navigation_entry_impl.h"
#include "content/browser/renderer_host/navigation_request.h"
#include "content/browser/renderer_host/overscroll_controller.h"
#include "content/browser/renderer_host/render_view_host_factory.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_aura.h"
#include "content/browser/web_contents/aura/gesture_nav_simple.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/child_process_host.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/overscroll_configuration.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_view_delegate.h"
#include "content/public/browser/web_drag_dest_delegate.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_features.h"
#include "net/base/filename_util.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "third_party/blink/public/mojom/drag/drag.mojom.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/drag_drop_client.h"
#include "ui/aura/client/drag_drop_delegate.h"
#include "ui/aura/client/screen_position_client.h"
#include "ui/aura/client/window_parenting_client.h"
#include "ui/aura/env.h"
#include "ui/aura/window.h"
#include "ui/aura/window_observer.h"
#include "ui/aura/window_tree_host_observer.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/clipboard/custom_data_helper.h"
#include "ui/base/clipboard/file_info.h"
#include "ui/base/data_transfer_policy/data_transfer_endpoint.h"
#include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/base/dragdrop/drop_target_event.h"
#include "ui/base/dragdrop/mojom/drag_drop_types.mojom.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/base/dragdrop/os_exchange_data_provider_factory.h"
#include "ui/base/hit_test.h"
#include "ui/base/ui_base_features.h"
#include "ui/compositor/layer.h"
#include "ui/display/screen.h"
#include "ui/events/blink/web_input_event.h"
#include "ui/events/event.h"
#include "ui/events/event_utils.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_png_rep.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/touch_selection/touch_selection_controller.h"

namespace content {

std::unique_ptr<WebContentsView> CreateWebContentsView(
    WebContentsImpl* web_contents,
    std::unique_ptr<WebContentsViewDelegate> delegate,
    raw_ptr<RenderViewHostDelegateView>* render_view_host_delegate_view) {}

class ScopedAllowBlockingForViewAura : public base::ScopedAllowBlocking {};

namespace {

DragOperation;

WebContentsViewAura::RenderWidgetHostViewCreateFunction
    g_create_render_widget_host_view =;

RenderWidgetHostViewAura* ToRenderWidgetHostViewAura(
    RenderWidgetHostView* view) {}

// Listens to all mouse drag events during a drag and drop and sends them to
// the renderer.
class WebDragSourceAura : public content::WebContentsObserver,
                          public aura::WindowObserver {};

#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN)
// Fill out the OSExchangeData with a file contents, synthesizing a name if
// necessary.
void PrepareDragForFileContents(const DropData& drop_data,
                                ui::OSExchangeDataProvider* provider) {}
#endif

#if BUILDFLAG(IS_WIN)
void PrepareDragForDownload(const DropData& drop_data,
                            ui::OSExchangeDataProvider* provider,
                            WebContentsImpl* web_contents) {
  const GURL& page_url = web_contents->GetLastCommittedURL();
  const std::string& page_encoding = web_contents->GetEncoding();

  // Parse the download metadata.
  std::u16string mime_type;
  base::FilePath file_name;
  GURL download_url;
  if (!ParseDownloadMetadata(drop_data.download_metadata,
                             &mime_type,
                             &file_name,
                             &download_url))
    return;

  // Generate the file name based on both mime type and proposed file name.
  std::string default_name =
      GetContentClient()->browser()->GetDefaultDownloadName();
  base::FilePath generated_download_file_name =
      net::GenerateFileName(download_url, std::string(), std::string(),
                            base::WideToUTF8(file_name.value()),
                            base::UTF16ToUTF8(mime_type), default_name);

  // http://crbug.com/332579
  ScopedAllowBlockingForViewAura allow_file_operations;

  base::FilePath temp_dir_path;
  if (!base::CreateNewTempDirectory(FILE_PATH_LITERAL("chrome_drag"),
                                    &temp_dir_path))
    return;

  base::FilePath download_path =
      temp_dir_path.Append(generated_download_file_name);

  // We cannot know when the target application will be done using the temporary
  // file, so schedule it to be deleted after rebooting.
  base::DeleteFileAfterReboot(download_path);
  base::DeleteFileAfterReboot(temp_dir_path);

  // Provide the data as file (CF_HDROP). A temporary download file with the
  // Zone.Identifier ADS (Alternate Data Stream) attached will be created.
  auto download_file = std::make_unique<DragDownloadFile>(
      download_path, base::File(), download_url,
      Referrer(page_url, drop_data.referrer_policy), page_encoding,
      provider->GetRendererTaintedOrigin(), web_contents);
  ui::DownloadFileInfo file_download(base::FilePath(),
                                     std::move(download_file));
  provider->SetDownloadFileInfo(&file_download);
}
#endif  // BUILDFLAG(IS_WIN)

// Returns the ClipboardFormatType to store file system files.
const ui::ClipboardFormatType& GetFileSystemFileFormatType() {}

// Utility to fill a ui::OSExchangeDataProvider object from DropData.
void PrepareDragData(const DropData& drop_data,
                     const url::Origin source_origin,
                     ui::OSExchangeDataProvider* provider,
                     WebContentsImpl* web_contents) {}

#if BUILDFLAG(IS_WIN)
// Function returning whether this drop target should extract virtual file data
// from the data store.
// (1) As with real files, only add virtual files if the drag did not originate
// in the renderer process. Without this, if an anchor element is dragged and
// then dropped on the same page, the browser will navigate to the URL
// referenced by the anchor. That is because virtual ".url" file data
// (internet shortcut) is added to the data object on drag start, and if
// script doesn't handle the drop, the browser behaves just as if a .url file
// were dragged in from the desktop. Filtering out virtual files if the drag
// is renderer tainted also prevents the possibility of a compromised renderer
// gaining access to the backing temp file paths.
// (2) Even if the drag is not renderer tainted, also exclude virtual files
// if the UniformResourceLocatorW clipboard format is found in the data object.
// Drags initiated in the browser process, such as dragging a bookmark from
// the bookmark bar, will add a virtual .url file to the data object using the
// CFSTR_FILEDESCRIPTORW/CFSTR_FILECONTENTS formats, which represents an
// internet shortcut intended to be  dropped on the desktop. But this causes a
// regression in the behavior of the extensions page (see
// https://crbug.com/963392). The primary scenario for introducing virtual file
// support was for dragging items out of Outlook.exe for upload to a file
// hosting service. The Outlook drag source does not add url data to the data
// object.
// TODO(crbug.com/41456054): DragDrop: Extend virtual filename support
// to DropData, for parity with real filename support.
// TODO(crbug.com/41459545): Drag and drop: Should support both virtual
// file and url data on drop.
bool ShouldIncludeVirtualFiles(const DropData& drop_data) {
  return !drop_data.did_originate_from_renderer && drop_data.url.is_empty();
}
#endif

// Utilities to convert between blink::DragOperationsMask and
// ui::DragDropTypes.
int ConvertFromDragOperationsMask(blink::DragOperationsMask ops) {}

blink::DragOperationsMask ConvertToDragOperationsMask(int drag_op) {}

GlobalRoutingID GetRenderViewHostID(RenderViewHost* rvh) {}

// Returns the host window for |window|, or nullpr if it has no host window.
aura::Window* GetHostWindow(aura::Window* window) {}

}  // namespace

WebContentsViewAura::DropMetadata::DropMetadata(
    const ui::DropTargetEvent& event) {}

WebContentsViewAura::OnPerformingDropContext::OnPerformingDropContext(
    RenderWidgetHostImpl* target_rwh,
    std::unique_ptr<DropData> drop_data,
    DropMetadata drop_metadata,
    std::unique_ptr<ui::OSExchangeData> data,
    base::ScopedClosureRunner end_drag_runner,
    std::optional<gfx::PointF> transformed_pt,
    gfx::PointF screen_pt)
    :{}

WebContentsViewAura::OnPerformingDropContext::OnPerformingDropContext(
    OnPerformingDropContext&&) = default;

WebContentsViewAura::OnPerformingDropContext::~OnPerformingDropContext() =
    default;

#if BUILDFLAG(IS_WIN)
// A web contents observer that watches for navigations while an async drop
// operation is in progress during virtual file data retrieval and temp file
// creation. Navigations may cause completion of the drop to be disallowed.
class WebContentsViewAura::AsyncDropNavigationObserver
    : public WebContentsObserver {
 public:
  explicit AsyncDropNavigationObserver(WebContents* watched_contents);

  AsyncDropNavigationObserver(const AsyncDropNavigationObserver&) = delete;
  AsyncDropNavigationObserver& operator=(const AsyncDropNavigationObserver&) =
      delete;

  // WebContentsObserver:
  void DidFinishNavigation(NavigationHandle* navigation_handle) override;

  // Was a navigation observed while the async drop was being processed that
  // should disallow the drop?
  bool drop_allowed() const { return drop_allowed_; }

 private:
  bool drop_allowed_ = true;
};

WebContentsViewAura::AsyncDropNavigationObserver::AsyncDropNavigationObserver(
    WebContents* watched_contents)
    : WebContentsObserver(watched_contents) {}

void WebContentsViewAura::AsyncDropNavigationObserver::DidFinishNavigation(
    NavigationHandle* navigation_handle) {
  auto* navigation_request = NavigationRequest::From(navigation_handle);
  // This method is called every time any navigation completes in the observed
  // web contents, including subframe navigations. In the case of a subframe
  // navigation, we can't readily determine on the browser process side if the
  // navigated subframe is the intended drop target. Err on the side of security
  // and disallow the drop if any navigation commits to a different url.
  // Note that this method is called twice for prerendering, one when the
  // prerendering starts and the document is created and starts loading and one
  // when the prerendered document has been activated and shown to the user.
  // We should not disallow the drop for the former prerendering state.
  if (navigation_request->HasCommitted() &&
      (navigation_request->GetURL() !=
       navigation_request->GetPreviousMainFrameURL()) &&
      navigation_request->GetRenderFrameHost()->GetLifecycleState() !=
          RenderFrameHost::LifecycleState::kPrerendering) {
    drop_allowed_ = false;
  }
}

// Deletes registered temp files asynchronously when the object goes out of
// scope (when the WebContentsViewAura is deleted on tab closure).
class WebContentsViewAura::AsyncDropTempFileDeleter {
 public:
  AsyncDropTempFileDeleter() = default;

  AsyncDropTempFileDeleter(const AsyncDropTempFileDeleter&) = delete;
  AsyncDropTempFileDeleter& operator=(const AsyncDropTempFileDeleter&) = delete;

  ~AsyncDropTempFileDeleter();
  void RegisterFile(const base::FilePath& path);

 private:
  void DeleteAllFilesAsync() const;
  void DeleteFileAsync(const base::FilePath& path) const;

  std::vector<base::FilePath> scoped_files_to_delete_;
};

WebContentsViewAura::AsyncDropTempFileDeleter::~AsyncDropTempFileDeleter() {
  DeleteAllFilesAsync();
}

void WebContentsViewAura::AsyncDropTempFileDeleter::RegisterFile(
    const base::FilePath& path) {
  scoped_files_to_delete_.push_back(path);
}

void WebContentsViewAura::AsyncDropTempFileDeleter::DeleteAllFilesAsync()
    const {
  for (const auto& path : scoped_files_to_delete_)
    DeleteFileAsync(path);
}

void WebContentsViewAura::AsyncDropTempFileDeleter::DeleteFileAsync(
    const base::FilePath& path) const {
  base::ThreadPool::PostTask(FROM_HERE,
                             {base::MayBlock(), base::TaskPriority::BEST_EFFORT,
                              base::TaskShutdownBehavior::BLOCK_SHUTDOWN},
                             base::GetDeleteFileCallback(std::move(path)));
}
#endif

class WebContentsViewAura::WindowObserver
    : public aura::WindowObserver, public aura::WindowTreeHostObserver {};

// static
void WebContentsViewAura::InstallCreateHookForTests(
    RenderWidgetHostViewCreateFunction create_render_widget_host_view) {}

////////////////////////////////////////////////////////////////////////////////
// WebContentsViewAura, public:

WebContentsViewAura::WebContentsViewAura(
    WebContentsImpl* web_contents,
    std::unique_ptr<WebContentsViewDelegate> delegate)
    :{}

WebContentsViewAura::~WebContentsViewAura() {}

void WebContentsViewAura::SetDelegateForTesting(
    std::unique_ptr<WebContentsViewDelegate> delegate) {}

////////////////////////////////////////////////////////////////////////////////
// WebContentsViewAura, private:

void WebContentsViewAura::PrepareDropData(
    DropData* drop_data,
    const ui::OSExchangeData& data) const {}

void WebContentsViewAura::EndDrag(
    base::WeakPtr<RenderWidgetHostImpl> source_rwh_weak_ptr,
    DragOperation op) {}

void WebContentsViewAura::InstallOverscrollControllerDelegate(
    RenderWidgetHostViewAura* view) {}

ui::TouchSelectionController* WebContentsViewAura::GetSelectionController()
    const {}

TouchSelectionControllerClientAura*
WebContentsViewAura::GetSelectionControllerClient() const {}

gfx::NativeView WebContentsViewAura::GetRenderWidgetHostViewParent() const {}

////////////////////////////////////////////////////////////////////////////////
// WebContentsViewAura, WebContentsView implementation:

gfx::NativeView WebContentsViewAura::GetNativeView() const {}

gfx::NativeView WebContentsViewAura::GetContentNativeView() const {}

gfx::NativeWindow WebContentsViewAura::GetTopLevelNativeWindow() const {}

gfx::Rect WebContentsViewAura::GetContainerBounds() const {}

void WebContentsViewAura::Focus() {}

void WebContentsViewAura::SetInitialFocus() {}

void WebContentsViewAura::StoreFocus() {}

void WebContentsViewAura::RestoreFocus() {}

void WebContentsViewAura::FocusThroughTabTraversal(bool reverse) {}

DropData* WebContentsViewAura::GetDropData() const {}

gfx::Rect WebContentsViewAura::GetViewBounds() const {}

void WebContentsViewAura::CreateAuraWindow(aura::Window* context) {}

void WebContentsViewAura::UpdateWebContentsVisibility() {}

Visibility WebContentsViewAura::GetVisibility() const {}

////////////////////////////////////////////////////////////////////////////////
// WebContentsViewAura, WebContentsView implementation:

void WebContentsViewAura::CreateView(gfx::NativeView context) {}

RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget(
    RenderWidgetHost* render_widget_host) {}

RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForChildWidget(
    RenderWidgetHost* render_widget_host) {}

void WebContentsViewAura::SetPageTitle(const std::u16string& title) {}

void WebContentsViewAura::RenderViewReady() {}

void WebContentsViewAura::RenderViewHostChanged(RenderViewHost* old_host,
                                                RenderViewHost* new_host) {}

void WebContentsViewAura::SetOverscrollControllerEnabled(bool enabled) {}

void WebContentsViewAura::OnCapturerCountChanged() {}

void WebContentsViewAura::FullscreenStateChanged(bool is_fullscreen) {}

void WebContentsViewAura::UpdateWindowControlsOverlay(
    const gfx::Rect& bounding_rect) {}

BackForwardTransitionAnimationManager*
WebContentsViewAura::GetBackForwardTransitionAnimationManager() {}

////////////////////////////////////////////////////////////////////////////////
// WebContentsViewAura, RenderViewHostDelegateView implementation:

void WebContentsViewAura::ShowContextMenu(RenderFrameHost& render_frame_host,
                                          const ContextMenuParams& params) {}

void WebContentsViewAura::StartDragging(
    const DropData& drop_data,
    const url::Origin& source_origin,
    blink::DragOperationsMask operations,
    const gfx::ImageSkia& image,
    const gfx::Vector2d& cursor_offset,
    const gfx::Rect& drag_obj_rect,
    const blink::mojom::DragEventSourceInfo& event_info,
    RenderWidgetHostImpl* source_rwh) {}

void WebContentsViewAura::UpdateDragOperation(DragOperation operation,
                                              bool document_is_handling_drag) {}

void WebContentsViewAura::GotFocus(RenderWidgetHostImpl* render_widget_host) {}

void WebContentsViewAura::LostFocus(RenderWidgetHostImpl* render_widget_host) {}

void WebContentsViewAura::TakeFocus(bool reverse) {}

////////////////////////////////////////////////////////////////////////////////
// WebContentsViewAura, aura::WindowDelegate implementation:

gfx::Size WebContentsViewAura::GetMinimumSize() const {}

gfx::Size WebContentsViewAura::GetMaximumSize() const {}

void WebContentsViewAura::OnBoundsChanged(const gfx::Rect& old_bounds,
                                          const gfx::Rect& new_bounds) {}

gfx::NativeCursor WebContentsViewAura::GetCursor(const gfx::Point& point) {}

int WebContentsViewAura::GetNonClientComponent(const gfx::Point& point) const {}

bool WebContentsViewAura::ShouldDescendIntoChildForEventHandling(
    aura::Window* child,
    const gfx::Point& location) {}

bool WebContentsViewAura::CanFocus() {}

void WebContentsViewAura::OnCaptureLost() {}

void WebContentsViewAura::OnPaint(const ui::PaintContext& context) {}

void WebContentsViewAura::OnDeviceScaleFactorChanged(
    float old_device_scale_factor,
    float new_device_scale_factor) {}

void WebContentsViewAura::OnWindowDestroying(aura::Window* window) {}

void WebContentsViewAura::OnWindowDestroyed(aura::Window* window) {}

void WebContentsViewAura::OnWindowTargetVisibilityChanged(bool visible) {}

void WebContentsViewAura::OnWindowOcclusionChanged(
    aura::Window::OcclusionState old_occlusion_state,
    aura::Window::OcclusionState new_occlusion_state) {}

bool WebContentsViewAura::HasHitTestMask() const {}

void WebContentsViewAura::GetHitTestMask(SkPath* mask) const {}

////////////////////////////////////////////////////////////////////////////////
// WebContentsViewAura, ui::EventHandler implementation:

void WebContentsViewAura::OnKeyEvent(ui::KeyEvent* event) {}

void WebContentsViewAura::OnMouseEvent(ui::MouseEvent* event) {}

////////////////////////////////////////////////////////////////////////////////
// WebContentsViewAura, aura::client::DragDropDelegate implementation:

void WebContentsViewAura::DragEnteredCallback(
    DropMetadata drop_metadata,
    std::unique_ptr<DropData> drop_data,
    base::WeakPtr<RenderWidgetHostViewBase> target,
    std::optional<gfx::PointF> transformed_pt) {}

void WebContentsViewAura::OnDragEntered(const ui::DropTargetEvent& event) {}

void WebContentsViewAura::DragUpdatedCallback(
    DropMetadata drop_metadata,
    std::unique_ptr<DropData> drop_data,
    base::WeakPtr<RenderWidgetHostViewBase> target,
    std::optional<gfx::PointF> transformed_pt) {}

aura::client::DragUpdateInfo WebContentsViewAura::OnDragUpdated(
    const ui::DropTargetEvent& event) {}

void WebContentsViewAura::OnDragExited() {}

void WebContentsViewAura::CompleteDragExit() {}

// PerformDropCallback() is called once the user releases the mouse button
// over this window.  This function completes the drop if possible.  A drop
// may not be possible for example if the RWH has changed since the user's drag
// entered this view.
//
// Performing the drop is an asynchronous operation that involves the RWH and
// the web contents delegate.  A drop is not considered done by this view until
// all the asynchronous operations complete.
//
// Assuming that a drop is allowed, an instance of OnPerformingDropContext is
// created to keep track of the drop state during the various async operations.
// This context is saved in the `drop_context` argument passed around to the
// various methods. The data being dropped, stored in `current_drag_data_`, is
// moved into the context.
//
// On the Windows platform, if the drop includes virtuals files (for example,
// dropping an email attachment dragged out of the native Outlook application)
// these are first converted into temp real files using the async function
// GetVirtualFilesAsTempFiles().  The callback OnGotVirtualFilesAsTempFiles()
// uses AsyncDropTempFileDeleter to make sure the temp files are deleted once
// the drop completes.  Other platform don't have handling of virtual files.
//
// Next, the delegate is given a chance to handle the dropped data in an async
// manner.  The delegate may perform additional checks on the dropped data,
// may filter that data according to specific criteria, and may even block the
// drop altogether.  For example, some enterprise policies may block
// sensitive data from being dropped on unsanctioned web pages.  This step is
// kicked off by calling MaybeLetDelegateProcessDrop() and the async response is
// handled by GotModifiedDropDataFromDelegate().  In tests it's possible that
// no delegate exists, in which case CompleteDrop() is called
// directly.
//
// GotModifiedDropDataFromDelegate() is called only when a delegate exists and
// processes the result of the delegate's handling of the dropped data.
// Assuming the delegate allows the drop, the dropped data in `drop_context`
// is updated and CompleteDrop() is called.
//
// CompleteDrop() calls CompleteDrop() to send the dropped data to
// the RWH.  At this point the drop is considered completed from this view's
// point of view.
//
// Note that many of the methods above are callback to async operations,
// like this method itself, OnGotVirtualFilesAsTempFiles(),
// GotModifiedDropDataFromDelegate().  Therefore these methods begin with
// similar checks to make sure the drop is still allowed. For example, checks
// to make sure the target RWH has not changed.  See
// drag_security_info_.IsValidDragTarget() for details.
void WebContentsViewAura::PerformDropCallback(
    DropMetadata drop_metadata,
    std::unique_ptr<ui::OSExchangeData> data,
    base::WeakPtr<RenderWidgetHostViewBase> target,
    std::optional<gfx::PointF> transformed_pt) {}

void WebContentsViewAura::MaybeLetDelegateProcessDrop(
    OnPerformingDropContext drop_context) {}

void WebContentsViewAura::GotModifiedDropDataFromDelegate(
    OnPerformingDropContext drop_context,
    std::optional<DropData> drop_data) {}

aura::client::DragDropDelegate::DropCallback
WebContentsViewAura::GetDropCallback(const ui::DropTargetEvent& event) {}

void WebContentsViewAura::CompleteDrop(OnPerformingDropContext drop_context) {}

void WebContentsViewAura::PerformDropOrExitDrag(
    base::ScopedClosureRunner exit_drag,
    DropMetadata drop_metadata,
    std::unique_ptr<ui::OSExchangeData> data,
    ui::mojom::DragOperation& output_drag_op,
    std::unique_ptr<ui::LayerTreeOwner> drag_image_layer_owner) {}

void WebContentsViewAura::RegisterDropCallbackForTesting(
    DropCallbackForTesting callback) {}

#if BUILDFLAG(IS_WIN)
void WebContentsViewAura::OnGotVirtualFilesAsTempFiles(
    OnPerformingDropContext drop_context,
    const std::vector<std::pair<base::FilePath, base::FilePath>>&
        filepaths_and_names) {
  if (!async_drop_navigation_observer_) {
    return;
  }

  if (!filepaths_and_names.empty()) {
    std::unique_ptr<AsyncDropNavigationObserver> drop_observer(
        std::move(async_drop_navigation_observer_));

    RenderWidgetHostImpl* target_rwh = drop_context.target_rwh.get();

    // Security check--don't allow the drop if a navigation occurred since the
    // drop was initiated or the render widget host has changed or it is not a
    // valid target.
    if (!drop_observer->drop_allowed() ||
        !(target_rwh && target_rwh == current_rwh_for_drag_.get() &&
          drag_security_info_.IsValidDragTarget(target_rwh))) {
      // Signal test code that the drop is disallowed.
      if (!drop_callback_for_testing_.is_null()) {
        std::move(drop_callback_for_testing_)
            .Run(target_rwh, *drop_context.drop_data,
                 drop_context.transformed_pt.value(), drop_context.screen_pt,
                 drop_context.drop_metadata.flags,
                 drop_observer->drop_allowed());
      }

      CompleteDragExit();
      return;
    }

    // The vector of filenames will still have items added during dragenter
    // (script is allowed to enumerate the files in the data store but not
    // retrieve the file contents in dragenter). But the temp file path in the
    // FileInfo structs will just be a placeholder. Clear out the vector before
    // replacing it with FileInfo structs that have the paths to the retrieved
    // file contents.
    drop_context.drop_data->filenames.clear();

    // Ensure we have temp file deleter.
    if (!async_drop_temp_file_deleter_) {
      async_drop_temp_file_deleter_ =
          std::make_unique<AsyncDropTempFileDeleter>();
    }

    for (const auto& filepath_and_name : filepaths_and_names) {
      drop_context.drop_data->filenames.push_back(
          ui::FileInfo(filepath_and_name.first, filepath_and_name.second));

      // Make sure the temp file eventually gets cleaned up.
      async_drop_temp_file_deleter_->RegisterFile(filepath_and_name.first);
    }
  }

  MaybeLetDelegateProcessDrop(std::move(drop_context));
}
#endif

int WebContentsViewAura::GetTopControlsHeight() const {}

int WebContentsViewAura::GetBottomControlsHeight() const {}

bool WebContentsViewAura::DoBrowserControlsShrinkRendererSize() const {}

#if BUILDFLAG(USE_EXTERNAL_POPUP_MENU)
void WebContentsViewAura::ShowPopupMenu(
    RenderFrameHost* render_frame_host,
    mojo::PendingRemote<blink::mojom::PopupMenuClient> popup_client,
    const gfx::Rect& bounds,
    int item_height,
    double item_font_size,
    int selected_item,
    std::vector<blink::mojom::MenuItemPtr> menu_items,
    bool right_aligned,
    bool allow_multiple_selection) {
  NOTIMPLEMENTED() << " show " << menu_items.size() << " menu items";
}
#endif

}  // namespace content