OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/android/preferences/website_preference_bridge.h" | 5 #include "chrome/browser/android/preferences/website_preference_bridge.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // TODO(sashab,lgarron): Find out which settings are being saved with the | 68 // TODO(sashab,lgarron): Find out which settings are being saved with the |
69 // port and omit it if it's the standard port. | 69 // port and omit it if it's the standard port. |
70 // TODO(mvanouwerkerk): Remove all this logic and take two passes through | 70 // TODO(mvanouwerkerk): Remove all this logic and take two passes through |
71 // HostContentSettingsMap: once to get all the 'interesting' hosts, and once | 71 // HostContentSettingsMap: once to get all the 'interesting' hosts, and once |
72 // (on SingleWebsitePreferences) to find permission patterns which match | 72 // (on SingleWebsitePreferences) to find permission patterns which match |
73 // each of these hosts. | 73 // each of these hosts. |
74 const char* kHttpPortSuffix = ":80"; | 74 const char* kHttpPortSuffix = ":80"; |
75 const char* kHttpsPortSuffix = ":443"; | 75 const char* kHttpsPortSuffix = ":443"; |
76 ScopedJavaLocalRef<jstring> jorigin; | 76 ScopedJavaLocalRef<jstring> jorigin; |
77 if (base::StartsWithASCII(origin, url::kHttpsScheme, false) && | 77 if (base::StartsWithASCII(origin, url::kHttpsScheme, false) && |
78 EndsWith(origin, kHttpsPortSuffix, false)) { | 78 base::EndsWith(origin, kHttpsPortSuffix, false)) { |
79 jorigin = ConvertUTF8ToJavaString( | 79 jorigin = ConvertUTF8ToJavaString( |
80 env, origin.substr(0, origin.size() - strlen(kHttpsPortSuffix))); | 80 env, origin.substr(0, origin.size() - strlen(kHttpsPortSuffix))); |
81 } else if (base::StartsWithASCII(origin, url::kHttpScheme, false) && | 81 } else if (base::StartsWithASCII(origin, url::kHttpScheme, false) && |
82 EndsWith(origin, kHttpPortSuffix, false)) { | 82 base::EndsWith(origin, kHttpPortSuffix, false)) { |
83 jorigin = ConvertUTF8ToJavaString( | 83 jorigin = ConvertUTF8ToJavaString( |
84 env, origin.substr(0, origin.size() - strlen(kHttpPortSuffix))); | 84 env, origin.substr(0, origin.size() - strlen(kHttpPortSuffix))); |
85 } else { | 85 } else { |
86 jorigin = ConvertUTF8ToJavaString(env, origin); | 86 jorigin = ConvertUTF8ToJavaString(env, origin); |
87 } | 87 } |
88 | 88 |
89 ScopedJavaLocalRef<jstring> jembedder; | 89 ScopedJavaLocalRef<jstring> jembedder; |
90 if (embedder != origin) | 90 if (embedder != origin) |
91 jembedder = ConvertUTF8ToJavaString(env, embedder); | 91 jembedder = ConvertUTF8ToJavaString(env, embedder); |
92 switch (content_type) { | 92 switch (content_type) { |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 GURL url(ConvertJavaStringToUTF8(env, jorigin)); | 701 GURL url(ConvertJavaStringToUTF8(env, jorigin)); |
702 scoped_refptr<SiteDataDeleteHelper> site_data_deleter( | 702 scoped_refptr<SiteDataDeleteHelper> site_data_deleter( |
703 new SiteDataDeleteHelper(profile, url)); | 703 new SiteDataDeleteHelper(profile, url)); |
704 site_data_deleter->Run(); | 704 site_data_deleter->Run(); |
705 } | 705 } |
706 | 706 |
707 // Register native methods | 707 // Register native methods |
708 bool RegisterWebsitePreferenceBridge(JNIEnv* env) { | 708 bool RegisterWebsitePreferenceBridge(JNIEnv* env) { |
709 return RegisterNativesImpl(env); | 709 return RegisterNativesImpl(env); |
710 } | 710 } |
OLD | NEW |