Chromium Code Reviews| 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 349 if (!base::StringToInt64(version_id, &id)) | 349 if (!base::StringToInt64(version_id, &id)) |
| 350 return CreateInvalidVersionIdErrorResoponse(); | 350 return CreateInvalidVersionIdErrorResoponse(); |
| 351 BrowserThread::PostTask( | 351 BrowserThread::PostTask( |
| 352 BrowserThread::IO, FROM_HERE, | 352 BrowserThread::IO, FROM_HERE, |
| 353 base::Bind(&GetDevToolsRouteInfoOnIO, context_, id, | 353 base::Bind(&GetDevToolsRouteInfoOnIO, context_, id, |
| 354 base::Bind(&ServiceWorkerHandler::OpenNewDevToolsWindow, | 354 base::Bind(&ServiceWorkerHandler::OpenNewDevToolsWindow, |
| 355 weak_factory_.GetWeakPtr()))); | 355 weak_factory_.GetWeakPtr()))); |
| 356 return Response::OK(); | 356 return Response::OK(); |
| 357 } | 357 } |
| 358 | 358 |
| 359 Response ServiceWorkerHandler::SkipWaiting(const std::string& version_id) { | |
| 360 if (!enabled_) | |
| 361 return Response::OK(); | |
| 362 if (!context_) | |
| 363 return CreateContextErrorResoponse(); | |
|
falken
2015/04/28 02:01:14
typo: Response
horo
2015/04/28 02:13:25
Done.
| |
| 364 | |
| 365 int64 id = 0; | |
| 366 if (!base::StringToInt64(version_id, &id)) | |
| 367 return CreateInvalidVersionIdErrorResoponse(); | |
|
falken
2015/04/28 02:01:14
typo: Response
horo
2015/04/28 02:13:25
Done.
| |
| 368 context_->SimulateSkipWaiting(id); | |
| 369 return Response::OK(); | |
| 370 } | |
| 371 | |
| 359 Response ServiceWorkerHandler::SetDebugOnStart(bool debug_on_start) { | 372 Response ServiceWorkerHandler::SetDebugOnStart(bool debug_on_start) { |
| 360 ServiceWorkerDevToolsManager::GetInstance() | 373 ServiceWorkerDevToolsManager::GetInstance() |
| 361 ->set_debug_service_worker_on_start(debug_on_start); | 374 ->set_debug_service_worker_on_start(debug_on_start); |
| 362 return Response::OK(); | 375 return Response::OK(); |
| 363 } | 376 } |
| 364 | 377 |
| 365 Response ServiceWorkerHandler::DeliverPushMessage( | 378 Response ServiceWorkerHandler::DeliverPushMessage( |
| 366 const std::string& origin, | 379 const std::string& origin, |
| 367 const std::string& registration_id, | 380 const std::string& registration_id, |
| 368 const std::string& data) { | 381 const std::string& data) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 495 return; | 508 return; |
| 496 host->DetachClient(); | 509 host->DetachClient(); |
| 497 client_->WorkerTerminated(WorkerTerminatedParams::Create()-> | 510 client_->WorkerTerminated(WorkerTerminatedParams::Create()-> |
| 498 set_worker_id(host->GetId())); | 511 set_worker_id(host->GetId())); |
| 499 attached_hosts_.erase(it); | 512 attached_hosts_.erase(it); |
| 500 } | 513 } |
| 501 | 514 |
| 502 } // namespace service_worker | 515 } // namespace service_worker |
| 503 } // namespace devtools | 516 } // namespace devtools |
| 504 } // namespace content | 517 } // namespace content |
| OLD | NEW |