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 26 matching lines...) Expand all Loading... |
37 #include "chrome/browser/geolocation/geolocation_permission_context_factory.h" | 37 #include "chrome/browser/geolocation/geolocation_permission_context_factory.h" |
38 #include "chrome/browser/media/cast_transport_host_filter.h" | 38 #include "chrome/browser/media/cast_transport_host_filter.h" |
39 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 39 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
40 #include "chrome/browser/media/midi_permission_context.h" | 40 #include "chrome/browser/media/midi_permission_context.h" |
41 #include "chrome/browser/media/midi_permission_context_factory.h" | 41 #include "chrome/browser/media/midi_permission_context_factory.h" |
42 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" | 42 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" |
43 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" | 43 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" |
44 #include "chrome/browser/net/chrome_net_log.h" | 44 #include "chrome/browser/net/chrome_net_log.h" |
45 #include "chrome/browser/notifications/desktop_notification_service.h" | 45 #include "chrome/browser/notifications/desktop_notification_service.h" |
46 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 46 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 47 #include "chrome/browser/notifications/platform_notification_service_impl.h" |
47 #include "chrome/browser/platform_util.h" | 48 #include "chrome/browser/platform_util.h" |
48 #include "chrome/browser/prerender/prerender_final_status.h" | 49 #include "chrome/browser/prerender/prerender_final_status.h" |
49 #include "chrome/browser/prerender/prerender_manager.h" | 50 #include "chrome/browser/prerender/prerender_manager.h" |
50 #include "chrome/browser/prerender/prerender_manager_factory.h" | 51 #include "chrome/browser/prerender/prerender_manager_factory.h" |
51 #include "chrome/browser/prerender/prerender_message_filter.h" | 52 #include "chrome/browser/prerender/prerender_message_filter.h" |
52 #include "chrome/browser/prerender/prerender_tracker.h" | 53 #include "chrome/browser/prerender/prerender_tracker.h" |
53 #include "chrome/browser/printing/printing_message_filter.h" | 54 #include "chrome/browser/printing/printing_message_filter.h" |
54 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h" | 55 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h" |
55 #include "chrome/browser/profiles/profile.h" | 56 #include "chrome/browser/profiles/profile.h" |
56 #include "chrome/browser/profiles/profile_io_data.h" | 57 #include "chrome/browser/profiles/profile_io_data.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 #include "components/pref_registry/pref_registry_syncable.h" | 102 #include "components/pref_registry/pref_registry_syncable.h" |
102 #include "components/signin/core/common/profile_management_switches.h" | 103 #include "components/signin/core/common/profile_management_switches.h" |
103 #include "components/translate/core/common/translate_switches.h" | 104 #include "components/translate/core/common/translate_switches.h" |
104 #include "content/public/browser/browser_child_process_host.h" | 105 #include "content/public/browser/browser_child_process_host.h" |
105 #include "content/public/browser/browser_main_parts.h" | 106 #include "content/public/browser/browser_main_parts.h" |
106 #include "content/public/browser/browser_ppapi_host.h" | 107 #include "content/public/browser/browser_ppapi_host.h" |
107 #include "content/public/browser/browser_thread.h" | 108 #include "content/public/browser/browser_thread.h" |
108 #include "content/public/browser/browser_url_handler.h" | 109 #include "content/public/browser/browser_url_handler.h" |
109 #include "content/public/browser/child_process_data.h" | 110 #include "content/public/browser/child_process_data.h" |
110 #include "content/public/browser/child_process_security_policy.h" | 111 #include "content/public/browser/child_process_security_policy.h" |
111 #include "content/public/browser/desktop_notification_delegate.h" | |
112 #include "content/public/browser/permission_type.h" | 112 #include "content/public/browser/permission_type.h" |
113 #include "content/public/browser/render_frame_host.h" | 113 #include "content/public/browser/render_frame_host.h" |
114 #include "content/public/browser/render_process_host.h" | 114 #include "content/public/browser/render_process_host.h" |
115 #include "content/public/browser/render_view_host.h" | 115 #include "content/public/browser/render_view_host.h" |
116 #include "content/public/browser/resource_context.h" | 116 #include "content/public/browser/resource_context.h" |
117 #include "content/public/browser/site_instance.h" | 117 #include "content/public/browser/site_instance.h" |
118 #include "content/public/browser/web_contents.h" | 118 #include "content/public/browser/web_contents.h" |
119 #include "content/public/common/child_process_host.h" | 119 #include "content/public/common/child_process_host.h" |
120 #include "content/public/common/content_descriptors.h" | 120 #include "content/public/common/content_descriptors.h" |
121 #include "content/public/common/show_desktop_notification_params.h" | |
122 #include "content/public/common/url_utils.h" | 121 #include "content/public/common/url_utils.h" |
123 #include "content/public/common/web_preferences.h" | 122 #include "content/public/common/web_preferences.h" |
124 #include "net/base/mime_util.h" | 123 #include "net/base/mime_util.h" |
125 #include "net/cookies/canonical_cookie.h" | 124 #include "net/cookies/canonical_cookie.h" |
126 #include "net/cookies/cookie_options.h" | 125 #include "net/cookies/cookie_options.h" |
127 #include "net/ssl/ssl_cert_request_info.h" | 126 #include "net/ssl/ssl_cert_request_info.h" |
128 #include "ppapi/host/ppapi_host.h" | 127 #include "ppapi/host/ppapi_host.h" |
129 #include "storage/browser/fileapi/external_mount_points.h" | 128 #include "storage/browser/fileapi/external_mount_points.h" |
130 #include "ui/base/l10n/l10n_util.h" | 129 #include "ui/base/l10n/l10n_util.h" |
131 #include "ui/base/resource/resource_bundle.h" | 130 #include "ui/base/resource/resource_bundle.h" |
(...skipping 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1850 int render_process_id, | 1849 int render_process_id, |
1851 int render_frame_id) { | 1850 int render_frame_id) { |
1852 chrome::SSLAddCertificate(cert_type, cert_data, cert_size, | 1851 chrome::SSLAddCertificate(cert_type, cert_data, cert_size, |
1853 render_process_id, render_frame_id); | 1852 render_process_id, render_frame_id); |
1854 } | 1853 } |
1855 | 1854 |
1856 content::MediaObserver* ChromeContentBrowserClient::GetMediaObserver() { | 1855 content::MediaObserver* ChromeContentBrowserClient::GetMediaObserver() { |
1857 return MediaCaptureDevicesDispatcher::GetInstance(); | 1856 return MediaCaptureDevicesDispatcher::GetInstance(); |
1858 } | 1857 } |
1859 | 1858 |
1860 blink::WebNotificationPermission | 1859 content::PlatformNotificationService* |
1861 ChromeContentBrowserClient::CheckDesktopNotificationPermission( | 1860 ChromeContentBrowserClient::GetPlatformNotificationService() { |
1862 const GURL& source_origin, | |
1863 content::ResourceContext* context, | |
1864 int render_process_id) { | |
1865 #if defined(ENABLE_NOTIFICATIONS) | 1861 #if defined(ENABLE_NOTIFICATIONS) |
1866 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 1862 return PlatformNotificationServiceImpl::GetInstance(); |
1867 | |
1868 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); | |
1869 #if defined(ENABLE_EXTENSIONS) | |
1870 InfoMap* extension_info_map = io_data->GetExtensionInfoMap(); | |
1871 | |
1872 // We want to see if there is an extension that hasn't been manually disabled | |
1873 // that has the notifications permission and applies to this security origin. | |
1874 // First, get the list of extensions with permission for the origin. | |
1875 extensions::ExtensionSet extensions; | |
1876 extension_info_map->GetExtensionsWithAPIPermissionForSecurityOrigin( | |
1877 source_origin, | |
1878 render_process_id, | |
1879 extensions::APIPermission::kNotifications, | |
1880 &extensions); | |
1881 for (extensions::ExtensionSet::const_iterator iter = extensions.begin(); | |
1882 iter != extensions.end(); ++iter) { | |
1883 // Then, check to see if it's been disabled by the user. | |
1884 if (!extension_info_map->AreNotificationsDisabled((*iter)->id())) | |
1885 return blink::WebNotificationPermissionAllowed; | |
1886 } | |
1887 #endif | |
1888 | |
1889 // No enabled extensions exist, so check the normal host content settings. | |
1890 HostContentSettingsMap* host_content_settings_map = | |
1891 io_data->GetHostContentSettingsMap(); | |
1892 ContentSetting setting = host_content_settings_map->GetContentSetting( | |
1893 source_origin, | |
1894 source_origin, | |
1895 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, | |
1896 NO_RESOURCE_IDENTIFIER); | |
1897 | |
1898 if (setting == CONTENT_SETTING_ALLOW) | |
1899 return blink::WebNotificationPermissionAllowed; | |
1900 if (setting == CONTENT_SETTING_BLOCK) | |
1901 return blink::WebNotificationPermissionDenied; | |
1902 return blink::WebNotificationPermissionDefault; | |
1903 #else | 1863 #else |
1904 return blink::WebNotificationPermissionAllowed; | 1864 NOTIMPLEMENTED(); |
| 1865 return NULL; |
1905 #endif | 1866 #endif |
1906 } | 1867 } |
1907 | 1868 |
1908 void ChromeContentBrowserClient::ShowDesktopNotification( | |
1909 const content::ShowDesktopNotificationHostMsgParams& params, | |
1910 content::BrowserContext* browser_context, | |
1911 int render_process_id, | |
1912 scoped_ptr<content::DesktopNotificationDelegate> delegate, | |
1913 base::Closure* cancel_callback) { | |
1914 #if defined(ENABLE_NOTIFICATIONS) | |
1915 Profile* profile = Profile::FromBrowserContext(browser_context); | |
1916 DCHECK(profile); | |
1917 | |
1918 DesktopNotificationService* service = | |
1919 DesktopNotificationServiceFactory::GetForProfile(profile); | |
1920 DCHECK(service); | |
1921 | |
1922 service->ShowDesktopNotification( | |
1923 params, render_process_id, delegate.Pass(), cancel_callback); | |
1924 profile->GetHostContentSettingsMap()->UpdateLastUsage( | |
1925 params.origin, params.origin, CONTENT_SETTINGS_TYPE_NOTIFICATIONS); | |
1926 #else | |
1927 NOTIMPLEMENTED(); | |
1928 #endif | |
1929 } | |
1930 | |
1931 void ChromeContentBrowserClient::RequestPermission( | 1869 void ChromeContentBrowserClient::RequestPermission( |
1932 content::PermissionType permission, | 1870 content::PermissionType permission, |
1933 content::WebContents* web_contents, | 1871 content::WebContents* web_contents, |
1934 int bridge_id, | 1872 int bridge_id, |
1935 const GURL& requesting_frame, | 1873 const GURL& requesting_frame, |
1936 bool user_gesture, | 1874 bool user_gesture, |
1937 const base::Callback<void(bool)>& result_callback) { | 1875 const base::Callback<void(bool)>& result_callback) { |
1938 int render_process_id = web_contents->GetRenderProcessHost()->GetID(); | 1876 int render_process_id = web_contents->GetRenderProcessHost()->GetID(); |
1939 int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID(); | 1877 int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID(); |
1940 Profile* profile = | 1878 Profile* profile = |
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2674 switches::kDisableWebRtcEncryption, | 2612 switches::kDisableWebRtcEncryption, |
2675 }; | 2613 }; |
2676 to_command_line->CopySwitchesFrom(from_command_line, | 2614 to_command_line->CopySwitchesFrom(from_command_line, |
2677 kWebRtcDevSwitchNames, | 2615 kWebRtcDevSwitchNames, |
2678 arraysize(kWebRtcDevSwitchNames)); | 2616 arraysize(kWebRtcDevSwitchNames)); |
2679 } | 2617 } |
2680 } | 2618 } |
2681 #endif // defined(ENABLE_WEBRTC) | 2619 #endif // defined(ENABLE_WEBRTC) |
2682 | 2620 |
2683 } // namespace chrome | 2621 } // namespace chrome |
OLD | NEW |