OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chromecast/shell/browser/devtools/cast_dev_tools_delegate.h" | 5 #include "chromecast/shell/browser/devtools/cast_dev_tools_delegate.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "content/public/browser/devtools_agent_host.h" | 10 #include "content/public/browser/devtools_agent_host.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 const char kTargetTypePage[] = "page"; | 25 const char kTargetTypePage[] = "page"; |
26 const char kTargetTypeServiceWorker[] = "service_worker"; | 26 const char kTargetTypeServiceWorker[] = "service_worker"; |
27 const char kTargetTypeSharedWorker[] = "worker"; | 27 const char kTargetTypeSharedWorker[] = "worker"; |
28 const char kTargetTypeOther[] = "other"; | 28 const char kTargetTypeOther[] = "other"; |
29 | 29 |
30 class Target : public content::DevToolsTarget { | 30 class Target : public content::DevToolsTarget { |
31 public: | 31 public: |
32 explicit Target(scoped_refptr<content::DevToolsAgentHost> agent_host); | 32 explicit Target(scoped_refptr<content::DevToolsAgentHost> agent_host); |
33 | 33 |
34 virtual std::string GetId() const OVERRIDE { return agent_host_->GetId(); } | 34 virtual std::string GetId() const override { return agent_host_->GetId(); } |
35 virtual std::string GetParentId() const OVERRIDE { return std::string(); } | 35 virtual std::string GetParentId() const override { return std::string(); } |
36 virtual std::string GetType() const OVERRIDE { | 36 virtual std::string GetType() const override { |
37 switch (agent_host_->GetType()) { | 37 switch (agent_host_->GetType()) { |
38 case content::DevToolsAgentHost::TYPE_WEB_CONTENTS: | 38 case content::DevToolsAgentHost::TYPE_WEB_CONTENTS: |
39 return kTargetTypePage; | 39 return kTargetTypePage; |
40 case content::DevToolsAgentHost::TYPE_SERVICE_WORKER: | 40 case content::DevToolsAgentHost::TYPE_SERVICE_WORKER: |
41 return kTargetTypeServiceWorker; | 41 return kTargetTypeServiceWorker; |
42 case content::DevToolsAgentHost::TYPE_SHARED_WORKER: | 42 case content::DevToolsAgentHost::TYPE_SHARED_WORKER: |
43 return kTargetTypeSharedWorker; | 43 return kTargetTypeSharedWorker; |
44 default: | 44 default: |
45 break; | 45 break; |
46 } | 46 } |
47 return kTargetTypeOther; | 47 return kTargetTypeOther; |
48 } | 48 } |
49 virtual std::string GetTitle() const OVERRIDE { | 49 virtual std::string GetTitle() const override { |
50 return agent_host_->GetTitle(); | 50 return agent_host_->GetTitle(); |
51 } | 51 } |
52 virtual std::string GetDescription() const OVERRIDE { return std::string(); } | 52 virtual std::string GetDescription() const override { return std::string(); } |
53 virtual GURL GetURL() const OVERRIDE { | 53 virtual GURL GetURL() const override { |
54 return agent_host_->GetURL(); | 54 return agent_host_->GetURL(); |
55 } | 55 } |
56 virtual GURL GetFaviconURL() const OVERRIDE { return favicon_url_; } | 56 virtual GURL GetFaviconURL() const override { return favicon_url_; } |
57 virtual base::TimeTicks GetLastActivityTime() const OVERRIDE { | 57 virtual base::TimeTicks GetLastActivityTime() const override { |
58 return last_activity_time_; | 58 return last_activity_time_; |
59 } | 59 } |
60 virtual bool IsAttached() const OVERRIDE { | 60 virtual bool IsAttached() const override { |
61 return agent_host_->IsAttached(); | 61 return agent_host_->IsAttached(); |
62 } | 62 } |
63 virtual scoped_refptr<content::DevToolsAgentHost> GetAgentHost() | 63 virtual scoped_refptr<content::DevToolsAgentHost> GetAgentHost() |
64 const OVERRIDE { | 64 const override { |
65 return agent_host_; | 65 return agent_host_; |
66 } | 66 } |
67 virtual bool Activate() const OVERRIDE { | 67 virtual bool Activate() const override { |
68 return agent_host_->Activate(); | 68 return agent_host_->Activate(); |
69 } | 69 } |
70 virtual bool Close() const OVERRIDE { | 70 virtual bool Close() const override { |
71 return agent_host_->Close(); | 71 return agent_host_->Close(); |
72 } | 72 } |
73 | 73 |
74 private: | 74 private: |
75 scoped_refptr<content::DevToolsAgentHost> agent_host_; | 75 scoped_refptr<content::DevToolsAgentHost> agent_host_; |
76 GURL favicon_url_; | 76 GURL favicon_url_; |
77 base::TimeTicks last_activity_time_; | 77 base::TimeTicks last_activity_time_; |
78 | 78 |
79 DISALLOW_COPY_AND_ASSIGN(Target); | 79 DISALLOW_COPY_AND_ASSIGN(Target); |
80 }; | 80 }; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 content::DevToolsAgentHost::GetOrCreateAll(); | 158 content::DevToolsAgentHost::GetOrCreateAll(); |
159 for (content::DevToolsAgentHost::List::iterator it = agents.begin(); | 159 for (content::DevToolsAgentHost::List::iterator it = agents.begin(); |
160 it != agents.end(); ++it) { | 160 it != agents.end(); ++it) { |
161 targets.push_back(new Target(*it)); | 161 targets.push_back(new Target(*it)); |
162 } | 162 } |
163 callback.Run(targets); | 163 callback.Run(targets); |
164 } | 164 } |
165 | 165 |
166 } // namespace shell | 166 } // namespace shell |
167 } // namespace chromecast | 167 } // namespace chromecast |
OLD | NEW |