| 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_storage.h" | 5 #include "content/browser/service_worker/service_worker_storage.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 ServiceWorkerRegistrationInfo info; | 586 ServiceWorkerRegistrationInfo info; |
| 587 info.pattern = it->scope; | 587 info.pattern = it->scope; |
| 588 info.script_url = it->script; | 588 info.script_url = it->script; |
| 589 info.registration_id = it->registration_id; | 589 info.registration_id = it->registration_id; |
| 590 if (ServiceWorkerVersion* version = | 590 if (ServiceWorkerVersion* version = |
| 591 context_->GetLiveVersion(it->version_id)) { | 591 context_->GetLiveVersion(it->version_id)) { |
| 592 if (it->is_active) | 592 if (it->is_active) |
| 593 info.active_version = version->GetInfo(); | 593 info.active_version = version->GetInfo(); |
| 594 else | 594 else |
| 595 info.waiting_version = version->GetInfo(); | 595 info.waiting_version = version->GetInfo(); |
| 596 infos.push_back(info); |
| 597 continue; |
| 598 } |
| 599 |
| 600 if (it->is_active) { |
| 601 info.active_version.is_null = false; |
| 602 info.active_version.status = ServiceWorkerVersion::ACTIVE; |
| 603 info.active_version.version_id = it->version_id; |
| 596 } else { | 604 } else { |
| 597 info.active_version.is_null = false; | 605 info.waiting_version.is_null = false; |
| 598 if (it->is_active) | 606 info.waiting_version.status = ServiceWorkerVersion::INSTALLED; |
| 599 info.active_version.status = ServiceWorkerVersion::ACTIVE; | 607 info.waiting_version.version_id = it->version_id; |
| 600 else | |
| 601 info.active_version.status = ServiceWorkerVersion::INSTALLED; | |
| 602 info.active_version.version_id = it->version_id; | |
| 603 } | 608 } |
| 604 infos.push_back(info); | 609 infos.push_back(info); |
| 605 } | 610 } |
| 606 | 611 |
| 607 // Add unstored registrations that are being installed. | 612 // Add unstored registrations that are being installed. |
| 608 for (RegistrationRefsById::const_iterator it = | 613 for (RegistrationRefsById::const_iterator it = |
| 609 installing_registrations_.begin(); | 614 installing_registrations_.begin(); |
| 610 it != installing_registrations_.end(); ++it) { | 615 it != installing_registrations_.end(); ++it) { |
| 611 if (pushed_registrations.insert(it->first).second) | 616 if (pushed_registrations.insert(it->first).second) |
| 612 infos.push_back(it->second->GetInfo()); | 617 infos.push_back(it->second->GetInfo()); |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 const FindInDBCallback& callback) { | 976 const FindInDBCallback& callback) { |
| 972 ServiceWorkerDatabase::RegistrationData data; | 977 ServiceWorkerDatabase::RegistrationData data; |
| 973 ResourceList resources; | 978 ResourceList resources; |
| 974 ServiceWorkerDatabase::Status status = | 979 ServiceWorkerDatabase::Status status = |
| 975 database->ReadRegistration(registration_id, origin, &data, &resources); | 980 database->ReadRegistration(registration_id, origin, &data, &resources); |
| 976 original_task_runner->PostTask( | 981 original_task_runner->PostTask( |
| 977 FROM_HERE, base::Bind(callback, data, resources, status)); | 982 FROM_HERE, base::Bind(callback, data, resources, status)); |
| 978 } | 983 } |
| 979 | 984 |
| 980 } // namespace content | 985 } // namespace content |
| OLD | NEW |