2018-10-19 15:50:30 +02:00
|
|
|
// 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.
|
|
|
|
|
2021-11-22 08:34:31 +01:00
|
|
|
#ifndef ELECTRON_SHELL_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_VIEW_H_
|
|
|
|
#define ELECTRON_SHELL_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_VIEW_H_
|
2013-03-14 09:03:50 -04:00
|
|
|
|
2021-03-16 15:43:51 -04:00
|
|
|
#include <string>
|
|
|
|
|
2023-05-11 16:07:39 -04:00
|
|
|
#include "base/memory/raw_ptr.h"
|
2023-07-16 16:14:43 +02:00
|
|
|
#include "electron/shell/common/api/api.mojom.h"
|
2024-07-29 12:42:57 -05:00
|
|
|
|
|
|
|
#if defined(TOOLKIT_VIEWS) && !BUILDFLAG(IS_MAC)
|
|
|
|
#include "ui/views/view.h"
|
|
|
|
#else
|
2013-03-14 09:03:50 -04:00
|
|
|
#include "ui/gfx/native_widget_types.h"
|
2024-07-29 12:42:57 -05:00
|
|
|
#endif
|
2013-03-14 09:03:50 -04:00
|
|
|
|
2014-07-02 16:21:47 +08:00
|
|
|
class DevToolsContentsResizingStrategy;
|
2024-07-27 09:44:22 -07:00
|
|
|
|
2024-07-29 12:42:57 -05:00
|
|
|
namespace gfx {
|
|
|
|
class RoundedCornersF;
|
|
|
|
} // namespace gfx
|
|
|
|
|
2024-07-27 09:44:22 -07:00
|
|
|
#if defined(TOOLKIT_VIEWS)
|
2014-07-04 16:25:59 +08:00
|
|
|
namespace views {
|
2024-07-27 09:44:22 -07:00
|
|
|
class View;
|
2024-03-04 09:32:40 -08:00
|
|
|
class WebView;
|
|
|
|
} // namespace views
|
2024-07-27 09:44:22 -07:00
|
|
|
#endif
|
2014-07-04 16:25:59 +08:00
|
|
|
|
2018-10-19 15:50:30 +02:00
|
|
|
namespace electron {
|
2013-03-14 09:03:50 -04:00
|
|
|
|
2022-10-17 11:10:07 -04:00
|
|
|
class InspectableWebContents;
|
2015-06-25 12:29:34 +08:00
|
|
|
class InspectableWebContentsViewDelegate;
|
|
|
|
|
2024-07-27 09:44:22 -07:00
|
|
|
class InspectableWebContentsView {
|
2013-11-17 18:23:13 -05:00
|
|
|
public:
|
2022-10-17 11:10:07 -04:00
|
|
|
explicit InspectableWebContentsView(
|
|
|
|
InspectableWebContents* inspectable_web_contents);
|
2024-07-27 09:44:22 -07:00
|
|
|
virtual ~InspectableWebContentsView();
|
2022-10-17 11:10:07 -04:00
|
|
|
|
|
|
|
InspectableWebContents* inspectable_web_contents() {
|
|
|
|
return inspectable_web_contents_;
|
|
|
|
}
|
2013-03-14 09:03:50 -04:00
|
|
|
|
2015-06-25 12:29:34 +08:00
|
|
|
// The delegate manages its own life.
|
|
|
|
void SetDelegate(InspectableWebContentsViewDelegate* delegate) {
|
|
|
|
delegate_ = delegate;
|
|
|
|
}
|
2018-04-17 21:46:27 -04:00
|
|
|
InspectableWebContentsViewDelegate* GetDelegate() const { return delegate_; }
|
2015-06-25 12:29:34 +08:00
|
|
|
|
2024-07-27 09:44:22 -07:00
|
|
|
#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;
|
2014-07-04 16:25:59 +08:00
|
|
|
#endif
|
|
|
|
|
2024-07-27 09:44:22 -07:00
|
|
|
virtual void ShowDevTools(bool activate) = 0;
|
|
|
|
virtual void SetCornerRadii(const gfx::RoundedCornersF& corner_radii) = 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:
|
2022-10-17 11:10:07 -04:00
|
|
|
// Owns us.
|
2023-05-11 16:07:39 -04:00
|
|
|
raw_ptr<InspectableWebContents> inspectable_web_contents_;
|
2022-10-17 11:10:07 -04:00
|
|
|
|
2024-07-27 09:44:22 -07:00
|
|
|
private:
|
2023-05-11 16:07:39 -04:00
|
|
|
raw_ptr<InspectableWebContentsViewDelegate> delegate_ =
|
|
|
|
nullptr; // weak references.
|
2013-03-14 09:03:50 -04:00
|
|
|
};
|
|
|
|
|
2018-10-19 15:50:30 +02:00
|
|
|
} // namespace electron
|
2013-03-14 09:03:50 -04:00
|
|
|
|
2021-11-22 08:34:31 +01:00
|
|
|
#endif // ELECTRON_SHELL_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_VIEW_H_
|