Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: chrome/browser/notifications/desktop_notification_service.cc

Issue 576823003: Merge two Notification constructors, increase priority of low-battery notification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Wrap kNotificationOriginUrl in GURL Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/prefs/scoped_user_pref_update.h" 9 #include "base/prefs/scoped_user_pref_update.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 // static 82 // static
83 std::string DesktopNotificationService::AddIconNotification( 83 std::string DesktopNotificationService::AddIconNotification(
84 const GURL& origin_url, 84 const GURL& origin_url,
85 const base::string16& title, 85 const base::string16& title,
86 const base::string16& message, 86 const base::string16& message,
87 const gfx::Image& icon, 87 const gfx::Image& icon,
88 const base::string16& replace_id, 88 const base::string16& replace_id,
89 NotificationDelegate* delegate, 89 NotificationDelegate* delegate,
90 Profile* profile) { 90 Profile* profile) {
91 Notification notification(origin_url, icon, title, message, 91 Notification notification(message_center::NOTIFICATION_TYPE_SIMPLE,
92 origin_url,
93 title,
94 message,
95 icon,
92 blink::WebTextDirectionDefault, 96 blink::WebTextDirectionDefault,
93 base::string16(), replace_id, delegate); 97 message_center::NotifierId(origin_url),
98 base::string16(),
99 replace_id,
100 message_center::RichNotificationData(),
101 delegate);
94 g_browser_process->notification_ui_manager()->Add(notification, profile); 102 g_browser_process->notification_ui_manager()->Add(notification, profile);
95 return notification.delegate_id(); 103 return notification.delegate_id();
96 } 104 }
97 105
98 DesktopNotificationService::DesktopNotificationService(Profile* profile) 106 DesktopNotificationService::DesktopNotificationService(Profile* profile)
99 : PermissionContextBase(profile, CONTENT_SETTINGS_TYPE_NOTIFICATIONS), 107 : PermissionContextBase(profile, CONTENT_SETTINGS_TYPE_NOTIFICATIONS),
100 profile_(profile), 108 profile_(profile),
101 extension_registry_observer_(this), 109 extension_registry_observer_(this),
102 weak_factory_(this) { 110 weak_factory_(this) {
103 OnStringListPrefChanged( 111 OnStringListPrefChanged(
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 // Tell the IO thread that this extension's permission for notifications 343 // Tell the IO thread that this extension's permission for notifications
336 // has changed. 344 // has changed.
337 extensions::InfoMap* extension_info_map = 345 extensions::InfoMap* extension_info_map =
338 extensions::ExtensionSystem::Get(profile_)->info_map(); 346 extensions::ExtensionSystem::Get(profile_)->info_map();
339 BrowserThread::PostTask( 347 BrowserThread::PostTask(
340 BrowserThread::IO, FROM_HERE, 348 BrowserThread::IO, FROM_HERE,
341 base::Bind(&extensions::InfoMap::SetNotificationsDisabled, 349 base::Bind(&extensions::InfoMap::SetNotificationsDisabled,
342 extension_info_map, notifier_id.id, !enabled)); 350 extension_info_map, notifier_id.id, !enabled));
343 #endif 351 #endif
344 } 352 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/power/peripheral_battery_observer.cc ('k') | chrome/browser/notifications/notification.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698