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

Unified Diff: chrome/browser/android/preferences/website_preference_bridge.cc

Issue 1819773002: Use GURLs instead of patterns for SetContentSetting() in WebsitePreferenceBridge (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bug 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1243f3aa8e9752529347e1afe596116f927988da..d7fb84f7812080235a167b96798c50e7778a7d13 100644
--- a/chrome/browser/android/preferences/website_preference_bridge.cc
+++ b/chrome/browser/android/preferences/website_preference_bridge.cc
@@ -131,14 +131,14 @@ ContentSetting GetSettingForOrigin(JNIEnv* env,
void SetSettingForOrigin(JNIEnv* env,
ContentSettingsType content_type,
jstring origin,
- ContentSettingsPattern secondary_pattern,
+ jstring embedder,
ContentSetting setting,
jboolean is_incognito) {
- GURL url(ConvertJavaStringToUTF8(env, origin));
+ GURL origin_url(ConvertJavaStringToUTF8(env, origin));
+ GURL embedder_url(ConvertJavaStringToUTF8(env, embedder));
GetHostContentSettingsMap(is_incognito)
- ->SetContentSetting(ContentSettingsPattern::FromURLNoWildcard(url),
- secondary_pattern, content_type, std::string(),
- setting);
+ ->SetContentSettingDefaultScope(origin_url, embedder_url, content_type,
+ std::string(), setting);
WebSiteSettingsUmaUtil::LogPermissionChange(content_type, setting);
}
@@ -168,10 +168,8 @@ static void SetFullscreenSettingForOrigin(JNIEnv* env,
const JavaParamRef<jstring>& embedder,
jint value,
jboolean is_incognito) {
- GURL embedder_url(ConvertJavaStringToUTF8(env, embedder));
- SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_FULLSCREEN, origin,
- ContentSettingsPattern::FromURLNoWildcard(embedder_url),
- (ContentSetting) value, is_incognito);
+ SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_FULLSCREEN, origin, embedder,
+ (ContentSetting)value, is_incognito);
}
static void GetGeolocationOrigins(JNIEnv* env,
@@ -200,10 +198,8 @@ static void SetGeolocationSettingForOrigin(
const JavaParamRef<jstring>& embedder,
jint value,
jboolean is_incognito) {
- GURL embedder_url(ConvertJavaStringToUTF8(env, embedder));
- SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_GEOLOCATION, origin,
- ContentSettingsPattern::FromURLNoWildcard(embedder_url),
- (ContentSetting) value, is_incognito);
+ SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_GEOLOCATION, origin, embedder,
+ (ContentSetting)value, is_incognito);
}
static void GetKeygenOrigins(JNIEnv* env,
@@ -229,10 +225,8 @@ static void SetKeygenSettingForOrigin(JNIEnv* env,
const JavaParamRef<jstring>& embedder,
jint value,
jboolean is_incognito) {
- GURL embedder_url(ConvertJavaStringToUTF8(env, embedder));
- SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_KEYGEN, origin,
- ContentSettingsPattern::FromURLNoWildcard(embedder_url),
- (ContentSetting) value, is_incognito);
+ SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_KEYGEN, origin, NULL,
svaldez 2016/03/22 16:05:24 Should this be NULL, possibly add a comment?
Bernhard Bauer 2016/03/22 16:11:58 And in any case it should be nullptr, not NULL.
lshang 2016/03/23 01:46:12 Done. I changed it to nullptr, and it indicates th
lshang 2016/03/23 01:46:12 Done.
Bernhard Bauer 2016/03/23 14:12:15 The biggest issue I have with nullptr specifically
+ (ContentSetting)value, is_incognito);
Bernhard Bauer 2016/03/22 16:11:58 Ooh, also we should use static_cast<ContentSetting
lshang 2016/03/23 01:46:12 Done.
}
static jboolean GetKeygenBlocked(JNIEnv* env,
@@ -266,10 +260,8 @@ static void SetMidiSettingForOrigin(JNIEnv* env,
const JavaParamRef<jstring>& embedder,
jint value,
jboolean is_incognito) {
- GURL embedder_url(ConvertJavaStringToUTF8(env, embedder));
- SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_MIDI_SYSEX, origin,
- ContentSettingsPattern::FromURLNoWildcard(embedder_url),
- (ContentSetting) value, is_incognito);
+ SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_MIDI_SYSEX, origin, embedder,
+ (ContentSetting)value, is_incognito);
}
static void GetProtectedMediaIdentifierOrigins(
@@ -300,11 +292,8 @@ static void SetProtectedMediaIdentifierSettingForOrigin(
const JavaParamRef<jstring>& embedder,
jint value,
jboolean is_incognito) {
- GURL embedder_url(ConvertJavaStringToUTF8(env, embedder));
SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER,
- origin,
- ContentSettingsPattern::FromURLNoWildcard(embedder_url),
- (ContentSetting) value, is_incognito);
+ origin, embedder, (ContentSetting)value, is_incognito);
}
static void GetNotificationOrigins(JNIEnv* env,
@@ -397,9 +386,8 @@ static void SetMicrophoneSettingForOrigin(JNIEnv* env,
const JavaParamRef<jstring>& embedder,
jint value,
jboolean is_incognito) {
- SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, origin,
- ContentSettingsPattern::Wildcard(),
- (ContentSetting) value, is_incognito);
+ SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, origin, NULL,
+ (ContentSetting)value, is_incognito);
}
static void SetCameraSettingForOrigin(JNIEnv* env,
@@ -409,8 +397,7 @@ static void SetCameraSettingForOrigin(JNIEnv* env,
jint value,
jboolean is_incognito) {
SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, origin,
- ContentSettingsPattern::Wildcard(),
- (ContentSetting) value, is_incognito);
+ NULL, (ContentSetting)value, is_incognito);
}
static scoped_refptr<content_settings::CookieSettings> GetCookieSettings() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698