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
|
@ -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.
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue