Commit a554b2a3 authored by peter's avatar peter Committed by Commit bot

Merge two Notification constructors, increase priority of low-battery notification.

BUG=

Review URL: https://codereview.chromium.org/576823003

Cr-Commit-Position: refs/heads/master@{#295287}
parent 82dd6af9
...@@ -216,17 +216,21 @@ bool PeripheralBatteryObserver::PostNotification(const std::string& address, ...@@ -216,17 +216,21 @@ bool PeripheralBatteryObserver::PostNotification(const std::string& address,
battery.level); battery.level);
Notification notification( Notification notification(
// TODO(mukai): add SYSTEM priority and use here. message_center::NOTIFICATION_TYPE_SIMPLE,
GURL(kNotificationOriginUrl), GURL(kNotificationOriginUrl),
ui::ResourceBundle::GetSharedInstance().GetImageNamed(
IDR_NOTIFICATION_PERIPHERAL_BATTERY_LOW),
base::UTF8ToUTF16(battery.name), base::UTF8ToUTF16(battery.name),
string_text, string_text,
ui::ResourceBundle::GetSharedInstance().GetImageNamed(
IDR_NOTIFICATION_PERIPHERAL_BATTERY_LOW),
blink::WebTextDirectionDefault, blink::WebTextDirectionDefault,
message_center::NotifierId(GURL(kNotificationOriginUrl)),
base::string16(), base::string16(),
base::UTF8ToUTF16(address), base::UTF8ToUTF16(address),
message_center::RichNotificationData(),
new PeripheralBatteryNotificationDelegate(address)); new PeripheralBatteryNotificationDelegate(address));
notification.set_priority(message_center::SYSTEM_PRIORITY);
notification_manager->Add( notification_manager->Add(
notification, notification,
ProfileManager::GetPrimaryUserProfile()); ProfileManager::GetPrimaryUserProfile());
......
...@@ -88,9 +88,17 @@ std::string DesktopNotificationService::AddIconNotification( ...@@ -88,9 +88,17 @@ std::string DesktopNotificationService::AddIconNotification(
const base::string16& replace_id, const base::string16& replace_id,
NotificationDelegate* delegate, NotificationDelegate* delegate,
Profile* profile) { Profile* profile) {
Notification notification(origin_url, icon, title, message, Notification notification(message_center::NOTIFICATION_TYPE_SIMPLE,
origin_url,
title,
message,
icon,
blink::WebTextDirectionDefault, blink::WebTextDirectionDefault,
base::string16(), replace_id, delegate); message_center::NotifierId(origin_url),
base::string16(),
replace_id,
message_center::RichNotificationData(),
delegate);
g_browser_process->notification_ui_manager()->Add(notification, profile); g_browser_process->notification_ui_manager()->Add(notification, profile);
return notification.delegate_id(); return notification.delegate_id();
} }
......
...@@ -54,27 +54,6 @@ Notification::Notification( ...@@ -54,27 +54,6 @@ Notification::Notification(
// to prevent "Downloading" the data url and overwriting the existing |icon|. // to prevent "Downloading" the data url and overwriting the existing |icon|.
} }
Notification::Notification(const GURL& origin_url,
const gfx::Image& icon,
const base::string16& title,
const base::string16& body,
blink::WebTextDirection dir,
const base::string16& display_source,
const base::string16& replace_id,
NotificationDelegate* delegate)
: message_center::Notification(message_center::NOTIFICATION_TYPE_SIMPLE,
delegate->id(),
title,
body,
icon,
display_source,
message_center::NotifierId(origin_url),
message_center::RichNotificationData(),
delegate),
origin_url_(origin_url),
replace_id_(replace_id),
delegate_(delegate) {}
Notification::Notification(const Notification& notification) Notification::Notification(const Notification& notification)
: message_center::Notification(notification), : message_center::Notification(notification),
origin_url_(notification.origin_url()), origin_url_(notification.origin_url()),
......
...@@ -38,17 +38,6 @@ class Notification : public message_center::Notification { ...@@ -38,17 +38,6 @@ class Notification : public message_center::Notification {
const base::string16& replace_id, const base::string16& replace_id,
NotificationDelegate* delegate); NotificationDelegate* delegate);
// Initializes a notification with text content and an icon image. Currently
// only used on Ash. Does not generate content_url_.
Notification(const GURL& origin_url,
const gfx::Image& icon,
const base::string16& title,
const base::string16& body,
blink::WebTextDirection dir,
const base::string16& display_source,
const base::string16& replace_id,
NotificationDelegate* delegate);
Notification( Notification(
message_center::NotificationType type, message_center::NotificationType type,
const GURL& origin_url, const GURL& origin_url,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment