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_registration.h" | 5 #include "content/browser/service_worker/service_worker_registration.h" |
6 | 6 |
7 #include "content/browser/service_worker/service_worker_context_core.h" | 7 #include "content/browser/service_worker/service_worker_context_core.h" |
8 #include "content/browser/service_worker/service_worker_info.h" | 8 #include "content/browser/service_worker/service_worker_info.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 if (context_) | 30 if (context_) |
31 context_->RemoveLiveRegistration(registration_id_); | 31 context_->RemoveLiveRegistration(registration_id_); |
32 } | 32 } |
33 | 33 |
34 ServiceWorkerRegistrationInfo ServiceWorkerRegistration::GetInfo() { | 34 ServiceWorkerRegistrationInfo ServiceWorkerRegistration::GetInfo() { |
35 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 35 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
36 return ServiceWorkerRegistrationInfo( | 36 return ServiceWorkerRegistrationInfo( |
37 script_url(), | 37 script_url(), |
38 pattern(), | 38 pattern(), |
39 active_version_ ? active_version_->GetInfo() : ServiceWorkerVersionInfo(), | 39 active_version_ ? active_version_->GetInfo() : ServiceWorkerVersionInfo(), |
40 pending_version_ ? pending_version_->GetInfo() | 40 waiting_version_ ? waiting_version_->GetInfo() |
41 : ServiceWorkerVersionInfo()); | 41 : ServiceWorkerVersionInfo()); |
42 } | 42 } |
43 | 43 |
44 ServiceWorkerVersion* ServiceWorkerRegistration::GetNewestVersion() { | 44 ServiceWorkerVersion* ServiceWorkerRegistration::GetNewestVersion() { |
45 if (active_version()) | 45 if (active_version()) |
46 return active_version(); | 46 return active_version(); |
47 return pending_version(); | 47 return waiting_version(); |
48 } | 48 } |
49 | 49 |
50 void ServiceWorkerRegistration::ActivatePendingVersion() { | 50 void ServiceWorkerRegistration::ActivateWaitingVersion() { |
51 active_version_->SetStatus(ServiceWorkerVersion::DEACTIVATED); | 51 active_version_->SetStatus(ServiceWorkerVersion::DEACTIVATED); |
52 active_version_ = pending_version_; | 52 active_version_ = waiting_version_; |
53 // TODO(kinuko): This should be set to ACTIVATING until activation finishes. | 53 // TODO(kinuko): This should be set to ACTIVATING until activation finishes. |
54 active_version_->SetStatus(ServiceWorkerVersion::ACTIVE); | 54 active_version_->SetStatus(ServiceWorkerVersion::ACTIVE); |
55 pending_version_ = NULL; | 55 waiting_version_ = NULL; |
56 } | 56 } |
57 | 57 |
58 } // namespace content | 58 } // namespace content |
OLD | NEW |