| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/pref_service_bridge.h" | 5 #include "chrome/browser/android/preferences/pref_service_bridge.h" |
| 6 | 6 |
| 7 #include <jni.h> | 7 #include <jni.h> |
| 8 | 8 |
| 9 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| (...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 if (accept_languages->find(language_region) == std::string::npos) { | 828 if (accept_languages->find(language_region) == std::string::npos) { |
| 829 std::vector<std::string> parts; | 829 std::vector<std::string> parts; |
| 830 parts.push_back(language_region); | 830 parts.push_back(language_region); |
| 831 // If language is not in the accept languages list, also add language code. | 831 // If language is not in the accept languages list, also add language code. |
| 832 if (accept_languages->find(language + ",") == std::string::npos && | 832 if (accept_languages->find(language + ",") == std::string::npos && |
| 833 !std::equal(language.rbegin(), language.rend(), | 833 !std::equal(language.rbegin(), language.rend(), |
| 834 accept_languages->rbegin())) { | 834 accept_languages->rbegin())) { |
| 835 parts.push_back(language); | 835 parts.push_back(language); |
| 836 } | 836 } |
| 837 parts.push_back(*accept_languages); | 837 parts.push_back(*accept_languages); |
| 838 *accept_languages = base::JoinString(parts, ","); | 838 *accept_languages = JoinString(parts, ','); |
| 839 } | 839 } |
| 840 } | 840 } |
| 841 | 841 |
| 842 // static | 842 // static |
| 843 std::string PrefServiceBridge::GetAndroidPermissionForContentSetting( | 843 std::string PrefServiceBridge::GetAndroidPermissionForContentSetting( |
| 844 ContentSettingsType content_type) { | 844 ContentSettingsType content_type) { |
| 845 JNIEnv* env = AttachCurrentThread(); | 845 JNIEnv* env = AttachCurrentThread(); |
| 846 base::android::ScopedJavaLocalRef<jstring> android_permission = | 846 base::android::ScopedJavaLocalRef<jstring> android_permission = |
| 847 Java_PrefServiceBridge_getAndroidPermissionForContentSetting( | 847 Java_PrefServiceBridge_getAndroidPermissionForContentSetting( |
| 848 env, content_type); | 848 env, content_type); |
| 849 if (android_permission.is_null()) | 849 if (android_permission.is_null()) |
| 850 return std::string(); | 850 return std::string(); |
| 851 | 851 |
| 852 return ConvertJavaStringToUTF8(android_permission); | 852 return ConvertJavaStringToUTF8(android_permission); |
| 853 } | 853 } |
| OLD | NEW |