Avi Drissman | 4e1b7bc3 | 2022-09-15 14:03:50 | [diff] [blame] | 1 | // Copyright 2013 The Chromium Authors |
[email protected] | 0773e0c | 2013-01-25 15:57:57 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | de7d61ff | 2013-08-20 11:30:41 | [diff] [blame] | 5 | #ifndef CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_ |
6 | #define CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_ | ||||
[email protected] | 0773e0c | 2013-01-25 15:57:57 | [diff] [blame] | 7 | |
dcheng | 6003e0b | 2016-04-09 18:42:34 | [diff] [blame] | 8 | #include <memory> |
9 | |||||
Keishi Hattori | 0e45c02 | 2021-11-27 09:25:52 | [diff] [blame] | 10 | #include "base/memory/raw_ptr.h" |
Dave Tapuska | 5198f0e | 2021-11-18 15:41:11 | [diff] [blame] | 11 | #include "base/memory/weak_ptr.h" |
[email protected] | 0773e0c | 2013-01-25 15:57:57 | [diff] [blame] | 12 | #include "content/public/browser/web_contents_observer.h" |
chenwilliam | fed5bda | 2017-03-24 02:01:06 | [diff] [blame] | 13 | #include "content/shell/browser/shell_devtools_bindings.h" |
pfeldman | 1e8f0d0d | 2015-03-01 07:14:54 | [diff] [blame] | 14 | |
[email protected] | 0773e0c | 2013-01-25 15:57:57 | [diff] [blame] | 15 | namespace content { |
16 | |||||
[email protected] | 0773e0c | 2013-01-25 15:57:57 | [diff] [blame] | 17 | class Shell; |
18 | class WebContents; | ||||
19 | |||||
chenwilliam | fed5bda | 2017-03-24 02:01:06 | [diff] [blame] | 20 | class ShellDevToolsFrontend : public ShellDevToolsDelegate, |
21 | public WebContentsObserver { | ||||
[email protected] | 0773e0c | 2013-01-25 15:57:57 | [diff] [blame] | 22 | public: |
23 | static ShellDevToolsFrontend* Show(WebContents* inspected_contents); | ||||
mkwst | 30d20d5 | 2014-10-09 13:33:14 | [diff] [blame] | 24 | |
Peter Boström | 9b03653 | 2021-10-28 23:37:28 | [diff] [blame] | 25 | ShellDevToolsFrontend(const ShellDevToolsFrontend&) = delete; |
26 | ShellDevToolsFrontend& operator=(const ShellDevToolsFrontend&) = delete; | ||||
27 | |||||
[email protected] | 546618b | 2013-10-20 21:17:32 | [diff] [blame] | 28 | void Activate(); |
[email protected] | 2317fcd | 2014-02-10 14:36:48 | [diff] [blame] | 29 | void InspectElementAt(int x, int y); |
chenwilliam | fed5bda | 2017-03-24 02:01:06 | [diff] [blame] | 30 | void Close() override; |
pfeldman | 55275645 | 2015-02-03 17:33:06 | [diff] [blame] | 31 | |
[email protected] | d212efd | 2013-04-15 13:03:06 | [diff] [blame] | 32 | Shell* frontend_shell() const { return frontend_shell_; } |
33 | |||||
Dave Tapuska | 5198f0e | 2021-11-18 15:41:11 | [diff] [blame] | 34 | base::WeakPtr<ShellDevToolsFrontend> GetWeakPtr(); |
35 | |||||
mkwst | 30d20d5 | 2014-10-09 13:33:14 | [diff] [blame] | 36 | private: |
[email protected] | 0773e0c | 2013-01-25 15:57:57 | [diff] [blame] | 37 | // WebContentsObserver overrides |
Sreeja Kamishetty | 4978330 | 2022-01-28 17:52:25 | [diff] [blame] | 38 | void PrimaryMainDocumentElementAvailable() override; |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 39 | void WebContentsDestroyed() override; |
[email protected] | 0773e0c | 2013-01-25 15:57:57 | [diff] [blame] | 40 | |
chenwilliam | fed5bda | 2017-03-24 02:01:06 | [diff] [blame] | 41 | ShellDevToolsFrontend(Shell* frontend_shell, WebContents* inspected_contents); |
42 | ~ShellDevToolsFrontend() override; | ||||
Keishi Hattori | 0e45c02 | 2021-11-27 09:25:52 | [diff] [blame] | 43 | raw_ptr<Shell> frontend_shell_; |
chenwilliam | fed5bda | 2017-03-24 02:01:06 | [diff] [blame] | 44 | std::unique_ptr<ShellDevToolsBindings> devtools_bindings_; |
Dave Tapuska | 5198f0e | 2021-11-18 15:41:11 | [diff] [blame] | 45 | |
46 | base::WeakPtrFactory<ShellDevToolsFrontend> weak_ptr_factory_{this}; | ||||
[email protected] | 0773e0c | 2013-01-25 15:57:57 | [diff] [blame] | 47 | }; |
48 | |||||
49 | } // namespace content | ||||
50 | |||||
[email protected] | de7d61ff | 2013-08-20 11:30:41 | [diff] [blame] | 51 | #endif // CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_ |