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

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

Issue 398163008: Export content_common dependency from some content targets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add content::NotificationPresenterPermission enum 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 2119 matching lines...) Expand 10 before | Expand all | Expand 10 after
2130 return; 2130 return;
2131 } 2131 }
2132 2132
2133 notification_service->RequestPermission( 2133 notification_service->RequestPermission(
2134 source_origin, render_frame_host, callback); 2134 source_origin, render_frame_host, callback);
2135 #else 2135 #else
2136 NOTIMPLEMENTED(); 2136 NOTIMPLEMENTED();
2137 #endif 2137 #endif
2138 } 2138 }
2139 2139
2140 blink::WebNotificationPresenter::Permission 2140 content::NotificationPresenterPermission
2141 ChromeContentBrowserClient::CheckDesktopNotificationPermission( 2141 ChromeContentBrowserClient::CheckDesktopNotificationPermission(
2142 const GURL& source_origin, 2142 const GURL& source_origin,
2143 content::ResourceContext* context, 2143 content::ResourceContext* context,
2144 int render_process_id) { 2144 int render_process_id) {
2145 #if defined(ENABLE_NOTIFICATIONS) 2145 #if defined(ENABLE_NOTIFICATIONS)
2146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 2146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
2147 2147
2148 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); 2148 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
2149 InfoMap* extension_info_map = io_data->GetExtensionInfoMap(); 2149 InfoMap* extension_info_map = io_data->GetExtensionInfoMap();
2150 2150
2151 // We want to see if there is an extension that hasn't been manually disabled 2151 // We want to see if there is an extension that hasn't been manually disabled
2152 // that has the notifications permission and applies to this security origin. 2152 // that has the notifications permission and applies to this security origin.
2153 // First, get the list of extensions with permission for the origin. 2153 // First, get the list of extensions with permission for the origin.
2154 extensions::ExtensionSet extensions; 2154 extensions::ExtensionSet extensions;
2155 extension_info_map->GetExtensionsWithAPIPermissionForSecurityOrigin( 2155 extension_info_map->GetExtensionsWithAPIPermissionForSecurityOrigin(
2156 source_origin, render_process_id, 2156 source_origin, render_process_id,
2157 extensions::APIPermission::kNotification, &extensions); 2157 extensions::APIPermission::kNotification, &extensions);
2158 for (extensions::ExtensionSet::const_iterator iter = extensions.begin(); 2158 for (extensions::ExtensionSet::const_iterator iter = extensions.begin();
2159 iter != extensions.end(); ++iter) { 2159 iter != extensions.end(); ++iter) {
2160 // Then, check to see if it's been disabled by the user. 2160 // Then, check to see if it's been disabled by the user.
2161 if (!extension_info_map->AreNotificationsDisabled((*iter)->id())) 2161 if (!extension_info_map->AreNotificationsDisabled((*iter)->id()))
2162 return blink::WebNotificationPresenter::PermissionAllowed; 2162 return content::NOTIFICATION_PRESENTER_PERMISSION_ALLOWED;
2163 } 2163 }
2164 2164
2165 // No enabled extensions exist, so check the normal host content settings. 2165 // No enabled extensions exist, so check the normal host content settings.
2166 HostContentSettingsMap* host_content_settings_map = 2166 HostContentSettingsMap* host_content_settings_map =
2167 io_data->GetHostContentSettingsMap(); 2167 io_data->GetHostContentSettingsMap();
2168 ContentSetting setting = host_content_settings_map->GetContentSetting( 2168 ContentSetting setting = host_content_settings_map->GetContentSetting(
2169 source_origin, 2169 source_origin,
2170 source_origin, 2170 source_origin,
2171 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, 2171 CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
2172 NO_RESOURCE_IDENTIFIER); 2172 NO_RESOURCE_IDENTIFIER);
2173 2173
2174 if (setting == CONTENT_SETTING_ALLOW) 2174 if (setting == CONTENT_SETTING_ALLOW)
2175 return blink::WebNotificationPresenter::PermissionAllowed; 2175 return content::NOTIFICATION_PRESENTER_PERMISSION_ALLOWED;
2176 if (setting == CONTENT_SETTING_BLOCK) 2176 if (setting == CONTENT_SETTING_BLOCK)
2177 return blink::WebNotificationPresenter::PermissionDenied; 2177 return content::NOTIFICATION_PRESENTER_PERMISSION_DENIED;
2178 return blink::WebNotificationPresenter::PermissionNotAllowed; 2178 return content::NOTIFICATION_PRESENTER_PERMISSION_NOT_ALLOWED;
2179 #else 2179 #else
2180 return blink::WebNotificationPresenter::PermissionAllowed; 2180 return content::NOTIFICATION_PRESENTER_PERMISSION_ALLOWED;
2181 #endif 2181 #endif
2182 } 2182 }
2183 2183
2184 void ChromeContentBrowserClient::ShowDesktopNotification( 2184 void ChromeContentBrowserClient::ShowDesktopNotification(
2185 const content::ShowDesktopNotificationHostMsgParams& params, 2185 const content::ShowDesktopNotificationHostMsgParams& params,
2186 RenderFrameHost* render_frame_host, 2186 RenderFrameHost* render_frame_host,
2187 content::DesktopNotificationDelegate* delegate, 2187 content::DesktopNotificationDelegate* delegate,
2188 base::Closure* cancel_callback) { 2188 base::Closure* cancel_callback) {
2189 #if defined(ENABLE_NOTIFICATIONS) 2189 #if defined(ENABLE_NOTIFICATIONS)
2190 content::RenderProcessHost* process = render_frame_host->GetProcess(); 2190 content::RenderProcessHost* process = render_frame_host->GetProcess();
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
2915 switches::kDisableWebRtcEncryption, 2915 switches::kDisableWebRtcEncryption,
2916 }; 2916 };
2917 to_command_line->CopySwitchesFrom(from_command_line, 2917 to_command_line->CopySwitchesFrom(from_command_line,
2918 kWebRtcDevSwitchNames, 2918 kWebRtcDevSwitchNames,
2919 arraysize(kWebRtcDevSwitchNames)); 2919 arraysize(kWebRtcDevSwitchNames));
2920 } 2920 }
2921 } 2921 }
2922 #endif // defined(ENABLE_WEBRTC) 2922 #endif // defined(ENABLE_WEBRTC)
2923 2923
2924 } // namespace chrome 2924 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | content/browser/renderer_host/render_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698