| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/desktop_notification_service.h" | 5 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" | 10 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 if (IsAshNotifyEnabled()) { | 273 if (IsAshNotifyEnabled()) { |
| 274 // For Ash create a non-HTML notification with |icon|. | 274 // For Ash create a non-HTML notification with |icon|. |
| 275 Notification notification(GURL(), icon, title, message, | 275 Notification notification(GURL(), icon, title, message, |
| 276 WebKit::WebTextDirectionDefault, | 276 WebKit::WebTextDirectionDefault, |
| 277 string16(), replace_id, delegate); | 277 string16(), replace_id, delegate); |
| 278 g_browser_process->notification_ui_manager()->Add(notification, profile); | 278 g_browser_process->notification_ui_manager()->Add(notification, profile); |
| 279 return notification.notification_id(); | 279 return notification.notification_id(); |
| 280 } | 280 } |
| 281 #endif | 281 #endif |
| 282 GURL icon_url; | 282 GURL icon_url; |
| 283 if (!icon.empty()) | 283 if (!icon.isNull()) |
| 284 icon_url = GURL(web_ui_util::GetImageDataUrl(icon)); | 284 icon_url = GURL(web_ui_util::GetImageDataUrl(icon)); |
| 285 return AddNotification( | 285 return AddNotification( |
| 286 origin_url, title, message, icon_url, replace_id, delegate, profile); | 286 origin_url, title, message, icon_url, replace_id, delegate, profile); |
| 287 } | 287 } |
| 288 | 288 |
| 289 // static | 289 // static |
| 290 void DesktopNotificationService::RemoveNotification( | 290 void DesktopNotificationService::RemoveNotification( |
| 291 const std::string& notification_id) { | 291 const std::string& notification_id) { |
| 292 g_browser_process->notification_ui_manager()->CancelById(notification_id); | 292 g_browser_process->notification_ui_manager()->CancelById(notification_id); |
| 293 } | 293 } |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 | 526 |
| 527 if (setting == CONTENT_SETTING_ALLOW) | 527 if (setting == CONTENT_SETTING_ALLOW) |
| 528 return WebKit::WebNotificationPresenter::PermissionAllowed; | 528 return WebKit::WebNotificationPresenter::PermissionAllowed; |
| 529 if (setting == CONTENT_SETTING_BLOCK) | 529 if (setting == CONTENT_SETTING_BLOCK) |
| 530 return WebKit::WebNotificationPresenter::PermissionDenied; | 530 return WebKit::WebNotificationPresenter::PermissionDenied; |
| 531 if (setting == CONTENT_SETTING_ASK) | 531 if (setting == CONTENT_SETTING_ASK) |
| 532 return WebKit::WebNotificationPresenter::PermissionNotAllowed; | 532 return WebKit::WebNotificationPresenter::PermissionNotAllowed; |
| 533 NOTREACHED() << "Invalid notifications settings value: " << setting; | 533 NOTREACHED() << "Invalid notifications settings value: " << setting; |
| 534 return WebKit::WebNotificationPresenter::PermissionNotAllowed; | 534 return WebKit::WebNotificationPresenter::PermissionNotAllowed; |
| 535 } | 535 } |
| OLD | NEW |