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::GetClientInfo(DevToolsCommandId command_id, | |
401 const std::string& client_id) { | |
402 return Response::InternalError("Not implemented yet"); | |
pfeldman
2015/06/05 12:19:54
Why do you need command_id?
horo
2015/06/08 03:21:53
"getTargetInfo" doesn't need to be "async" command
| |
403 } | |
404 | |
405 Response ServiceWorkerHandler::FocusClient(const std::string& client_id) { | |
406 scoped_refptr<DevToolsAgentHost> agent_host( | |
407 DevToolsAgentHost::GetForId(client_id)); | |
408 if (!agent_host) { | |
pfeldman
2015/06/05 12:19:54
drop {}
horo
2015/06/08 03:21:53
Done.
| |
409 return Response::InvalidParams("clientId"); | |
410 } | |
411 agent_host->Activate(); | |
412 return Response::OK(); | |
413 } | |
414 | |
400 void ServiceWorkerHandler::OpenNewDevToolsWindow(int process_id, | 415 void ServiceWorkerHandler::OpenNewDevToolsWindow(int process_id, |
401 int devtools_agent_route_id) { | 416 int devtools_agent_route_id) { |
402 scoped_refptr<DevToolsAgentHostImpl> agent_host( | 417 scoped_refptr<DevToolsAgentHostImpl> agent_host( |
403 ServiceWorkerDevToolsManager::GetInstance() | 418 ServiceWorkerDevToolsManager::GetInstance() |
404 ->GetDevToolsAgentHostForWorker(process_id, devtools_agent_route_id)); | 419 ->GetDevToolsAgentHostForWorker(process_id, devtools_agent_route_id)); |
405 if (!agent_host.get()) | 420 if (!agent_host.get()) |
406 return; | 421 return; |
407 agent_host->Inspect(render_frame_host_->GetProcess()->GetBrowserContext()); | 422 agent_host->Inspect(render_frame_host_->GetProcess()->GetBrowserContext()); |
408 } | 423 } |
409 | 424 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
517 return; | 532 return; |
518 host->DetachClient(); | 533 host->DetachClient(); |
519 client_->WorkerTerminated(WorkerTerminatedParams::Create()-> | 534 client_->WorkerTerminated(WorkerTerminatedParams::Create()-> |
520 set_worker_id(host->GetId())); | 535 set_worker_id(host->GetId())); |
521 attached_hosts_.erase(it); | 536 attached_hosts_.erase(it); |
522 } | 537 } |
523 | 538 |
524 } // namespace service_worker | 539 } // namespace service_worker |
525 } // namespace devtools | 540 } // namespace devtools |
526 } // namespace content | 541 } // namespace content |
OLD | NEW |