| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/push_messaging/push_messaging_service_impl.h" | 5 #include "chrome/browser/push_messaging/push_messaging_service_impl.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/barrier_closure.h" | 9 #include "base/barrier_closure.h" |
| 10 #include "base/base64url.h" | 10 #include "base/base64url.h" |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 // TODO(mvanouwerkerk): Show a warning in the developer console of the | 353 // TODO(mvanouwerkerk): Show a warning in the developer console of the |
| 354 // Service Worker corresponding to app_id (and/or on an internals page). | 354 // Service Worker corresponding to app_id (and/or on an internals page). |
| 355 // See https://crbug.com/508516 for options. | 355 // See https://crbug.com/508516 for options. |
| 356 switch (status) { | 356 switch (status) { |
| 357 // Call EnforceUserVisibleOnlyRequirements if the message was delivered to | 357 // Call EnforceUserVisibleOnlyRequirements if the message was delivered to |
| 358 // the Service Worker JavaScript, even if the website's event handler failed | 358 // the Service Worker JavaScript, even if the website's event handler failed |
| 359 // (to prevent sites deliberately failing in order to avoid having to show | 359 // (to prevent sites deliberately failing in order to avoid having to show |
| 360 // notifications). | 360 // notifications). |
| 361 case content::PUSH_DELIVERY_STATUS_SUCCESS: | 361 case content::PUSH_DELIVERY_STATUS_SUCCESS: |
| 362 case content::PUSH_DELIVERY_STATUS_EVENT_WAITUNTIL_REJECTED: | 362 case content::PUSH_DELIVERY_STATUS_EVENT_WAITUNTIL_REJECTED: |
| 363 case content::PUSH_DELIVERY_STATUS_TIMEOUT: |
| 363 #if defined(ENABLE_NOTIFICATIONS) | 364 #if defined(ENABLE_NOTIFICATIONS) |
| 364 // Only enforce the user visible requirements if this is currently running | 365 // Only enforce the user visible requirements if this is currently running |
| 365 // as the delivery callback for the last in-flight message, and silent | 366 // as the delivery callback for the last in-flight message, and silent |
| 366 // push has not been enabled through a command line flag. | 367 // push has not been enabled through a command line flag. |
| 367 if (in_flight_message_deliveries_.count(app_id) == 1 && | 368 if (in_flight_message_deliveries_.count(app_id) == 1 && |
| 368 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 369 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 369 switches::kAllowSilentPush)) { | 370 switches::kAllowSilentPush)) { |
| 370 notification_manager_.EnforceUserVisibleOnlyRequirements( | 371 notification_manager_.EnforceUserVisibleOnlyRequirements( |
| 371 requesting_origin, service_worker_registration_id, | 372 requesting_origin, service_worker_registration_id, |
| 372 completion_closure_runner.Release()); | 373 completion_closure_runner.Release()); |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 } | 960 } |
| 960 | 961 |
| 961 instance_id::InstanceIDDriver* PushMessagingServiceImpl::GetInstanceIDDriver() | 962 instance_id::InstanceIDDriver* PushMessagingServiceImpl::GetInstanceIDDriver() |
| 962 const { | 963 const { |
| 963 instance_id::InstanceIDProfileService* instance_id_profile_service = | 964 instance_id::InstanceIDProfileService* instance_id_profile_service = |
| 964 instance_id::InstanceIDProfileServiceFactory::GetForProfile(profile_); | 965 instance_id::InstanceIDProfileServiceFactory::GetForProfile(profile_); |
| 965 CHECK(instance_id_profile_service); | 966 CHECK(instance_id_profile_service); |
| 966 CHECK(instance_id_profile_service->driver()); | 967 CHECK(instance_id_profile_service->driver()); |
| 967 return instance_id_profile_service->driver(); | 968 return instance_id_profile_service->driver(); |
| 968 } | 969 } |
| OLD | NEW |