summaryrefslogtreecommitdiffstats
path: root/chrome/browser/notifications/desktop_notification_service.cc
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-17 01:19:06 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-17 01:19:06 +0000
commit3b845753b707daca3fe3e733263065f162b7162b (patch)
treeb674a4d72a118323da1fad83f8caa43f57a86b32 /chrome/browser/notifications/desktop_notification_service.cc
parentfee8f0222a5f2a377ba5d7f2d3383481c02eafac (diff)
downloadchromium_src-3b845753b707daca3fe3e733263065f162b7162b.zip
chromium_src-3b845753b707daca3fe3e733263065f162b7162b.tar.gz
chromium_src-3b845753b707daca3fe3e733263065f162b7162b.tar.bz2
* Moved sticky/controls frag to chromeos::BalloonViewImpl
* Added AddSystemNotification to add system notification and UpdateNotification to update a notification. * refactored NotificationObjectProxy and added NotificationDelegate class. * Added notification_browser.cc. BUG=33306 TEST=added notification_browser.cc with minimal test. I'll add more in next step. Review URL: http://codereview.chromium.org/1013002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41801 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/notifications/desktop_notification_service.cc')
-rw-r--r--chrome/browser/notifications/desktop_notification_service.cc25
1 files changed, 8 insertions, 17 deletions
diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc
index 55613f5..d351880 100644
--- a/chrome/browser/notifications/desktop_notification_service.cc
+++ b/chrome/browser/notifications/desktop_notification_service.cc
@@ -36,14 +36,9 @@
using WebKit::WebNotificationPresenter;
-namespace {
-
-// Creates a data:xxxx URL which contains the full HTML for a notification
-// using supplied icon, title, and text, run through a template which contains
-// the standard formatting for notifications.
-static string16 CreateDataUrl(const GURL& icon_url, const string16& title,
- const string16& body) {
-
+// static
+string16 DesktopNotificationService::CreateDataUrl(
+ const GURL& icon_url, const string16& title, const string16& body) {
int resource;
string16 line_name;
string16 line;
@@ -81,8 +76,6 @@ static string16 CreateDataUrl(const GURL& icon_url, const string16& title,
return ReplaceStringPlaceholders(format_string, subst, NULL);
}
-}
-
// A task object which calls the renderer to inform the web page that the
// permission request has completed.
class NotificationPermissionCallbackTask : public Task {
@@ -334,21 +327,20 @@ bool DesktopNotificationService::CancelDesktopNotification(
scoped_refptr<NotificationObjectProxy> proxy(
new NotificationObjectProxy(process_id, route_id, notification_id,
false));
- Notification notif(GURL(), GURL(), L"", proxy, false);
+ Notification notif(GURL(), GURL(), L"", proxy);
return ui_manager_->Cancel(notif);
}
bool DesktopNotificationService::ShowDesktopNotification(
const GURL& origin, const GURL& url, int process_id, int route_id,
- DesktopNotificationSource source, int notification_id,
- bool sticky) {
+ DesktopNotificationSource source, int notification_id) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
NotificationObjectProxy* proxy =
new NotificationObjectProxy(process_id, route_id,
notification_id,
source == WorkerNotification);
- Notification notif(origin, url, DisplayNameForOrigin(origin), proxy, sticky);
+ Notification notif(origin, url, DisplayNameForOrigin(origin), proxy);
ShowNotification(notif);
return true;
}
@@ -356,8 +348,7 @@ bool DesktopNotificationService::ShowDesktopNotification(
bool DesktopNotificationService::ShowDesktopNotificationText(
const GURL& origin, const GURL& icon, const string16& title,
const string16& text, int process_id, int route_id,
- DesktopNotificationSource source, int notification_id,
- bool sticky) {
+ DesktopNotificationSource source, int notification_id) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
NotificationObjectProxy* proxy =
new NotificationObjectProxy(process_id, route_id,
@@ -366,7 +357,7 @@ bool DesktopNotificationService::ShowDesktopNotificationText(
// "upconvert" the string parameters to a data: URL.
string16 data_url = CreateDataUrl(icon, title, text);
Notification notif(
- origin, GURL(data_url), DisplayNameForOrigin(origin), proxy, sticky);
+ origin, GURL(data_url), DisplayNameForOrigin(origin), proxy);
ShowNotification(notif);
return true;
}