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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 return ProfileManager::GetActiveUserProfile()->GetOriginalProfile(); | 63 return ProfileManager::GetActiveUserProfile()->GetOriginalProfile(); |
64 } | 64 } |
65 | 65 |
66 bool GetBooleanForContentSetting(ContentSettingsType type) { | 66 bool GetBooleanForContentSetting(ContentSettingsType type) { |
67 HostContentSettingsMap* content_settings = | 67 HostContentSettingsMap* content_settings = |
68 HostContentSettingsMapFactory::GetForProfile(GetOriginalProfile()); | 68 HostContentSettingsMapFactory::GetForProfile(GetOriginalProfile()); |
69 switch (content_settings->GetDefaultContentSetting(type, NULL)) { | 69 switch (content_settings->GetDefaultContentSetting(type, NULL)) { |
70 case CONTENT_SETTING_BLOCK: | 70 case CONTENT_SETTING_BLOCK: |
71 return false; | 71 return false; |
72 case CONTENT_SETTING_ALLOW: | 72 case CONTENT_SETTING_ALLOW: |
73 return true; | |
74 case CONTENT_SETTING_ASK: | 73 case CONTENT_SETTING_ASK: |
75 default: | 74 default: |
76 return true; | 75 return true; |
77 } | 76 } |
78 } | 77 } |
79 | 78 |
80 bool IsContentSettingManaged(ContentSettingsType content_settings_type) { | 79 bool IsContentSettingManaged(ContentSettingsType content_settings_type) { |
81 std::string source; | 80 std::string source; |
82 HostContentSettingsMap* content_settings = | 81 HostContentSettingsMap* content_settings = |
83 HostContentSettingsMapFactory::GetForProfile(GetOriginalProfile()); | 82 HostContentSettingsMapFactory::GetForProfile(GetOriginalProfile()); |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 ContentSettingsType content_type) { | 941 ContentSettingsType content_type) { |
943 JNIEnv* env = AttachCurrentThread(); | 942 JNIEnv* env = AttachCurrentThread(); |
944 base::android::ScopedJavaLocalRef<jstring> android_permission = | 943 base::android::ScopedJavaLocalRef<jstring> android_permission = |
945 Java_PrefServiceBridge_getAndroidPermissionForContentSetting( | 944 Java_PrefServiceBridge_getAndroidPermissionForContentSetting( |
946 env, content_type); | 945 env, content_type); |
947 if (android_permission.is_null()) | 946 if (android_permission.is_null()) |
948 return std::string(); | 947 return std::string(); |
949 | 948 |
950 return ConvertJavaStringToUTF8(android_permission); | 949 return ConvertJavaStringToUTF8(android_permission); |
951 } | 950 } |
OLD | NEW |