| 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_wrapper.h" | 5 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 // FindRegistrationForDocument() can run the callback synchronously. | 674 // FindRegistrationForDocument() can run the callback synchronously. |
| 675 callback.Run(SERVICE_WORKER_ERROR_ABORT, nullptr); | 675 callback.Run(SERVICE_WORKER_ERROR_ABORT, nullptr); |
| 676 return; | 676 return; |
| 677 } | 677 } |
| 678 context_core_->storage()->FindRegistrationForDocument( | 678 context_core_->storage()->FindRegistrationForDocument( |
| 679 net::SimplifyUrlForRequest(document_url), | 679 net::SimplifyUrlForRequest(document_url), |
| 680 base::Bind(&ServiceWorkerContextWrapper::DidFindRegistrationForFindReady, | 680 base::Bind(&ServiceWorkerContextWrapper::DidFindRegistrationForFindReady, |
| 681 this, callback)); | 681 this, callback)); |
| 682 } | 682 } |
| 683 | 683 |
| 684 void ServiceWorkerContextWrapper::FindReadyRegistrationForPattern( |
| 685 const GURL& scope, |
| 686 const FindRegistrationCallback& callback) { |
| 687 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 688 if (!context_core_) { |
| 689 RunSoon(base::Bind(callback, SERVICE_WORKER_ERROR_ABORT, nullptr)); |
| 690 return; |
| 691 } |
| 692 context_core_->storage()->FindRegistrationForPattern( |
| 693 net::SimplifyUrlForRequest(scope), |
| 694 base::Bind(&ServiceWorkerContextWrapper::DidFindRegistrationForFindReady, |
| 695 this, callback)); |
| 696 } |
| 697 |
| 684 void ServiceWorkerContextWrapper::FindReadyRegistrationForId( | 698 void ServiceWorkerContextWrapper::FindReadyRegistrationForId( |
| 685 int64_t registration_id, | 699 int64_t registration_id, |
| 686 const GURL& origin, | 700 const GURL& origin, |
| 687 const FindRegistrationCallback& callback) { | 701 const FindRegistrationCallback& callback) { |
| 688 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 702 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 689 if (!context_core_) { | 703 if (!context_core_) { |
| 690 // FindRegistrationForId() can run the callback synchronously. | 704 // FindRegistrationForId() can run the callback synchronously. |
| 691 callback.Run(SERVICE_WORKER_ERROR_ABORT, nullptr); | 705 callback.Run(SERVICE_WORKER_ERROR_ABORT, nullptr); |
| 692 return; | 706 return; |
| 693 } | 707 } |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 observer_list_->Notify(FROM_HERE, | 908 observer_list_->Notify(FROM_HERE, |
| 895 &ServiceWorkerContextObserver::OnStorageWiped); | 909 &ServiceWorkerContextObserver::OnStorageWiped); |
| 896 } | 910 } |
| 897 | 911 |
| 898 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() { | 912 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() { |
| 899 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 913 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 900 return context_core_.get(); | 914 return context_core_.get(); |
| 901 } | 915 } |
| 902 | 916 |
| 903 } // namespace content | 917 } // namespace content |
| OLD | NEW |