fix: remove InspectableWebContentsViewMac (#43088)

* fix: remove InspectableWebContentsViewMac (#43033)

* Revert "refactor: remove InspectableWebContentsViewMac in favor of the Views version (#41326)"

This reverts commit e67ab9a93d.

* build: fix gn check

* chore: implement setCornerRadii in inspectable_web_contents_view_mac

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* fix: pass in cornerRadii value in setCornerRadii

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* fix: forward declaration

* 5578714: Remove 0-arg (default) constructor for views::Widget::InitParams.

5578714

* fix: contents_web_view_ -> contents_view_

* chore: remove extraneous includes

---------

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* fix: remove custom border radius feat (#42320)

* fixup! remove custom border radius feat

---------

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
Keeley Hammond 2024-07-30 03:30:38 -07:00 committed by GitHub
parent 2ef1c6dc49
commit c2a46108c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 955 additions and 300 deletions

View file

@ -9,28 +9,29 @@
#include <string>
#include "base/memory/raw_ptr.h"
#include "chrome/browser/devtools/devtools_contents_resizing_strategy.h"
#include "electron/shell/common/api/api.mojom.h"
#include "ui/gfx/geometry/rounded_corners_f.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/views/view.h"
class DevToolsContentsResizingStrategy;
#if defined(TOOLKIT_VIEWS)
namespace views {
class View;
class WebView;
class Widget;
class WidgetDelegate;
} // namespace views
#endif
namespace electron {
class InspectableWebContents;
class InspectableWebContentsViewDelegate;
class InspectableWebContentsView : public views::View {
class InspectableWebContentsView {
public:
explicit InspectableWebContentsView(
InspectableWebContents* inspectable_web_contents);
~InspectableWebContentsView() override;
virtual ~InspectableWebContentsView();
InspectableWebContents* inspectable_web_contents() {
return inspectable_web_contents_;
@ -42,38 +43,31 @@ class InspectableWebContentsView : public views::View {
}
InspectableWebContentsViewDelegate* GetDelegate() const { return delegate_; }
void ShowDevTools(bool activate);
void CloseDevTools();
bool IsDevToolsViewShowing();
bool IsDevToolsViewFocused();
void SetIsDocked(bool docked, bool activate);
void SetContentsResizingStrategy(
const DevToolsContentsResizingStrategy& strategy);
void SetTitle(const std::u16string& title);
const std::u16string GetTitle();
// views::View:
void Layout(PassKey) override;
#if BUILDFLAG(IS_MAC)
bool OnMousePressed(const ui::MouseEvent& event) override;
#if defined(TOOLKIT_VIEWS) && !BUILDFLAG(IS_MAC)
// Returns the container control, which has devtools view attached.
virtual views::View* GetView() = 0;
#else
virtual gfx::NativeView GetNativeView() const = 0;
#endif
private:
virtual void ShowDevTools(bool activate) = 0;
// Hide the DevTools view.
virtual void CloseDevTools() = 0;
virtual bool IsDevToolsViewShowing() = 0;
virtual bool IsDevToolsViewFocused() = 0;
virtual void SetIsDocked(bool docked, bool activate) = 0;
virtual void SetContentsResizingStrategy(
const DevToolsContentsResizingStrategy& strategy) = 0;
virtual void SetTitle(const std::u16string& title) = 0;
virtual const std::u16string GetTitle() = 0;
protected:
// Owns us.
raw_ptr<InspectableWebContents> inspectable_web_contents_;
private:
raw_ptr<InspectableWebContentsViewDelegate> delegate_ =
nullptr; // weak references.
std::unique_ptr<views::Widget> devtools_window_;
raw_ptr<views::WebView> devtools_window_web_view_ = nullptr;
raw_ptr<views::View> contents_web_view_ = nullptr;
raw_ptr<views::WebView> devtools_web_view_ = nullptr;
DevToolsContentsResizingStrategy strategy_;
bool devtools_visible_ = false;
raw_ptr<views::WidgetDelegate> devtools_window_delegate_ = nullptr;
std::u16string title_;
};
} // namespace electron