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); |
+} |