| 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 "chrome/browser/devtools/devtools_target_impl.h" | 5 #include "chrome/browser/devtools/devtools_target_impl.h" |
| 6 | 6 |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/devtools/devtools_window.h" | 9 #include "chrome/browser/devtools/devtools_window.h" |
| 10 #include "chrome/browser/extensions/extension_host.h" | 10 #include "chrome/browser/extensions/extension_host.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 void DevToolsTargetImpl::Reload() const { | 268 void DevToolsTargetImpl::Reload() const { |
| 269 } | 269 } |
| 270 | 270 |
| 271 // static | 271 // static |
| 272 scoped_ptr<DevToolsTargetImpl> DevToolsTargetImpl::CreateForRenderViewHost( | 272 scoped_ptr<DevToolsTargetImpl> DevToolsTargetImpl::CreateForRenderViewHost( |
| 273 content::RenderViewHost* rvh, bool is_tab) { | 273 content::RenderViewHost* rvh, bool is_tab) { |
| 274 return scoped_ptr<DevToolsTargetImpl>(new RenderViewHostTarget(rvh, is_tab)); | 274 return scoped_ptr<DevToolsTargetImpl>(new RenderViewHostTarget(rvh, is_tab)); |
| 275 } | 275 } |
| 276 | 276 |
| 277 // static | 277 // static |
| 278 scoped_ptr<DevToolsTargetImpl> DevToolsTargetImpl::CreateForWorker( | |
| 279 const WorkerService::WorkerInfo& worker_info) { | |
| 280 return scoped_ptr<DevToolsTargetImpl>(new WorkerTarget(worker_info)); | |
| 281 } | |
| 282 | |
| 283 // static | |
| 284 DevToolsTargetImpl::List DevToolsTargetImpl::EnumerateRenderViewHostTargets() { | 278 DevToolsTargetImpl::List DevToolsTargetImpl::EnumerateRenderViewHostTargets() { |
| 285 std::set<RenderViewHost*> tab_rvhs; | 279 std::set<RenderViewHost*> tab_rvhs; |
| 286 for (TabContentsIterator it; !it.done(); it.Next()) | 280 for (TabContentsIterator it; !it.done(); it.Next()) |
| 287 tab_rvhs.insert(it->GetRenderViewHost()); | 281 tab_rvhs.insert(it->GetRenderViewHost()); |
| 288 | 282 |
| 289 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 283 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 290 DevToolsTargetImpl::List result; | 284 DevToolsTargetImpl::List result; |
| 291 std::vector<RenderViewHost*> rvh_list = | 285 std::vector<RenderViewHost*> rvh_list = |
| 292 content::DevToolsAgentHost::GetValidRenderViewHosts(); | 286 content::DevToolsAgentHost::GetValidRenderViewHosts(); |
| 293 for (std::vector<RenderViewHost*>::iterator it = rvh_list.begin(); | 287 for (std::vector<RenderViewHost*>::iterator it = rvh_list.begin(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 | 326 |
| 333 // static | 327 // static |
| 334 void DevToolsTargetImpl::EnumerateAllTargets(Callback callback) { | 328 void DevToolsTargetImpl::EnumerateAllTargets(Callback callback) { |
| 335 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 329 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 336 content::BrowserThread::PostTask( | 330 content::BrowserThread::PostTask( |
| 337 content::BrowserThread::IO, | 331 content::BrowserThread::IO, |
| 338 FROM_HERE, | 332 FROM_HERE, |
| 339 base::Bind(&DevToolsTargetImpl::EnumerateWorkerTargets, | 333 base::Bind(&DevToolsTargetImpl::EnumerateWorkerTargets, |
| 340 base::Bind(&CollectAllTargets, callback))); | 334 base::Bind(&CollectAllTargets, callback))); |
| 341 } | 335 } |
| OLD | NEW |