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

Side by Side Diff: chrome/browser/android/preferences/website_preference_bridge.cc

Issue 2020063003: Use GetPermissionStatus instead of DesktopNotificationProfileUtil::GetContentSetting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove embber param for notifications Created 4 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/android/preferences/website_preference_bridge.h" 5 #include "chrome/browser/android/preferences/website_preference_bridge.h"
6 6
7 #include "base/android/callback_android.h" 7 #include "base/android/callback_android.h"
8 #include "base/android/jni_android.h" 8 #include "base/android/jni_android.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 const JavaParamRef<jobject>& list) { 306 const JavaParamRef<jobject>& list) {
307 GetOrigins(env, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, 307 GetOrigins(env, CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
308 &Java_WebsitePreferenceBridge_insertNotificationIntoList, list, 308 &Java_WebsitePreferenceBridge_insertNotificationIntoList, list,
309 false); 309 false);
310 } 310 }
311 311
312 static jint GetNotificationSettingForOrigin( 312 static jint GetNotificationSettingForOrigin(
313 JNIEnv* env, 313 JNIEnv* env,
314 const JavaParamRef<jclass>& clazz, 314 const JavaParamRef<jclass>& clazz,
315 const JavaParamRef<jstring>& origin, 315 const JavaParamRef<jstring>& origin,
316 const JavaParamRef<jstring>& embedder,
317 jboolean is_incognito) { 316 jboolean is_incognito) {
318 return DesktopNotificationProfileUtil::GetContentSetting( 317 return GetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
319 GetActiveUserProfile(is_incognito), 318 origin, origin, is_incognito);
320 GURL(ConvertJavaStringToUTF8(env, origin)));
321 } 319 }
322 320
323 static void SetNotificationSettingForOrigin( 321 static void SetNotificationSettingForOrigin(
324 JNIEnv* env, 322 JNIEnv* env,
325 const JavaParamRef<jclass>& clazz, 323 const JavaParamRef<jclass>& clazz,
326 const JavaParamRef<jstring>& origin, 324 const JavaParamRef<jstring>& origin,
327 const JavaParamRef<jstring>& embedder, 325 const JavaParamRef<jstring>& embedder,
Bernhard Bauer 2016/06/03 08:03:33 This parameter could also be removed.
328 jint value, 326 jint value,
329 jboolean is_incognito) { 327 jboolean is_incognito) {
330 // Note: Web Notification permission behaves differently from all other 328 // Note: Web Notification permission behaves differently from all other
331 // permission types. See https://crbug.com/416894. 329 // permission types. See https://crbug.com/416894.
332 Profile* profile = GetActiveUserProfile(is_incognito); 330 Profile* profile = GetActiveUserProfile(is_incognito);
333 GURL url = GURL(ConvertJavaStringToUTF8(env, origin)); 331 GURL url = GURL(ConvertJavaStringToUTF8(env, origin));
334 ContentSetting setting = static_cast<ContentSetting>(value); 332 ContentSetting setting = static_cast<ContentSetting>(value);
335 switch (setting) { 333 switch (setting) {
336 case CONTENT_SETTING_DEFAULT: 334 case CONTENT_SETTING_DEFAULT:
337 DesktopNotificationProfileUtil::ClearSetting(profile, url); 335 DesktopNotificationProfileUtil::ClearSetting(profile, url);
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 GURL url(ConvertJavaStringToUTF8(env, jorigin)); 689 GURL url(ConvertJavaStringToUTF8(env, jorigin));
692 scoped_refptr<SiteDataDeleteHelper> site_data_deleter( 690 scoped_refptr<SiteDataDeleteHelper> site_data_deleter(
693 new SiteDataDeleteHelper(profile, url)); 691 new SiteDataDeleteHelper(profile, url));
694 site_data_deleter->Run(); 692 site_data_deleter->Run();
695 } 693 }
696 694
697 // Register native methods 695 // Register native methods
698 bool RegisterWebsitePreferenceBridge(JNIEnv* env) { 696 bool RegisterWebsitePreferenceBridge(JNIEnv* env) {
699 return RegisterNativesImpl(env); 697 return RegisterNativesImpl(env);
700 } 698 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698