refactor: use views NonClientHitTest for draggable regions on mac (#35603)

* refactor: use views NonClientHitTest for draggable regions on mac

* iwyu

* add backport of 9bb5f0316

* chore: update patches

* remove some unneeded functions

* remove test for triggering when BW is focused

* chore: update patches

* simplify views/mac split now that the draggable logic is the same

* Apply suggestions from code review

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* Update shell/browser/native_window.h

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* fix build

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
Jeremy Rose 2022-10-12 09:05:45 -07:00 committed by GitHub
parent 7ce94eb0b4
commit 8a926ffde4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 70 additions and 392 deletions

View file

@ -18,9 +18,12 @@
#include "content/public/browser/web_contents_user_data.h"
#include "extensions/browser/app_window/size_constraints.h"
#include "shell/browser/native_window_observer.h"
#include "shell/common/api/api.mojom.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/views/widget/widget_delegate.h"
class SkRegion;
namespace base {
class DictionaryValue;
}
@ -337,6 +340,11 @@ class NativeWindow : public base::SupportsUserData,
return fullscreen_transition_type_;
}
SkRegion const* draggable_region() const { return draggable_region_.get(); }
void UpdateDraggableRegions(
const std::vector<mojom::DraggableRegionPtr>& regions);
views::Widget* widget() const { return widget_.get(); }
views::View* content_view() const { return content_view_; }
@ -456,6 +464,10 @@ class NativeWindow : public base::SupportsUserData,
gfx::Rect overlay_rect_;
// For custom drag, the whole window is non-draggable and the draggable region
// has to been explicitly provided.
std::unique_ptr<SkRegion> draggable_region_; // used in custom drag.
base::WeakPtrFactory<NativeWindow> weak_factory_{this};
};