| 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/services/gcm/push_messaging_service_impl.h" | 5 #include "chrome/browser/services/gcm/push_messaging_service_impl.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 IDS_PUSH_MESSAGING_GENERIC_NOTIFICATION_TITLE, | 236 IDS_PUSH_MESSAGING_GENERIC_NOTIFICATION_TITLE, |
| 237 base::UTF8ToUTF16(application_id.origin.host())); | 237 base::UTF8ToUTF16(application_id.origin.host())); |
| 238 notification_data.direction = | 238 notification_data.direction = |
| 239 content::PlatformNotificationData::NotificationDirectionLeftToRight; | 239 content::PlatformNotificationData::NotificationDirectionLeftToRight; |
| 240 notification_data.body = | 240 notification_data.body = |
| 241 l10n_util::GetStringUTF16(IDS_PUSH_MESSAGING_GENERIC_NOTIFICATION_BODY); | 241 l10n_util::GetStringUTF16(IDS_PUSH_MESSAGING_GENERIC_NOTIFICATION_BODY); |
| 242 notification_data.tag = | 242 notification_data.tag = |
| 243 base::ASCIIToUTF16("user_visible_auto_notification"); | 243 base::ASCIIToUTF16("user_visible_auto_notification"); |
| 244 notification_data.icon = GURL(); // TODO(johnme): Better icon? | 244 notification_data.icon = GURL(); // TODO(johnme): Better icon? |
| 245 PlatformNotificationServiceImpl::GetInstance()->DisplayPersistentNotification( | 245 PlatformNotificationServiceImpl::GetInstance()->DisplayPersistentNotification( |
| 246 profile_, | 246 profile_, application_id.service_worker_registration_id, |
| 247 application_id.service_worker_registration_id, | 247 application_id.origin, SkBitmap() /* icon */, notification_data); |
| 248 application_id.origin, | |
| 249 SkBitmap() /* icon */, | |
| 250 notification_data, | |
| 251 content::ChildProcessHost::kInvalidUniqueID /* render_process_id */); | |
| 252 #endif | 248 #endif |
| 253 } | 249 } |
| 254 | 250 |
| 255 void PushMessagingServiceImpl::OnMessagesDeleted(const std::string& app_id) { | 251 void PushMessagingServiceImpl::OnMessagesDeleted(const std::string& app_id) { |
| 256 // TODO(mvanouwerkerk): Fire push error event on the Service Worker | 252 // TODO(mvanouwerkerk): Fire push error event on the Service Worker |
| 257 // corresponding to app_id. | 253 // corresponding to app_id. |
| 258 } | 254 } |
| 259 | 255 |
| 260 void PushMessagingServiceImpl::OnSendError( | 256 void PushMessagingServiceImpl::OnSendError( |
| 261 const std::string& app_id, | 257 const std::string& app_id, |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 bool PushMessagingServiceImpl::HasPermission(const GURL& origin) { | 484 bool PushMessagingServiceImpl::HasPermission(const GURL& origin) { |
| 489 gcm::PushMessagingPermissionContext* permission_context = | 485 gcm::PushMessagingPermissionContext* permission_context = |
| 490 gcm::PushMessagingPermissionContextFactory::GetForProfile(profile_); | 486 gcm::PushMessagingPermissionContextFactory::GetForProfile(profile_); |
| 491 DCHECK(permission_context); | 487 DCHECK(permission_context); |
| 492 | 488 |
| 493 return permission_context->GetPermissionStatus(origin, origin) == | 489 return permission_context->GetPermissionStatus(origin, origin) == |
| 494 CONTENT_SETTING_ALLOW; | 490 CONTENT_SETTING_ALLOW; |
| 495 } | 491 } |
| 496 | 492 |
| 497 } // namespace gcm | 493 } // namespace gcm |
| OLD | NEW |