| OLD | NEW |
| 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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 const base::string16& title, | 376 const base::string16& title, |
| 377 const base::string16& message, | 377 const base::string16& message, |
| 378 const gfx::Image& icon, | 378 const gfx::Image& icon, |
| 379 const base::string16& replace_id, | 379 const base::string16& replace_id, |
| 380 NotificationDelegate* delegate, | 380 NotificationDelegate* delegate, |
| 381 Profile* profile) { | 381 Profile* profile) { |
| 382 Notification notification(origin_url, icon, title, message, | 382 Notification notification(origin_url, icon, title, message, |
| 383 blink::WebTextDirectionDefault, | 383 blink::WebTextDirectionDefault, |
| 384 base::string16(), replace_id, delegate); | 384 base::string16(), replace_id, delegate); |
| 385 g_browser_process->notification_ui_manager()->Add(notification, profile); | 385 g_browser_process->notification_ui_manager()->Add(notification, profile); |
| 386 return notification.notification_id(); | 386 return notification.delegate_id(); |
| 387 } | 387 } |
| 388 | 388 |
| 389 DesktopNotificationService::DesktopNotificationService( | 389 DesktopNotificationService::DesktopNotificationService( |
| 390 Profile* profile, | 390 Profile* profile, |
| 391 NotificationUIManager* ui_manager) | 391 NotificationUIManager* ui_manager) |
| 392 : profile_(profile), | 392 : profile_(profile), |
| 393 ui_manager_(ui_manager) { | 393 ui_manager_(ui_manager) { |
| 394 OnStringListPrefChanged( | 394 OnStringListPrefChanged( |
| 395 prefs::kMessageCenterDisabledExtensionIds, &disabled_extension_ids_); | 395 prefs::kMessageCenterDisabledExtensionIds, &disabled_extension_ids_); |
| 396 OnStringListPrefChanged( | 396 OnStringListPrefChanged( |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 // Tell the IO thread that this extension's permission for notifications | 752 // Tell the IO thread that this extension's permission for notifications |
| 753 // has changed. | 753 // has changed. |
| 754 extensions::InfoMap* extension_info_map = | 754 extensions::InfoMap* extension_info_map = |
| 755 extensions::ExtensionSystem::Get(profile_)->info_map(); | 755 extensions::ExtensionSystem::Get(profile_)->info_map(); |
| 756 BrowserThread::PostTask( | 756 BrowserThread::PostTask( |
| 757 BrowserThread::IO, FROM_HERE, | 757 BrowserThread::IO, FROM_HERE, |
| 758 base::Bind(&extensions::InfoMap::SetNotificationsDisabled, | 758 base::Bind(&extensions::InfoMap::SetNotificationsDisabled, |
| 759 extension_info_map, notifier_id.id, !enabled)); | 759 extension_info_map, notifier_id.id, !enabled)); |
| 760 #endif | 760 #endif |
| 761 } | 761 } |
| OLD | NEW |