| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/browser/devtools/protocol/service_worker_handler.h" | 5 #include "content/browser/devtools/protocol/service_worker_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/containers/scoped_ptr_hash_map.h" | 8 #include "base/containers/scoped_ptr_hash_map.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 return CreateContextErrorResponse(); | 390 return CreateContextErrorResponse(); |
| 391 int64 id = 0; | 391 int64 id = 0; |
| 392 if (!base::StringToInt64(registration_id, &id)) | 392 if (!base::StringToInt64(registration_id, &id)) |
| 393 return CreateInvalidVersionIdErrorResponse(); | 393 return CreateInvalidVersionIdErrorResponse(); |
| 394 BrowserContext::DeliverPushMessage( | 394 BrowserContext::DeliverPushMessage( |
| 395 render_frame_host_->GetProcess()->GetBrowserContext(), GURL(origin), id, | 395 render_frame_host_->GetProcess()->GetBrowserContext(), GURL(origin), id, |
| 396 data, base::Bind(&PushDeliveryNoOp)); | 396 data, base::Bind(&PushDeliveryNoOp)); |
| 397 return Response::OK(); | 397 return Response::OK(); |
| 398 } | 398 } |
| 399 | 399 |
| 400 Response ServiceWorkerHandler::GetTargetInfo(DevToolsCommandId command_id, |
| 401 const std::string& target_id) { |
| 402 return Response::InternalError("Not implemented yet"); |
| 403 } |
| 404 |
| 405 Response ServiceWorkerHandler::FocusTarget(const std::string& target_id) { |
| 406 scoped_refptr<DevToolsAgentHost> agent_host( |
| 407 DevToolsAgentHost::GetForId(target_id)); |
| 408 if (!agent_host) |
| 409 return Response::InvalidParams("targetId"); |
| 410 agent_host->Activate(); |
| 411 return Response::OK(); |
| 412 } |
| 413 |
| 400 void ServiceWorkerHandler::OpenNewDevToolsWindow(int process_id, | 414 void ServiceWorkerHandler::OpenNewDevToolsWindow(int process_id, |
| 401 int devtools_agent_route_id) { | 415 int devtools_agent_route_id) { |
| 402 scoped_refptr<DevToolsAgentHostImpl> agent_host( | 416 scoped_refptr<DevToolsAgentHostImpl> agent_host( |
| 403 ServiceWorkerDevToolsManager::GetInstance() | 417 ServiceWorkerDevToolsManager::GetInstance() |
| 404 ->GetDevToolsAgentHostForWorker(process_id, devtools_agent_route_id)); | 418 ->GetDevToolsAgentHostForWorker(process_id, devtools_agent_route_id)); |
| 405 if (!agent_host.get()) | 419 if (!agent_host.get()) |
| 406 return; | 420 return; |
| 407 agent_host->Inspect(render_frame_host_->GetProcess()->GetBrowserContext()); | 421 agent_host->Inspect(render_frame_host_->GetProcess()->GetBrowserContext()); |
| 408 } | 422 } |
| 409 | 423 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 return; | 531 return; |
| 518 host->DetachClient(); | 532 host->DetachClient(); |
| 519 client_->WorkerTerminated(WorkerTerminatedParams::Create()-> | 533 client_->WorkerTerminated(WorkerTerminatedParams::Create()-> |
| 520 set_worker_id(host->GetId())); | 534 set_worker_id(host->GetId())); |
| 521 attached_hosts_.erase(it); | 535 attached_hosts_.erase(it); |
| 522 } | 536 } |
| 523 | 537 |
| 524 } // namespace service_worker | 538 } // namespace service_worker |
| 525 } // namespace devtools | 539 } // namespace devtools |
| 526 } // namespace content | 540 } // namespace content |
| OLD | NEW |