OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/android/preferences/website_address.h" | |
6 | |
7 #include "base/android/jni_string.h" | |
8 #include "components/content_settings/core/common/content_settings_pattern.h" | |
9 #include "jni/WebsiteAddress_jni.h" | |
10 #include "url/gurl.h" | |
11 | |
12 jboolean HasSameContentSettingsOrigin(JNIEnv* env, | |
13 jclass clazz, | |
14 jstring url1, | |
15 jstring url2) { | |
16 // This uses the same origin matching logic as many of the content settings. | |
17 // TODO(sashab): Remove this and individually fetch origin settings in | |
18 // WebsitePermissionsFetcher instead of filtering afterwards this way. | |
19 GURL gurl1 = GURL(base::android::ConvertJavaStringToUTF8(env, url1)); | |
20 GURL gurl2 = GURL(base::android::ConvertJavaStringToUTF8(env, url2)); | |
21 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.
| |
22 } | |
23 | |
24 // Register native methods | |
25 bool RegisterWebsiteAddress(JNIEnv* env) { | |
26 return RegisterNativesImpl(env); | |
27 } | |
OLD | NEW |