| 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 "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "content/browser/service_worker/service_worker_context_core.h" | 8 #include "content/browser/service_worker/service_worker_context_core.h" |
| 9 #include "content/browser/service_worker/service_worker_context_observer.h" | 9 #include "content/browser/service_worker/service_worker_context_observer.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 ServiceWorkerStatusCode status) { | 93 ServiceWorkerStatusCode status) { |
| 94 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 94 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 95 BrowserThread::PostTask( | 95 BrowserThread::PostTask( |
| 96 BrowserThread::UI, | 96 BrowserThread::UI, |
| 97 FROM_HERE, | 97 FROM_HERE, |
| 98 base::Bind(continuation, status == SERVICE_WORKER_OK)); | 98 base::Bind(continuation, status == SERVICE_WORKER_OK)); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void ServiceWorkerContextWrapper::UnregisterServiceWorker( | 101 void ServiceWorkerContextWrapper::UnregisterServiceWorker( |
| 102 const GURL& pattern, | 102 const GURL& pattern, |
| 103 int source_process_id, | |
| 104 const ResultCallback& continuation) { | 103 const ResultCallback& continuation) { |
| 105 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 104 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
| 106 BrowserThread::PostTask( | 105 BrowserThread::PostTask( |
| 107 BrowserThread::IO, | 106 BrowserThread::IO, |
| 108 FROM_HERE, | 107 FROM_HERE, |
| 109 base::Bind(&ServiceWorkerContextWrapper::UnregisterServiceWorker, | 108 base::Bind(&ServiceWorkerContextWrapper::UnregisterServiceWorker, |
| 110 this, | 109 this, |
| 111 pattern, | 110 pattern, |
| 112 source_process_id, | |
| 113 continuation)); | 111 continuation)); |
| 114 return; | 112 return; |
| 115 } | 113 } |
| 116 | 114 |
| 117 context()->UnregisterServiceWorker( | 115 context()->UnregisterServiceWorker( |
| 118 pattern, | 116 pattern, |
| 119 source_process_id, | |
| 120 NULL /* provider_host */, | |
| 121 base::Bind(&FinishUnregistrationOnIO, continuation)); | 117 base::Bind(&FinishUnregistrationOnIO, continuation)); |
| 122 } | 118 } |
| 123 | 119 |
| 124 void ServiceWorkerContextWrapper::AddObserver( | 120 void ServiceWorkerContextWrapper::AddObserver( |
| 125 ServiceWorkerContextObserver* observer) { | 121 ServiceWorkerContextObserver* observer) { |
| 126 observer_list_->AddObserver(observer); | 122 observer_list_->AddObserver(observer); |
| 127 } | 123 } |
| 128 | 124 |
| 129 void ServiceWorkerContextWrapper::RemoveObserver( | 125 void ServiceWorkerContextWrapper::RemoveObserver( |
| 130 ServiceWorkerContextObserver* observer) { | 126 ServiceWorkerContextObserver* observer) { |
| 131 observer_list_->RemoveObserver(observer); | 127 observer_list_->RemoveObserver(observer); |
| 132 } | 128 } |
| 133 | 129 |
| 134 } // namespace content | 130 } // namespace content |
| OLD | NEW |