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, | |
Miguel Garcia
2015/02/18 21:40:46
Do we really need to go to C++ to do this? can't w
Michael van Ouwerkerk
2015/02/19 17:19:35
Done.
| |
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); | |
22 } | |
23 | |
24 // Register native methods | |
25 bool RegisterWebsiteAddress(JNIEnv* env) { | |
26 return RegisterNativesImpl(env); | |
27 } | |
OLD | NEW |