| 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 "content/browser/service_worker/service_worker_context_core.h" | 5 #include "content/browser/service_worker/service_worker_context_core.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 | 405 |
| 406 ServiceWorkerProviderHost* ServiceWorkerContextCore::GetProviderHostByClientID( | 406 ServiceWorkerProviderHost* ServiceWorkerContextCore::GetProviderHostByClientID( |
| 407 const std::string& client_uuid) { | 407 const std::string& client_uuid) { |
| 408 auto found = provider_by_uuid_->find(client_uuid); | 408 auto found = provider_by_uuid_->find(client_uuid); |
| 409 if (found == provider_by_uuid_->end()) | 409 if (found == provider_by_uuid_->end()) |
| 410 return nullptr; | 410 return nullptr; |
| 411 return found->second; | 411 return found->second; |
| 412 } | 412 } |
| 413 | 413 |
| 414 void ServiceWorkerContextCore::RegisterServiceWorker( | 414 void ServiceWorkerContextCore::RegisterServiceWorker( |
| 415 const GURL& pattern, | |
| 416 const GURL& script_url, | 415 const GURL& script_url, |
| 416 const ServiceWorkerRegistrationOptions& options, |
| 417 ServiceWorkerProviderHost* provider_host, | 417 ServiceWorkerProviderHost* provider_host, |
| 418 const RegistrationCallback& callback) { | 418 const RegistrationCallback& callback) { |
| 419 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 419 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 420 was_service_worker_registered_ = true; | 420 was_service_worker_registered_ = true; |
| 421 job_coordinator_->Register( | 421 job_coordinator_->Register( |
| 422 pattern, | 422 script_url, options, provider_host, |
| 423 script_url, | 423 base::Bind(&ServiceWorkerContextCore::RegistrationComplete, AsWeakPtr(), |
| 424 provider_host, | 424 options.scope, callback)); |
| 425 base::Bind(&ServiceWorkerContextCore::RegistrationComplete, | |
| 426 AsWeakPtr(), | |
| 427 pattern, | |
| 428 callback)); | |
| 429 } | 425 } |
| 430 | 426 |
| 431 void ServiceWorkerContextCore::UpdateServiceWorker( | 427 void ServiceWorkerContextCore::UpdateServiceWorker( |
| 432 ServiceWorkerRegistration* registration, | 428 ServiceWorkerRegistration* registration, |
| 433 bool force_bypass_cache) { | 429 bool force_bypass_cache) { |
| 434 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 430 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 435 job_coordinator_->Update(registration, force_bypass_cache); | 431 job_coordinator_->Update(registration, force_bypass_cache); |
| 436 } | 432 } |
| 437 | 433 |
| 438 void ServiceWorkerContextCore::UpdateServiceWorker( | 434 void ServiceWorkerContextCore::UpdateServiceWorker( |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 scoped_refptr<ServiceWorkerRegistration> registration) { | 903 scoped_refptr<ServiceWorkerRegistration> registration) { |
| 908 if (!registration->active_version() && !registration->waiting_version()) { | 904 if (!registration->active_version() && !registration->waiting_version()) { |
| 909 callback.Run(ServiceWorkerCapability::NO_SERVICE_WORKER); | 905 callback.Run(ServiceWorkerCapability::NO_SERVICE_WORKER); |
| 910 return; | 906 return; |
| 911 } | 907 } |
| 912 | 908 |
| 913 CheckFetchHandlerOfInstalledServiceWorker(callback, registration); | 909 CheckFetchHandlerOfInstalledServiceWorker(callback, registration); |
| 914 } | 910 } |
| 915 | 911 |
| 916 } // namespace content | 912 } // namespace content |
| OLD | NEW |