| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "content/public/browser/devtools_target.h" | 11 #include "content/public/browser/devtools_target.h" |
| 12 #include "content/public/browser/worker_service.h" | 12 #include "content/public/browser/worker_service.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 RenderViewHost; | 18 class RenderViewHost; |
| 19 } | 19 } |
| 20 | 20 |
| 21 class DevToolsTargetImpl : public content::DevToolsTarget { | 21 class DevToolsTargetImpl : public content::DevToolsTarget { |
| 22 public: | 22 public: |
| 23 explicit DevToolsTargetImpl(content::DevToolsAgentHost* agent_host); | 23 explicit DevToolsTargetImpl(content::DevToolsAgentHost* agent_host); |
| 24 virtual ~DevToolsTargetImpl(); | 24 virtual ~DevToolsTargetImpl(); |
| 25 | 25 |
| 26 // content::DevToolsTarget overrides: | 26 // content::DevToolsTarget overrides: |
| 27 virtual std::string GetId() const OVERRIDE; | 27 virtual std::string GetId() const OVERRIDE; |
| 28 virtual std::string GetParentId() const OVERRIDE; |
| 28 virtual std::string GetType() const OVERRIDE; | 29 virtual std::string GetType() const OVERRIDE; |
| 29 virtual std::string GetTitle() const OVERRIDE; | 30 virtual std::string GetTitle() const OVERRIDE; |
| 30 virtual std::string GetDescription() const OVERRIDE; | 31 virtual std::string GetDescription() const OVERRIDE; |
| 31 virtual GURL GetURL() const OVERRIDE; | 32 virtual GURL GetURL() const OVERRIDE; |
| 32 virtual GURL GetFaviconURL() const OVERRIDE; | 33 virtual GURL GetFaviconURL() const OVERRIDE; |
| 33 virtual base::TimeTicks GetLastActivityTime() const OVERRIDE; | 34 virtual base::TimeTicks GetLastActivityTime() const OVERRIDE; |
| 34 virtual scoped_refptr<content::DevToolsAgentHost> | 35 virtual scoped_refptr<content::DevToolsAgentHost> |
| 35 GetAgentHost() const OVERRIDE; | 36 GetAgentHost() const OVERRIDE; |
| 36 virtual bool IsAttached() const OVERRIDE; | 37 virtual bool IsAttached() const OVERRIDE; |
| 37 virtual bool Activate() const OVERRIDE; | 38 virtual bool Activate() const OVERRIDE; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 51 // Open a new DevTools window or activate the existing one. | 52 // Open a new DevTools window or activate the existing one. |
| 52 virtual void Inspect(Profile* profile) const; | 53 virtual void Inspect(Profile* profile) const; |
| 53 | 54 |
| 54 // Reload the target page. | 55 // Reload the target page. |
| 55 virtual void Reload() const; | 56 virtual void Reload() const; |
| 56 | 57 |
| 57 // Creates a new target associated with RenderViewHost. | 58 // Creates a new target associated with RenderViewHost. |
| 58 static scoped_ptr<DevToolsTargetImpl> CreateForRenderViewHost( | 59 static scoped_ptr<DevToolsTargetImpl> CreateForRenderViewHost( |
| 59 content::RenderViewHost*, bool is_tab); | 60 content::RenderViewHost*, bool is_tab); |
| 60 | 61 |
| 62 void set_parent_id(const std::string& parent_id) { parent_id_ = parent_id; } |
| 61 void set_type(const std::string& type) { type_ = type; } | 63 void set_type(const std::string& type) { type_ = type; } |
| 62 void set_title(const std::string& title) { title_ = title; } | 64 void set_title(const std::string& title) { title_ = title; } |
| 63 void set_description(const std::string& desc) { description_ = desc; } | 65 void set_description(const std::string& desc) { description_ = desc; } |
| 64 void set_url(const GURL& url) { url_ = url; } | 66 void set_url(const GURL& url) { url_ = url; } |
| 65 void set_favicon_url(const GURL& url) { favicon_url_ = url; } | 67 void set_favicon_url(const GURL& url) { favicon_url_ = url; } |
| 66 void set_last_activity_time(const base::TimeTicks& time) { | 68 void set_last_activity_time(const base::TimeTicks& time) { |
| 67 last_activity_time_ = time; | 69 last_activity_time_ = time; |
| 68 } | 70 } |
| 69 | 71 |
| 70 typedef std::vector<DevToolsTargetImpl*> List; | 72 typedef std::vector<DevToolsTargetImpl*> List; |
| 71 typedef base::Callback<void(const List&)> Callback; | 73 typedef base::Callback<void(const List&)> Callback; |
| 72 | 74 |
| 73 static List EnumerateRenderViewHostTargets(); | 75 static List EnumerateRenderViewHostTargets(); |
| 74 static void EnumerateWorkerTargets(Callback callback); | 76 static void EnumerateWorkerTargets(Callback callback); |
| 75 static void EnumerateAllTargets(Callback callback); | 77 static void EnumerateAllTargets(Callback callback); |
| 76 | 78 |
| 77 private: | 79 private: |
| 78 scoped_refptr<content::DevToolsAgentHost> agent_host_; | 80 scoped_refptr<content::DevToolsAgentHost> agent_host_; |
| 79 std::string id_; | 81 std::string parent_id_; |
| 80 std::string type_; | 82 std::string type_; |
| 81 std::string title_; | 83 std::string title_; |
| 82 std::string description_; | 84 std::string description_; |
| 83 GURL url_; | 85 GURL url_; |
| 84 GURL favicon_url_; | 86 GURL favicon_url_; |
| 85 base::TimeTicks last_activity_time_; | 87 base::TimeTicks last_activity_time_; |
| 86 }; | 88 }; |
| 87 | 89 |
| 88 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TARGET_IMPL_H_ | 90 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TARGET_IMPL_H_ |
| OLD | NEW |