| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 package org.chromium.chrome.browser.accessibility; | 5 package org.chromium.chrome.browser.accessibility; |
| 6 | 6 |
| 7 import android.annotation.SuppressLint; |
| 7 import android.content.Context; | 8 import android.content.Context; |
| 8 import android.content.SharedPreferences; | 9 import android.content.SharedPreferences; |
| 9 | 10 |
| 10 import org.chromium.base.ContextUtils; | 11 import org.chromium.base.ContextUtils; |
| 11 import org.chromium.base.ObserverList; | 12 import org.chromium.base.ObserverList; |
| 12 import org.chromium.base.ThreadUtils; | 13 import org.chromium.base.ThreadUtils; |
| 13 import org.chromium.base.VisibleForTesting; | 14 import org.chromium.base.VisibleForTesting; |
| 14 import org.chromium.base.annotations.CalledByNative; | 15 import org.chromium.base.annotations.CalledByNative; |
| 15 import org.chromium.chrome.browser.util.MathUtils; | 16 import org.chromium.chrome.browser.util.MathUtils; |
| 16 | 17 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 31 * setting is on (i.e. this value should be the same as or lesser than the f
ont size scale used | 32 * setting is on (i.e. this value should be the same as or lesser than the f
ont size scale used |
| 32 * by accessiblity large text). | 33 * by accessiblity large text). |
| 33 */ | 34 */ |
| 34 public static final float FORCE_ENABLE_ZOOM_THRESHOLD_MULTIPLIER = 1.3f; | 35 public static final float FORCE_ENABLE_ZOOM_THRESHOLD_MULTIPLIER = 1.3f; |
| 35 | 36 |
| 36 private static final float EPSILON = 0.001f; | 37 private static final float EPSILON = 0.001f; |
| 37 | 38 |
| 38 static final String PREF_USER_SET_FORCE_ENABLE_ZOOM = "user_set_force_enable
_zoom"; | 39 static final String PREF_USER_SET_FORCE_ENABLE_ZOOM = "user_set_force_enable
_zoom"; |
| 39 static final String PREF_USER_FONT_SCALE_FACTOR = "user_font_scale_factor"; | 40 static final String PREF_USER_FONT_SCALE_FACTOR = "user_font_scale_factor"; |
| 40 | 41 |
| 42 // TODO(crbug.com/635567): Fix this properly. |
| 43 @SuppressLint("StaticFieldLeak") |
| 41 private static FontSizePrefs sFontSizePrefs; | 44 private static FontSizePrefs sFontSizePrefs; |
| 42 | 45 |
| 43 private final long mFontSizePrefsAndroidPtr; | 46 private final long mFontSizePrefsAndroidPtr; |
| 44 private final Context mApplicationContext; | 47 private final Context mApplicationContext; |
| 45 private final SharedPreferences mSharedPreferences; | 48 private final SharedPreferences mSharedPreferences; |
| 46 private final ObserverList<FontSizePrefsObserver> mObserverList; | 49 private final ObserverList<FontSizePrefsObserver> mObserverList; |
| 47 | 50 |
| 48 private Float mSystemFontScaleForTests; | 51 private Float mSystemFontScaleForTests; |
| 49 | 52 |
| 50 /** | 53 /** |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 } | 219 } |
| 217 } | 220 } |
| 218 | 221 |
| 219 private native long nativeInit(); | 222 private native long nativeInit(); |
| 220 private native void nativeSetFontScaleFactor(long nativeFontSizePrefsAndroid
, | 223 private native void nativeSetFontScaleFactor(long nativeFontSizePrefsAndroid
, |
| 221 float fontScaleFactor); | 224 float fontScaleFactor); |
| 222 private native float nativeGetFontScaleFactor(long nativeFontSizePrefsAndroi
d); | 225 private native float nativeGetFontScaleFactor(long nativeFontSizePrefsAndroi
d); |
| 223 private native boolean nativeGetForceEnableZoom(long nativeFontSizePrefsAndr
oid); | 226 private native boolean nativeGetForceEnableZoom(long nativeFontSizePrefsAndr
oid); |
| 224 private native void nativeSetForceEnableZoom(long nativeFontSizePrefsAndroid
, boolean enabled); | 227 private native void nativeSetForceEnableZoom(long nativeFontSizePrefsAndroid
, boolean enabled); |
| 225 } | 228 } |
| OLD | NEW |