fix: return pointer instead of pointer's content (#16014)
This commit is contained in:
parent
f3c64ea9d8
commit
624ade2c25
9 changed files with 302 additions and 253 deletions
|
@ -696,8 +696,8 @@ v8::Local<v8::Value> TopLevelWindow::GetNativeWindowHandle() {
|
|||
// TODO(MarshallOfSound): Replace once
|
||||
// https://chromium-review.googlesource.com/c/chromium/src/+/1253094/ has
|
||||
// landed
|
||||
auto handle = window_->GetNativeWindowHandlePointer();
|
||||
return ToBuffer(isolate(), std::get<0>(handle), std::get<1>(handle));
|
||||
NativeWindowHandle handle = window_->GetNativeWindowHandle();
|
||||
return ToBuffer(isolate(), &handle, sizeof(handle));
|
||||
}
|
||||
|
||||
void TopLevelWindow::SetProgressBar(double progress, mate::Arguments* args) {
|
||||
|
|
|
@ -45,6 +45,12 @@ class NativeBrowserView;
|
|||
|
||||
struct DraggableRegion;
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
typedef NSView* NativeWindowHandle;
|
||||
#else
|
||||
typedef gfx::AcceleratedWidget NativeWindowHandle;
|
||||
#endif
|
||||
|
||||
class NativeWindow : public base::SupportsUserData,
|
||||
public views::WidgetDelegate {
|
||||
public:
|
||||
|
@ -153,7 +159,7 @@ class NativeWindow : public base::SupportsUserData,
|
|||
virtual gfx::NativeView GetNativeView() const = 0;
|
||||
virtual gfx::NativeWindow GetNativeWindow() const = 0;
|
||||
virtual gfx::AcceleratedWidget GetAcceleratedWidget() const = 0;
|
||||
virtual std::tuple<void*, int> GetNativeWindowHandlePointer() const = 0;
|
||||
virtual NativeWindowHandle GetNativeWindowHandle() const = 0;
|
||||
|
||||
// Taskbar/Dock APIs.
|
||||
enum ProgressState {
|
||||
|
|
|
@ -107,7 +107,7 @@ class NativeWindowMac : public NativeWindow {
|
|||
gfx::NativeView GetNativeView() const override;
|
||||
gfx::NativeWindow GetNativeWindow() const override;
|
||||
gfx::AcceleratedWidget GetAcceleratedWidget() const override;
|
||||
std::tuple<void*, int> GetNativeWindowHandlePointer() const override;
|
||||
NativeWindowHandle GetNativeWindowHandle() const override;
|
||||
void SetProgressBar(double progress, const ProgressState state) override;
|
||||
void SetOverlayIcon(const gfx::Image& overlay,
|
||||
const std::string& description) override;
|
||||
|
|
|
@ -1110,9 +1110,8 @@ gfx::AcceleratedWidget NativeWindowMac::GetAcceleratedWidget() const {
|
|||
return gfx::kNullAcceleratedWidget;
|
||||
}
|
||||
|
||||
std::tuple<void*, int> NativeWindowMac::GetNativeWindowHandlePointer() const {
|
||||
NSView* view = [window_ contentView];
|
||||
return std::make_tuple(static_cast<void*>(view), sizeof(view));
|
||||
NativeWindowHandle NativeWindowMac::GetNativeWindowHandle() const {
|
||||
return [window_ contentView];
|
||||
}
|
||||
|
||||
void NativeWindowMac::SetProgressBar(double progress,
|
||||
|
|
|
@ -1071,9 +1071,8 @@ gfx::AcceleratedWidget NativeWindowViews::GetAcceleratedWidget() const {
|
|||
return GetNativeWindow()->GetHost()->GetAcceleratedWidget();
|
||||
}
|
||||
|
||||
std::tuple<void*, int> NativeWindowViews::GetNativeWindowHandlePointer() const {
|
||||
gfx::AcceleratedWidget handle = GetAcceleratedWidget();
|
||||
return std::make_tuple(static_cast<void*>(&handle), sizeof(handle));
|
||||
NativeWindowHandle NativeWindowViews::GetNativeWindowHandle() const {
|
||||
return GetAcceleratedWidget();
|
||||
}
|
||||
|
||||
gfx::Rect NativeWindowViews::ContentBoundsToWindowBounds(
|
||||
|
|
|
@ -130,7 +130,7 @@ class NativeWindowViews : public NativeWindow,
|
|||
bool IsVisibleOnAllWorkspaces() override;
|
||||
|
||||
gfx::AcceleratedWidget GetAcceleratedWidget() const override;
|
||||
std::tuple<void*, int> GetNativeWindowHandlePointer() const override;
|
||||
NativeWindowHandle GetNativeWindowHandle() const override;
|
||||
|
||||
gfx::Rect ContentBoundsToWindowBounds(const gfx::Rect& bounds) const override;
|
||||
gfx::Rect WindowBoundsToContentBounds(const gfx::Rect& bounds) const override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue