| 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/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/prefs/scoped_user_pref_update.h" | 10 #include "base/prefs/scoped_user_pref_update.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 DesktopNotificationService::~DesktopNotificationService() { | 87 DesktopNotificationService::~DesktopNotificationService() { |
| 88 } | 88 } |
| 89 | 89 |
| 90 void DesktopNotificationService::RequestNotificationPermission( | 90 void DesktopNotificationService::RequestNotificationPermission( |
| 91 content::WebContents* web_contents, | 91 content::WebContents* web_contents, |
| 92 const PermissionRequestID& request_id, | 92 const PermissionRequestID& request_id, |
| 93 const GURL& requesting_origin, | 93 const GURL& requesting_origin, |
| 94 bool user_gesture, | 94 bool user_gesture, |
| 95 const BrowserPermissionCallback& result_callback) { | 95 const BrowserPermissionCallback& result_callback) { |
| 96 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 96 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 97 | 97 |
| 98 #if defined(ENABLE_EXTENSIONS) | 98 #if defined(ENABLE_EXTENSIONS) |
| 99 extensions::InfoMap* extension_info_map = | 99 extensions::InfoMap* extension_info_map = |
| 100 extensions::ExtensionSystem::Get(profile_)->info_map(); | 100 extensions::ExtensionSystem::Get(profile_)->info_map(); |
| 101 const extensions::Extension* extension = NULL; | 101 const extensions::Extension* extension = NULL; |
| 102 if (extension_info_map) { | 102 if (extension_info_map) { |
| 103 extensions::ExtensionSet extensions; | 103 extensions::ExtensionSet extensions; |
| 104 extension_info_map->GetExtensionsWithAPIPermissionForSecurityOrigin( | 104 extension_info_map->GetExtensionsWithAPIPermissionForSecurityOrigin( |
| 105 requesting_origin, | 105 requesting_origin, |
| 106 request_id.render_process_id(), | 106 request_id.render_process_id(), |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 // Tell the IO thread that this extension's permission for notifications | 272 // Tell the IO thread that this extension's permission for notifications |
| 273 // has changed. | 273 // has changed. |
| 274 extensions::InfoMap* extension_info_map = | 274 extensions::InfoMap* extension_info_map = |
| 275 extensions::ExtensionSystem::Get(profile_)->info_map(); | 275 extensions::ExtensionSystem::Get(profile_)->info_map(); |
| 276 BrowserThread::PostTask( | 276 BrowserThread::PostTask( |
| 277 BrowserThread::IO, FROM_HERE, | 277 BrowserThread::IO, FROM_HERE, |
| 278 base::Bind(&extensions::InfoMap::SetNotificationsDisabled, | 278 base::Bind(&extensions::InfoMap::SetNotificationsDisabled, |
| 279 extension_info_map, notifier_id.id, !enabled)); | 279 extension_info_map, notifier_id.id, !enabled)); |
| 280 #endif | 280 #endif |
| 281 } | 281 } |
| OLD | NEW |