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/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 // different pixel density. Be smarter about this when the API gets updated | 328 // different pixel density. Be smarter about this when the API gets updated |
329 // with a way for developers to specify images of different resolutions. | 329 // with a way for developers to specify images of different resolutions. |
330 Notification notification(origin, notification_data.title, | 330 Notification notification(origin, notification_data.title, |
331 notification_data.body, gfx::Image::CreateFrom1xBitmap(icon), | 331 notification_data.body, gfx::Image::CreateFrom1xBitmap(icon), |
332 display_source, notification_data.tag, delegate); | 332 display_source, notification_data.tag, delegate); |
333 | 333 |
334 notification.set_context_message(display_source); | 334 notification.set_context_message(display_source); |
335 notification.set_vibration_pattern(notification_data.vibration_pattern); | 335 notification.set_vibration_pattern(notification_data.vibration_pattern); |
336 notification.set_silent(notification_data.silent); | 336 notification.set_silent(notification_data.silent); |
337 | 337 |
| 338 std::vector<message_center::ButtonInfo> buttons; |
| 339 for (const auto& action : notification_data.actions) |
| 340 buttons.push_back(message_center::ButtonInfo(action.title)); |
| 341 |
| 342 notification.set_buttons(buttons); |
| 343 |
338 // Web Notifications do not timeout. | 344 // Web Notifications do not timeout. |
339 notification.set_never_timeout(true); | 345 notification.set_never_timeout(true); |
340 | 346 |
341 return notification; | 347 return notification; |
342 } | 348 } |
343 | 349 |
344 NotificationUIManager* | 350 NotificationUIManager* |
345 PlatformNotificationServiceImpl::GetNotificationUIManager() const { | 351 PlatformNotificationServiceImpl::GetNotificationUIManager() const { |
346 if (notification_ui_manager_for_tests_) | 352 if (notification_ui_manager_for_tests_) |
347 return notification_ui_manager_for_tests_; | 353 return notification_ui_manager_for_tests_; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 formatted_origin.push_back(':'); | 402 formatted_origin.push_back(':'); |
397 formatted_origin.append(base::UTF8ToUTF16(origin.port())); | 403 formatted_origin.append(base::UTF8ToUTF16(origin.port())); |
398 } | 404 } |
399 return formatted_origin; | 405 return formatted_origin; |
400 } | 406 } |
401 | 407 |
402 // TODO(dewittj): Once file:// URLs are passed in to the origin | 408 // TODO(dewittj): Once file:// URLs are passed in to the origin |
403 // GURL here, begin returning the path as the display name. | 409 // GURL here, begin returning the path as the display name. |
404 return net::FormatUrl(origin, languages); | 410 return net::FormatUrl(origin, languages); |
405 } | 411 } |
OLD | NEW |