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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TARGET_IMPL_H_
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TARGET_IMPL_H_
10 #include "base/callback.h"
11 #include "components/devtools_discovery/basic_target_descriptor.h"
16 class DevToolsAgentHost
;
20 class DevToolsTargetImpl
: public devtools_discovery::BasicTargetDescriptor
{
22 static const char kTargetTypeApp
[];
23 static const char kTargetTypeBackgroundPage
[];
24 static const char kTargetTypePage
[];
25 static const char kTargetTypeWorker
[];
26 static const char kTargetTypeWebView
[];
27 static const char kTargetTypeIFrame
[];
28 static const char kTargetTypeOther
[];
29 static const char kTargetTypeServiceWorker
[];
31 explicit DevToolsTargetImpl(
32 scoped_refptr
<content::DevToolsAgentHost
> agent_host
);
33 ~DevToolsTargetImpl() override
;
35 // Returns the WebContents associated with the target on NULL if there is
37 content::WebContents
* GetWebContents() const;
39 // Returns the tab id if the target is associated with a tab, -1 otherwise.
40 virtual int GetTabId() const;
42 // Returns the extension id if the target is associated with an extension
44 virtual std::string
GetExtensionId() const;
46 // Open a new DevTools window or activate the existing one.
47 virtual void Inspect(Profile
* profile
) const;
49 // Reload the target page.
50 virtual void Reload() const;
52 // Creates a new target associated with tab.
53 static scoped_ptr
<DevToolsTargetImpl
> CreateForTab(
54 content::WebContents
* web_contents
);
56 // Caller takes ownership of returned objects.
57 static std::vector
<DevToolsTargetImpl
*> EnumerateAll();
60 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TARGET_IMPL_H_