| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/string_piece.h" | 9 #include "base/string_piece.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/browser/tab_contents/tab_contents.h" | 23 #include "chrome/browser/tab_contents/tab_contents.h" |
| 24 #include "chrome/browser/worker_host/worker_process_host.h" | 24 #include "chrome/browser/worker_host/worker_process_host.h" |
| 25 #include "chrome/common/child_process_host.h" | 25 #include "chrome/common/child_process_host.h" |
| 26 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
| 27 #include "chrome/common/pref_service.h" | 27 #include "chrome/common/pref_service.h" |
| 28 #include "chrome/common/render_messages.h" | 28 #include "chrome/common/render_messages.h" |
| 29 #include "grit/browser_resources.h" | 29 #include "grit/browser_resources.h" |
| 30 #include "grit/chromium_strings.h" | 30 #include "grit/chromium_strings.h" |
| 31 #include "grit/generated_resources.h" | 31 #include "grit/generated_resources.h" |
| 32 #include "grit/theme_resources.h" | 32 #include "grit/theme_resources.h" |
| 33 #include "webkit/api/public/WebNotificationPresenter.h" | 33 #include "third_party/WebKit/WebKit/chromium/public/WebNotificationPresenter.h" |
| 34 | 34 |
| 35 using WebKit::WebNotificationPresenter; | 35 using WebKit::WebNotificationPresenter; |
| 36 | 36 |
| 37 // Creates a data:xxxx URL which contains the full HTML for a notification | 37 // Creates a data:xxxx URL which contains the full HTML for a notification |
| 38 // using supplied icon, title, and text, run through a template which contains | 38 // using supplied icon, title, and text, run through a template which contains |
| 39 // the standard formatting for notifications. | 39 // the standard formatting for notifications. |
| 40 static string16 CreateDataUrl(const GURL& icon_url, const string16& title, | 40 static string16 CreateDataUrl(const GURL& icon_url, const string16& title, |
| 41 const string16& body) { | 41 const string16& body) { |
| 42 const base::StringPiece template_html( | 42 const base::StringPiece template_html( |
| 43 ResourceBundle::GetSharedInstance().GetRawDataResource( | 43 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 NotificationObjectProxy* proxy = | 300 NotificationObjectProxy* proxy = |
| 301 new NotificationObjectProxy(process_id, route_id, | 301 new NotificationObjectProxy(process_id, route_id, |
| 302 notification_id, | 302 notification_id, |
| 303 source == WorkerNotification); | 303 source == WorkerNotification); |
| 304 // "upconvert" the string parameters to a data: URL. | 304 // "upconvert" the string parameters to a data: URL. |
| 305 string16 data_url = CreateDataUrl(icon, title, text); | 305 string16 data_url = CreateDataUrl(icon, title, text); |
| 306 Notification notif(origin, GURL(data_url), proxy); | 306 Notification notif(origin, GURL(data_url), proxy); |
| 307 ShowNotification(notif); | 307 ShowNotification(notif); |
| 308 return true; | 308 return true; |
| 309 } | 309 } |
| OLD | NEW |