Check USB device path access when prompting users to select a device.
[chromium-blink-merge.git] / chrome / browser / devtools / devtools_target_impl.h
blob4a4a5614954d99ba659906b10472d9776ceaecb6
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 "content/public/browser/devtools_target.h"
12 #include "content/public/browser/worker_service.h"
14 class Profile;
16 namespace content {
17 class DevToolsAgentHost;
18 class RenderViewHost;
19 class WebContents;
22 class DevToolsTargetImpl : public content::DevToolsTarget {
23 public:
24 static const char kTargetTypeApp[];
25 static const char kTargetTypeBackgroundPage[];
26 static const char kTargetTypePage[];
27 static const char kTargetTypeWorker[];
28 static const char kTargetTypeWebView[];
29 static const char kTargetTypeIFrame[];
30 static const char kTargetTypeOther[];
31 static const char kTargetTypeServiceWorker[];
33 explicit DevToolsTargetImpl(
34 scoped_refptr<content::DevToolsAgentHost> agent_host);
35 ~DevToolsTargetImpl() override;
37 // content::DevToolsTarget overrides:
38 std::string GetId() const override;
39 std::string GetParentId() const override;
40 std::string GetType() const override;
41 std::string GetTitle() const override;
42 std::string GetDescription() const override;
43 GURL GetURL() const override;
44 GURL GetFaviconURL() const override;
45 base::TimeTicks GetLastActivityTime() const override;
46 scoped_refptr<content::DevToolsAgentHost> GetAgentHost() const override;
47 bool IsAttached() const override;
48 bool Activate() const override;
49 bool Close() const override;
51 // Returns the WebContents associated with the target on NULL if there is
52 // not any.
53 virtual content::WebContents* GetWebContents() const;
55 // Returns the tab id if the target is associated with a tab, -1 otherwise.
56 virtual int GetTabId() const;
58 // Returns the extension id if the target is associated with an extension
59 // background page.
60 virtual std::string GetExtensionId() const;
62 // Open a new DevTools window or activate the existing one.
63 virtual void Inspect(Profile* profile) const;
65 // Reload the target page.
66 virtual void Reload() const;
68 // Creates a new target associated with WebContents.
69 static scoped_ptr<DevToolsTargetImpl> CreateForWebContents(
70 content::WebContents* web_contents,
71 bool is_tab);
73 void set_parent_id(const std::string& parent_id) { parent_id_ = parent_id; }
74 void set_type(const std::string& type) { type_ = type; }
75 void set_title(const std::string& title) { title_ = title; }
76 void set_description(const std::string& desc) { description_ = desc; }
77 void set_url(const GURL& url) { url_ = url; }
78 void set_favicon_url(const GURL& url) { favicon_url_ = url; }
79 void set_last_activity_time(const base::TimeTicks& time) {
80 last_activity_time_ = time;
83 typedef std::vector<DevToolsTargetImpl*> List;
84 typedef base::Callback<void(const List&)> Callback;
86 static void EnumerateAllTargets(Callback callback);
88 private:
89 scoped_refptr<content::DevToolsAgentHost> agent_host_;
90 std::string parent_id_;
91 std::string type_;
92 std::string title_;
93 std::string description_;
94 GURL url_;
95 GURL favicon_url_;
96 base::TimeTicks last_activity_time_;
99 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TARGET_IMPL_H_