[Presentation API, Android] Implement basic messaging
[chromium-blink-merge.git] / chrome / browser / devtools / devtools_target_impl.h
blobbdddd83c2e598d23edbcf99fbaa7d1fdbce701ac
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_
8 #include <vector>
10 #include "base/callback.h"
11 #include "components/devtools_discovery/basic_target_descriptor.h"
13 class Profile;
15 namespace content {
16 class DevToolsAgentHost;
17 class WebContents;
20 class DevToolsTargetImpl : public devtools_discovery::BasicTargetDescriptor {
21 public:
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
36 // not any.
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
43 // background page.
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_