| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/android/content_settings.h" | 5 #include "content/browser/android/content_settings.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 "content/browser/android/content_view_core_impl.h" | 9 #include "content/browser/android/content_view_core_impl.h" |
| 10 #include "content/browser/renderer_host/render_view_host_delegate.h" | 10 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 user_agent = | 58 user_agent = |
| 59 GetFieldID(env, clazz, "mUserAgent", kStringClassName); | 59 GetFieldID(env, clazz, "mUserAgent", kStringClassName); |
| 60 minimum_font_size = GetFieldID(env, clazz, "mMinimumFontSize", "I"); | 60 minimum_font_size = GetFieldID(env, clazz, "mMinimumFontSize", "I"); |
| 61 minimum_logical_font_size = | 61 minimum_logical_font_size = |
| 62 GetFieldID(env, clazz, "mMinimumLogicalFontSize", "I"); | 62 GetFieldID(env, clazz, "mMinimumLogicalFontSize", "I"); |
| 63 default_font_size = GetFieldID(env, clazz, "mDefaultFontSize", "I"); | 63 default_font_size = GetFieldID(env, clazz, "mDefaultFontSize", "I"); |
| 64 default_fixed_font_size = | 64 default_fixed_font_size = |
| 65 GetFieldID(env, clazz, "mDefaultFixedFontSize", "I"); | 65 GetFieldID(env, clazz, "mDefaultFixedFontSize", "I"); |
| 66 load_images_automatically = | 66 load_images_automatically = |
| 67 GetFieldID(env, clazz, "mLoadsImagesAutomatically", "Z"); | 67 GetFieldID(env, clazz, "mLoadsImagesAutomatically", "Z"); |
| 68 images_enabled = |
| 69 GetFieldID(env, clazz, "mImagesEnabled", "Z"); |
| 68 java_script_enabled = | 70 java_script_enabled = |
| 69 GetFieldID(env, clazz, "mJavaScriptEnabled", "Z"); | 71 GetFieldID(env, clazz, "mJavaScriptEnabled", "Z"); |
| 70 allow_universal_access_from_file_urls = | 72 allow_universal_access_from_file_urls = |
| 71 GetFieldID(env, clazz, "mAllowUniversalAccessFromFileURLs", "Z"); | 73 GetFieldID(env, clazz, "mAllowUniversalAccessFromFileURLs", "Z"); |
| 72 allow_file_access_from_file_urls = | 74 allow_file_access_from_file_urls = |
| 73 GetFieldID(env, clazz, "mAllowFileAccessFromFileURLs", "Z"); | 75 GetFieldID(env, clazz, "mAllowFileAccessFromFileURLs", "Z"); |
| 74 java_script_can_open_windows_automatically = | 76 java_script_can_open_windows_automatically = |
| 75 GetFieldID(env, clazz, "mJavaScriptCanOpenWindowsAutomatically", "Z"); | 77 GetFieldID(env, clazz, "mJavaScriptCanOpenWindowsAutomatically", "Z"); |
| 76 dom_storage_enabled = | 78 dom_storage_enabled = |
| 77 GetFieldID(env, clazz, "mDomStorageEnabled", "Z"); | 79 GetFieldID(env, clazz, "mDomStorageEnabled", "Z"); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 88 jfieldID serif_font_family; | 90 jfieldID serif_font_family; |
| 89 jfieldID cursive_font_family; | 91 jfieldID cursive_font_family; |
| 90 jfieldID fantasy_font_family; | 92 jfieldID fantasy_font_family; |
| 91 jfieldID default_text_encoding; | 93 jfieldID default_text_encoding; |
| 92 jfieldID user_agent; | 94 jfieldID user_agent; |
| 93 jfieldID minimum_font_size; | 95 jfieldID minimum_font_size; |
| 94 jfieldID minimum_logical_font_size; | 96 jfieldID minimum_logical_font_size; |
| 95 jfieldID default_font_size; | 97 jfieldID default_font_size; |
| 96 jfieldID default_fixed_font_size; | 98 jfieldID default_fixed_font_size; |
| 97 jfieldID load_images_automatically; | 99 jfieldID load_images_automatically; |
| 100 jfieldID images_enabled; |
| 98 jfieldID java_script_enabled; | 101 jfieldID java_script_enabled; |
| 99 jfieldID allow_universal_access_from_file_urls; | 102 jfieldID allow_universal_access_from_file_urls; |
| 100 jfieldID allow_file_access_from_file_urls; | 103 jfieldID allow_file_access_from_file_urls; |
| 101 jfieldID java_script_can_open_windows_automatically; | 104 jfieldID java_script_can_open_windows_automatically; |
| 102 jfieldID dom_storage_enabled; | 105 jfieldID dom_storage_enabled; |
| 103 jfieldID allow_file_url_access; | 106 jfieldID allow_file_url_access; |
| 104 jfieldID allow_content_url_access; | 107 jfieldID allow_content_url_access; |
| 105 }; | 108 }; |
| 106 | 109 |
| 107 ContentSettings::ContentSettings(JNIEnv* env, | 110 ContentSettings::ContentSettings(JNIEnv* env, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 env->SetIntField( | 193 env->SetIntField( |
| 191 obj, field_ids_->default_fixed_font_size, prefs.default_fixed_font_size); | 194 obj, field_ids_->default_fixed_font_size, prefs.default_fixed_font_size); |
| 192 CheckException(env); | 195 CheckException(env); |
| 193 | 196 |
| 194 env->SetBooleanField( | 197 env->SetBooleanField( |
| 195 obj, | 198 obj, |
| 196 field_ids_->load_images_automatically, prefs.loads_images_automatically); | 199 field_ids_->load_images_automatically, prefs.loads_images_automatically); |
| 197 CheckException(env); | 200 CheckException(env); |
| 198 | 201 |
| 199 env->SetBooleanField( | 202 env->SetBooleanField( |
| 203 obj, |
| 204 field_ids_->images_enabled, prefs.images_enabled); |
| 205 CheckException(env); |
| 206 |
| 207 env->SetBooleanField( |
| 200 obj, field_ids_->java_script_enabled, prefs.javascript_enabled); | 208 obj, field_ids_->java_script_enabled, prefs.javascript_enabled); |
| 201 CheckException(env); | 209 CheckException(env); |
| 202 | 210 |
| 203 env->SetBooleanField( | 211 env->SetBooleanField( |
| 204 obj, | 212 obj, |
| 205 field_ids_->allow_universal_access_from_file_urls, | 213 field_ids_->allow_universal_access_from_file_urls, |
| 206 prefs.allow_universal_access_from_file_urls); | 214 prefs.allow_universal_access_from_file_urls); |
| 207 CheckException(env); | 215 CheckException(env); |
| 208 | 216 |
| 209 env->SetBooleanField( | 217 env->SetBooleanField( |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 | 295 |
| 288 prefs.default_font_size = | 296 prefs.default_font_size = |
| 289 env->GetIntField(obj, field_ids_->default_font_size); | 297 env->GetIntField(obj, field_ids_->default_font_size); |
| 290 | 298 |
| 291 prefs.default_fixed_font_size = | 299 prefs.default_fixed_font_size = |
| 292 env->GetIntField(obj, field_ids_->default_fixed_font_size); | 300 env->GetIntField(obj, field_ids_->default_fixed_font_size); |
| 293 | 301 |
| 294 prefs.loads_images_automatically = | 302 prefs.loads_images_automatically = |
| 295 env->GetBooleanField(obj, field_ids_->load_images_automatically); | 303 env->GetBooleanField(obj, field_ids_->load_images_automatically); |
| 296 | 304 |
| 305 prefs.images_enabled = |
| 306 env->GetBooleanField(obj, field_ids_->images_enabled); |
| 307 |
| 297 prefs.javascript_enabled = | 308 prefs.javascript_enabled = |
| 298 env->GetBooleanField(obj, field_ids_->java_script_enabled); | 309 env->GetBooleanField(obj, field_ids_->java_script_enabled); |
| 299 | 310 |
| 300 prefs.allow_universal_access_from_file_urls = env->GetBooleanField( | 311 prefs.allow_universal_access_from_file_urls = env->GetBooleanField( |
| 301 obj, field_ids_->allow_universal_access_from_file_urls); | 312 obj, field_ids_->allow_universal_access_from_file_urls); |
| 302 | 313 |
| 303 prefs.allow_file_access_from_file_urls = env->GetBooleanField( | 314 prefs.allow_file_access_from_file_urls = env->GetBooleanField( |
| 304 obj, field_ids_->allow_file_access_from_file_urls); | 315 obj, field_ids_->allow_file_access_from_file_urls); |
| 305 | 316 |
| 306 prefs.javascript_can_open_windows_automatically = env->GetBooleanField( | 317 prefs.javascript_can_open_windows_automatically = env->GetBooleanField( |
| (...skipping 30 matching lines...) Expand all Loading... |
| 337 return reinterpret_cast<jint>(content_settings); | 348 return reinterpret_cast<jint>(content_settings); |
| 338 } | 349 } |
| 339 | 350 |
| 340 static jstring GetDefaultUserAgent(JNIEnv* env, jclass clazz) { | 351 static jstring GetDefaultUserAgent(JNIEnv* env, jclass clazz) { |
| 341 // "Version/4.0" had been hardcoded in the legacy WebView. | 352 // "Version/4.0" had been hardcoded in the legacy WebView. |
| 342 std::string ua = webkit_glue::BuildUserAgentFromProduct("Version/4.0"); | 353 std::string ua = webkit_glue::BuildUserAgentFromProduct("Version/4.0"); |
| 343 return base::android::ConvertUTF8ToJavaString(env, ua).Release(); | 354 return base::android::ConvertUTF8ToJavaString(env, ua).Release(); |
| 344 } | 355 } |
| 345 | 356 |
| 346 } // namespace content | 357 } // namespace content |
| OLD | NEW |