fix: draggable regions exclusively on BrowserViews (#26145)
This commit is contained in:
parent
760c4aeb3e
commit
7cdc42f43a
16 changed files with 139 additions and 68 deletions
|
@ -4,9 +4,12 @@
|
|||
|
||||
#include "shell/browser/api/electron_api_browser_view.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "shell/browser/api/electron_api_web_contents.h"
|
||||
#include "shell/browser/browser.h"
|
||||
#include "shell/browser/native_browser_view.h"
|
||||
#include "shell/browser/ui/drag_util.h"
|
||||
#include "shell/common/color_util.h"
|
||||
#include "shell/common/gin_converters/gfx_converter.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
|
@ -80,6 +83,7 @@ BrowserView::BrowserView(gin::Arguments* args,
|
|||
|
||||
web_contents_.Reset(isolate, web_contents.ToV8());
|
||||
api_web_contents_ = web_contents.get();
|
||||
api_web_contents_->AddObserver(this);
|
||||
Observe(web_contents->web_contents());
|
||||
|
||||
view_.reset(
|
||||
|
@ -90,6 +94,7 @@ BrowserView::~BrowserView() {
|
|||
if (api_web_contents_) { // destroy() is called
|
||||
// Destroy WebContents asynchronously unless app is shutting down,
|
||||
// because destroy() might be called inside WebContents's event handler.
|
||||
api_web_contents_->RemoveObserver(this);
|
||||
api_web_contents_->DestroyWebContents(!Browser::Get()->is_shutting_down());
|
||||
}
|
||||
}
|
||||
|
@ -100,6 +105,11 @@ void BrowserView::WebContentsDestroyed() {
|
|||
Unpin();
|
||||
}
|
||||
|
||||
void BrowserView::OnDraggableRegionsUpdated(
|
||||
const std::vector<mojom::DraggableRegionPtr>& regions) {
|
||||
view_->UpdateDraggableRegions(regions);
|
||||
}
|
||||
|
||||
// static
|
||||
gin::Handle<BrowserView> BrowserView::New(gin_helper::ErrorThrower thrower,
|
||||
gin::Arguments* args) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue