Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "android_webview/native/aw_settings.h" | 5 #include "android_webview/native/aw_settings.h" |
| 6 | 6 |
| 7 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" | 7 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" |
| 8 #include "android_webview/native/aw_contents.h" | 8 #include "android_webview/native/aw_contents.h" |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| 11 #include "base/command_line.h" | |
| 11 #include "base/supports_user_data.h" | 12 #include "base/supports_user_data.h" |
| 12 #include "content/public/browser/navigation_controller.h" | 13 #include "content/public/browser/navigation_controller.h" |
| 13 #include "content/public/browser/navigation_entry.h" | 14 #include "content/public/browser/navigation_entry.h" |
| 14 #include "content/public/browser/render_view_host.h" | 15 #include "content/public/browser/render_view_host.h" |
| 15 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 16 #include "content/public/common/content_client.h" | 17 #include "content/public/common/content_client.h" |
| 18 #include "content/public/common/content_switches.h" | |
| 17 #include "jni/AwSettings_jni.h" | 19 #include "jni/AwSettings_jni.h" |
| 18 #include "webkit/common/user_agent/user_agent.h" | 20 #include "webkit/common/user_agent/user_agent.h" |
| 19 #include "webkit/common/webpreferences.h" | 21 #include "webkit/common/webpreferences.h" |
| 20 | 22 |
| 21 using base::android::ConvertJavaStringToUTF16; | 23 using base::android::ConvertJavaStringToUTF16; |
| 22 using base::android::ConvertUTF8ToJavaString; | 24 using base::android::ConvertUTF8ToJavaString; |
| 23 using base::android::ScopedJavaLocalRef; | 25 using base::android::ScopedJavaLocalRef; |
| 24 | 26 |
| 25 namespace android_webview { | 27 namespace android_webview { |
| 26 | 28 |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 305 web_prefs->viewport_meta_non_user_scalable_quirk = support_quirks; | 307 web_prefs->viewport_meta_non_user_scalable_quirk = support_quirks; |
| 306 web_prefs->viewport_meta_zero_values_quirk = support_quirks; | 308 web_prefs->viewport_meta_zero_values_quirk = support_quirks; |
| 307 web_prefs->clobber_user_agent_initial_scale_quirk = support_quirks; | 309 web_prefs->clobber_user_agent_initial_scale_quirk = support_quirks; |
| 308 web_prefs->ignore_main_frame_overflow_hidden_quirk = support_quirks; | 310 web_prefs->ignore_main_frame_overflow_hidden_quirk = support_quirks; |
| 309 web_prefs->report_screen_size_in_physical_pixels_quirk = support_quirks; | 311 web_prefs->report_screen_size_in_physical_pixels_quirk = support_quirks; |
| 310 | 312 |
| 311 web_prefs->password_echo_enabled = | 313 web_prefs->password_echo_enabled = |
| 312 Java_AwSettings_getPasswordEchoEnabledLocked(env, obj); | 314 Java_AwSettings_getPasswordEchoEnabledLocked(env, obj); |
| 313 web_prefs->spatial_navigation_enabled = | 315 web_prefs->spatial_navigation_enabled = |
| 314 Java_AwSettings_getSpatialNavigationLocked(env, obj); | 316 Java_AwSettings_getSpatialNavigationLocked(env, obj); |
| 317 | |
| 318 web_prefs->accelerated_2d_canvas_enabled = | |
| 319 !CommandLine::ForCurrentProcess()->HasSwitch( | |
|
mnaganov (inactive)
2014/01/17 09:56:22
I don't really like checking the command line on e
boliu
2014/01/17 14:58:49
I guess that's the right tradeoff. Added an instan
| |
| 320 switches::kDisableAccelerated2dCanvas) && | |
| 321 Java_AwSettings_getEnableSupportedHardwareAcceleratedFeatures(env, obj); | |
| 315 } | 322 } |
| 316 | 323 |
| 317 static jlong Init(JNIEnv* env, | 324 static jlong Init(JNIEnv* env, |
| 318 jobject obj, | 325 jobject obj, |
| 319 jlong web_contents) { | 326 jlong web_contents) { |
| 320 AwSettings* settings = new AwSettings(env, obj, web_contents); | 327 AwSettings* settings = new AwSettings(env, obj, web_contents); |
| 321 return reinterpret_cast<intptr_t>(settings); | 328 return reinterpret_cast<intptr_t>(settings); |
| 322 } | 329 } |
| 323 | 330 |
| 324 static jstring GetDefaultUserAgent(JNIEnv* env, jclass clazz) { | 331 static jstring GetDefaultUserAgent(JNIEnv* env, jclass clazz) { |
| 325 return base::android::ConvertUTF8ToJavaString( | 332 return base::android::ConvertUTF8ToJavaString( |
| 326 env, content::GetUserAgent(GURL())).Release(); | 333 env, content::GetUserAgent(GURL())).Release(); |
| 327 } | 334 } |
| 328 | 335 |
| 329 bool RegisterAwSettings(JNIEnv* env) { | 336 bool RegisterAwSettings(JNIEnv* env) { |
| 330 return RegisterNativesImpl(env) >= 0; | 337 return RegisterNativesImpl(env) >= 0; |
| 331 } | 338 } |
| 332 | 339 |
| 333 } // namespace android_webview | 340 } // namespace android_webview |
| OLD | NEW |