| 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/chrome_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 1859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1870 | 1870 |
| 1871 blink::WebNotificationPermission | 1871 blink::WebNotificationPermission |
| 1872 ChromeContentBrowserClient::CheckDesktopNotificationPermission( | 1872 ChromeContentBrowserClient::CheckDesktopNotificationPermission( |
| 1873 const GURL& source_origin, | 1873 const GURL& source_origin, |
| 1874 content::ResourceContext* context, | 1874 content::ResourceContext* context, |
| 1875 int render_process_id) { | 1875 int render_process_id) { |
| 1876 #if defined(ENABLE_NOTIFICATIONS) | 1876 #if defined(ENABLE_NOTIFICATIONS) |
| 1877 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 1877 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 1878 | 1878 |
| 1879 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); | 1879 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); |
| 1880 #if defined(ENABLE_EXTENSIONS) |
| 1880 InfoMap* extension_info_map = io_data->GetExtensionInfoMap(); | 1881 InfoMap* extension_info_map = io_data->GetExtensionInfoMap(); |
| 1881 | 1882 |
| 1882 // We want to see if there is an extension that hasn't been manually disabled | 1883 // We want to see if there is an extension that hasn't been manually disabled |
| 1883 // that has the notifications permission and applies to this security origin. | 1884 // that has the notifications permission and applies to this security origin. |
| 1884 // First, get the list of extensions with permission for the origin. | 1885 // First, get the list of extensions with permission for the origin. |
| 1885 extensions::ExtensionSet extensions; | 1886 extensions::ExtensionSet extensions; |
| 1886 extension_info_map->GetExtensionsWithAPIPermissionForSecurityOrigin( | 1887 extension_info_map->GetExtensionsWithAPIPermissionForSecurityOrigin( |
| 1887 source_origin, | 1888 source_origin, |
| 1888 render_process_id, | 1889 render_process_id, |
| 1889 extensions::APIPermission::kNotifications, | 1890 extensions::APIPermission::kNotifications, |
| 1890 &extensions); | 1891 &extensions); |
| 1891 for (extensions::ExtensionSet::const_iterator iter = extensions.begin(); | 1892 for (extensions::ExtensionSet::const_iterator iter = extensions.begin(); |
| 1892 iter != extensions.end(); ++iter) { | 1893 iter != extensions.end(); ++iter) { |
| 1893 // Then, check to see if it's been disabled by the user. | 1894 // Then, check to see if it's been disabled by the user. |
| 1894 if (!extension_info_map->AreNotificationsDisabled((*iter)->id())) | 1895 if (!extension_info_map->AreNotificationsDisabled((*iter)->id())) |
| 1895 return blink::WebNotificationPermissionAllowed; | 1896 return blink::WebNotificationPermissionAllowed; |
| 1896 } | 1897 } |
| 1898 #endif |
| 1897 | 1899 |
| 1898 // No enabled extensions exist, so check the normal host content settings. | 1900 // No enabled extensions exist, so check the normal host content settings. |
| 1899 HostContentSettingsMap* host_content_settings_map = | 1901 HostContentSettingsMap* host_content_settings_map = |
| 1900 io_data->GetHostContentSettingsMap(); | 1902 io_data->GetHostContentSettingsMap(); |
| 1901 ContentSetting setting = host_content_settings_map->GetContentSetting( | 1903 ContentSetting setting = host_content_settings_map->GetContentSetting( |
| 1902 source_origin, | 1904 source_origin, |
| 1903 source_origin, | 1905 source_origin, |
| 1904 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, | 1906 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
| 1905 NO_RESOURCE_IDENTIFIER); | 1907 NO_RESOURCE_IDENTIFIER); |
| 1906 | 1908 |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2607 switches::kDisableWebRtcEncryption, | 2609 switches::kDisableWebRtcEncryption, |
| 2608 }; | 2610 }; |
| 2609 to_command_line->CopySwitchesFrom(from_command_line, | 2611 to_command_line->CopySwitchesFrom(from_command_line, |
| 2610 kWebRtcDevSwitchNames, | 2612 kWebRtcDevSwitchNames, |
| 2611 arraysize(kWebRtcDevSwitchNames)); | 2613 arraysize(kWebRtcDevSwitchNames)); |
| 2612 } | 2614 } |
| 2613 } | 2615 } |
| 2614 #endif // defined(ENABLE_WEBRTC) | 2616 #endif // defined(ENABLE_WEBRTC) |
| 2615 | 2617 |
| 2616 } // namespace chrome | 2618 } // namespace chrome |
| OLD | NEW |