 Chromium Code Reviews
 Chromium Code Reviews Issue 921803002:
  Enable Notification permissions to be toggled in Site Settings.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 921803002:
  Enable Notification permissions to be toggled in Site Settings.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| Index: chrome/browser/android/preferences/website_preference_bridge.cc | 
| diff --git a/chrome/browser/android/preferences/website_preference_bridge.cc b/chrome/browser/android/preferences/website_preference_bridge.cc | 
| index d21bf9ddf2ee2c587b376588a6be7dde8ab82462..793d7d2e448b29ea7298a15614707dbc684c1443 100644 | 
| --- a/chrome/browser/android/preferences/website_preference_bridge.cc | 
| +++ b/chrome/browser/android/preferences/website_preference_bridge.cc | 
| @@ -15,6 +15,7 @@ | 
| #include "chrome/browser/browsing_data/cookies_tree_model.h" | 
| #include "chrome/browser/browsing_data/local_data_container.h" | 
| #include "chrome/browser/content_settings/cookie_settings.h" | 
| +#include "chrome/browser/notifications/desktop_notification_profile_util.h" | 
| #include "chrome/browser/profiles/profile.h" | 
| #include "chrome/browser/profiles/profile_manager.h" | 
| #include "components/content_settings/core/browser/host_content_settings_map.h" | 
| @@ -190,15 +191,32 @@ static void GetPushNotificationOrigins(JNIEnv* env, | 
| static jint GetPushNotificationSettingForOrigin(JNIEnv* env, jclass clazz, | 
| jstring origin, jstring embedder) { | 
| - return GetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, | 
| - origin, embedder); | 
| + return DesktopNotificationProfileUtil::GetContentSetting( | 
| + ProfileManager::GetActiveUserProfile(), | 
| + GURL(ConvertJavaStringToUTF8(env, origin))); | 
| } | 
| static void SetPushNotificationSettingForOrigin(JNIEnv* env, jclass clazz, | 
| jstring origin, jstring embedder, jint value) { | 
| - GURL embedder_url(ConvertJavaStringToUTF8(env, embedder)); | 
| - SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, | 
| - origin, ContentSettingsPattern::FromURLNoWildcard(embedder_url), value); | 
| + // TODO(peter): Web Notification permission behaves differently from all other | 
| + // permission types. See https://crbug.com/416894. | 
| + Profile* profile = ProfileManager::GetActiveUserProfile(); | 
| + GURL url = GURL(ConvertJavaStringToUTF8(env, origin)); | 
| + | 
| + switch (value) { | 
| + case -1: | 
| + DesktopNotificationProfileUtil::ClearSetting( | 
| + profile, ContentSettingsPattern::FromURLNoWildcard(url)); | 
| + break; | 
| + case 1: | 
| + DesktopNotificationProfileUtil::GrantPermission(profile, url); | 
| + break; | 
| + case 2: | 
| + DesktopNotificationProfileUtil::DenyPermission(profile, url); | 
| + break; | 
| + default: | 
| + NOTREACHED(); | 
| + } | 
| 
Finnur
2015/02/13 14:58:46
I was going to point out that this breaks the Site
 | 
| } | 
| static void GetVoiceAndVideoCaptureOrigins(JNIEnv* env, |