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

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: Add auditing for actual usage, too. 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 #include "content/public/browser/child_process_data.h" 116 #include "content/public/browser/child_process_data.h"
117 #include "content/public/browser/child_process_security_policy.h" 117 #include "content/public/browser/child_process_security_policy.h"
118 #include "content/public/browser/render_frame_host.h" 118 #include "content/public/browser/render_frame_host.h"
119 #include "content/public/browser/render_process_host.h" 119 #include "content/public/browser/render_process_host.h"
120 #include "content/public/browser/render_view_host.h" 120 #include "content/public/browser/render_view_host.h"
121 #include "content/public/browser/resource_context.h" 121 #include "content/public/browser/resource_context.h"
122 #include "content/public/browser/site_instance.h" 122 #include "content/public/browser/site_instance.h"
123 #include "content/public/browser/web_contents.h" 123 #include "content/public/browser/web_contents.h"
124 #include "content/public/common/child_process_host.h" 124 #include "content/public/common/child_process_host.h"
125 #include "content/public/common/content_descriptors.h" 125 #include "content/public/common/content_descriptors.h"
126 #include "content/public/common/show_desktop_notification_params.h"
126 #include "content/public/common/url_utils.h" 127 #include "content/public/common/url_utils.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"
135 #include "extensions/common/constants.h" 136 #include "extensions/common/constants.h"
(...skipping 1955 matching lines...) Expand 10 before | Expand all | Expand 10 after
2091 RenderFrameHost* render_frame_host, 2092 RenderFrameHost* render_frame_host,
2092 content::DesktopNotificationDelegate* delegate, 2093 content::DesktopNotificationDelegate* delegate,
2093 base::Closure* cancel_callback) { 2094 base::Closure* cancel_callback) {
2094 #if defined(ENABLE_NOTIFICATIONS) 2095 #if defined(ENABLE_NOTIFICATIONS)
2095 content::RenderProcessHost* process = render_frame_host->GetProcess(); 2096 content::RenderProcessHost* process = render_frame_host->GetProcess();
2096 Profile* profile = Profile::FromBrowserContext(process->GetBrowserContext()); 2097 Profile* profile = Profile::FromBrowserContext(process->GetBrowserContext());
2097 DesktopNotificationService* service = 2098 DesktopNotificationService* service =
2098 DesktopNotificationServiceFactory::GetForProfile(profile); 2099 DesktopNotificationServiceFactory::GetForProfile(profile);
2099 service->ShowDesktopNotification( 2100 service->ShowDesktopNotification(
2100 params, render_frame_host, delegate, cancel_callback); 2101 params, render_frame_host, delegate, cancel_callback);
2102
2103 UseContentSettingPermissionHelper(
2104 profile,
2105 params.origin,
2106 params.origin,
2107 content_settings::GetTypeName(CONTENT_SETTINGS_TYPE_NOTIFICATIONS));
2101 #else 2108 #else
2102 NOTIMPLEMENTED(); 2109 NOTIMPLEMENTED();
2103 #endif 2110 #endif
2104 } 2111 }
2105 2112
2106 void ChromeContentBrowserClient::RequestGeolocationPermission( 2113 void ChromeContentBrowserClient::RequestGeolocationPermission(
2107 content::WebContents* web_contents, 2114 content::WebContents* web_contents,
2108 int bridge_id, 2115 int bridge_id,
2109 const GURL& requesting_frame, 2116 const GURL& requesting_frame,
2110 bool user_gesture, 2117 bool user_gesture,
(...skipping 14 matching lines...) Expand all
2125 base::Callback<void(bool)> result_callback, 2132 base::Callback<void(bool)> result_callback,
2126 base::Closure* cancel_callback) { 2133 base::Closure* cancel_callback) {
2127 MidiPermissionContext* context = 2134 MidiPermissionContext* context =
2128 MidiPermissionContextFactory::GetForProfile( 2135 MidiPermissionContextFactory::GetForProfile(
2129 Profile::FromBrowserContext(web_contents->GetBrowserContext())); 2136 Profile::FromBrowserContext(web_contents->GetBrowserContext()));
2130 context->RequestMidiSysExPermission(web_contents, bridge_id, requesting_frame, 2137 context->RequestMidiSysExPermission(web_contents, bridge_id, requesting_frame,
2131 user_gesture, result_callback, 2138 user_gesture, result_callback,
2132 cancel_callback); 2139 cancel_callback);
2133 } 2140 }
2134 2141
2142 void ChromeContentBrowserClient::UseContentSettingPermission(
2143 content::WebContents* web_contents,
2144 const GURL& primary_url,
2145 const GURL& secondary_url,
2146 const std::string& setting_type) {
2147 UseContentSettingPermissionHelper(
2148 Profile::FromBrowserContext(web_contents->GetBrowserContext()),
2149 primary_url,
2150 secondary_url,
2151 setting_type);
2152 }
2153
2154 void ChromeContentBrowserClient::UseContentSettingPermissionHelper(
Michael van Ouwerkerk 2014/07/01 11:02:23 Why do you need this method? It makes one simple c
Daniel Nishi 2014/07/01 18:37:48 |UseContentSettingPermission| is called from conte
2155 Profile* profile,
2156 const GURL& primary_url,
2157 const GURL& secondary_url,
2158 const std::string& setting_type) {
2159 profile->GetHostContentSettingsMap()->UpdateLastUsage(
2160 primary_url,
2161 secondary_url,
2162 content_settings::GetTypeFromName(setting_type));
2163 }
2164
2135 void ChromeContentBrowserClient::RequestProtectedMediaIdentifierPermission( 2165 void ChromeContentBrowserClient::RequestProtectedMediaIdentifierPermission(
2136 content::WebContents* web_contents, 2166 content::WebContents* web_contents,
2137 const GURL& origin, 2167 const GURL& origin,
2138 base::Callback<void(bool)> result_callback, 2168 base::Callback<void(bool)> result_callback,
2139 base::Closure* cancel_callback) { 2169 base::Closure* cancel_callback) {
2140 #if defined(OS_ANDROID) 2170 #if defined(OS_ANDROID)
2141 ProtectedMediaIdentifierPermissionContext* context = 2171 ProtectedMediaIdentifierPermissionContext* context =
2142 ProtectedMediaIdentifierPermissionContextFactory::GetForProfile( 2172 ProtectedMediaIdentifierPermissionContextFactory::GetForProfile(
2143 Profile::FromBrowserContext(web_contents->GetBrowserContext())); 2173 Profile::FromBrowserContext(web_contents->GetBrowserContext()));
2144 context->RequestProtectedMediaIdentifierPermission(web_contents, 2174 context->RequestProtectedMediaIdentifierPermission(web_contents,
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
2803 switches::kDisableWebRtcEncryption, 2833 switches::kDisableWebRtcEncryption,
2804 }; 2834 };
2805 to_command_line->CopySwitchesFrom(from_command_line, 2835 to_command_line->CopySwitchesFrom(from_command_line,
2806 kWebRtcDevSwitchNames, 2836 kWebRtcDevSwitchNames,
2807 arraysize(kWebRtcDevSwitchNames)); 2837 arraysize(kWebRtcDevSwitchNames));
2808 } 2838 }
2809 } 2839 }
2810 #endif // defined(ENABLE_WEBRTC) 2840 #endif // defined(ENABLE_WEBRTC)
2811 2841
2812 } // namespace chrome 2842 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698