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 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 if (accept_languages->find(language_region) == std::string::npos) { | 819 if (accept_languages->find(language_region) == std::string::npos) { |
820 std::vector<std::string> parts; | 820 std::vector<std::string> parts; |
821 parts.push_back(language_region); | 821 parts.push_back(language_region); |
822 // If language is not in the accept languages list, also add language code. | 822 // If language is not in the accept languages list, also add language code. |
823 if (accept_languages->find(language + ",") == std::string::npos && | 823 if (accept_languages->find(language + ",") == std::string::npos && |
824 !std::equal(language.rbegin(), language.rend(), | 824 !std::equal(language.rbegin(), language.rend(), |
825 accept_languages->rbegin())) { | 825 accept_languages->rbegin())) { |
826 parts.push_back(language); | 826 parts.push_back(language); |
827 } | 827 } |
828 parts.push_back(*accept_languages); | 828 parts.push_back(*accept_languages); |
829 *accept_languages = JoinString(parts, ','); | 829 *accept_languages = base::JoinString(parts, ","); |
830 } | 830 } |
831 } | 831 } |
832 | 832 |
833 // static | 833 // static |
834 std::string PrefServiceBridge::GetAndroidPermissionForContentSetting( | 834 std::string PrefServiceBridge::GetAndroidPermissionForContentSetting( |
835 ContentSettingsType content_type) { | 835 ContentSettingsType content_type) { |
836 JNIEnv* env = AttachCurrentThread(); | 836 JNIEnv* env = AttachCurrentThread(); |
837 base::android::ScopedJavaLocalRef<jstring> android_permission = | 837 base::android::ScopedJavaLocalRef<jstring> android_permission = |
838 Java_PrefServiceBridge_getAndroidPermissionForContentSetting( | 838 Java_PrefServiceBridge_getAndroidPermissionForContentSetting( |
839 env, content_type); | 839 env, content_type); |
840 if (android_permission.is_null()) | 840 if (android_permission.is_null()) |
841 return std::string(); | 841 return std::string(); |
842 | 842 |
843 return ConvertJavaStringToUTF8(android_permission); | 843 return ConvertJavaStringToUTF8(android_permission); |
844 } | 844 } |
OLD | NEW |