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 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 } | 816 } |
817 | 817 |
818 ServiceWorkerProcessManager* ServiceWorkerContextCore::process_manager() { | 818 ServiceWorkerProcessManager* ServiceWorkerContextCore::process_manager() { |
819 return wrapper_->process_manager(); | 819 return wrapper_->process_manager(); |
820 } | 820 } |
821 | 821 |
822 void ServiceWorkerContextCore::DidFindRegistrationForCheckHasServiceWorker( | 822 void ServiceWorkerContextCore::DidFindRegistrationForCheckHasServiceWorker( |
823 const GURL& other_url, | 823 const GURL& other_url, |
824 const ServiceWorkerContext::CheckHasServiceWorkerCallback callback, | 824 const ServiceWorkerContext::CheckHasServiceWorkerCallback callback, |
825 ServiceWorkerStatusCode status, | 825 ServiceWorkerStatusCode status, |
826 const scoped_refptr<ServiceWorkerRegistration>& registration) { | 826 scoped_refptr<ServiceWorkerRegistration> registration) { |
827 if (status != SERVICE_WORKER_OK) { | 827 if (status != SERVICE_WORKER_OK) { |
828 callback.Run(false); | 828 callback.Run(false); |
829 return; | 829 return; |
830 } | 830 } |
831 | 831 |
832 if (!ServiceWorkerUtils::ScopeMatches(registration->pattern(), other_url)) { | 832 if (!ServiceWorkerUtils::ScopeMatches(registration->pattern(), other_url)) { |
833 callback.Run(false); | 833 callback.Run(false); |
834 return; | 834 return; |
835 } | 835 } |
836 | 836 |
837 if (registration->is_uninstalling() || registration->is_uninstalled()) { | 837 if (registration->is_uninstalling() || registration->is_uninstalled()) { |
838 callback.Run(false); | 838 callback.Run(false); |
839 return; | 839 return; |
840 } | 840 } |
841 | 841 |
842 if (!registration->active_version() && !registration->waiting_version()) { | 842 if (!registration->active_version() && !registration->waiting_version()) { |
843 registration->RegisterRegistrationFinishedCallback( | 843 registration->RegisterRegistrationFinishedCallback( |
844 base::Bind(&ServiceWorkerContextCore:: | 844 base::Bind(&ServiceWorkerContextCore:: |
845 OnRegistrationFinishedForCheckHasServiceWorker, | 845 OnRegistrationFinishedForCheckHasServiceWorker, |
846 AsWeakPtr(), callback, registration)); | 846 AsWeakPtr(), callback, registration)); |
847 return; | 847 return; |
848 } | 848 } |
849 | 849 |
850 callback.Run(true); | 850 callback.Run(true); |
851 } | 851 } |
852 | 852 |
853 void ServiceWorkerContextCore::OnRegistrationFinishedForCheckHasServiceWorker( | 853 void ServiceWorkerContextCore::OnRegistrationFinishedForCheckHasServiceWorker( |
854 const ServiceWorkerContext::CheckHasServiceWorkerCallback callback, | 854 const ServiceWorkerContext::CheckHasServiceWorkerCallback callback, |
855 const scoped_refptr<ServiceWorkerRegistration>& registration) { | 855 scoped_refptr<ServiceWorkerRegistration> registration) { |
856 callback.Run(registration->active_version() || | 856 callback.Run(registration->active_version() || |
857 registration->waiting_version()); | 857 registration->waiting_version()); |
858 } | 858 } |
859 | 859 |
860 } // namespace content | 860 } // namespace content |
OLD | NEW |