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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 #include "content/public/browser/child_process_data.h" | 115 #include "content/public/browser/child_process_data.h" |
116 #include "content/public/browser/child_process_security_policy.h" | 116 #include "content/public/browser/child_process_security_policy.h" |
117 #include "content/public/browser/render_frame_host.h" | 117 #include "content/public/browser/render_frame_host.h" |
118 #include "content/public/browser/render_process_host.h" | 118 #include "content/public/browser/render_process_host.h" |
119 #include "content/public/browser/render_view_host.h" | 119 #include "content/public/browser/render_view_host.h" |
120 #include "content/public/browser/resource_context.h" | 120 #include "content/public/browser/resource_context.h" |
121 #include "content/public/browser/site_instance.h" | 121 #include "content/public/browser/site_instance.h" |
122 #include "content/public/browser/web_contents.h" | 122 #include "content/public/browser/web_contents.h" |
123 #include "content/public/common/child_process_host.h" | 123 #include "content/public/common/child_process_host.h" |
124 #include "content/public/common/content_descriptors.h" | 124 #include "content/public/common/content_descriptors.h" |
| 125 #include "content/public/common/show_desktop_notification_params.h" |
125 #include "content/public/common/url_utils.h" | 126 #include "content/public/common/url_utils.h" |
126 #include "extensions/browser/extension_host.h" | 127 #include "extensions/browser/extension_host.h" |
127 #include "extensions/browser/extension_message_filter.h" | 128 #include "extensions/browser/extension_message_filter.h" |
128 #include "extensions/browser/extension_registry.h" | 129 #include "extensions/browser/extension_registry.h" |
129 #include "extensions/browser/extension_system.h" | 130 #include "extensions/browser/extension_system.h" |
130 #include "extensions/browser/info_map.h" | 131 #include "extensions/browser/info_map.h" |
131 #include "extensions/browser/process_manager.h" | 132 #include "extensions/browser/process_manager.h" |
132 #include "extensions/browser/process_map.h" | 133 #include "extensions/browser/process_map.h" |
133 #include "extensions/browser/view_type_utils.h" | 134 #include "extensions/browser/view_type_utils.h" |
134 #include "extensions/common/constants.h" | 135 #include "extensions/common/constants.h" |
(...skipping 1958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2093 RenderFrameHost* render_frame_host, | 2094 RenderFrameHost* render_frame_host, |
2094 content::DesktopNotificationDelegate* delegate, | 2095 content::DesktopNotificationDelegate* delegate, |
2095 base::Closure* cancel_callback) { | 2096 base::Closure* cancel_callback) { |
2096 #if defined(ENABLE_NOTIFICATIONS) | 2097 #if defined(ENABLE_NOTIFICATIONS) |
2097 content::RenderProcessHost* process = render_frame_host->GetProcess(); | 2098 content::RenderProcessHost* process = render_frame_host->GetProcess(); |
2098 Profile* profile = Profile::FromBrowserContext(process->GetBrowserContext()); | 2099 Profile* profile = Profile::FromBrowserContext(process->GetBrowserContext()); |
2099 DesktopNotificationService* service = | 2100 DesktopNotificationService* service = |
2100 DesktopNotificationServiceFactory::GetForProfile(profile); | 2101 DesktopNotificationServiceFactory::GetForProfile(profile); |
2101 service->ShowDesktopNotification( | 2102 service->ShowDesktopNotification( |
2102 params, render_frame_host, delegate, cancel_callback); | 2103 params, render_frame_host, delegate, cancel_callback); |
| 2104 |
| 2105 profile->GetHostContentSettingsMap()->UpdateLastUsage( |
| 2106 params.origin, params.origin, CONTENT_SETTINGS_TYPE_NOTIFICATIONS); |
2103 #else | 2107 #else |
2104 NOTIMPLEMENTED(); | 2108 NOTIMPLEMENTED(); |
2105 #endif | 2109 #endif |
2106 } | 2110 } |
2107 | 2111 |
2108 void ChromeContentBrowserClient::RequestGeolocationPermission( | 2112 void ChromeContentBrowserClient::RequestGeolocationPermission( |
2109 content::WebContents* web_contents, | 2113 content::WebContents* web_contents, |
2110 int bridge_id, | 2114 int bridge_id, |
2111 const GURL& requesting_frame, | 2115 const GURL& requesting_frame, |
2112 bool user_gesture, | 2116 bool user_gesture, |
(...skipping 14 matching lines...) Expand all Loading... |
2127 base::Callback<void(bool)> result_callback, | 2131 base::Callback<void(bool)> result_callback, |
2128 base::Closure* cancel_callback) { | 2132 base::Closure* cancel_callback) { |
2129 MidiPermissionContext* context = | 2133 MidiPermissionContext* context = |
2130 MidiPermissionContextFactory::GetForProfile( | 2134 MidiPermissionContextFactory::GetForProfile( |
2131 Profile::FromBrowserContext(web_contents->GetBrowserContext())); | 2135 Profile::FromBrowserContext(web_contents->GetBrowserContext())); |
2132 context->RequestMidiSysExPermission(web_contents, bridge_id, requesting_frame, | 2136 context->RequestMidiSysExPermission(web_contents, bridge_id, requesting_frame, |
2133 user_gesture, result_callback, | 2137 user_gesture, result_callback, |
2134 cancel_callback); | 2138 cancel_callback); |
2135 } | 2139 } |
2136 | 2140 |
| 2141 void ChromeContentBrowserClient::UseContentSettingPermission( |
| 2142 content::WebContents* web_contents, |
| 2143 const GURL& primary_url, |
| 2144 const GURL& secondary_url, |
| 2145 const std::string& setting_type) { |
| 2146 Profile::FromBrowserContext(web_contents->GetBrowserContext()) |
| 2147 ->GetHostContentSettingsMap() |
| 2148 ->UpdateLastUsage(primary_url, |
| 2149 secondary_url, |
| 2150 content_settings::GetTypeFromName(setting_type)); |
| 2151 } |
| 2152 |
2137 void ChromeContentBrowserClient::RequestProtectedMediaIdentifierPermission( | 2153 void ChromeContentBrowserClient::RequestProtectedMediaIdentifierPermission( |
2138 content::WebContents* web_contents, | 2154 content::WebContents* web_contents, |
2139 const GURL& origin, | 2155 const GURL& origin, |
2140 base::Callback<void(bool)> result_callback, | 2156 base::Callback<void(bool)> result_callback, |
2141 base::Closure* cancel_callback) { | 2157 base::Closure* cancel_callback) { |
2142 #if defined(OS_ANDROID) | 2158 #if defined(OS_ANDROID) |
2143 ProtectedMediaIdentifierPermissionContext* context = | 2159 ProtectedMediaIdentifierPermissionContext* context = |
2144 ProtectedMediaIdentifierPermissionContextFactory::GetForProfile( | 2160 ProtectedMediaIdentifierPermissionContextFactory::GetForProfile( |
2145 Profile::FromBrowserContext(web_contents->GetBrowserContext())); | 2161 Profile::FromBrowserContext(web_contents->GetBrowserContext())); |
2146 context->RequestProtectedMediaIdentifierPermission(web_contents, | 2162 context->RequestProtectedMediaIdentifierPermission(web_contents, |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2801 switches::kDisableWebRtcEncryption, | 2817 switches::kDisableWebRtcEncryption, |
2802 }; | 2818 }; |
2803 to_command_line->CopySwitchesFrom(from_command_line, | 2819 to_command_line->CopySwitchesFrom(from_command_line, |
2804 kWebRtcDevSwitchNames, | 2820 kWebRtcDevSwitchNames, |
2805 arraysize(kWebRtcDevSwitchNames)); | 2821 arraysize(kWebRtcDevSwitchNames)); |
2806 } | 2822 } |
2807 } | 2823 } |
2808 #endif // defined(ENABLE_WEBRTC) | 2824 #endif // defined(ENABLE_WEBRTC) |
2809 | 2825 |
2810 } // namespace chrome | 2826 } // namespace chrome |
OLD | NEW |