fix: make BrowserView aware of owning window (#31796)

This commit is contained in:
Shelley Vohr 2021-11-15 16:23:31 +01:00 committed by GitHub
parent bf7b245fa0
commit 65e4f75058
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 27 deletions

View file

@ -14,6 +14,7 @@
#include "gin/wrappable.h"
#include "shell/browser/extended_web_contents_observer.h"
#include "shell/browser/native_browser_view.h"
#include "shell/browser/native_window.h"
#include "shell/common/api/api.mojom.h"
#include "shell/common/gin_helper/constructible.h"
#include "shell/common/gin_helper/error_thrower.h"
@ -52,6 +53,10 @@ class BrowserView : public gin::Wrappable<BrowserView>,
WebContents* web_contents() const { return api_web_contents_; }
NativeBrowserView* view() const { return view_.get(); }
NativeWindow* owner_window() const { return owner_window_.get(); }
void SetOwnerWindow(NativeWindow* window);
int32_t ID() const { return id_; }
// disable copy
@ -80,6 +85,7 @@ class BrowserView : public gin::Wrappable<BrowserView>,
class WebContents* api_web_contents_ = nullptr;
std::unique_ptr<NativeBrowserView> view_;
base::WeakPtr<NativeWindow> owner_window_;
int32_t id_;
};