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:
parent
f2c341b655
commit
23d4a252c6
18 changed files with 397 additions and 360 deletions
16
shell/browser/ui/inspectable_web_contents_view.cc
Normal file
16
shell/browser/ui/inspectable_web_contents_view.cc
Normal file
|
@ -0,0 +1,16 @@
|
|||
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Copyright (c) 2013 Adam Roben <adam@roben.org>. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE-CHROMIUM file.
|
||||
|
||||
#include "shell/browser/ui/inspectable_web_contents_view.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
InspectableWebContentsView::InspectableWebContentsView(
|
||||
InspectableWebContents* inspectable_web_contents)
|
||||
: inspectable_web_contents_(inspectable_web_contents) {}
|
||||
|
||||
InspectableWebContentsView::~InspectableWebContentsView() = default;
|
||||
|
||||
} // namespace electron
|
|
@ -7,7 +7,9 @@
|
|||
#define ELECTRON_SHELL_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_VIEW_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "shell/common/api/api.mojom.h"
|
||||
#include "ui/gfx/native_widget_types.h"
|
||||
|
||||
class DevToolsContentsResizingStrategy;
|
||||
|
@ -20,12 +22,18 @@ class View;
|
|||
|
||||
namespace electron {
|
||||
|
||||
class InspectableWebContents;
|
||||
class InspectableWebContentsViewDelegate;
|
||||
|
||||
class InspectableWebContentsView {
|
||||
public:
|
||||
InspectableWebContentsView() {}
|
||||
virtual ~InspectableWebContentsView() {}
|
||||
explicit InspectableWebContentsView(
|
||||
InspectableWebContents* inspectable_web_contents);
|
||||
virtual ~InspectableWebContentsView();
|
||||
|
||||
InspectableWebContents* inspectable_web_contents() {
|
||||
return inspectable_web_contents_;
|
||||
}
|
||||
|
||||
// The delegate manages its own life.
|
||||
void SetDelegate(InspectableWebContentsViewDelegate* delegate) {
|
||||
|
@ -33,6 +41,10 @@ class InspectableWebContentsView {
|
|||
}
|
||||
InspectableWebContentsViewDelegate* GetDelegate() const { return delegate_; }
|
||||
|
||||
const std::vector<mojom::DraggableRegionPtr>& GetDraggableRegions() const {
|
||||
return draggable_regions_;
|
||||
}
|
||||
|
||||
#if defined(TOOLKIT_VIEWS) && !BUILDFLAG(IS_MAC)
|
||||
// Returns the container control, which has devtools view attached.
|
||||
virtual views::View* GetView() = 0;
|
||||
|
@ -54,6 +66,16 @@ class InspectableWebContentsView {
|
|||
const DevToolsContentsResizingStrategy& strategy) = 0;
|
||||
virtual void SetTitle(const std::u16string& title) = 0;
|
||||
|
||||
// Called when the window needs to update its draggable region.
|
||||
virtual void UpdateDraggableRegions(
|
||||
const std::vector<mojom::DraggableRegionPtr>& regions) = 0;
|
||||
|
||||
protected:
|
||||
// Owns us.
|
||||
InspectableWebContents* inspectable_web_contents_;
|
||||
|
||||
std::vector<mojom::DraggableRegionPtr> draggable_regions_;
|
||||
|
||||
private:
|
||||
InspectableWebContentsViewDelegate* delegate_ = nullptr; // weak references.
|
||||
};
|
||||
|
|
|
@ -8,14 +8,14 @@
|
|||
|
||||
#include "shell/browser/ui/inspectable_web_contents_view.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "base/mac/scoped_nsobject.h"
|
||||
|
||||
@class ElectronInspectableWebContentsView;
|
||||
|
||||
namespace electron {
|
||||
|
||||
class InspectableWebContents;
|
||||
|
||||
class InspectableWebContentsViewMac : public InspectableWebContentsView {
|
||||
public:
|
||||
explicit InspectableWebContentsViewMac(
|
||||
|
@ -34,15 +34,10 @@ class InspectableWebContentsViewMac : public InspectableWebContentsView {
|
|||
void SetContentsResizingStrategy(
|
||||
const DevToolsContentsResizingStrategy& strategy) override;
|
||||
void SetTitle(const std::u16string& title) override;
|
||||
|
||||
InspectableWebContents* inspectable_web_contents() {
|
||||
return inspectable_web_contents_;
|
||||
}
|
||||
void UpdateDraggableRegions(
|
||||
const std::vector<mojom::DraggableRegionPtr>& regions) override;
|
||||
|
||||
private:
|
||||
// Owns us.
|
||||
InspectableWebContents* inspectable_web_contents_;
|
||||
|
||||
base::scoped_nsobject<ElectronInspectableWebContentsView> view_;
|
||||
};
|
||||
|
||||
|
|
|
@ -6,11 +6,216 @@
|
|||
#include "shell/browser/ui/inspectable_web_contents_view_mac.h"
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <objc/runtime.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "base/strings/sys_string_conversions.h"
|
||||
#import "shell/browser/ui/cocoa/electron_inspectable_web_contents_view.h"
|
||||
#include "shell/browser/ui/drag_util.h"
|
||||
#include "shell/browser/ui/inspectable_web_contents.h"
|
||||
#include "shell/browser/ui/inspectable_web_contents_view_delegate.h"
|
||||
#include "ui/gfx/geometry/rect.h"
|
||||
|
||||
@interface DragRegionView : NSView
|
||||
|
||||
@property(assign) NSPoint initialLocation;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSWindow ()
|
||||
- (void)performWindowDragWithEvent:(NSEvent*)event;
|
||||
@end
|
||||
|
||||
@implementation DragRegionView
|
||||
|
||||
@synthesize initialLocation;
|
||||
|
||||
+ (void)load {
|
||||
if (getenv("ELECTRON_DEBUG_DRAG_REGIONS")) {
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
SEL originalSelector = @selector(drawRect:);
|
||||
SEL swizzledSelector = @selector(drawDebugRect:);
|
||||
|
||||
Method originalMethod =
|
||||
class_getInstanceMethod([self class], originalSelector);
|
||||
Method swizzledMethod =
|
||||
class_getInstanceMethod([self class], swizzledSelector);
|
||||
BOOL didAddMethod =
|
||||
class_addMethod([self class], originalSelector,
|
||||
method_getImplementation(swizzledMethod),
|
||||
method_getTypeEncoding(swizzledMethod));
|
||||
|
||||
if (didAddMethod) {
|
||||
class_replaceMethod([self class], swizzledSelector,
|
||||
method_getImplementation(originalMethod),
|
||||
method_getTypeEncoding(originalMethod));
|
||||
} else {
|
||||
method_exchangeImplementations(originalMethod, swizzledMethod);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)mouseDownCanMoveWindow {
|
||||
return
|
||||
[self.window respondsToSelector:@selector(performWindowDragWithEvent:)];
|
||||
}
|
||||
|
||||
- (BOOL)acceptsFirstMouse:(NSEvent*)event {
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)shouldIgnoreMouseEvent {
|
||||
NSEventType type = [[NSApp currentEvent] type];
|
||||
return type != NSEventTypeLeftMouseDragged &&
|
||||
type != NSEventTypeLeftMouseDown;
|
||||
}
|
||||
|
||||
- (NSView*)hitTest:(NSPoint)point {
|
||||
// Pass-through events that hit one of the exclusion zones
|
||||
for (NSView* exclusion_zones in [self subviews]) {
|
||||
if ([exclusion_zones hitTest:point])
|
||||
return nil;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)mouseDown:(NSEvent*)event {
|
||||
[super mouseDown:event];
|
||||
|
||||
if ([self.window respondsToSelector:@selector(performWindowDragWithEvent:)]) {
|
||||
// According to Google, using performWindowDragWithEvent:
|
||||
// does not generate a NSWindowWillMoveNotification. Hence post one.
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName:NSWindowWillMoveNotification
|
||||
object:self];
|
||||
|
||||
[self.window performWindowDragWithEvent:event];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.window.styleMask & NSWindowStyleMaskFullScreen) {
|
||||
return;
|
||||
}
|
||||
|
||||
self.initialLocation = [event locationInWindow];
|
||||
}
|
||||
|
||||
- (void)mouseDragged:(NSEvent*)event {
|
||||
if ([self.window respondsToSelector:@selector(performWindowDragWithEvent:)]) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.window.styleMask & NSWindowStyleMaskFullScreen) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSPoint currentLocation = [NSEvent mouseLocation];
|
||||
NSPoint newOrigin;
|
||||
|
||||
NSRect screenFrame = [[NSScreen mainScreen] frame];
|
||||
NSSize screenSize = screenFrame.size;
|
||||
NSRect windowFrame = [self.window frame];
|
||||
NSSize windowSize = windowFrame.size;
|
||||
|
||||
newOrigin.x = currentLocation.x - self.initialLocation.x;
|
||||
newOrigin.y = currentLocation.y - self.initialLocation.y;
|
||||
|
||||
BOOL inMenuBar = (newOrigin.y + windowSize.height) >
|
||||
(screenFrame.origin.y + screenSize.height);
|
||||
BOOL screenAboveMainScreen = false;
|
||||
|
||||
if (inMenuBar) {
|
||||
for (NSScreen* screen in [NSScreen screens]) {
|
||||
NSRect currentScreenFrame = [screen frame];
|
||||
BOOL isHigher = currentScreenFrame.origin.y > screenFrame.origin.y;
|
||||
|
||||
// If there's another screen that is generally above the current screen,
|
||||
// we'll draw a new rectangle that is just above the current screen. If
|
||||
// the "higher" screen intersects with this rectangle, we'll allow drawing
|
||||
// above the menubar.
|
||||
if (isHigher) {
|
||||
NSRect aboveScreenRect =
|
||||
NSMakeRect(screenFrame.origin.x,
|
||||
screenFrame.origin.y + screenFrame.size.height - 10,
|
||||
screenFrame.size.width, 200);
|
||||
|
||||
BOOL screenAboveIntersects =
|
||||
NSIntersectsRect(currentScreenFrame, aboveScreenRect);
|
||||
|
||||
if (screenAboveIntersects) {
|
||||
screenAboveMainScreen = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Don't let window get dragged up under the menu bar
|
||||
if (inMenuBar && !screenAboveMainScreen) {
|
||||
newOrigin.y = screenFrame.origin.y +
|
||||
(screenFrame.size.height - windowFrame.size.height);
|
||||
}
|
||||
|
||||
// Move the window to the new location
|
||||
[self.window setFrameOrigin:newOrigin];
|
||||
}
|
||||
|
||||
// For debugging purposes only.
|
||||
- (void)drawDebugRect:(NSRect)aRect {
|
||||
[[[NSColor greenColor] colorWithAlphaComponent:0.5] set];
|
||||
NSRectFill([self bounds]);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface ExcludeDragRegionView : NSView
|
||||
@end
|
||||
|
||||
@implementation ExcludeDragRegionView
|
||||
|
||||
+ (void)load {
|
||||
if (getenv("ELECTRON_DEBUG_DRAG_REGIONS")) {
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
SEL originalSelector = @selector(drawRect:);
|
||||
SEL swizzledSelector = @selector(drawDebugRect:);
|
||||
|
||||
Method originalMethod =
|
||||
class_getInstanceMethod([self class], originalSelector);
|
||||
Method swizzledMethod =
|
||||
class_getInstanceMethod([self class], swizzledSelector);
|
||||
BOOL didAddMethod =
|
||||
class_addMethod([self class], originalSelector,
|
||||
method_getImplementation(swizzledMethod),
|
||||
method_getTypeEncoding(swizzledMethod));
|
||||
|
||||
if (didAddMethod) {
|
||||
class_replaceMethod([self class], swizzledSelector,
|
||||
method_getImplementation(originalMethod),
|
||||
method_getTypeEncoding(originalMethod));
|
||||
} else {
|
||||
method_exchangeImplementations(originalMethod, swizzledMethod);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)mouseDownCanMoveWindow {
|
||||
return NO;
|
||||
}
|
||||
|
||||
// For debugging purposes only.
|
||||
- (void)drawDebugRect:(NSRect)aRect {
|
||||
[[[NSColor redColor] colorWithAlphaComponent:0.5] set];
|
||||
NSRectFill([self bounds]);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
namespace electron {
|
||||
|
||||
|
@ -21,7 +226,7 @@ InspectableWebContentsView* CreateInspectableContentsView(
|
|||
|
||||
InspectableWebContentsViewMac::InspectableWebContentsViewMac(
|
||||
InspectableWebContents* inspectable_web_contents)
|
||||
: inspectable_web_contents_(inspectable_web_contents),
|
||||
: InspectableWebContentsView(inspectable_web_contents),
|
||||
view_([[ElectronInspectableWebContentsView alloc]
|
||||
initWithInspectableWebContentsViewMac:this]) {}
|
||||
|
||||
|
@ -62,4 +267,65 @@ void InspectableWebContentsViewMac::SetTitle(const std::u16string& title) {
|
|||
[view_ setTitle:base::SysUTF16ToNSString(title)];
|
||||
}
|
||||
|
||||
void InspectableWebContentsViewMac::UpdateDraggableRegions(
|
||||
const std::vector<mojom::DraggableRegionPtr>& regions) {
|
||||
auto* web_contents = inspectable_web_contents()->GetWebContents();
|
||||
NSView* web_view = web_contents->GetNativeView().GetNativeNSView();
|
||||
NSView* inspectable_view = GetNativeView().GetNativeNSView();
|
||||
NSView* inspectable_superview = inspectable_view.superview;
|
||||
|
||||
NSInteger webViewWidth = NSWidth([web_view bounds]);
|
||||
NSInteger webViewHeight = NSHeight([web_view bounds]);
|
||||
|
||||
// Draggable regions are implemented by having the whole web view draggable
|
||||
// and overlaying regions that are not draggable.
|
||||
if (&draggable_regions_ != ®ions)
|
||||
draggable_regions_ = mojo::Clone(regions);
|
||||
|
||||
std::vector<gfx::Rect> drag_exclude_rects;
|
||||
if (draggable_regions_.empty()) {
|
||||
drag_exclude_rects.emplace_back(0, 0, webViewWidth, webViewHeight);
|
||||
} else {
|
||||
drag_exclude_rects = CalculateNonDraggableRegions(
|
||||
DraggableRegionsToSkRegion(draggable_regions_), webViewWidth,
|
||||
webViewHeight);
|
||||
}
|
||||
|
||||
// Remove all DragRegionViews that were added last time. Note that we need
|
||||
// to copy the `subviews` array to avoid mutation during iteration.
|
||||
base::scoped_nsobject<NSArray> subviews([[web_view subviews] copy]);
|
||||
for (NSView* subview in subviews.get()) {
|
||||
if ([subview isKindOfClass:[DragRegionView class]])
|
||||
[subview removeFromSuperview];
|
||||
}
|
||||
|
||||
// Create one giant NSView that is draggable.
|
||||
base::scoped_nsobject<NSView> drag_region_view(
|
||||
[[DragRegionView alloc] initWithFrame:web_view.bounds]);
|
||||
[web_view addSubview:drag_region_view];
|
||||
|
||||
// Then, on top of that, add "exclusion zones".
|
||||
const int superview_height =
|
||||
(inspectable_superview) ? inspectable_superview.frame.size.height : 0;
|
||||
if (!inspectable_superview)
|
||||
inspectable_superview = inspectable_view;
|
||||
const int offset_x = inspectable_view.frame.origin.x;
|
||||
const int offset_y = superview_height - inspectable_view.frame.origin.y -
|
||||
inspectable_view.frame.size.height;
|
||||
for (const auto& rect : drag_exclude_rects) {
|
||||
const auto x = rect.x() + offset_x;
|
||||
const auto y = superview_height - (rect.bottom() + offset_y);
|
||||
const auto exclude_rect = NSMakeRect(x, y, rect.width(), rect.height());
|
||||
|
||||
const auto drag_region_view_exclude_rect =
|
||||
[inspectable_superview convertRect:exclude_rect
|
||||
toView:drag_region_view];
|
||||
|
||||
base::scoped_nsobject<NSView> exclude_drag_region_view(
|
||||
[[ExcludeDragRegionView alloc]
|
||||
initWithFrame:drag_region_view_exclude_rect]);
|
||||
[drag_region_view addSubview:exclude_drag_region_view];
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace electron
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,8 +7,10 @@
|
|||
#include <memory>
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "shell/browser/ui/drag_util.h"
|
||||
#include "shell/browser/ui/inspectable_web_contents.h"
|
||||
#include "shell/browser/ui/inspectable_web_contents_delegate.h"
|
||||
#include "shell/browser/ui/inspectable_web_contents_view_delegate.h"
|
||||
|
@ -79,7 +81,7 @@ InspectableWebContentsView* CreateInspectableContentsView(
|
|||
|
||||
InspectableWebContentsViewViews::InspectableWebContentsViewViews(
|
||||
InspectableWebContents* inspectable_web_contents)
|
||||
: inspectable_web_contents_(inspectable_web_contents),
|
||||
: InspectableWebContentsView(inspectable_web_contents),
|
||||
devtools_web_view_(new views::WebView(nullptr)),
|
||||
title_(u"Developer Tools") {
|
||||
if (!inspectable_web_contents_->IsGuest() &&
|
||||
|
@ -103,6 +105,19 @@ InspectableWebContentsViewViews::~InspectableWebContentsViewViews() {
|
|||
devtools_window_->GetWindowBoundsInScreen());
|
||||
}
|
||||
|
||||
bool InspectableWebContentsViewViews::IsContainedInDraggableRegion(
|
||||
views::View* root_view,
|
||||
const gfx::Point& location) {
|
||||
if (!draggable_region_.get())
|
||||
return false;
|
||||
// Draggable regions are defined relative to the web contents.
|
||||
gfx::Point point_in_contents_web_view_coords(location);
|
||||
views::View::ConvertPointToTarget(root_view, this,
|
||||
&point_in_contents_web_view_coords);
|
||||
return draggable_region_->contains(point_in_contents_web_view_coords.x(),
|
||||
point_in_contents_web_view_coords.y());
|
||||
}
|
||||
|
||||
views::View* InspectableWebContentsViewViews::GetView() {
|
||||
return this;
|
||||
}
|
||||
|
@ -212,6 +227,14 @@ void InspectableWebContentsViewViews::SetTitle(const std::u16string& title) {
|
|||
}
|
||||
}
|
||||
|
||||
void InspectableWebContentsViewViews::UpdateDraggableRegions(
|
||||
const std::vector<mojom::DraggableRegionPtr>& regions) {
|
||||
if (&draggable_regions_ == ®ions)
|
||||
return;
|
||||
draggable_regions_ = mojo::Clone(regions);
|
||||
draggable_region_ = DraggableRegionsToSkRegion(draggable_regions_);
|
||||
}
|
||||
|
||||
void InspectableWebContentsViewViews::Layout() {
|
||||
if (!devtools_web_view_->GetVisible()) {
|
||||
contents_web_view_->SetBoundsRect(GetContentsBounds());
|
||||
|
|
|
@ -6,10 +6,12 @@
|
|||
#define ELECTRON_SHELL_BROWSER_UI_VIEWS_INSPECTABLE_WEB_CONTENTS_VIEW_VIEWS_H_
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "chrome/browser/devtools/devtools_contents_resizing_strategy.h"
|
||||
#include "shell/browser/ui/inspectable_web_contents_view.h"
|
||||
#include "third_party/skia/include/core/SkRegion.h"
|
||||
#include "ui/views/view.h"
|
||||
|
||||
namespace views {
|
||||
|
@ -20,8 +22,6 @@ class WidgetDelegate;
|
|||
|
||||
namespace electron {
|
||||
|
||||
class InspectableWebContents;
|
||||
|
||||
class InspectableWebContentsViewViews : public InspectableWebContentsView,
|
||||
public views::View {
|
||||
public:
|
||||
|
@ -29,6 +29,9 @@ class InspectableWebContentsViewViews : public InspectableWebContentsView,
|
|||
InspectableWebContents* inspectable_web_contents);
|
||||
~InspectableWebContentsViewViews() override;
|
||||
|
||||
bool IsContainedInDraggableRegion(views::View* root_view,
|
||||
const gfx::Point& location);
|
||||
|
||||
// InspectableWebContentsView:
|
||||
views::View* GetView() override;
|
||||
views::View* GetWebView() override;
|
||||
|
@ -40,20 +43,15 @@ class InspectableWebContentsViewViews : public InspectableWebContentsView,
|
|||
void SetContentsResizingStrategy(
|
||||
const DevToolsContentsResizingStrategy& strategy) override;
|
||||
void SetTitle(const std::u16string& title) override;
|
||||
void UpdateDraggableRegions(
|
||||
const std::vector<mojom::DraggableRegionPtr>& regions) override;
|
||||
|
||||
// views::View:
|
||||
void Layout() override;
|
||||
|
||||
InspectableWebContents* inspectable_web_contents() {
|
||||
return inspectable_web_contents_;
|
||||
}
|
||||
|
||||
const std::u16string& GetTitle() const { return title_; }
|
||||
|
||||
private:
|
||||
// Owns us.
|
||||
InspectableWebContents* inspectable_web_contents_;
|
||||
|
||||
std::unique_ptr<views::Widget> devtools_window_;
|
||||
views::WebView* devtools_window_web_view_ = nullptr;
|
||||
views::View* contents_web_view_ = nullptr;
|
||||
|
@ -63,6 +61,8 @@ class InspectableWebContentsViewViews : public InspectableWebContentsView,
|
|||
bool devtools_visible_ = false;
|
||||
views::WidgetDelegate* devtools_window_delegate_ = nullptr;
|
||||
std::u16string title_;
|
||||
|
||||
std::unique_ptr<SkRegion> draggable_region_;
|
||||
};
|
||||
|
||||
} // namespace electron
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue