2018-10-19 07:50:30 -06: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 00:34:31 -07:00
|
|
|
#ifndef ELECTRON_SHELL_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_VIEW_H_
|
|
|
|
#define ELECTRON_SHELL_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_VIEW_H_
|
2013-03-14 07:03:50 -06:00
|
|
|
|
2021-03-16 13:43:51 -06:00
|
|
|
#include <string>
|
|
|
|
|
2023-05-11 14:07:39 -06:00
|
|
|
#include "base/memory/raw_ptr.h"
|
2023-07-16 08:14:43 -06:00
|
|
|
#include "electron/shell/common/api/api.mojom.h"
|
2013-03-14 07:03:50 -06:00
|
|
|
#include "ui/gfx/native_widget_types.h"
|
|
|
|
|
2014-07-02 02:21:47 -06:00
|
|
|
class DevToolsContentsResizingStrategy;
|
|
|
|
|
2014-07-04 02:25:59 -06:00
|
|
|
#if defined(TOOLKIT_VIEWS)
|
|
|
|
namespace views {
|
|
|
|
class View;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-06-19 15:23:04 -06:00
|
|
|
namespace electron {
|
2013-03-14 07:03:50 -06:00
|
|
|
|
2022-10-17 09:10:07 -06:00
|
|
|
class InspectableWebContents;
|
2015-06-24 22:29:34 -06:00
|
|
|
class InspectableWebContentsViewDelegate;
|
|
|
|
|
2013-03-14 07:03:50 -06:00
|
|
|
class InspectableWebContentsView {
|
2013-11-17 16:23:13 -07:00
|
|
|
public:
|
2022-10-17 09:10:07 -06:00
|
|
|
explicit InspectableWebContentsView(
|
|
|
|
InspectableWebContents* inspectable_web_contents);
|
|
|
|
virtual ~InspectableWebContentsView();
|
|
|
|
|
|
|
|
InspectableWebContents* inspectable_web_contents() {
|
|
|
|
return inspectable_web_contents_;
|
|
|
|
}
|
2013-03-14 07:03:50 -06:00
|
|
|
|
2015-06-24 22:29:34 -06:00
|
|
|
// The delegate manages its own life.
|
|
|
|
void SetDelegate(InspectableWebContentsViewDelegate* delegate) {
|
|
|
|
delegate_ = delegate;
|
|
|
|
}
|
2018-04-17 19:46:27 -06:00
|
|
|
InspectableWebContentsViewDelegate* GetDelegate() const { return delegate_; }
|
2015-06-24 22:29:34 -06:00
|
|
|
|
2022-02-09 19:58:52 -07:00
|
|
|
#if defined(TOOLKIT_VIEWS) && !BUILDFLAG(IS_MAC)
|
2014-07-04 02:25:59 -06:00
|
|
|
// Returns the container control, which has devtools view attached.
|
|
|
|
virtual views::View* GetView() = 0;
|
2014-07-11 09:32:00 -06:00
|
|
|
#else
|
|
|
|
virtual gfx::NativeView GetNativeView() const = 0;
|
2014-07-04 02:25:59 -06:00
|
|
|
#endif
|
|
|
|
|
2018-11-27 02:34:44 -07:00
|
|
|
virtual void ShowDevTools(bool activate) = 0;
|
2014-03-19 19:26:21 -06:00
|
|
|
// Hide the DevTools view.
|
2013-03-27 08:59:40 -06:00
|
|
|
virtual void CloseDevTools() = 0;
|
2013-12-09 05:34:44 -07:00
|
|
|
virtual bool IsDevToolsViewShowing() = 0;
|
2015-09-14 21:04:46 -06:00
|
|
|
virtual bool IsDevToolsViewFocused() = 0;
|
2018-11-27 02:34:44 -07:00
|
|
|
virtual void SetIsDocked(bool docked, bool activate) = 0;
|
2014-07-02 02:21:47 -06:00
|
|
|
virtual void SetContentsResizingStrategy(
|
|
|
|
const DevToolsContentsResizingStrategy& strategy) = 0;
|
2021-03-16 10:18:45 -06:00
|
|
|
virtual void SetTitle(const std::u16string& title) = 0;
|
2023-08-14 23:32:53 -06:00
|
|
|
virtual const std::u16string GetTitle() = 0;
|
2015-06-24 22:29:34 -06:00
|
|
|
|
2022-10-17 09:10:07 -06:00
|
|
|
protected:
|
|
|
|
// Owns us.
|
2023-05-11 14:07:39 -06:00
|
|
|
raw_ptr<InspectableWebContents> inspectable_web_contents_;
|
2022-10-17 09:10:07 -06:00
|
|
|
|
2015-06-24 22:29:34 -06:00
|
|
|
private:
|
2023-05-11 14:07:39 -06:00
|
|
|
raw_ptr<InspectableWebContentsViewDelegate> delegate_ =
|
|
|
|
nullptr; // weak references.
|
2013-03-14 07:03:50 -06:00
|
|
|
};
|
|
|
|
|
2019-06-19 15:23:04 -06:00
|
|
|
} // namespace electron
|
2013-03-14 07:03:50 -06:00
|
|
|
|
2021-11-22 00:34:31 -07:00
|
|
|
#endif // ELECTRON_SHELL_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_VIEW_H_
|