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

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

Issue 1864163005: Switch Cookie to use ContentSettingException instead of CookieInfo on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: one missing comments to be addressed Created 4 years, 8 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 | « chrome/android/java_sources.gni ('k') | 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 31e94cf5ec3a2d0b7ad6b0383a6b825ce7ab5cd7..52f6d54faf96e6212210acb09ca9cb0b10156bd8 100644
--- a/chrome/browser/android/preferences/website_preference_bridge.cc
+++ b/chrome/browser/android/preferences/website_preference_bridge.cc
@@ -406,65 +406,6 @@ static void SetCameraSettingForOrigin(JNIEnv* env,
is_incognito);
}
-static scoped_refptr<content_settings::CookieSettings> GetCookieSettings() {
- // A single cookie setting applies to both incognito and non-incognito.
- Profile* profile = ProfileManager::GetActiveUserProfile();
- return CookieSettingsFactory::GetForProfile(profile);
-}
-
-static void GetCookieOrigins(JNIEnv* env,
- const JavaParamRef<jclass>& clazz,
- const JavaParamRef<jobject>& list,
- jboolean managedOnly) {
- ContentSettingsForOneType all_settings;
- GetCookieSettings()->GetCookieSettings(&all_settings);
- const ContentSetting default_setting =
- GetCookieSettings()->GetDefaultCookieSetting(nullptr);
- for (const auto& settings_it : all_settings) {
- if (settings_it.setting == default_setting)
- continue;
- if (managedOnly &&
- HostContentSettingsMap::GetProviderTypeFromSource(settings_it.source) !=
- HostContentSettingsMap::ProviderType::POLICY_PROVIDER) {
- continue;
- }
- const std::string& origin = settings_it.primary_pattern.ToString();
- const std::string& embedder = settings_it.secondary_pattern.ToString();
- ScopedJavaLocalRef<jstring> jorigin = ConvertUTF8ToJavaString(env, origin);
- ScopedJavaLocalRef<jstring> jembedder;
- if (embedder != origin)
- jembedder = ConvertUTF8ToJavaString(env, embedder);
- Java_WebsitePreferenceBridge_insertCookieInfoIntoList(env, list,
- jorigin.obj(), jembedder.obj());
- }
-}
-
-static jint GetCookieSettingForOrigin(JNIEnv* env,
- const JavaParamRef<jclass>& clazz,
- const JavaParamRef<jstring>& origin,
- const JavaParamRef<jstring>& embedder,
- jboolean is_incognito) {
- return GetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_COOKIES, origin,
- embedder, false);
-}
-
-static void SetCookieSettingForOrigin(JNIEnv* env,
- const JavaParamRef<jclass>& clazz,
- const JavaParamRef<jstring>& origin,
- const JavaParamRef<jstring>& embedder,
- jint value,
- jboolean is_incognito) {
- GURL url(ConvertJavaStringToUTF8(env, origin));
- ContentSetting setting = static_cast<ContentSetting>(value);
- if (setting == CONTENT_SETTING_DEFAULT) {
- GetCookieSettings()->ResetCookieSetting(url);
- } else {
- GetCookieSettings()->SetCookieSetting(url, setting);
- }
- WebSiteSettingsUmaUtil::LogPermissionChange(CONTENT_SETTINGS_TYPE_COOKIES,
- setting);
-}
-
static jboolean IsContentSettingsPatternValid(
JNIEnv* env,
const JavaParamRef<jclass>& clazz,
« no previous file with comments | « chrome/android/java_sources.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698