Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/platform_notification_service_impl.h" | 5 #include "chrome/browser/notifications/platform_notification_service_impl.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/notifications/desktop_notification_profile_util.h" | 10 #include "chrome/browser/notifications/desktop_notification_profile_util.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 for (const auto& extension : extensions) { | 169 for (const auto& extension : extensions) { |
| 170 if (!extension_info_map->AreNotificationsDisabled(extension->id())) | 170 if (!extension_info_map->AreNotificationsDisabled(extension->id())) |
| 171 return blink::WebNotificationPermissionAllowed; | 171 return blink::WebNotificationPermissionAllowed; |
| 172 } | 172 } |
| 173 #endif | 173 #endif |
| 174 | 174 |
| 175 // No enabled extensions exist, so check the normal host content settings. | 175 // No enabled extensions exist, so check the normal host content settings. |
| 176 HostContentSettingsMap* host_content_settings_map = | 176 HostContentSettingsMap* host_content_settings_map = |
| 177 io_data->GetHostContentSettingsMap(); | 177 io_data->GetHostContentSettingsMap(); |
| 178 ContentSetting setting = host_content_settings_map->GetContentSetting( | 178 ContentSetting setting = host_content_settings_map->GetContentSetting( |
| 179 origin, | 179 origin, origin, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
| 180 origin, | 180 NoResourceIdentifier::GetResourceIdentifier()); |
|
markusheintz_
2015/03/27 10:27:34
nit: Please put each param back into a single line
Deepak
2015/03/27 11:40:04
Done.
| |
| 181 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, | |
| 182 NO_RESOURCE_IDENTIFIER); | |
| 183 | 181 |
| 184 if (setting == CONTENT_SETTING_ALLOW) | 182 if (setting == CONTENT_SETTING_ALLOW) |
| 185 return blink::WebNotificationPermissionAllowed; | 183 return blink::WebNotificationPermissionAllowed; |
| 186 if (setting == CONTENT_SETTING_BLOCK) | 184 if (setting == CONTENT_SETTING_BLOCK) |
| 187 return blink::WebNotificationPermissionDenied; | 185 return blink::WebNotificationPermissionDenied; |
| 188 | 186 |
| 189 return blink::WebNotificationPermissionDefault; | 187 return blink::WebNotificationPermissionDefault; |
| 190 } | 188 } |
| 191 | 189 |
| 192 void PlatformNotificationServiceImpl::DisplayNotification( | 190 void PlatformNotificationServiceImpl::DisplayNotification( |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 332 formatted_origin.push_back(':'); | 330 formatted_origin.push_back(':'); |
| 333 formatted_origin.append(base::UTF8ToUTF16(origin.port())); | 331 formatted_origin.append(base::UTF8ToUTF16(origin.port())); |
| 334 } | 332 } |
| 335 return formatted_origin; | 333 return formatted_origin; |
| 336 } | 334 } |
| 337 | 335 |
| 338 // TODO(dewittj): Once file:// URLs are passed in to the origin | 336 // TODO(dewittj): Once file:// URLs are passed in to the origin |
| 339 // GURL here, begin returning the path as the display name. | 337 // GURL here, begin returning the path as the display name. |
| 340 return net::FormatUrl(origin, languages); | 338 return net::FormatUrl(origin, languages); |
| 341 } | 339 } |
| OLD | NEW |