OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/browser/devtools/shared_worker_devtools_agent_host.h" |
| 6 |
| 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "content/browser/shared_worker/shared_worker_service_impl.h" |
| 9 #include "content/public/browser/browser_thread.h" |
| 10 #include "content/public/browser/render_process_host.h" |
| 11 |
| 12 namespace content { |
| 13 |
| 14 namespace { |
| 15 |
| 16 void TerminateSharedWorkerOnIO( |
| 17 EmbeddedWorkerDevToolsAgentHost::WorkerId worker_id) { |
| 18 SharedWorkerServiceImpl::GetInstance()->TerminateWorker( |
| 19 worker_id.first, worker_id.second); |
| 20 } |
| 21 |
| 22 } // namespace |
| 23 |
| 24 SharedWorkerDevToolsAgentHost::SharedWorkerDevToolsAgentHost( |
| 25 WorkerId worker_id, |
| 26 const SharedWorkerInstance& shared_worker) |
| 27 : EmbeddedWorkerDevToolsAgentHost(worker_id), |
| 28 shared_worker_(new SharedWorkerInstance(shared_worker)) { |
| 29 } |
| 30 |
| 31 DevToolsAgentHost::Type SharedWorkerDevToolsAgentHost::GetType() { |
| 32 return TYPE_SHARED_WORKER; |
| 33 } |
| 34 |
| 35 std::string SharedWorkerDevToolsAgentHost::GetTitle() { |
| 36 return base::UTF16ToUTF8(shared_worker_->name()); |
| 37 } |
| 38 |
| 39 GURL SharedWorkerDevToolsAgentHost::GetURL() { |
| 40 return shared_worker_->url(); |
| 41 } |
| 42 |
| 43 bool SharedWorkerDevToolsAgentHost::Activate() { |
| 44 return false; |
| 45 } |
| 46 |
| 47 bool SharedWorkerDevToolsAgentHost::Close() { |
| 48 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 49 base::Bind(&TerminateSharedWorkerOnIO, worker_id())); |
| 50 return true; |
| 51 } |
| 52 |
| 53 bool SharedWorkerDevToolsAgentHost::Matches( |
| 54 const SharedWorkerInstance& other) { |
| 55 return shared_worker_->Matches(other); |
| 56 } |
| 57 |
| 58 SharedWorkerDevToolsAgentHost::~SharedWorkerDevToolsAgentHost() { |
| 59 } |
| 60 |
| 61 } // namespace content |
OLD | NEW |