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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 #include "content/public/browser/child_process_data.h" | 117 #include "content/public/browser/child_process_data.h" |
118 #include "content/public/browser/child_process_security_policy.h" | 118 #include "content/public/browser/child_process_security_policy.h" |
119 #include "content/public/browser/render_frame_host.h" | 119 #include "content/public/browser/render_frame_host.h" |
120 #include "content/public/browser/render_process_host.h" | 120 #include "content/public/browser/render_process_host.h" |
121 #include "content/public/browser/render_view_host.h" | 121 #include "content/public/browser/render_view_host.h" |
122 #include "content/public/browser/resource_context.h" | 122 #include "content/public/browser/resource_context.h" |
123 #include "content/public/browser/site_instance.h" | 123 #include "content/public/browser/site_instance.h" |
124 #include "content/public/browser/web_contents.h" | 124 #include "content/public/browser/web_contents.h" |
125 #include "content/public/common/child_process_host.h" | 125 #include "content/public/common/child_process_host.h" |
126 #include "content/public/common/content_descriptors.h" | 126 #include "content/public/common/content_descriptors.h" |
| 127 #include "content/public/common/show_desktop_notification_params.h" |
127 #include "content/public/common/url_utils.h" | 128 #include "content/public/common/url_utils.h" |
128 #include "content/public/common/web_preferences.h" | 129 #include "content/public/common/web_preferences.h" |
129 #include "extensions/browser/extension_host.h" | 130 #include "extensions/browser/extension_host.h" |
130 #include "extensions/browser/extension_message_filter.h" | 131 #include "extensions/browser/extension_message_filter.h" |
131 #include "extensions/browser/extension_registry.h" | 132 #include "extensions/browser/extension_registry.h" |
132 #include "extensions/browser/extension_system.h" | 133 #include "extensions/browser/extension_system.h" |
133 #include "extensions/browser/info_map.h" | 134 #include "extensions/browser/info_map.h" |
134 #include "extensions/browser/process_manager.h" | 135 #include "extensions/browser/process_manager.h" |
135 #include "extensions/browser/process_map.h" | 136 #include "extensions/browser/process_map.h" |
136 #include "extensions/browser/view_type_utils.h" | 137 #include "extensions/browser/view_type_utils.h" |
(...skipping 2037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2174 RenderFrameHost* render_frame_host, | 2175 RenderFrameHost* render_frame_host, |
2175 content::DesktopNotificationDelegate* delegate, | 2176 content::DesktopNotificationDelegate* delegate, |
2176 base::Closure* cancel_callback) { | 2177 base::Closure* cancel_callback) { |
2177 #if defined(ENABLE_NOTIFICATIONS) | 2178 #if defined(ENABLE_NOTIFICATIONS) |
2178 content::RenderProcessHost* process = render_frame_host->GetProcess(); | 2179 content::RenderProcessHost* process = render_frame_host->GetProcess(); |
2179 Profile* profile = Profile::FromBrowserContext(process->GetBrowserContext()); | 2180 Profile* profile = Profile::FromBrowserContext(process->GetBrowserContext()); |
2180 DesktopNotificationService* service = | 2181 DesktopNotificationService* service = |
2181 DesktopNotificationServiceFactory::GetForProfile(profile); | 2182 DesktopNotificationServiceFactory::GetForProfile(profile); |
2182 service->ShowDesktopNotification( | 2183 service->ShowDesktopNotification( |
2183 params, render_frame_host, delegate, cancel_callback); | 2184 params, render_frame_host, delegate, cancel_callback); |
| 2185 |
| 2186 profile->GetHostContentSettingsMap()->UpdateLastUsage( |
| 2187 params.origin, params.origin, CONTENT_SETTINGS_TYPE_NOTIFICATIONS); |
2184 #else | 2188 #else |
2185 NOTIMPLEMENTED(); | 2189 NOTIMPLEMENTED(); |
2186 #endif | 2190 #endif |
2187 } | 2191 } |
2188 | 2192 |
2189 void ChromeContentBrowserClient::RequestGeolocationPermission( | 2193 void ChromeContentBrowserClient::RequestGeolocationPermission( |
2190 content::WebContents* web_contents, | 2194 content::WebContents* web_contents, |
2191 int bridge_id, | 2195 int bridge_id, |
2192 const GURL& requesting_frame, | 2196 const GURL& requesting_frame, |
2193 bool user_gesture, | 2197 bool user_gesture, |
(...skipping 17 matching lines...) Expand all Loading... |
2211 MidiPermissionContextFactory::GetForProfile( | 2215 MidiPermissionContextFactory::GetForProfile( |
2212 Profile::FromBrowserContext(web_contents->GetBrowserContext())); | 2216 Profile::FromBrowserContext(web_contents->GetBrowserContext())); |
2213 int renderer_id = web_contents->GetRenderProcessHost()->GetID(); | 2217 int renderer_id = web_contents->GetRenderProcessHost()->GetID(); |
2214 int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID(); | 2218 int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID(); |
2215 const PermissionRequestID id(renderer_id, render_view_id, bridge_id, GURL()); | 2219 const PermissionRequestID id(renderer_id, render_view_id, bridge_id, GURL()); |
2216 | 2220 |
2217 context->RequestPermission(web_contents, id, requesting_frame, | 2221 context->RequestPermission(web_contents, id, requesting_frame, |
2218 user_gesture, result_callback); | 2222 user_gesture, result_callback); |
2219 } | 2223 } |
2220 | 2224 |
| 2225 void ChromeContentBrowserClient::DidUseGeolocationPermission( |
| 2226 content::WebContents* web_contents, |
| 2227 const GURL& frame_url, |
| 2228 const GURL& main_frame_url) { |
| 2229 Profile::FromBrowserContext(web_contents->GetBrowserContext()) |
| 2230 ->GetHostContentSettingsMap() |
| 2231 ->UpdateLastUsage( |
| 2232 frame_url, main_frame_url, CONTENT_SETTINGS_TYPE_GEOLOCATION); |
| 2233 } |
| 2234 |
2221 void ChromeContentBrowserClient::RequestProtectedMediaIdentifierPermission( | 2235 void ChromeContentBrowserClient::RequestProtectedMediaIdentifierPermission( |
2222 content::WebContents* web_contents, | 2236 content::WebContents* web_contents, |
2223 const GURL& origin, | 2237 const GURL& origin, |
2224 base::Callback<void(bool)> result_callback, | 2238 base::Callback<void(bool)> result_callback, |
2225 base::Closure* cancel_callback) { | 2239 base::Closure* cancel_callback) { |
2226 #if defined(OS_ANDROID) | 2240 #if defined(OS_ANDROID) |
2227 ProtectedMediaIdentifierPermissionContext* context = | 2241 ProtectedMediaIdentifierPermissionContext* context = |
2228 ProtectedMediaIdentifierPermissionContextFactory::GetForProfile( | 2242 ProtectedMediaIdentifierPermissionContextFactory::GetForProfile( |
2229 Profile::FromBrowserContext(web_contents->GetBrowserContext())); | 2243 Profile::FromBrowserContext(web_contents->GetBrowserContext())); |
2230 context->RequestProtectedMediaIdentifierPermission(web_contents, | 2244 context->RequestProtectedMediaIdentifierPermission(web_contents, |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2896 switches::kDisableWebRtcEncryption, | 2910 switches::kDisableWebRtcEncryption, |
2897 }; | 2911 }; |
2898 to_command_line->CopySwitchesFrom(from_command_line, | 2912 to_command_line->CopySwitchesFrom(from_command_line, |
2899 kWebRtcDevSwitchNames, | 2913 kWebRtcDevSwitchNames, |
2900 arraysize(kWebRtcDevSwitchNames)); | 2914 arraysize(kWebRtcDevSwitchNames)); |
2901 } | 2915 } |
2902 } | 2916 } |
2903 #endif // defined(ENABLE_WEBRTC) | 2917 #endif // defined(ENABLE_WEBRTC) |
2904 | 2918 |
2905 } // namespace chrome | 2919 } // namespace chrome |
OLD | NEW |