Chromium Code Reviews| Index: chrome/browser/push_messaging/push_messaging_service_impl.cc |
| diff --git a/chrome/browser/push_messaging/push_messaging_service_impl.cc b/chrome/browser/push_messaging/push_messaging_service_impl.cc |
| index f495134d827fa2465fc3db88c320de47c44b6cd0..a4cff965efec8d799223055f8524413148a0c17c 100644 |
| --- a/chrome/browser/push_messaging/push_messaging_service_impl.cc |
| +++ b/chrome/browser/push_messaging/push_messaging_service_impl.cc |
| @@ -19,6 +19,7 @@ |
| #include "base/threading/thread_task_runner_handle.h" |
| #include "build/build_config.h" |
| #include "chrome/browser/browser_process.h" |
| +#include "chrome/browser/chrome_notification_types.h" |
| #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| #include "chrome/browser/gcm/gcm_profile_service_factory.h" |
| #include "chrome/browser/gcm/instance_id/instance_id_profile_service.h" |
| @@ -45,6 +46,7 @@ |
| #include "components/rappor/public/rappor_utils.h" |
| #include "components/rappor/rappor_service_impl.h" |
| #include "content/public/browser/browser_context.h" |
| +#include "content/public/browser/notification_service.h" |
| #include "content/public/browser/render_frame_host.h" |
| #include "content/public/browser/service_worker_context.h" |
| #include "content/public/browser/storage_partition.h" |
| @@ -158,12 +160,33 @@ PushMessagingServiceImpl::PushMessagingServiceImpl(Profile* profile) |
| weak_factory_(this) { |
| DCHECK(profile); |
| HostContentSettingsMapFactory::GetForProfile(profile_)->AddObserver(this); |
| + |
| + registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, |
|
dgn
2017/03/01 11:49:53
why registering this here too? AFAICT all the obse
sammiequon
2017/03/18 00:01:39
These are here to see if xiyuan@ 's hypothesis (on
dgn
2017/03/20 11:07:22
Acknowledged.
|
| + content::NotificationService::AllSources()); |
| + registrar_.Add(this, chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, |
| + content::NotificationService::AllSources()); |
| } |
| PushMessagingServiceImpl::~PushMessagingServiceImpl() { |
| HostContentSettingsMapFactory::GetForProfile(profile_)->RemoveObserver(this); |
| } |
| +void PushMessagingServiceImpl::Observe( |
| + int type, |
| + const content::NotificationSource& source, |
| + const content::NotificationDetails& details) { |
| + switch (type) { |
| + case chrome::NOTIFICATION_APP_TERMINATING: { |
| + LOG(ERROR) << "PushMessagingServiceImpl Terminating"; |
| + break; |
| + } |
| + case chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST: { |
| + LOG(ERROR) << "PushMessagingServiceImpl Close All Browsers Request"; |
| + break; |
| + } |
| + } |
| +} |
| + |
| void PushMessagingServiceImpl::IncreasePushSubscriptionCount(int add, |
| bool is_pending) { |
| DCHECK(add > 0); |