| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 for (extensions::ExtensionSet::const_iterator iter = extensions.begin(); | 109 for (extensions::ExtensionSet::const_iterator iter = extensions.begin(); |
| 110 iter != extensions.end(); ++iter) { | 110 iter != extensions.end(); ++iter) { |
| 111 if (IsNotifierEnabled(NotifierId( | 111 if (IsNotifierEnabled(NotifierId( |
| 112 NotifierId::APPLICATION, (*iter)->id()))) { | 112 NotifierId::APPLICATION, (*iter)->id()))) { |
| 113 extension = iter->get(); | 113 extension = iter->get(); |
| 114 break; | 114 break; |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 if (IsExtensionWithPermissionOrSuggestInConsole( | 118 if (IsExtensionWithPermissionOrSuggestInConsole( |
| 119 extensions::APIPermission::kNotifications, | 119 extensions::APIPermission::kNotifications, extension, |
| 120 extension, | 120 web_contents->GetMainFrame())) { |
| 121 web_contents->GetRenderViewHost())) { | |
| 122 result_callback.Run(CONTENT_SETTING_ALLOW); | 121 result_callback.Run(CONTENT_SETTING_ALLOW); |
| 123 return; | 122 return; |
| 124 } | 123 } |
| 125 #endif | 124 #endif |
| 126 | 125 |
| 127 // Track whether the requesting and embedding origins are different when | 126 // Track whether the requesting and embedding origins are different when |
| 128 // permission to display Web Notifications is being requested. | 127 // permission to display Web Notifications is being requested. |
| 129 UMA_HISTOGRAM_BOOLEAN("Notifications.DifferentRequestingEmbeddingOrigins", | 128 UMA_HISTOGRAM_BOOLEAN("Notifications.DifferentRequestingEmbeddingOrigins", |
| 130 requesting_origin.GetOrigin() != | 129 requesting_origin.GetOrigin() != |
| 131 web_contents->GetLastCommittedURL().GetOrigin()); | 130 web_contents->GetLastCommittedURL().GetOrigin()); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 // Tell the IO thread that this extension's permission for notifications | 275 // Tell the IO thread that this extension's permission for notifications |
| 277 // has changed. | 276 // has changed. |
| 278 extensions::InfoMap* extension_info_map = | 277 extensions::InfoMap* extension_info_map = |
| 279 extensions::ExtensionSystem::Get(profile_)->info_map(); | 278 extensions::ExtensionSystem::Get(profile_)->info_map(); |
| 280 BrowserThread::PostTask( | 279 BrowserThread::PostTask( |
| 281 BrowserThread::IO, FROM_HERE, | 280 BrowserThread::IO, FROM_HERE, |
| 282 base::Bind(&extensions::InfoMap::SetNotificationsDisabled, | 281 base::Bind(&extensions::InfoMap::SetNotificationsDisabled, |
| 283 extension_info_map, notifier_id.id, !enabled)); | 282 extension_info_map, notifier_id.id, !enabled)); |
| 284 #endif | 283 #endif |
| 285 } | 284 } |
| OLD | NEW |