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

Side by Side Diff: chrome/browser/services/gcm/push_messaging_service_impl.cc

Issue 661643002: Adds a context message of the security origin for web notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adds a bug reference. Created 5 years, 11 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 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 IDS_PUSH_MESSAGING_GENERIC_NOTIFICATION_TITLE, 241 IDS_PUSH_MESSAGING_GENERIC_NOTIFICATION_TITLE,
242 base::UTF8ToUTF16(application_id.origin.host())); 242 base::UTF8ToUTF16(application_id.origin.host()));
243 notification_data.direction = 243 notification_data.direction =
244 content::PlatformNotificationData::NotificationDirectionLeftToRight; 244 content::PlatformNotificationData::NotificationDirectionLeftToRight;
245 notification_data.body = 245 notification_data.body =
246 l10n_util::GetStringUTF16(IDS_PUSH_MESSAGING_GENERIC_NOTIFICATION_BODY); 246 l10n_util::GetStringUTF16(IDS_PUSH_MESSAGING_GENERIC_NOTIFICATION_BODY);
247 notification_data.tag = 247 notification_data.tag =
248 base::ASCIIToUTF16(kPushMessagingForcedNotificationTag); 248 base::ASCIIToUTF16(kPushMessagingForcedNotificationTag);
249 notification_data.icon = GURL(); // TODO(johnme): Better icon? 249 notification_data.icon = GURL(); // TODO(johnme): Better icon?
250 notification_service->DisplayPersistentNotification( 250 notification_service->DisplayPersistentNotification(
251 profile_, 251 profile_, application_id.service_worker_registration_id,
252 application_id.service_worker_registration_id, 252 application_id.origin, SkBitmap() /* icon */, notification_data);
253 application_id.origin,
254 SkBitmap() /* icon */,
255 notification_data,
256 content::ChildProcessHost::kInvalidUniqueID /* render_process_id */);
257 #endif 253 #endif
258 } 254 }
259 255
260 void PushMessagingServiceImpl::OnMessagesDeleted(const std::string& app_id) { 256 void PushMessagingServiceImpl::OnMessagesDeleted(const std::string& app_id) {
261 // TODO(mvanouwerkerk): Fire push error event on the Service Worker 257 // TODO(mvanouwerkerk): Fire push error event on the Service Worker
262 // corresponding to app_id. 258 // corresponding to app_id.
263 } 259 }
264 260
265 void PushMessagingServiceImpl::OnSendError( 261 void PushMessagingServiceImpl::OnSendError(
266 const std::string& app_id, 262 const std::string& app_id,
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 bool PushMessagingServiceImpl::HasPermission(const GURL& origin) { 488 bool PushMessagingServiceImpl::HasPermission(const GURL& origin) {
493 gcm::PushMessagingPermissionContext* permission_context = 489 gcm::PushMessagingPermissionContext* permission_context =
494 gcm::PushMessagingPermissionContextFactory::GetForProfile(profile_); 490 gcm::PushMessagingPermissionContextFactory::GetForProfile(profile_);
495 DCHECK(permission_context); 491 DCHECK(permission_context);
496 492
497 return permission_context->GetPermissionStatus(origin, origin) == 493 return permission_context->GetPermissionStatus(origin, origin) ==
498 CONTENT_SETTING_ALLOW; 494 CONTENT_SETTING_ALLOW;
499 } 495 }
500 496
501 } // namespace gcm 497 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698