| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 171 } |
| 172 | 172 |
| 173 bool Target::Close() const { | 173 bool Target::Close() const { |
| 174 return agent_host_->Close(); | 174 return agent_host_->Close(); |
| 175 } | 175 } |
| 176 | 176 |
| 177 } // namespace | 177 } // namespace |
| 178 | 178 |
| 179 namespace content { | 179 namespace content { |
| 180 | 180 |
| 181 // ShellDevToolsDelegate ---------------------------------------------------- |
| 182 |
| 181 ShellDevToolsDelegate::ShellDevToolsDelegate(BrowserContext* browser_context) | 183 ShellDevToolsDelegate::ShellDevToolsDelegate(BrowserContext* browser_context) |
| 182 : browser_context_(browser_context) { | 184 : browser_context_(browser_context) { |
| 183 std::string frontend_url; | 185 std::string frontend_url; |
| 184 #if defined(OS_ANDROID) | 186 #if defined(OS_ANDROID) |
| 185 frontend_url = base::StringPrintf(kFrontEndURL, GetWebKitRevision().c_str()); | 187 frontend_url = base::StringPrintf(kFrontEndURL, GetWebKitRevision().c_str()); |
| 186 #endif | 188 #endif |
| 187 devtools_http_handler_ = | 189 devtools_http_handler_ = |
| 188 DevToolsHttpHandler::Start(CreateSocketFactory(), frontend_url, this, | 190 DevToolsHttpHandler::Start(CreateSocketFactory(), frontend_url, this, |
| 189 base::FilePath()); | 191 base::FilePath()); |
| 190 } | 192 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 211 return false; | 213 return false; |
| 212 #else | 214 #else |
| 213 return true; | 215 return true; |
| 214 #endif | 216 #endif |
| 215 } | 217 } |
| 216 | 218 |
| 217 base::FilePath ShellDevToolsDelegate::GetDebugFrontendDir() { | 219 base::FilePath ShellDevToolsDelegate::GetDebugFrontendDir() { |
| 218 return base::FilePath(); | 220 return base::FilePath(); |
| 219 } | 221 } |
| 220 | 222 |
| 221 std::string ShellDevToolsDelegate::GetPageThumbnailData(const GURL& url) { | 223 scoped_ptr<net::StreamListenSocket> |
| 224 ShellDevToolsDelegate::CreateSocketForTethering( |
| 225 net::StreamListenSocket::Delegate* delegate, |
| 226 std::string* name) { |
| 227 return scoped_ptr<net::StreamListenSocket>(); |
| 228 } |
| 229 |
| 230 // ShellDevToolsManagerDelegate ---------------------------------------------- |
| 231 |
| 232 ShellDevToolsManagerDelegate::ShellDevToolsManagerDelegate( |
| 233 BrowserContext* browser_context) |
| 234 : browser_context_(browser_context) { |
| 235 } |
| 236 |
| 237 ShellDevToolsManagerDelegate::~ShellDevToolsManagerDelegate() { |
| 238 } |
| 239 |
| 240 base::DictionaryValue* ShellDevToolsManagerDelegate::HandleCommand( |
| 241 DevToolsAgentHost* agent_host, |
| 242 base::DictionaryValue* command) { |
| 243 return NULL; |
| 244 } |
| 245 |
| 246 std::string ShellDevToolsManagerDelegate::GetPageThumbnailData( |
| 247 const GURL& url) { |
| 222 return std::string(); | 248 return std::string(); |
| 223 } | 249 } |
| 224 | 250 |
| 225 scoped_ptr<DevToolsTarget> | 251 scoped_ptr<DevToolsTarget> |
| 226 ShellDevToolsDelegate::CreateNewTarget(const GURL& url) { | 252 ShellDevToolsManagerDelegate::CreateNewTarget(const GURL& url) { |
| 227 Shell* shell = Shell::CreateNewWindow(browser_context_, | 253 Shell* shell = Shell::CreateNewWindow(browser_context_, |
| 228 url, | 254 url, |
| 229 NULL, | 255 NULL, |
| 230 MSG_ROUTING_NONE, | 256 MSG_ROUTING_NONE, |
| 231 gfx::Size()); | 257 gfx::Size()); |
| 232 return scoped_ptr<DevToolsTarget>( | 258 return scoped_ptr<DevToolsTarget>( |
| 233 new Target(DevToolsAgentHost::GetOrCreateFor(shell->web_contents()))); | 259 new Target(DevToolsAgentHost::GetOrCreateFor(shell->web_contents()))); |
| 234 } | 260 } |
| 235 | 261 |
| 236 void ShellDevToolsDelegate::EnumerateTargets(TargetCallback callback) { | 262 void ShellDevToolsManagerDelegate::EnumerateTargets(TargetCallback callback) { |
| 237 TargetList targets; | 263 TargetList targets; |
| 238 content::DevToolsAgentHost::List agents = | 264 content::DevToolsAgentHost::List agents = |
| 239 content::DevToolsAgentHost::GetOrCreateAll(); | 265 content::DevToolsAgentHost::GetOrCreateAll(); |
| 240 for (content::DevToolsAgentHost::List::iterator it = agents.begin(); | 266 for (content::DevToolsAgentHost::List::iterator it = agents.begin(); |
| 241 it != agents.end(); ++it) { | 267 it != agents.end(); ++it) { |
| 242 targets.push_back(new Target(*it)); | 268 targets.push_back(new Target(*it)); |
| 243 } | 269 } |
| 244 callback.Run(targets); | 270 callback.Run(targets); |
| 245 } | 271 } |
| 246 | 272 |
| 247 scoped_ptr<net::StreamListenSocket> | |
| 248 ShellDevToolsDelegate::CreateSocketForTethering( | |
| 249 net::StreamListenSocket::Delegate* delegate, | |
| 250 std::string* name) { | |
| 251 return scoped_ptr<net::StreamListenSocket>(); | |
| 252 } | |
| 253 | |
| 254 } // namespace content | 273 } // namespace content |
| OLD | NEW |