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

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

Issue 768373002: Remove DesktopNotificationService::AddIconNotification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove comment Created 6 years 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 void DesktopNotificationService::RegisterProfilePrefs( 55 void DesktopNotificationService::RegisterProfilePrefs(
56 user_prefs::PrefRegistrySyncable* registry) { 56 user_prefs::PrefRegistrySyncable* registry) {
57 registry->RegisterListPref( 57 registry->RegisterListPref(
58 prefs::kMessageCenterDisabledExtensionIds, 58 prefs::kMessageCenterDisabledExtensionIds,
59 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 59 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
60 registry->RegisterListPref( 60 registry->RegisterListPref(
61 prefs::kMessageCenterDisabledSystemComponentIds, 61 prefs::kMessageCenterDisabledSystemComponentIds,
62 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 62 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
63 } 63 }
64 64
65 // static
66 std::string DesktopNotificationService::AddIconNotification(
67 const GURL& origin_url,
68 const base::string16& title,
69 const base::string16& message,
70 const gfx::Image& icon,
71 const base::string16& replace_id,
72 NotificationDelegate* delegate,
73 Profile* profile) {
74 Notification notification(message_center::NOTIFICATION_TYPE_SIMPLE,
75 origin_url,
76 title,
77 message,
78 icon,
79 blink::WebTextDirectionDefault,
80 NotifierId(origin_url),
81 base::string16(),
82 replace_id,
83 message_center::RichNotificationData(),
84 delegate);
85 g_browser_process->notification_ui_manager()->Add(notification, profile);
86 return notification.delegate_id();
87 }
88
89 DesktopNotificationService::DesktopNotificationService(Profile* profile) 65 DesktopNotificationService::DesktopNotificationService(Profile* profile)
90 : PermissionContextBase(profile, CONTENT_SETTINGS_TYPE_NOTIFICATIONS), 66 : PermissionContextBase(profile, CONTENT_SETTINGS_TYPE_NOTIFICATIONS),
91 profile_(profile) 67 profile_(profile)
92 #if defined(ENABLE_EXTENSIONS) 68 #if defined(ENABLE_EXTENSIONS)
93 , 69 ,
94 extension_registry_observer_(this) 70 extension_registry_observer_(this)
95 #endif 71 #endif
96 { 72 {
97 OnStringListPrefChanged( 73 OnStringListPrefChanged(
98 prefs::kMessageCenterDisabledExtensionIds, &disabled_extension_ids_); 74 prefs::kMessageCenterDisabledExtensionIds, &disabled_extension_ids_);
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 // Tell the IO thread that this extension's permission for notifications 336 // Tell the IO thread that this extension's permission for notifications
361 // has changed. 337 // has changed.
362 extensions::InfoMap* extension_info_map = 338 extensions::InfoMap* extension_info_map =
363 extensions::ExtensionSystem::Get(profile_)->info_map(); 339 extensions::ExtensionSystem::Get(profile_)->info_map();
364 BrowserThread::PostTask( 340 BrowserThread::PostTask(
365 BrowserThread::IO, FROM_HERE, 341 BrowserThread::IO, FROM_HERE,
366 base::Bind(&extensions::InfoMap::SetNotificationsDisabled, 342 base::Bind(&extensions::InfoMap::SetNotificationsDisabled,
367 extension_info_map, notifier_id.id, !enabled)); 343 extension_info_map, notifier_id.id, !enabled));
368 #endif 344 #endif
369 } 345 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698