Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 356543003: Audit the last usage of Geolocation and Notification permissions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update the utils. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 "content/public/common/web_preferences.h" 127 #include "content/public/common/web_preferences.h"
127 #include "extensions/browser/extension_host.h" 128 #include "extensions/browser/extension_host.h"
128 #include "extensions/browser/extension_message_filter.h" 129 #include "extensions/browser/extension_message_filter.h"
129 #include "extensions/browser/extension_registry.h" 130 #include "extensions/browser/extension_registry.h"
130 #include "extensions/browser/extension_system.h" 131 #include "extensions/browser/extension_system.h"
131 #include "extensions/browser/info_map.h" 132 #include "extensions/browser/info_map.h"
132 #include "extensions/browser/process_manager.h" 133 #include "extensions/browser/process_manager.h"
133 #include "extensions/browser/process_map.h" 134 #include "extensions/browser/process_map.h"
134 #include "extensions/browser/view_type_utils.h" 135 #include "extensions/browser/view_type_utils.h"
(...skipping 2032 matching lines...) Expand 10 before | Expand all | Expand 10 after
2167 RenderFrameHost* render_frame_host, 2168 RenderFrameHost* render_frame_host,
2168 content::DesktopNotificationDelegate* delegate, 2169 content::DesktopNotificationDelegate* delegate,
2169 base::Closure* cancel_callback) { 2170 base::Closure* cancel_callback) {
2170 #if defined(ENABLE_NOTIFICATIONS) 2171 #if defined(ENABLE_NOTIFICATIONS)
2171 content::RenderProcessHost* process = render_frame_host->GetProcess(); 2172 content::RenderProcessHost* process = render_frame_host->GetProcess();
2172 Profile* profile = Profile::FromBrowserContext(process->GetBrowserContext()); 2173 Profile* profile = Profile::FromBrowserContext(process->GetBrowserContext());
2173 DesktopNotificationService* service = 2174 DesktopNotificationService* service =
2174 DesktopNotificationServiceFactory::GetForProfile(profile); 2175 DesktopNotificationServiceFactory::GetForProfile(profile);
2175 service->ShowDesktopNotification( 2176 service->ShowDesktopNotification(
2176 params, render_frame_host, delegate, cancel_callback); 2177 params, render_frame_host, delegate, cancel_callback);
2178
2179 profile->GetHostContentSettingsMap()->UpdateLastUsage(
2180 params.origin, params.origin, CONTENT_SETTINGS_TYPE_NOTIFICATIONS);
2177 #else 2181 #else
2178 NOTIMPLEMENTED(); 2182 NOTIMPLEMENTED();
2179 #endif 2183 #endif
2180 } 2184 }
2181 2185
2182 void ChromeContentBrowserClient::RequestGeolocationPermission( 2186 void ChromeContentBrowserClient::RequestGeolocationPermission(
2183 content::WebContents* web_contents, 2187 content::WebContents* web_contents,
2184 int bridge_id, 2188 int bridge_id,
2185 const GURL& requesting_frame, 2189 const GURL& requesting_frame,
2186 bool user_gesture, 2190 bool user_gesture,
(...skipping 17 matching lines...) Expand all
2204 MidiPermissionContextFactory::GetForProfile( 2208 MidiPermissionContextFactory::GetForProfile(
2205 Profile::FromBrowserContext(web_contents->GetBrowserContext())); 2209 Profile::FromBrowserContext(web_contents->GetBrowserContext()));
2206 int renderer_id = web_contents->GetRenderProcessHost()->GetID(); 2210 int renderer_id = web_contents->GetRenderProcessHost()->GetID();
2207 int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID(); 2211 int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID();
2208 const PermissionRequestID id(renderer_id, render_view_id, bridge_id, GURL()); 2212 const PermissionRequestID id(renderer_id, render_view_id, bridge_id, GURL());
2209 2213
2210 context->RequestPermission(web_contents, id, requesting_frame, 2214 context->RequestPermission(web_contents, id, requesting_frame,
2211 user_gesture, result_callback); 2215 user_gesture, result_callback);
2212 } 2216 }
2213 2217
2218 void ChromeContentBrowserClient::UseContentSettingPermission(
2219 content::WebContents* web_contents,
2220 const GURL& primary_url,
2221 const GURL& secondary_url,
2222 const std::string& setting_type_name) {
2223 ContentSettingsType setting_type;
2224 bool rv = content_settings::GetTypeFromName(setting_type_name, &setting_type);
2225 DCHECK(rv);
2226 Profile::FromBrowserContext(web_contents->GetBrowserContext())
2227 ->GetHostContentSettingsMap()
2228 ->UpdateLastUsage(primary_url,
2229 secondary_url,
2230 setting_type);
2231 }
2232
2214 void ChromeContentBrowserClient::RequestProtectedMediaIdentifierPermission( 2233 void ChromeContentBrowserClient::RequestProtectedMediaIdentifierPermission(
2215 content::WebContents* web_contents, 2234 content::WebContents* web_contents,
2216 const GURL& origin, 2235 const GURL& origin,
2217 base::Callback<void(bool)> result_callback, 2236 base::Callback<void(bool)> result_callback,
2218 base::Closure* cancel_callback) { 2237 base::Closure* cancel_callback) {
2219 #if defined(OS_ANDROID) 2238 #if defined(OS_ANDROID)
2220 ProtectedMediaIdentifierPermissionContext* context = 2239 ProtectedMediaIdentifierPermissionContext* context =
2221 ProtectedMediaIdentifierPermissionContextFactory::GetForProfile( 2240 ProtectedMediaIdentifierPermissionContextFactory::GetForProfile(
2222 Profile::FromBrowserContext(web_contents->GetBrowserContext())); 2241 Profile::FromBrowserContext(web_contents->GetBrowserContext()));
2223 context->RequestProtectedMediaIdentifierPermission(web_contents, 2242 context->RequestProtectedMediaIdentifierPermission(web_contents,
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
2889 switches::kDisableWebRtcEncryption, 2908 switches::kDisableWebRtcEncryption,
2890 }; 2909 };
2891 to_command_line->CopySwitchesFrom(from_command_line, 2910 to_command_line->CopySwitchesFrom(from_command_line,
2892 kWebRtcDevSwitchNames, 2911 kWebRtcDevSwitchNames,
2893 arraysize(kWebRtcDevSwitchNames)); 2912 arraysize(kWebRtcDevSwitchNames));
2894 } 2913 }
2895 } 2914 }
2896 #endif // defined(ENABLE_WEBRTC) 2915 #endif // defined(ENABLE_WEBRTC)
2897 2916
2898 } // namespace chrome 2917 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698