Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: android_webview/native/aw_settings.cc

Issue 140753006: [Android WebView] Turn on accelerated canvas based on View.isHardwareAccelerated (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « android_webview/native/aw_settings.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 11 matching lines...) Expand all
38 return data ? data->settings_ : NULL; 40 return data ? data->settings_ : NULL;
39 } 41 }
40 42
41 private: 43 private:
42 AwSettings* settings_; 44 AwSettings* settings_;
43 }; 45 };
44 46
45 AwSettings::AwSettings(JNIEnv* env, jobject obj, jlong web_contents) 47 AwSettings::AwSettings(JNIEnv* env, jobject obj, jlong web_contents)
46 : WebContentsObserver( 48 : WebContentsObserver(
47 reinterpret_cast<content::WebContents*>(web_contents)), 49 reinterpret_cast<content::WebContents*>(web_contents)),
50 accelerated_2d_canvas_disabled_by_switch_(
51 CommandLine::ForCurrentProcess()->HasSwitch(
52 switches::kDisableAccelerated2dCanvas)),
48 aw_settings_(env, obj) { 53 aw_settings_(env, obj) {
49 reinterpret_cast<content::WebContents*>(web_contents)-> 54 reinterpret_cast<content::WebContents*>(web_contents)->
50 SetUserData(kAwSettingsUserDataKey, new AwSettingsUserData(this)); 55 SetUserData(kAwSettingsUserDataKey, new AwSettingsUserData(this));
51 } 56 }
52 57
53 AwSettings::~AwSettings() { 58 AwSettings::~AwSettings() {
54 if (web_contents()) { 59 if (web_contents()) {
55 web_contents()->SetUserData(kAwSettingsUserDataKey, NULL); 60 web_contents()->SetUserData(kAwSettingsUserDataKey, NULL);
56 } 61 }
57 62
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 web_prefs->viewport_meta_non_user_scalable_quirk = support_quirks; 310 web_prefs->viewport_meta_non_user_scalable_quirk = support_quirks;
306 web_prefs->viewport_meta_zero_values_quirk = support_quirks; 311 web_prefs->viewport_meta_zero_values_quirk = support_quirks;
307 web_prefs->clobber_user_agent_initial_scale_quirk = support_quirks; 312 web_prefs->clobber_user_agent_initial_scale_quirk = support_quirks;
308 web_prefs->ignore_main_frame_overflow_hidden_quirk = support_quirks; 313 web_prefs->ignore_main_frame_overflow_hidden_quirk = support_quirks;
309 web_prefs->report_screen_size_in_physical_pixels_quirk = support_quirks; 314 web_prefs->report_screen_size_in_physical_pixels_quirk = support_quirks;
310 315
311 web_prefs->password_echo_enabled = 316 web_prefs->password_echo_enabled =
312 Java_AwSettings_getPasswordEchoEnabledLocked(env, obj); 317 Java_AwSettings_getPasswordEchoEnabledLocked(env, obj);
313 web_prefs->spatial_navigation_enabled = 318 web_prefs->spatial_navigation_enabled =
314 Java_AwSettings_getSpatialNavigationLocked(env, obj); 319 Java_AwSettings_getSpatialNavigationLocked(env, obj);
320
321 web_prefs->accelerated_2d_canvas_enabled =
322 !accelerated_2d_canvas_disabled_by_switch_ &&
323 Java_AwSettings_getEnableSupportedHardwareAcceleratedFeaturesLocked(
324 env, obj);
315 } 325 }
316 326
317 static jlong Init(JNIEnv* env, 327 static jlong Init(JNIEnv* env,
318 jobject obj, 328 jobject obj,
319 jlong web_contents) { 329 jlong web_contents) {
320 AwSettings* settings = new AwSettings(env, obj, web_contents); 330 AwSettings* settings = new AwSettings(env, obj, web_contents);
321 return reinterpret_cast<intptr_t>(settings); 331 return reinterpret_cast<intptr_t>(settings);
322 } 332 }
323 333
324 static jstring GetDefaultUserAgent(JNIEnv* env, jclass clazz) { 334 static jstring GetDefaultUserAgent(JNIEnv* env, jclass clazz) {
325 return base::android::ConvertUTF8ToJavaString( 335 return base::android::ConvertUTF8ToJavaString(
326 env, content::GetUserAgent(GURL())).Release(); 336 env, content::GetUserAgent(GURL())).Release();
327 } 337 }
328 338
329 bool RegisterAwSettings(JNIEnv* env) { 339 bool RegisterAwSettings(JNIEnv* env) {
330 return RegisterNativesImpl(env) >= 0; 340 return RegisterNativesImpl(env) >= 0;
331 } 341 }
332 342
333 } // namespace android_webview 343 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/native/aw_settings.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698