Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(619)

Side by Side Diff: content/browser/service_worker/service_worker_registration.cc

Issue 1100763002: Inject CanAddURLToHistory into TopSitesImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@prefs
Patch Set: Fix error introduced during rebase Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/browser/service_worker/service_worker_metrics.h"
9 #include "content/browser/service_worker/service_worker_register_job.h" 10 #include "content/browser/service_worker/service_worker_register_job.h"
10 #include "content/browser/service_worker/service_worker_utils.h" 11 #include "content/browser/service_worker/service_worker_utils.h"
11 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
12 13
13 namespace content { 14 namespace content {
14 15
15 namespace { 16 namespace {
16 17
17 ServiceWorkerVersionInfo GetVersionInfo(ServiceWorkerVersion* version) { 18 ServiceWorkerVersionInfo GetVersionInfo(ServiceWorkerVersion* version) {
18 if (!version) 19 if (!version)
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 activating_version->DispatchActivateEvent( 300 activating_version->DispatchActivateEvent(
300 base::Bind(&ServiceWorkerRegistration::OnActivateEventFinished, 301 base::Bind(&ServiceWorkerRegistration::OnActivateEventFinished,
301 this, activating_version)); 302 this, activating_version));
302 } 303 }
303 304
304 void ServiceWorkerRegistration::OnActivateEventFinished( 305 void ServiceWorkerRegistration::OnActivateEventFinished(
305 ServiceWorkerVersion* activating_version, 306 ServiceWorkerVersion* activating_version,
306 ServiceWorkerStatusCode status) { 307 ServiceWorkerStatusCode status) {
307 if (!context_ || activating_version != active_version()) 308 if (!context_ || activating_version != active_version())
308 return; 309 return;
310 ServiceWorkerMetrics::RecordActivateEventStatus(status);
311
309 // "If activateFailed is true, then:..." 312 // "If activateFailed is true, then:..."
310 if (status != SERVICE_WORKER_OK) { 313 if (status != SERVICE_WORKER_OK) {
311 // "Set registration's active worker to null." (The spec's step order may 314 // "Set registration's active worker to null." (The spec's step order may
312 // differ. It's OK because the other steps queue a task.) 315 // differ. It's OK because the other steps queue a task.)
313 UnsetVersion(activating_version); 316 UnsetVersion(activating_version);
314 317
315 // "Run the Update State algorithm passing registration's active worker and 318 // "Run the Update State algorithm passing registration's active worker and
316 // 'redundant' as the arguments." 319 // 'redundant' as the arguments."
317 activating_version->SetStatus(ServiceWorkerVersion::REDUNDANT); 320 activating_version->SetStatus(ServiceWorkerVersion::REDUNDANT);
318 321
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 if (!context_) { 402 if (!context_) {
400 callback.Run(SERVICE_WORKER_ERROR_ABORT); 403 callback.Run(SERVICE_WORKER_ERROR_ABORT);
401 return; 404 return;
402 } 405 }
403 context_->storage()->NotifyDoneInstallingRegistration( 406 context_->storage()->NotifyDoneInstallingRegistration(
404 this, version.get(), status); 407 this, version.get(), status);
405 callback.Run(status); 408 callback.Run(status);
406 } 409 }
407 410
408 } // namespace content 411 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698