OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TARGET_IMPL_H_ | 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TARGET_IMPL_H_ |
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TARGET_IMPL_H_ | 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TARGET_IMPL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "components/devtools_discovery/basic_target_descriptor.h" | 12 #include "components/devtools_discovery/basic_target_descriptor.h" |
13 | 13 |
14 class Profile; | 14 class Profile; |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 class DevToolsAgentHost; | 17 class DevToolsAgentHost; |
18 class WebContents; | 18 class WebContents; |
19 } | 19 } |
20 | 20 |
21 class DevToolsTargetImpl : public devtools_discovery::BasicTargetDescriptor { | 21 class DevToolsTargetImpl : public devtools_discovery::BasicTargetDescriptor { |
22 public: | 22 public: |
23 static const char kTargetTypeApp[]; | |
24 static const char kTargetTypeBackgroundPage[]; | |
25 static const char kTargetTypePage[]; | |
26 static const char kTargetTypeWorker[]; | |
27 static const char kTargetTypeWebView[]; | |
28 static const char kTargetTypeIFrame[]; | |
29 static const char kTargetTypeNode[]; | |
30 static const char kTargetTypeOther[]; | |
31 static const char kTargetTypeServiceWorker[]; | |
32 | |
33 explicit DevToolsTargetImpl( | 23 explicit DevToolsTargetImpl( |
34 scoped_refptr<content::DevToolsAgentHost> agent_host); | 24 scoped_refptr<content::DevToolsAgentHost> agent_host); |
35 ~DevToolsTargetImpl() override; | 25 ~DevToolsTargetImpl() override; |
36 | 26 |
37 // Returns the WebContents associated with the target on NULL if there is | |
38 // not any. | |
39 content::WebContents* GetWebContents() const; | |
40 | |
41 // Returns the tab id if the target is associated with a tab, -1 otherwise. | |
42 virtual int GetTabId() const; | |
43 | |
44 // Returns the extension id if the target is associated with an extension | |
45 // background page. | |
46 virtual std::string GetExtensionId() const; | |
47 | |
48 // Open a new DevTools window or activate the existing one. | |
49 virtual void Inspect(Profile* profile) const; | |
50 | |
51 // Reload the target page. | |
52 virtual void Reload() const; | |
53 | |
54 // Creates a new target associated with tab. | |
55 static std::unique_ptr<DevToolsTargetImpl> CreateForTab( | |
56 content::WebContents* web_contents); | |
57 | |
58 // Caller takes ownership of returned objects. | 27 // Caller takes ownership of returned objects. |
59 static std::vector<DevToolsTargetImpl*> EnumerateAll(); | 28 static std::vector<DevToolsTargetImpl*> EnumerateAll(); |
60 }; | 29 }; |
61 | 30 |
62 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TARGET_IMPL_H_ | 31 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TARGET_IMPL_H_ |
OLD | NEW |