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 #include "content/shell/browser/shell_devtools_delegate.h" | 5 #include "content/shell/browser/shell_devtools_delegate.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 #if defined(OS_ANDROID) | 49 #if defined(OS_ANDROID) |
50 class UnixDomainServerSocketFactory | 50 class UnixDomainServerSocketFactory |
51 : public content::DevToolsHttpHandler::ServerSocketFactory { | 51 : public content::DevToolsHttpHandler::ServerSocketFactory { |
52 public: | 52 public: |
53 explicit UnixDomainServerSocketFactory(const std::string& socket_name) | 53 explicit UnixDomainServerSocketFactory(const std::string& socket_name) |
54 : content::DevToolsHttpHandler::ServerSocketFactory(socket_name, 0, 1) {} | 54 : content::DevToolsHttpHandler::ServerSocketFactory(socket_name, 0, 1) {} |
55 | 55 |
56 private: | 56 private: |
57 // content::DevToolsHttpHandler::ServerSocketFactory. | 57 // content::DevToolsHttpHandler::ServerSocketFactory. |
58 virtual scoped_ptr<net::ServerSocket> Create() const OVERRIDE { | 58 virtual scoped_ptr<net::ServerSocket> Create() const override { |
59 return scoped_ptr<net::ServerSocket>( | 59 return scoped_ptr<net::ServerSocket>( |
60 new net::UnixDomainServerSocket( | 60 new net::UnixDomainServerSocket( |
61 base::Bind(&content::CanUserConnectToDevTools), | 61 base::Bind(&content::CanUserConnectToDevTools), |
62 true /* use_abstract_namespace */)); | 62 true /* use_abstract_namespace */)); |
63 } | 63 } |
64 | 64 |
65 DISALLOW_COPY_AND_ASSIGN(UnixDomainServerSocketFactory); | 65 DISALLOW_COPY_AND_ASSIGN(UnixDomainServerSocketFactory); |
66 }; | 66 }; |
67 #else | 67 #else |
68 class TCPServerSocketFactory | 68 class TCPServerSocketFactory |
69 : public content::DevToolsHttpHandler::ServerSocketFactory { | 69 : public content::DevToolsHttpHandler::ServerSocketFactory { |
70 public: | 70 public: |
71 TCPServerSocketFactory(const std::string& address, int port, int backlog) | 71 TCPServerSocketFactory(const std::string& address, int port, int backlog) |
72 : content::DevToolsHttpHandler::ServerSocketFactory( | 72 : content::DevToolsHttpHandler::ServerSocketFactory( |
73 address, port, backlog) {} | 73 address, port, backlog) {} |
74 | 74 |
75 private: | 75 private: |
76 // content::DevToolsHttpHandler::ServerSocketFactory. | 76 // content::DevToolsHttpHandler::ServerSocketFactory. |
77 virtual scoped_ptr<net::ServerSocket> Create() const OVERRIDE { | 77 virtual scoped_ptr<net::ServerSocket> Create() const override { |
78 return scoped_ptr<net::ServerSocket>( | 78 return scoped_ptr<net::ServerSocket>( |
79 new net::TCPServerSocket(NULL, net::NetLog::Source())); | 79 new net::TCPServerSocket(NULL, net::NetLog::Source())); |
80 } | 80 } |
81 | 81 |
82 DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory); | 82 DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory); |
83 }; | 83 }; |
84 #endif | 84 #endif |
85 | 85 |
86 scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory> | 86 scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory> |
87 CreateSocketFactory() { | 87 CreateSocketFactory() { |
(...skipping 23 matching lines...) Expand all Loading... |
111 } | 111 } |
112 return scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory>( | 112 return scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory>( |
113 new TCPServerSocketFactory("127.0.0.1", port, 1)); | 113 new TCPServerSocketFactory("127.0.0.1", port, 1)); |
114 #endif | 114 #endif |
115 } | 115 } |
116 | 116 |
117 class Target : public content::DevToolsTarget { | 117 class Target : public content::DevToolsTarget { |
118 public: | 118 public: |
119 explicit Target(scoped_refptr<DevToolsAgentHost> agent_host); | 119 explicit Target(scoped_refptr<DevToolsAgentHost> agent_host); |
120 | 120 |
121 virtual std::string GetId() const OVERRIDE { return agent_host_->GetId(); } | 121 virtual std::string GetId() const override { return agent_host_->GetId(); } |
122 virtual std::string GetParentId() const OVERRIDE { return std::string(); } | 122 virtual std::string GetParentId() const override { return std::string(); } |
123 virtual std::string GetType() const OVERRIDE { | 123 virtual std::string GetType() const override { |
124 switch (agent_host_->GetType()) { | 124 switch (agent_host_->GetType()) { |
125 case DevToolsAgentHost::TYPE_WEB_CONTENTS: | 125 case DevToolsAgentHost::TYPE_WEB_CONTENTS: |
126 return kTargetTypePage; | 126 return kTargetTypePage; |
127 case DevToolsAgentHost::TYPE_SERVICE_WORKER: | 127 case DevToolsAgentHost::TYPE_SERVICE_WORKER: |
128 return kTargetTypeServiceWorker; | 128 return kTargetTypeServiceWorker; |
129 default: | 129 default: |
130 break; | 130 break; |
131 } | 131 } |
132 return kTargetTypeOther; | 132 return kTargetTypeOther; |
133 } | 133 } |
134 virtual std::string GetTitle() const OVERRIDE { | 134 virtual std::string GetTitle() const override { |
135 return agent_host_->GetTitle(); | 135 return agent_host_->GetTitle(); |
136 } | 136 } |
137 virtual std::string GetDescription() const OVERRIDE { return std::string(); } | 137 virtual std::string GetDescription() const override { return std::string(); } |
138 virtual GURL GetURL() const OVERRIDE { return agent_host_->GetURL(); } | 138 virtual GURL GetURL() const override { return agent_host_->GetURL(); } |
139 virtual GURL GetFaviconURL() const OVERRIDE { return favicon_url_; } | 139 virtual GURL GetFaviconURL() const override { return favicon_url_; } |
140 virtual base::TimeTicks GetLastActivityTime() const OVERRIDE { | 140 virtual base::TimeTicks GetLastActivityTime() const override { |
141 return last_activity_time_; | 141 return last_activity_time_; |
142 } | 142 } |
143 virtual bool IsAttached() const OVERRIDE { | 143 virtual bool IsAttached() const override { |
144 return agent_host_->IsAttached(); | 144 return agent_host_->IsAttached(); |
145 } | 145 } |
146 virtual scoped_refptr<DevToolsAgentHost> GetAgentHost() const OVERRIDE { | 146 virtual scoped_refptr<DevToolsAgentHost> GetAgentHost() const override { |
147 return agent_host_; | 147 return agent_host_; |
148 } | 148 } |
149 virtual bool Activate() const OVERRIDE; | 149 virtual bool Activate() const override; |
150 virtual bool Close() const OVERRIDE; | 150 virtual bool Close() const override; |
151 | 151 |
152 private: | 152 private: |
153 scoped_refptr<DevToolsAgentHost> agent_host_; | 153 scoped_refptr<DevToolsAgentHost> agent_host_; |
154 GURL favicon_url_; | 154 GURL favicon_url_; |
155 base::TimeTicks last_activity_time_; | 155 base::TimeTicks last_activity_time_; |
156 }; | 156 }; |
157 | 157 |
158 Target::Target(scoped_refptr<DevToolsAgentHost> agent_host) | 158 Target::Target(scoped_refptr<DevToolsAgentHost> agent_host) |
159 : agent_host_(agent_host) { | 159 : agent_host_(agent_host) { |
160 if (WebContents* web_contents = agent_host_->GetWebContents()) { | 160 if (WebContents* web_contents = agent_host_->GetWebContents()) { |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 content::DevToolsAgentHost::List agents = | 264 content::DevToolsAgentHost::List agents = |
265 content::DevToolsAgentHost::GetOrCreateAll(); | 265 content::DevToolsAgentHost::GetOrCreateAll(); |
266 for (content::DevToolsAgentHost::List::iterator it = agents.begin(); | 266 for (content::DevToolsAgentHost::List::iterator it = agents.begin(); |
267 it != agents.end(); ++it) { | 267 it != agents.end(); ++it) { |
268 targets.push_back(new Target(*it)); | 268 targets.push_back(new Target(*it)); |
269 } | 269 } |
270 callback.Run(targets); | 270 callback.Run(targets); |
271 } | 271 } |
272 | 272 |
273 } // namespace content | 273 } // namespace content |
OLD | NEW |