| 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 <vector> | 10 #include <vector> |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 } | 474 } |
| 475 | 475 |
| 476 std::vector<ServiceWorkerVersionInfo> | 476 std::vector<ServiceWorkerVersionInfo> |
| 477 ServiceWorkerContextWrapper::GetAllLiveVersionInfo() { | 477 ServiceWorkerContextWrapper::GetAllLiveVersionInfo() { |
| 478 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 478 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 479 if (!context_core_) | 479 if (!context_core_) |
| 480 return std::vector<ServiceWorkerVersionInfo>(); | 480 return std::vector<ServiceWorkerVersionInfo>(); |
| 481 return context_core_->GetAllLiveVersionInfo(); | 481 return context_core_->GetAllLiveVersionInfo(); |
| 482 } | 482 } |
| 483 | 483 |
| 484 bool ServiceWorkerContextWrapper::HasWindowProviderHost( | 484 void ServiceWorkerContextWrapper::HasMainFrameProviderHost( |
| 485 const GURL& origin) const { | 485 const GURL& origin, |
| 486 const BoolCallback& callback) const { |
| 486 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 487 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 487 if (!context_core_) | 488 if (!context_core_) { |
| 488 return false; | 489 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
| 489 return context_core_->HasWindowProviderHost(origin); | 490 base::Bind(callback, false)); |
| 491 return; |
| 492 } |
| 493 context_core_->HasMainFrameProviderHost(origin, callback); |
| 490 } | 494 } |
| 491 | 495 |
| 492 void ServiceWorkerContextWrapper::FindRegistrationForDocument( | 496 void ServiceWorkerContextWrapper::FindRegistrationForDocument( |
| 493 const GURL& document_url, | 497 const GURL& document_url, |
| 494 const FindRegistrationCallback& callback) { | 498 const FindRegistrationCallback& callback) { |
| 495 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 499 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 496 if (!context_core_) { | 500 if (!context_core_) { |
| 497 // FindRegistrationForDocument() can run the callback synchronously. | 501 // FindRegistrationForDocument() can run the callback synchronously. |
| 498 callback.Run(SERVICE_WORKER_ERROR_ABORT, nullptr); | 502 callback.Run(SERVICE_WORKER_ERROR_ABORT, nullptr); |
| 499 return; | 503 return; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 observer_list_->Notify(FROM_HERE, | 696 observer_list_->Notify(FROM_HERE, |
| 693 &ServiceWorkerContextObserver::OnStorageWiped); | 697 &ServiceWorkerContextObserver::OnStorageWiped); |
| 694 } | 698 } |
| 695 | 699 |
| 696 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() { | 700 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() { |
| 697 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 701 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 698 return context_core_.get(); | 702 return context_core_.get(); |
| 699 } | 703 } |
| 700 | 704 |
| 701 } // namespace content | 705 } // namespace content |
| OLD | NEW |