| 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_register_job.h" | 5 #include "content/browser/service_worker/service_worker_register_job.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "content/browser/service_worker/service_worker_context_core.h" | 10 #include "content/browser/service_worker/service_worker_context_core.h" |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 | 393 |
| 394 void ServiceWorkerRegisterJob::OnInstallFinished( | 394 void ServiceWorkerRegisterJob::OnInstallFinished( |
| 395 ServiceWorkerStatusCode status) { | 395 ServiceWorkerStatusCode status) { |
| 396 if (status != SERVICE_WORKER_OK) { | 396 if (status != SERVICE_WORKER_OK) { |
| 397 // "8. If installFailed is true, then:..." | 397 // "8. If installFailed is true, then:..." |
| 398 Complete(status); | 398 Complete(status); |
| 399 return; | 399 return; |
| 400 } | 400 } |
| 401 | 401 |
| 402 SetPhase(STORE); | 402 SetPhase(STORE); |
| 403 registration()->set_last_update_check(base::Time::Now()); | 403 const base::Time now = base::Time::Now(); |
| 404 registration()->set_last_update_check(now); |
| 405 registration()->installing_version()->set_update_time(now); |
| 404 context_->storage()->StoreRegistration( | 406 context_->storage()->StoreRegistration( |
| 405 registration(), | 407 registration(), |
| 406 new_version(), | 408 new_version(), |
| 407 base::Bind(&ServiceWorkerRegisterJob::OnStoreRegistrationComplete, | 409 base::Bind(&ServiceWorkerRegisterJob::OnStoreRegistrationComplete, |
| 408 weak_factory_.GetWeakPtr())); | 410 weak_factory_.GetWeakPtr())); |
| 409 } | 411 } |
| 410 | 412 |
| 411 void ServiceWorkerRegisterJob::OnStoreRegistrationComplete( | 413 void ServiceWorkerRegisterJob::OnStoreRegistrationComplete( |
| 412 ServiceWorkerStatusCode status) { | 414 ServiceWorkerStatusCode status) { |
| 413 if (status != SERVICE_WORKER_OK) { | 415 if (status != SERVICE_WORKER_OK) { |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 if (host->IsHostToRunningServiceWorker()) | 560 if (host->IsHostToRunningServiceWorker()) |
| 559 continue; | 561 continue; |
| 560 if (!ServiceWorkerUtils::ScopeMatches(registration->pattern(), | 562 if (!ServiceWorkerUtils::ScopeMatches(registration->pattern(), |
| 561 host->document_url())) | 563 host->document_url())) |
| 562 continue; | 564 continue; |
| 563 host->AddMatchingRegistration(registration); | 565 host->AddMatchingRegistration(registration); |
| 564 } | 566 } |
| 565 } | 567 } |
| 566 | 568 |
| 567 } // namespace content | 569 } // namespace content |
| OLD | NEW |