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

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

Issue 927763003: Move website settings fetching from WebsitePreferences to new WebsitePermissionFetcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatting Created 5 years, 10 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
Index: chrome/browser/android/preferences/website_address.cc
diff --git a/chrome/browser/android/preferences/website_address.cc b/chrome/browser/android/preferences/website_address.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3078c189c9bfe4d91619b503ff182e9d500c8488
--- /dev/null
+++ b/chrome/browser/android/preferences/website_address.cc
@@ -0,0 +1,27 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/android/preferences/website_address.h"
+
+#include "base/android/jni_string.h"
+#include "components/content_settings/core/common/content_settings_pattern.h"
+#include "jni/WebsiteAddress_jni.h"
+#include "url/gurl.h"
+
+jboolean HasSameContentSettingsOrigin(JNIEnv* env,
+ jclass clazz,
+ jstring url1,
+ jstring url2) {
+ // This uses the same origin matching logic as many of the content settings.
+ // TODO(sashab): Remove this and individually fetch origin settings in
+ // WebsitePermissionsFetcher instead of filtering afterwards this way.
+ GURL gurl1 = GURL(base::android::ConvertJavaStringToUTF8(env, url1));
+ GURL gurl2 = GURL(base::android::ConvertJavaStringToUTF8(env, url2));
+ return ContentSettingsPattern::FromURL(gurl1).Matches(gurl2);
Peter Beverloo 2015/02/17 15:06:46 We should verify that this in fact works for most
sashab 2015/02/18 05:28:32 Agreed. Maybe the best thing to do for now is just
Michael van Ouwerkerk 2015/02/18 19:57:39 Verified that this works for the single site scree
Michael van Ouwerkerk 2015/02/18 19:57:39 Acknowledged.
+}
+
+// Register native methods
+bool RegisterWebsiteAddress(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}

Powered by Google App Engine
This is Rietveld 408576698