Chromium Code Reviews| 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 565eae68ef56d80961de51df01b7668f5fbbe8ec..8ccf339d4dca1ea598cd1cab05858d8cea835604 100644 |
| --- a/chrome/browser/chrome_content_browser_client.cc |
| +++ b/chrome/browser/chrome_content_browser_client.cc |
| @@ -1942,40 +1942,41 @@ void ChromeContentBrowserClient::RequestPermission( |
| } |
| } |
| -content::PermissionStatus ChromeContentBrowserClient::GetPermissionStatus( |
| - content::PermissionType permission, |
| - content::BrowserContext* browser_context, |
| - const GURL& requesting_origin, |
| - const GURL& embedding_origin) { |
| - DCHECK(browser_context); |
| - Profile* profile = Profile::FromBrowserContext(browser_context); |
| - |
| - PermissionContextBase* context = nullptr; |
| +PermissionContextBase* |
| +ChromeContentBrowserClient::GetPermissionContextFromProfile(Profile* profile, |
|
mlamouri (slow - plz ping)
2014/12/19 13:08:03
I don't think you need this to be part of the clas
timvolodine
2015/01/22 19:37:01
Done.
|
| + content::PermissionType permission) { |
| switch (permission) { |
| case content::PERMISSION_MIDI_SYSEX: |
| - context = MidiPermissionContextFactory::GetForProfile(profile); |
| - break; |
| + return MidiPermissionContextFactory::GetForProfile(profile); |
| case content::PERMISSION_NOTIFICATIONS: |
| #if defined(ENABLE_NOTIFICATIONS) |
| - context = DesktopNotificationServiceFactory::GetForProfile(profile); |
| + return DesktopNotificationServiceFactory::GetForProfile(profile); |
| #else |
| NOTIMPLEMENTED(); |
| #endif |
| - break; |
| case content::PERMISSION_GEOLOCATION: |
| - context = GeolocationPermissionContextFactory::GetForProfile(profile); |
| - break; |
| + return GeolocationPermissionContextFactory::GetForProfile(profile); |
| case content::PERMISSION_PROTECTED_MEDIA: |
| NOTIMPLEMENTED(); |
| break; |
| case content::PERMISSION_PUSH_MESSAGING: |
| - context = gcm::PushMessagingPermissionContextFactory::GetForProfile( |
| - profile); |
| - break; |
| + return gcm::PushMessagingPermissionContextFactory::GetForProfile(profile); |
| case content::PERMISSION_NUM: |
| NOTREACHED() << "Invalid RequestPermission for " << permission; |
| break; |
| } |
| + return nullptr; |
| +} |
| + |
| +content::PermissionStatus ChromeContentBrowserClient::GetPermissionStatus( |
| + content::PermissionType permission, |
| + content::BrowserContext* browser_context, |
| + const GURL& requesting_origin, |
| + const GURL& embedding_origin) { |
| + DCHECK(browser_context); |
| + Profile* profile = Profile::FromBrowserContext(browser_context); |
| + PermissionContextBase* context = GetPermissionContextFromProfile(profile, |
| + permission); |
| ContentSetting result = context |
| ? context->GetPermissionStatus(requesting_origin.GetOrigin(), |
| @@ -1985,6 +1986,24 @@ content::PermissionStatus ChromeContentBrowserClient::GetPermissionStatus( |
| return ContentSettingToPermissionStatus(result); |
| } |
| +content::PermissionStatus ChromeContentBrowserClient::RevokePermission( |
| + content::PermissionType permission, |
| + content::BrowserContext* browser_context, |
| + const GURL& requesting_origin, |
| + const GURL& embedding_origin) { |
| + DCHECK(browser_context); |
| + Profile* profile = Profile::FromBrowserContext(browser_context); |
| + PermissionContextBase* context = GetPermissionContextFromProfile(profile, |
| + permission); |
| + |
| + ContentSetting result = context |
| + ? context->RevokePermission(requesting_origin.GetOrigin(), |
| + embedding_origin.GetOrigin()) |
| + : CONTENT_SETTING_DEFAULT; |
|
mlamouri (slow - plz ping)
2014/12/19 13:08:03
Maybe you could do:
if (!context)
return PERMIS
timvolodine
2015/01/22 19:37:01
Done.
|
| + |
| + return ContentSettingToPermissionStatus(result); |
| +} |
| + |
| void ChromeContentBrowserClient::CancelPermissionRequest( |
| content::PermissionType permission, |
| content::WebContents* web_contents, |