OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |