chore: Move draggable regions implementation from NativeBrowserView into InspectableWebContentsView (#35007)

* hore: Move draggable regions implementation from NativeBrowserView into InspectableWebContentsView

The draggable regions implementation is related to WebView, so
InspectableWebContentsView is a more appropriate place to put it there.
Also, this refactoring will allow the subsequent extension of the
WebContentsView API, which will eventually replace BrowserView API.

* fix: Lint error

* fix: Adjusted owner-window
This commit is contained in:
Daniel Kocielinski 2022-10-17 11:10:07 -04:00 committed by GitHub
parent f2c341b655
commit 23d4a252c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 397 additions and 360 deletions

View file

@ -6,6 +6,7 @@
#include "shell/browser/native_browser_view_views.h"
#include "shell/browser/native_window_views.h"
#include "shell/browser/ui/views/inspectable_web_contents_view_views.h"
#include "ui/aura/window.h"
#include "ui/base/hit_test.h"
#include "ui/views/widget/widget.h"
@ -80,11 +81,11 @@ int FramelessView::NonClientHitTest(const gfx::Point& cursor) {
return HTCLIENT;
// Check attached BrowserViews for potential draggable areas.
for (auto* view : window_->browser_views()) {
auto* native_view = static_cast<NativeBrowserViewViews*>(view);
auto* view_draggable_region = native_view->draggable_region();
if (view_draggable_region &&
view_draggable_region->contains(cursor.x(), cursor.y()))
for (auto* view : window_->inspectable_views()) {
auto* inspectable_view =
static_cast<InspectableWebContentsViewViews*>(view);
if (inspectable_view->IsContainedInDraggableRegion(window_->content_view(),
cursor))
return HTCAPTION;
}