| Index: chrome/browser/chrome_content_browser_client.cc
|
| diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
|
| index a872ec6c9b027869d158c6dc1934f05be88253a9..5e4408578ca05e87f35a07ba6ee1459315cabd39 100644
|
| --- a/chrome/browser/chrome_content_browser_client.cc
|
| +++ b/chrome/browser/chrome_content_browser_client.cc
|
| @@ -1971,6 +1971,55 @@ void ChromeContentBrowserClient::RequestPermission(
|
| }
|
| }
|
|
|
| +void ChromeContentBrowserClient::HasPermission(
|
| + content::PermissionType permission,
|
| + content::WebContents* web_contents,
|
| + const GURL& requesting_frame,
|
| + const base::Callback<void(bool)>& result_callback) {
|
| + Profile* profile =
|
| + Profile::FromBrowserContext(web_contents->GetBrowserContext());
|
| +
|
| + PermissionContextBase* context = nullptr;
|
| + switch (permission) {
|
| + case content::PERMISSION_MIDI_SYSEX:
|
| + context = MidiPermissionContextFactory::GetForProfile(profile);
|
| + break;
|
| + case content::PERMISSION_NOTIFICATIONS:
|
| +#if defined(ENABLE_NOTIFICATIONS)
|
| + context = DesktopNotificationServiceFactory::GetForProfile(profile);
|
| +#else
|
| + NOTIMPLEMENTED();
|
| +#endif
|
| + break;
|
| + case content::PERMISSION_GEOLOCATION:
|
| + context = GeolocationPermissionContextFactory::GetForProfile(profile);
|
| + break;
|
| + case content::PERMISSION_PROTECTED_MEDIA:
|
| +#if defined(OS_ANDROID)
|
| + context = ProtectedMediaIdentifierPermissionContextFactory::GetForProfile(
|
| + profile);
|
| +#else
|
| + NOTIMPLEMENTED();
|
| +#endif
|
| + break;
|
| + case content::PERMISSION_PUSH_MESSAGING:
|
| + context = gcm::PushMessagingPermissionContextFactory::GetForProfile(
|
| + profile);
|
| + break;
|
| + case content::PERMISSION_NUM:
|
| + NOTREACHED() << "Invalid RequestPermission for " << permission;
|
| + break;
|
| + }
|
| +
|
| + if (!context)
|
| + result_callback.Run(false);
|
| +
|
| + ContentSetting result = context->GetPermissionStatus(
|
| + requesting_frame.GetOrigin(),
|
| + web_contents->GetLastCommittedURL().GetOrigin());
|
| + result_callback.Run(result == CONTENT_SETTING_ALLOW);
|
| +}
|
| +
|
| void ChromeContentBrowserClient::CancelPermissionRequest(
|
| content::PermissionType permission,
|
| content::WebContents* web_contents,
|
|
|