| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 images_enabled = | 68 images_enabled = |
| 69 GetFieldID(env, clazz, "mImagesEnabled", "Z"); | 69 GetFieldID(env, clazz, "mImagesEnabled", "Z"); |
| 70 java_script_enabled = | 70 java_script_enabled = |
| 71 GetFieldID(env, clazz, "mJavaScriptEnabled", "Z"); | 71 GetFieldID(env, clazz, "mJavaScriptEnabled", "Z"); |
| 72 allow_universal_access_from_file_urls = | 72 allow_universal_access_from_file_urls = |
| 73 GetFieldID(env, clazz, "mAllowUniversalAccessFromFileURLs", "Z"); | 73 GetFieldID(env, clazz, "mAllowUniversalAccessFromFileURLs", "Z"); |
| 74 allow_file_access_from_file_urls = | 74 allow_file_access_from_file_urls = |
| 75 GetFieldID(env, clazz, "mAllowFileAccessFromFileURLs", "Z"); | 75 GetFieldID(env, clazz, "mAllowFileAccessFromFileURLs", "Z"); |
| 76 java_script_can_open_windows_automatically = | 76 java_script_can_open_windows_automatically = |
| 77 GetFieldID(env, clazz, "mJavaScriptCanOpenWindowsAutomatically", "Z"); | 77 GetFieldID(env, clazz, "mJavaScriptCanOpenWindowsAutomatically", "Z"); |
| 78 support_multiple_windows = |
| 79 GetFieldID(env, clazz, "mSupportMultipleWindows", "Z"); |
| 78 dom_storage_enabled = | 80 dom_storage_enabled = |
| 79 GetFieldID(env, clazz, "mDomStorageEnabled", "Z"); | 81 GetFieldID(env, clazz, "mDomStorageEnabled", "Z"); |
| 80 } | 82 } |
| 81 | 83 |
| 82 // Field ids | 84 // Field ids |
| 83 jfieldID standard_fond_family; | 85 jfieldID standard_fond_family; |
| 84 jfieldID fixed_font_family; | 86 jfieldID fixed_font_family; |
| 85 jfieldID sans_serif_font_family; | 87 jfieldID sans_serif_font_family; |
| 86 jfieldID serif_font_family; | 88 jfieldID serif_font_family; |
| 87 jfieldID cursive_font_family; | 89 jfieldID cursive_font_family; |
| 88 jfieldID fantasy_font_family; | 90 jfieldID fantasy_font_family; |
| 89 jfieldID default_text_encoding; | 91 jfieldID default_text_encoding; |
| 90 jfieldID user_agent; | 92 jfieldID user_agent; |
| 91 jfieldID minimum_font_size; | 93 jfieldID minimum_font_size; |
| 92 jfieldID minimum_logical_font_size; | 94 jfieldID minimum_logical_font_size; |
| 93 jfieldID default_font_size; | 95 jfieldID default_font_size; |
| 94 jfieldID default_fixed_font_size; | 96 jfieldID default_fixed_font_size; |
| 95 jfieldID load_images_automatically; | 97 jfieldID load_images_automatically; |
| 96 jfieldID images_enabled; | 98 jfieldID images_enabled; |
| 97 jfieldID java_script_enabled; | 99 jfieldID java_script_enabled; |
| 98 jfieldID allow_universal_access_from_file_urls; | 100 jfieldID allow_universal_access_from_file_urls; |
| 99 jfieldID allow_file_access_from_file_urls; | 101 jfieldID allow_file_access_from_file_urls; |
| 100 jfieldID java_script_can_open_windows_automatically; | 102 jfieldID java_script_can_open_windows_automatically; |
| 103 jfieldID support_multiple_windows; |
| 101 jfieldID dom_storage_enabled; | 104 jfieldID dom_storage_enabled; |
| 102 }; | 105 }; |
| 103 | 106 |
| 104 ContentSettings::ContentSettings(JNIEnv* env, | 107 ContentSettings::ContentSettings(JNIEnv* env, |
| 105 jobject obj, | 108 jobject obj, |
| 106 WebContents* contents, | 109 WebContents* contents, |
| 107 bool is_master_mode) | 110 bool is_master_mode) |
| 108 : WebContentsObserver(contents), | 111 : WebContentsObserver(contents), |
| 109 is_master_mode_(is_master_mode), | 112 is_master_mode_(is_master_mode), |
| 110 content_settings_(env, obj) { | 113 content_settings_(env, obj) { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 field_ids_->allow_file_access_from_file_urls, | 221 field_ids_->allow_file_access_from_file_urls, |
| 219 prefs.allow_file_access_from_file_urls); | 222 prefs.allow_file_access_from_file_urls); |
| 220 CheckException(env); | 223 CheckException(env); |
| 221 | 224 |
| 222 env->SetBooleanField( | 225 env->SetBooleanField( |
| 223 obj, | 226 obj, |
| 224 field_ids_->java_script_can_open_windows_automatically, | 227 field_ids_->java_script_can_open_windows_automatically, |
| 225 prefs.javascript_can_open_windows_automatically); | 228 prefs.javascript_can_open_windows_automatically); |
| 226 CheckException(env); | 229 CheckException(env); |
| 227 | 230 |
| 231 env->SetBooleanField( |
| 232 obj, |
| 233 field_ids_->support_multiple_windows, |
| 234 prefs.support_multiple_windows); |
| 235 CheckException(env); |
| 236 |
| 228 Java_ContentSettings_setPluginsDisabled(env, obj, !prefs.plugins_enabled); | 237 Java_ContentSettings_setPluginsDisabled(env, obj, !prefs.plugins_enabled); |
| 229 CheckException(env); | 238 CheckException(env); |
| 230 | 239 |
| 231 env->SetBooleanField( | 240 env->SetBooleanField( |
| 232 obj, | 241 obj, |
| 233 field_ids_->dom_storage_enabled, | 242 field_ids_->dom_storage_enabled, |
| 234 prefs.local_storage_enabled); | 243 prefs.local_storage_enabled); |
| 235 CheckException(env); | 244 CheckException(env); |
| 236 } | 245 } |
| 237 | 246 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 | 321 |
| 313 prefs.allow_universal_access_from_file_urls = env->GetBooleanField( | 322 prefs.allow_universal_access_from_file_urls = env->GetBooleanField( |
| 314 obj, field_ids_->allow_universal_access_from_file_urls); | 323 obj, field_ids_->allow_universal_access_from_file_urls); |
| 315 | 324 |
| 316 prefs.allow_file_access_from_file_urls = env->GetBooleanField( | 325 prefs.allow_file_access_from_file_urls = env->GetBooleanField( |
| 317 obj, field_ids_->allow_file_access_from_file_urls); | 326 obj, field_ids_->allow_file_access_from_file_urls); |
| 318 | 327 |
| 319 prefs.javascript_can_open_windows_automatically = env->GetBooleanField( | 328 prefs.javascript_can_open_windows_automatically = env->GetBooleanField( |
| 320 obj, field_ids_->java_script_can_open_windows_automatically); | 329 obj, field_ids_->java_script_can_open_windows_automatically); |
| 321 | 330 |
| 331 prefs.support_multiple_windows = env->GetBooleanField( |
| 332 obj, field_ids_->support_multiple_windows); |
| 333 |
| 322 prefs.plugins_enabled = !Java_ContentSettings_getPluginsDisabled(env, obj); | 334 prefs.plugins_enabled = !Java_ContentSettings_getPluginsDisabled(env, obj); |
| 323 | 335 |
| 324 prefs.local_storage_enabled = env->GetBooleanField( | 336 prefs.local_storage_enabled = env->GetBooleanField( |
| 325 obj, field_ids_->dom_storage_enabled); | 337 obj, field_ids_->dom_storage_enabled); |
| 326 | 338 |
| 327 render_view_host->UpdateWebkitPreferences(prefs); | 339 render_view_host->UpdateWebkitPreferences(prefs); |
| 328 } | 340 } |
| 329 | 341 |
| 330 void ContentSettings::SyncFromNative(JNIEnv* env, jobject obj) { | 342 void ContentSettings::SyncFromNative(JNIEnv* env, jobject obj) { |
| 331 SyncFromNativeImpl(); | 343 SyncFromNativeImpl(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 353 new ContentSettings(env, obj, web_contents, is_master_mode); | 365 new ContentSettings(env, obj, web_contents, is_master_mode); |
| 354 return reinterpret_cast<jint>(content_settings); | 366 return reinterpret_cast<jint>(content_settings); |
| 355 } | 367 } |
| 356 | 368 |
| 357 static jstring GetDefaultUserAgent(JNIEnv* env, jclass clazz) { | 369 static jstring GetDefaultUserAgent(JNIEnv* env, jclass clazz) { |
| 358 return base::android::ConvertUTF8ToJavaString( | 370 return base::android::ConvertUTF8ToJavaString( |
| 359 env, GetContentClient()->GetUserAgent()).Release(); | 371 env, GetContentClient()->GetUserAgent()).Release(); |
| 360 } | 372 } |
| 361 | 373 |
| 362 } // namespace content | 374 } // namespace content |
| OLD | NEW |