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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 #include "chrome/browser/extensions/chrome_content_browser_client_extensions_par
t.h" | 222 #include "chrome/browser/extensions/chrome_content_browser_client_extensions_par
t.h" |
223 #include "chrome/browser/extensions/extension_service.h" | 223 #include "chrome/browser/extensions/extension_service.h" |
224 #include "chrome/browser/extensions/extension_util.h" | 224 #include "chrome/browser/extensions/extension_util.h" |
225 #include "chrome/browser/speech/extension_api/tts_engine_extension_api.h" | 225 #include "chrome/browser/speech/extension_api/tts_engine_extension_api.h" |
226 #include "extensions/browser/extension_system.h" | 226 #include "extensions/browser/extension_system.h" |
227 #include "extensions/browser/guest_view/guest_view_base.h" | 227 #include "extensions/browser/guest_view/guest_view_base.h" |
228 #include "extensions/browser/guest_view/guest_view_manager.h" | 228 #include "extensions/browser/guest_view/guest_view_manager.h" |
229 #include "extensions/browser/guest_view/web_view/web_view_guest.h" | 229 #include "extensions/browser/guest_view/web_view/web_view_guest.h" |
230 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" | 230 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" |
231 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" | 231 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" |
232 #include "extensions/browser/suggest_permission_util.h" | |
233 #include "extensions/common/constants.h" | 232 #include "extensions/common/constants.h" |
234 #include "extensions/common/extension.h" | 233 #include "extensions/common/extension.h" |
235 #include "extensions/common/extension_set.h" | 234 #include "extensions/common/extension_set.h" |
236 #include "extensions/common/manifest_handlers/background_info.h" | 235 #include "extensions/common/manifest_handlers/background_info.h" |
237 #include "extensions/common/manifest_handlers/shared_module_info.h" | 236 #include "extensions/common/manifest_handlers/shared_module_info.h" |
238 #include "extensions/common/permissions/permissions_data.h" | 237 #include "extensions/common/permissions/permissions_data.h" |
239 #include "extensions/common/permissions/socket_permission.h" | 238 #include "extensions/common/permissions/socket_permission.h" |
240 #include "extensions/common/switches.h" | 239 #include "extensions/common/switches.h" |
241 #endif | 240 #endif |
242 | 241 |
(...skipping 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1822 content::RenderFrameHost* render_frame_host, | 1821 content::RenderFrameHost* render_frame_host, |
1823 const base::Callback<void(blink::WebNotificationPermission)>& callback) { | 1822 const base::Callback<void(blink::WebNotificationPermission)>& callback) { |
1824 #if defined(ENABLE_NOTIFICATIONS) | 1823 #if defined(ENABLE_NOTIFICATIONS) |
1825 // Skip showing the infobar if the request comes from an extension, and that | 1824 // Skip showing the infobar if the request comes from an extension, and that |
1826 // extension has the 'notify' permission. (If the extension does not have the | 1825 // extension has the 'notify' permission. (If the extension does not have the |
1827 // permission, the user will still be prompted.) | 1826 // permission, the user will still be prompted.) |
1828 Profile* profile = Profile::FromBrowserContext( | 1827 Profile* profile = Profile::FromBrowserContext( |
1829 render_frame_host->GetSiteInstance()->GetBrowserContext()); | 1828 render_frame_host->GetSiteInstance()->GetBrowserContext()); |
1830 DesktopNotificationService* notification_service = | 1829 DesktopNotificationService* notification_service = |
1831 DesktopNotificationServiceFactory::GetForProfile(profile); | 1830 DesktopNotificationServiceFactory::GetForProfile(profile); |
1832 #if defined(ENABLE_EXTENSIONS) | |
1833 InfoMap* extension_info_map = | |
1834 extensions::ExtensionSystem::Get(profile)->info_map(); | |
1835 const Extension* extension = NULL; | |
1836 if (extension_info_map) { | |
1837 extensions::ExtensionSet extensions; | |
1838 extension_info_map->GetExtensionsWithAPIPermissionForSecurityOrigin( | |
1839 source_origin, | |
1840 render_frame_host->GetProcess()->GetID(), | |
1841 extensions::APIPermission::kNotifications, | |
1842 &extensions); | |
1843 for (extensions::ExtensionSet::const_iterator iter = extensions.begin(); | |
1844 iter != extensions.end(); ++iter) { | |
1845 if (notification_service->IsNotifierEnabled(NotifierId( | |
1846 NotifierId::APPLICATION, (*iter)->id()))) { | |
1847 extension = iter->get(); | |
1848 break; | |
1849 } | |
1850 } | |
1851 } | |
1852 if (IsExtensionWithPermissionOrSuggestInConsole( | |
1853 APIPermission::kNotifications, | |
1854 extension, | |
1855 render_frame_host->GetRenderViewHost())) { | |
1856 callback.Run(blink::WebNotificationPermissionAllowed); | |
1857 return; | |
1858 } | |
1859 #endif | |
1860 | |
1861 WebContents* web_contents = WebContents::FromRenderFrameHost( | 1831 WebContents* web_contents = WebContents::FromRenderFrameHost( |
1862 render_frame_host); | 1832 render_frame_host); |
1863 int render_process_id = render_frame_host->GetProcess()->GetID(); | 1833 int render_process_id = render_frame_host->GetProcess()->GetID(); |
1864 const PermissionRequestID request_id(render_process_id, | 1834 const PermissionRequestID request_id(render_process_id, |
1865 web_contents->GetRoutingID(), | 1835 web_contents->GetRoutingID(), |
1866 -1 /* bridge id */, | 1836 -1 /* bridge id */, |
1867 GURL()); | 1837 GURL()); |
1868 | 1838 |
1869 notification_service->RequestNotificationPermission( | 1839 notification_service->RequestNotificationPermission( |
1870 web_contents, | 1840 web_contents, |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2640 switches::kDisableWebRtcEncryption, | 2610 switches::kDisableWebRtcEncryption, |
2641 }; | 2611 }; |
2642 to_command_line->CopySwitchesFrom(from_command_line, | 2612 to_command_line->CopySwitchesFrom(from_command_line, |
2643 kWebRtcDevSwitchNames, | 2613 kWebRtcDevSwitchNames, |
2644 arraysize(kWebRtcDevSwitchNames)); | 2614 arraysize(kWebRtcDevSwitchNames)); |
2645 } | 2615 } |
2646 } | 2616 } |
2647 #endif // defined(ENABLE_WEBRTC) | 2617 #endif // defined(ENABLE_WEBRTC) |
2648 | 2618 |
2649 } // namespace chrome | 2619 } // namespace chrome |
OLD | NEW |