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

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

Issue 1694923004: Use GURLs instead of patterns in SetContentSetting in notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scoping_set_content_setting
Patch Set: add a note Created 4 years, 9 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/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/android/scoped_java_ref.h" 9 #include "base/android/scoped_java_ref.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 const JavaParamRef<jstring>& embedder, 333 const JavaParamRef<jstring>& embedder,
334 jint value, 334 jint value,
335 jboolean is_incognito) { 335 jboolean is_incognito) {
336 // Note: Web Notification permission behaves differently from all other 336 // Note: Web Notification permission behaves differently from all other
337 // permission types. See https://crbug.com/416894. 337 // permission types. See https://crbug.com/416894.
338 Profile* profile = GetActiveUserProfile(is_incognito); 338 Profile* profile = GetActiveUserProfile(is_incognito);
339 GURL url = GURL(ConvertJavaStringToUTF8(env, origin)); 339 GURL url = GURL(ConvertJavaStringToUTF8(env, origin));
340 ContentSetting setting = (ContentSetting) value; 340 ContentSetting setting = (ContentSetting) value;
341 switch (setting) { 341 switch (setting) {
342 case CONTENT_SETTING_DEFAULT: 342 case CONTENT_SETTING_DEFAULT:
343 DesktopNotificationProfileUtil::ClearSetting( 343 DesktopNotificationProfileUtil::ClearSetting(profile, url);
344 profile, ContentSettingsPattern::FromURLNoWildcard(url));
345 break; 344 break;
346 case CONTENT_SETTING_ALLOW: 345 case CONTENT_SETTING_ALLOW:
347 DesktopNotificationProfileUtil::GrantPermission(profile, url); 346 DesktopNotificationProfileUtil::GrantPermission(profile, url);
348 break; 347 break;
349 case CONTENT_SETTING_BLOCK: 348 case CONTENT_SETTING_BLOCK:
350 DesktopNotificationProfileUtil::DenyPermission(profile, url); 349 DesktopNotificationProfileUtil::DenyPermission(profile, url);
351 break; 350 break;
352 default: 351 default:
353 NOTREACHED(); 352 NOTREACHED();
354 } 353 }
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 GURL url(ConvertJavaStringToUTF8(env, jorigin)); 764 GURL url(ConvertJavaStringToUTF8(env, jorigin));
766 scoped_refptr<SiteDataDeleteHelper> site_data_deleter( 765 scoped_refptr<SiteDataDeleteHelper> site_data_deleter(
767 new SiteDataDeleteHelper(profile, url)); 766 new SiteDataDeleteHelper(profile, url));
768 site_data_deleter->Run(); 767 site_data_deleter->Run();
769 } 768 }
770 769
771 // Register native methods 770 // Register native methods
772 bool RegisterWebsitePreferenceBridge(JNIEnv* env) { 771 bool RegisterWebsitePreferenceBridge(JNIEnv* env) {
773 return RegisterNativesImpl(env); 772 return RegisterNativesImpl(env);
774 } 773 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698