Chromium Code Reviews| 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 336 DisplayNameForContextMessage(profile, origin)); | 336 DisplayNameForContextMessage(profile, origin)); |
| 337 notification.set_vibration_pattern(notification_data.vibration_pattern); | 337 notification.set_vibration_pattern(notification_data.vibration_pattern); |
| 338 notification.set_silent(notification_data.silent); | 338 notification.set_silent(notification_data.silent); |
| 339 | 339 |
| 340 std::vector<message_center::ButtonInfo> buttons; | 340 std::vector<message_center::ButtonInfo> buttons; |
| 341 for (const auto& action : notification_data.actions) | 341 for (const auto& action : notification_data.actions) |
| 342 buttons.push_back(message_center::ButtonInfo(action.title)); | 342 buttons.push_back(message_center::ButtonInfo(action.title)); |
| 343 | 343 |
| 344 notification.set_buttons(buttons); | 344 notification.set_buttons(buttons); |
| 345 | 345 |
| 346 // Web Notifications do not timeout. | 346 // On desktop, notifications with require_interaction==true stay on-screen |
| 347 notification.set_never_timeout(true); | 347 // rather than minimizing to the notification center after a timeout. |
| 348 // On mobile, this is ignored (notifications are minimized at all times). | |
| 349 if (notification_data.require_interaction) | |
|
Peter Beverloo
2015/08/28 14:17:54
We can't do this.
The feature is still marked as
| |
| 350 notification.set_never_timeout(true); | |
| 348 | 351 |
| 349 return notification; | 352 return notification; |
| 350 } | 353 } |
| 351 | 354 |
| 352 NotificationUIManager* | 355 NotificationUIManager* |
| 353 PlatformNotificationServiceImpl::GetNotificationUIManager() const { | 356 PlatformNotificationServiceImpl::GetNotificationUIManager() const { |
| 354 if (notification_ui_manager_for_tests_) | 357 if (notification_ui_manager_for_tests_) |
| 355 return notification_ui_manager_for_tests_; | 358 return notification_ui_manager_for_tests_; |
| 356 | 359 |
| 357 return g_browser_process->notification_ui_manager(); | 360 return g_browser_process->notification_ui_manager(); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 372 extensions::ExtensionRegistry::Get(profile)->GetExtensionById( | 375 extensions::ExtensionRegistry::Get(profile)->GetExtensionById( |
| 373 origin.host(), extensions::ExtensionRegistry::EVERYTHING); | 376 origin.host(), extensions::ExtensionRegistry::EVERYTHING); |
| 374 DCHECK(extension); | 377 DCHECK(extension); |
| 375 | 378 |
| 376 return base::UTF8ToUTF16(extension->name()); | 379 return base::UTF8ToUTF16(extension->name()); |
| 377 } | 380 } |
| 378 #endif | 381 #endif |
| 379 | 382 |
| 380 return base::string16(); | 383 return base::string16(); |
| 381 } | 384 } |
| OLD | NEW |