| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 images_enabled = | 69 images_enabled = |
| 70 GetFieldID(env, clazz, "mImagesEnabled", "Z"); | 70 GetFieldID(env, clazz, "mImagesEnabled", "Z"); |
| 71 java_script_enabled = | 71 java_script_enabled = |
| 72 GetFieldID(env, clazz, "mJavaScriptEnabled", "Z"); | 72 GetFieldID(env, clazz, "mJavaScriptEnabled", "Z"); |
| 73 allow_universal_access_from_file_urls = | 73 allow_universal_access_from_file_urls = |
| 74 GetFieldID(env, clazz, "mAllowUniversalAccessFromFileURLs", "Z"); | 74 GetFieldID(env, clazz, "mAllowUniversalAccessFromFileURLs", "Z"); |
| 75 allow_file_access_from_file_urls = | 75 allow_file_access_from_file_urls = |
| 76 GetFieldID(env, clazz, "mAllowFileAccessFromFileURLs", "Z"); | 76 GetFieldID(env, clazz, "mAllowFileAccessFromFileURLs", "Z"); |
| 77 java_script_can_open_windows_automatically = | 77 java_script_can_open_windows_automatically = |
| 78 GetFieldID(env, clazz, "mJavaScriptCanOpenWindowsAutomatically", "Z"); | 78 GetFieldID(env, clazz, "mJavaScriptCanOpenWindowsAutomatically", "Z"); |
| 79 support_multiple_windows = |
| 80 GetFieldID(env, clazz, "mSupportMultipleWindows", "Z"); |
| 79 dom_storage_enabled = | 81 dom_storage_enabled = |
| 80 GetFieldID(env, clazz, "mDomStorageEnabled", "Z"); | 82 GetFieldID(env, clazz, "mDomStorageEnabled", "Z"); |
| 81 } | 83 } |
| 82 | 84 |
| 83 // Field ids | 85 // Field ids |
| 84 jfieldID text_size_percent; | 86 jfieldID text_size_percent; |
| 85 jfieldID standard_fond_family; | 87 jfieldID standard_fond_family; |
| 86 jfieldID fixed_font_family; | 88 jfieldID fixed_font_family; |
| 87 jfieldID sans_serif_font_family; | 89 jfieldID sans_serif_font_family; |
| 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; |
| 98 jfieldID images_enabled; | 100 jfieldID images_enabled; |
| 99 jfieldID java_script_enabled; | 101 jfieldID java_script_enabled; |
| 100 jfieldID allow_universal_access_from_file_urls; | 102 jfieldID allow_universal_access_from_file_urls; |
| 101 jfieldID allow_file_access_from_file_urls; | 103 jfieldID allow_file_access_from_file_urls; |
| 102 jfieldID java_script_can_open_windows_automatically; | 104 jfieldID java_script_can_open_windows_automatically; |
| 105 jfieldID support_multiple_windows; |
| 103 jfieldID dom_storage_enabled; | 106 jfieldID dom_storage_enabled; |
| 104 }; | 107 }; |
| 105 | 108 |
| 106 ContentSettings::ContentSettings(JNIEnv* env, | 109 ContentSettings::ContentSettings(JNIEnv* env, |
| 107 jobject obj, | 110 jobject obj, |
| 108 WebContents* contents, | 111 WebContents* contents, |
| 109 bool is_master_mode) | 112 bool is_master_mode) |
| 110 : WebContentsObserver(contents), | 113 : WebContentsObserver(contents), |
| 111 is_master_mode_(is_master_mode), | 114 is_master_mode_(is_master_mode), |
| 112 content_settings_(env, obj) { | 115 content_settings_(env, obj) { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 field_ids_->allow_file_access_from_file_urls, | 232 field_ids_->allow_file_access_from_file_urls, |
| 230 prefs.allow_file_access_from_file_urls); | 233 prefs.allow_file_access_from_file_urls); |
| 231 CheckException(env); | 234 CheckException(env); |
| 232 | 235 |
| 233 env->SetBooleanField( | 236 env->SetBooleanField( |
| 234 obj, | 237 obj, |
| 235 field_ids_->java_script_can_open_windows_automatically, | 238 field_ids_->java_script_can_open_windows_automatically, |
| 236 prefs.javascript_can_open_windows_automatically); | 239 prefs.javascript_can_open_windows_automatically); |
| 237 CheckException(env); | 240 CheckException(env); |
| 238 | 241 |
| 242 env->SetBooleanField( |
| 243 obj, |
| 244 field_ids_->support_multiple_windows, |
| 245 prefs.supports_multiple_windows); |
| 246 CheckException(env); |
| 247 |
| 239 Java_ContentSettings_setPluginsDisabled(env, obj, !prefs.plugins_enabled); | 248 Java_ContentSettings_setPluginsDisabled(env, obj, !prefs.plugins_enabled); |
| 240 CheckException(env); | 249 CheckException(env); |
| 241 | 250 |
| 242 env->SetBooleanField( | 251 env->SetBooleanField( |
| 243 obj, | 252 obj, |
| 244 field_ids_->dom_storage_enabled, | 253 field_ids_->dom_storage_enabled, |
| 245 prefs.local_storage_enabled); | 254 prefs.local_storage_enabled); |
| 246 CheckException(env); | 255 CheckException(env); |
| 247 } | 256 } |
| 248 | 257 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 | 339 |
| 331 prefs.allow_universal_access_from_file_urls = env->GetBooleanField( | 340 prefs.allow_universal_access_from_file_urls = env->GetBooleanField( |
| 332 obj, field_ids_->allow_universal_access_from_file_urls); | 341 obj, field_ids_->allow_universal_access_from_file_urls); |
| 333 | 342 |
| 334 prefs.allow_file_access_from_file_urls = env->GetBooleanField( | 343 prefs.allow_file_access_from_file_urls = env->GetBooleanField( |
| 335 obj, field_ids_->allow_file_access_from_file_urls); | 344 obj, field_ids_->allow_file_access_from_file_urls); |
| 336 | 345 |
| 337 prefs.javascript_can_open_windows_automatically = env->GetBooleanField( | 346 prefs.javascript_can_open_windows_automatically = env->GetBooleanField( |
| 338 obj, field_ids_->java_script_can_open_windows_automatically); | 347 obj, field_ids_->java_script_can_open_windows_automatically); |
| 339 | 348 |
| 349 prefs.supports_multiple_windows = env->GetBooleanField( |
| 350 obj, field_ids_->support_multiple_windows); |
| 351 |
| 340 prefs.plugins_enabled = !Java_ContentSettings_getPluginsDisabled(env, obj); | 352 prefs.plugins_enabled = !Java_ContentSettings_getPluginsDisabled(env, obj); |
| 341 | 353 |
| 342 prefs.local_storage_enabled = env->GetBooleanField( | 354 prefs.local_storage_enabled = env->GetBooleanField( |
| 343 obj, field_ids_->dom_storage_enabled); | 355 obj, field_ids_->dom_storage_enabled); |
| 344 | 356 |
| 345 render_view_host->UpdateWebkitPreferences(prefs); | 357 render_view_host->UpdateWebkitPreferences(prefs); |
| 346 } | 358 } |
| 347 | 359 |
| 348 void ContentSettings::SyncFromNative(JNIEnv* env, jobject obj) { | 360 void ContentSettings::SyncFromNative(JNIEnv* env, jobject obj) { |
| 349 SyncFromNativeImpl(); | 361 SyncFromNativeImpl(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 371 new ContentSettings(env, obj, web_contents, is_master_mode); | 383 new ContentSettings(env, obj, web_contents, is_master_mode); |
| 372 return reinterpret_cast<jint>(content_settings); | 384 return reinterpret_cast<jint>(content_settings); |
| 373 } | 385 } |
| 374 | 386 |
| 375 static jstring GetDefaultUserAgent(JNIEnv* env, jclass clazz) { | 387 static jstring GetDefaultUserAgent(JNIEnv* env, jclass clazz) { |
| 376 return base::android::ConvertUTF8ToJavaString( | 388 return base::android::ConvertUTF8ToJavaString( |
| 377 env, GetContentClient()->GetUserAgent()).Release(); | 389 env, GetContentClient()->GetUserAgent()).Release(); |
| 378 } | 390 } |
| 379 | 391 |
| 380 } // namespace content | 392 } // namespace content |
| OLD | NEW |