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

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: Addressing comments and a multi-frame unit test. 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 "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 1956 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 profile->GetHostContentSettingsMap()->UpdateLastUsage(
2104 params.origin, params.origin, CONTENT_SETTINGS_TYPE_NOTIFICATIONS);
2101 #else 2105 #else
2102 NOTIMPLEMENTED(); 2106 NOTIMPLEMENTED();
2103 #endif 2107 #endif
2104 } 2108 }
2105 2109
2106 void ChromeContentBrowserClient::RequestGeolocationPermission( 2110 void ChromeContentBrowserClient::RequestGeolocationPermission(
2107 content::WebContents* web_contents, 2111 content::WebContents* web_contents,
2108 int bridge_id, 2112 int bridge_id,
2109 const GURL& requesting_frame, 2113 const GURL& requesting_frame,
2110 bool user_gesture, 2114 bool user_gesture,
(...skipping 14 matching lines...) Expand all
2125 base::Callback<void(bool)> result_callback, 2129 base::Callback<void(bool)> result_callback,
2126 base::Closure* cancel_callback) { 2130 base::Closure* cancel_callback) {
2127 MidiPermissionContext* context = 2131 MidiPermissionContext* context =
2128 MidiPermissionContextFactory::GetForProfile( 2132 MidiPermissionContextFactory::GetForProfile(
2129 Profile::FromBrowserContext(web_contents->GetBrowserContext())); 2133 Profile::FromBrowserContext(web_contents->GetBrowserContext()));
2130 context->RequestMidiSysExPermission(web_contents, bridge_id, requesting_frame, 2134 context->RequestMidiSysExPermission(web_contents, bridge_id, requesting_frame,
2131 user_gesture, result_callback, 2135 user_gesture, result_callback,
2132 cancel_callback); 2136 cancel_callback);
2133 } 2137 }
2134 2138
2139 void ChromeContentBrowserClient::UseContentSettingPermission(
2140 content::WebContents* web_contents,
2141 const GURL& primary_url,
2142 const GURL& secondary_url,
2143 const std::string& setting_type) {
2144 Profile::FromBrowserContext(web_contents->GetBrowserContext())
2145 ->GetHostContentSettingsMap()
2146 ->UpdateLastUsage(primary_url,
2147 secondary_url,
2148 content_settings::GetTypeFromName(setting_type));
2149 }
2150
2135 void ChromeContentBrowserClient::RequestProtectedMediaIdentifierPermission( 2151 void ChromeContentBrowserClient::RequestProtectedMediaIdentifierPermission(
2136 content::WebContents* web_contents, 2152 content::WebContents* web_contents,
2137 const GURL& origin, 2153 const GURL& origin,
2138 base::Callback<void(bool)> result_callback, 2154 base::Callback<void(bool)> result_callback,
2139 base::Closure* cancel_callback) { 2155 base::Closure* cancel_callback) {
2140 #if defined(OS_ANDROID) 2156 #if defined(OS_ANDROID)
2141 ProtectedMediaIdentifierPermissionContext* context = 2157 ProtectedMediaIdentifierPermissionContext* context =
2142 ProtectedMediaIdentifierPermissionContextFactory::GetForProfile( 2158 ProtectedMediaIdentifierPermissionContextFactory::GetForProfile(
2143 Profile::FromBrowserContext(web_contents->GetBrowserContext())); 2159 Profile::FromBrowserContext(web_contents->GetBrowserContext()));
2144 context->RequestProtectedMediaIdentifierPermission(web_contents, 2160 context->RequestProtectedMediaIdentifierPermission(web_contents,
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
2799 switches::kDisableWebRtcEncryption, 2815 switches::kDisableWebRtcEncryption,
2800 }; 2816 };
2801 to_command_line->CopySwitchesFrom(from_command_line, 2817 to_command_line->CopySwitchesFrom(from_command_line,
2802 kWebRtcDevSwitchNames, 2818 kWebRtcDevSwitchNames,
2803 arraysize(kWebRtcDevSwitchNames)); 2819 arraysize(kWebRtcDevSwitchNames));
2804 } 2820 }
2805 } 2821 }
2806 #endif // defined(ENABLE_WEBRTC) 2822 #endif // defined(ENABLE_WEBRTC)
2807 2823
2808 } // namespace chrome 2824 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698