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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 env, list, jorigin.obj(), jembedder.obj()); | 104 env, list, jorigin.obj(), jembedder.obj()); |
105 break; | 105 break; |
106 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: | 106 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: |
107 Java_WebsitePreferenceBridge_insertProtectedMediaIdentifierInfoIntoList( | 107 Java_WebsitePreferenceBridge_insertProtectedMediaIdentifierInfoIntoList( |
108 env, list, jorigin.obj(), jembedder.obj()); | 108 env, list, jorigin.obj(), jembedder.obj()); |
109 break; | 109 break; |
110 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: | 110 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
111 Java_WebsitePreferenceBridge_insertPushNotificationIntoList( | 111 Java_WebsitePreferenceBridge_insertPushNotificationIntoList( |
112 env, list, jorigin.obj(), jembedder.obj()); | 112 env, list, jorigin.obj(), jembedder.obj()); |
113 break; | 113 break; |
114 case CONTENT_SETTINGS_TYPE_FULLSCREEN: | |
115 Java_WebsitePreferenceBridge_insertFullscreenInfoIntoList( | |
116 env, list, jorigin.obj(), jembedder.obj()); | |
114 default: | 117 default: |
115 DCHECK(false); | 118 DCHECK(false); |
116 break; | 119 break; |
117 } | 120 } |
118 } | 121 } |
119 } | 122 } |
120 | 123 |
121 static jint GetSettingForOrigin(JNIEnv* env, | 124 static jint GetSettingForOrigin(JNIEnv* env, |
122 ContentSettingsType content_type, | 125 ContentSettingsType content_type, |
123 jstring origin, | 126 jstring origin, |
(...skipping 13 matching lines...) Expand all Loading... | |
137 jstring origin, | 140 jstring origin, |
138 ContentSettingsPattern secondary_pattern, | 141 ContentSettingsPattern secondary_pattern, |
139 jint value) { | 142 jint value) { |
140 GURL url(ConvertJavaStringToUTF8(env, origin)); | 143 GURL url(ConvertJavaStringToUTF8(env, origin)); |
141 ContentSetting setting = CONTENT_SETTING_DEFAULT; | 144 ContentSetting setting = CONTENT_SETTING_DEFAULT; |
142 switch (value) { | 145 switch (value) { |
143 case -1: break; | 146 case -1: break; |
144 case 0: setting = CONTENT_SETTING_DEFAULT; break; | 147 case 0: setting = CONTENT_SETTING_DEFAULT; break; |
145 case 1: setting = CONTENT_SETTING_ALLOW; break; | 148 case 1: setting = CONTENT_SETTING_ALLOW; break; |
146 case 2: setting = CONTENT_SETTING_BLOCK; break; | 149 case 2: setting = CONTENT_SETTING_BLOCK; break; |
150 case 3: setting = CONTENT_SETTING_ASK; break; | |
Finnur
2015/03/13 10:42:14
Hmmm, this does not seem right to me.
Category de
qinmin
2015/03/17 23:49:30
BLOCK is not allowed for fullscreen. Check HostCon
Finnur
2015/03/19 10:35:26
I suspect we're conflating two things here.
The f
qinmin
2015/03/19 18:15:00
I see. I commented out the line and everything sti
| |
147 default: | 151 default: |
148 NOTREACHED(); | 152 NOTREACHED(); |
149 } | 153 } |
150 GetHostContentSettingsMap()->SetContentSetting( | 154 GetHostContentSettingsMap()->SetContentSetting( |
151 ContentSettingsPattern::FromURLNoWildcard(url), | 155 ContentSettingsPattern::FromURLNoWildcard(url), |
152 secondary_pattern, | 156 secondary_pattern, |
153 content_type, | 157 content_type, |
154 std::string(), | 158 std::string(), |
155 setting); | 159 setting); |
156 WebSiteSettingsUmaUtil::LogPermissionChange(content_type, setting); | 160 WebSiteSettingsUmaUtil::LogPermissionChange(content_type, setting); |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
658 } | 662 } |
659 | 663 |
660 static void ClearCookieData(JNIEnv* env, jclass clazz, jstring jorigin) { | 664 static void ClearCookieData(JNIEnv* env, jclass clazz, jstring jorigin) { |
661 Profile* profile = ProfileManager::GetActiveUserProfile(); | 665 Profile* profile = ProfileManager::GetActiveUserProfile(); |
662 GURL url(ConvertJavaStringToUTF8(env, jorigin)); | 666 GURL url(ConvertJavaStringToUTF8(env, jorigin)); |
663 scoped_refptr<SiteDataDeleteHelper> site_data_deleter( | 667 scoped_refptr<SiteDataDeleteHelper> site_data_deleter( |
664 new SiteDataDeleteHelper(profile, url)); | 668 new SiteDataDeleteHelper(profile, url)); |
665 site_data_deleter->Run(); | 669 site_data_deleter->Run(); |
666 } | 670 } |
667 | 671 |
672 static void GetFullscreenOrigins(JNIEnv* env, | |
673 jclass clazz, | |
674 jobject list, | |
675 jboolean managedOnly) { | |
676 GetOrigins(env, CONTENT_SETTINGS_TYPE_FULLSCREEN, list, managedOnly); | |
677 } | |
678 | |
679 static jint GetFullscreenSettingForOrigin(JNIEnv* env, jclass clazz, | |
680 jstring origin, jstring embedder) { | |
681 return GetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_FULLSCREEN, | |
682 origin, embedder); | |
683 } | |
684 | |
685 static void SetFullscreenSettingForOrigin(JNIEnv* env, jclass clazz, | |
686 jstring origin, jstring embedder, jint value) { | |
687 GURL embedder_url(ConvertJavaStringToUTF8(env, embedder)); | |
688 SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_FULLSCREEN, | |
689 origin, ContentSettingsPattern::FromURLNoWildcard(embedder_url), value); | |
690 } | |
Finnur
2015/03/13 10:42:14
There's a host of similar functions on line 170 an
qinmin
2015/03/17 23:49:30
Done.
| |
691 | |
668 // Register native methods | 692 // Register native methods |
669 bool RegisterWebsitePreferenceBridge(JNIEnv* env) { | 693 bool RegisterWebsitePreferenceBridge(JNIEnv* env) { |
670 return RegisterNativesImpl(env); | 694 return RegisterNativesImpl(env); |
671 } | 695 } |
OLD | NEW |