blob: 820aa06e4a382421675df97ebd221889b58066cc [file] [log] [blame]
Avi Drissman4e1b7bc32022-09-15 14:03:501// Copyright 2013 The Chromium Authors
[email protected]0773e0c2013-01-25 15:57:572// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]de7d61ff2013-08-20 11:30:415#ifndef CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_
6#define CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_
[email protected]0773e0c2013-01-25 15:57:577
dcheng6003e0b2016-04-09 18:42:348#include <memory>
9
Keishi Hattori0e45c022021-11-27 09:25:5210#include "base/memory/raw_ptr.h"
Dave Tapuska5198f0e2021-11-18 15:41:1111#include "base/memory/weak_ptr.h"
[email protected]0773e0c2013-01-25 15:57:5712#include "content/public/browser/web_contents_observer.h"
chenwilliamfed5bda2017-03-24 02:01:0613#include "content/shell/browser/shell_devtools_bindings.h"
pfeldman1e8f0d0d2015-03-01 07:14:5414
[email protected]0773e0c2013-01-25 15:57:5715namespace content {
16
[email protected]0773e0c2013-01-25 15:57:5717class Shell;
18class WebContents;
19
chenwilliamfed5bda2017-03-24 02:01:0620class ShellDevToolsFrontend : public ShellDevToolsDelegate,
21 public WebContentsObserver {
[email protected]0773e0c2013-01-25 15:57:5722 public:
23 static ShellDevToolsFrontend* Show(WebContents* inspected_contents);
mkwst30d20d52014-10-09 13:33:1424
Peter Boström9b036532021-10-28 23:37:2825 ShellDevToolsFrontend(const ShellDevToolsFrontend&) = delete;
26 ShellDevToolsFrontend& operator=(const ShellDevToolsFrontend&) = delete;
27
[email protected]546618b2013-10-20 21:17:3228 void Activate();
[email protected]2317fcd2014-02-10 14:36:4829 void InspectElementAt(int x, int y);
chenwilliamfed5bda2017-03-24 02:01:0630 void Close() override;
pfeldman552756452015-02-03 17:33:0631
[email protected]d212efd2013-04-15 13:03:0632 Shell* frontend_shell() const { return frontend_shell_; }
33
Dave Tapuska5198f0e2021-11-18 15:41:1134 base::WeakPtr<ShellDevToolsFrontend> GetWeakPtr();
35
mkwst30d20d52014-10-09 13:33:1436 private:
[email protected]0773e0c2013-01-25 15:57:5737 // WebContentsObserver overrides
Sreeja Kamishetty49783302022-01-28 17:52:2538 void PrimaryMainDocumentElementAvailable() override;
dchenge933b3e2014-10-21 11:44:0939 void WebContentsDestroyed() override;
[email protected]0773e0c2013-01-25 15:57:5740
chenwilliamfed5bda2017-03-24 02:01:0641 ShellDevToolsFrontend(Shell* frontend_shell, WebContents* inspected_contents);
42 ~ShellDevToolsFrontend() override;
Keishi Hattori0e45c022021-11-27 09:25:5243 raw_ptr<Shell> frontend_shell_;
chenwilliamfed5bda2017-03-24 02:01:0644 std::unique_ptr<ShellDevToolsBindings> devtools_bindings_;
Dave Tapuska5198f0e2021-11-18 15:41:1145
46 base::WeakPtrFactory<ShellDevToolsFrontend> weak_ptr_factory_{this};
[email protected]0773e0c2013-01-25 15:57:5747};
48
49} // namespace content
50
[email protected]de7d61ff2013-08-20 11:30:4151#endif // CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_