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/notifications/platform_notification_service_impl.h" | 5 #include "chrome/browser/notifications/platform_notification_service_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/metrics/user_metrics_action.h" | 9 #include "base/metrics/user_metrics_action.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 // different pixel density. Be smarter about this when the API gets updated | 355 // different pixel density. Be smarter about this when the API gets updated |
356 // with a way for developers to specify images of different resolutions. | 356 // with a way for developers to specify images of different resolutions. |
357 Notification notification( | 357 Notification notification( |
358 origin, notification_data.title, notification_data.body, | 358 origin, notification_data.title, notification_data.body, |
359 gfx::Image::CreateFrom1xBitmap(icon), base::UTF8ToUTF16(origin.host()), | 359 gfx::Image::CreateFrom1xBitmap(icon), base::UTF8ToUTF16(origin.host()), |
360 notification_data.tag, delegate); | 360 notification_data.tag, delegate); |
361 | 361 |
362 notification.set_context_message( | 362 notification.set_context_message( |
363 DisplayNameForContextMessage(profile, origin)); | 363 DisplayNameForContextMessage(profile, origin)); |
364 notification.set_vibration_pattern(notification_data.vibration_pattern); | 364 notification.set_vibration_pattern(notification_data.vibration_pattern); |
| 365 notification.set_timestamp(notification_data.timestamp); |
365 notification.set_silent(notification_data.silent); | 366 notification.set_silent(notification_data.silent); |
366 | 367 |
367 std::vector<message_center::ButtonInfo> buttons; | 368 std::vector<message_center::ButtonInfo> buttons; |
368 | 369 |
369 // Developer supplied buttons. | 370 // Developer supplied buttons. |
370 for (const auto& action : notification_data.actions) | 371 for (const auto& action : notification_data.actions) |
371 buttons.push_back(message_center::ButtonInfo(action.title)); | 372 buttons.push_back(message_center::ButtonInfo(action.title)); |
372 | 373 |
373 // Android always includes the settings button in all notifications, whereas for | 374 // Android always includes the settings button in all notifications, whereas for |
374 // desktop only web (not extensions) notifications do. | 375 // desktop only web (not extensions) notifications do. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 extensions::ExtensionRegistry::Get(profile)->GetExtensionById( | 437 extensions::ExtensionRegistry::Get(profile)->GetExtensionById( |
437 origin.host(), extensions::ExtensionRegistry::EVERYTHING); | 438 origin.host(), extensions::ExtensionRegistry::EVERYTHING); |
438 DCHECK(extension); | 439 DCHECK(extension); |
439 | 440 |
440 return base::UTF8ToUTF16(extension->name()); | 441 return base::UTF8ToUTF16(extension->name()); |
441 } | 442 } |
442 #endif | 443 #endif |
443 | 444 |
444 return base::string16(); | 445 return base::string16(); |
445 } | 446 } |
OLD | NEW |