Chromium Code Reviews| Index: chrome/browser/accessibility/font_size_prefs_android.h |
| diff --git a/chrome/browser/accessibility/font_size_prefs_android.h b/chrome/browser/accessibility/font_size_prefs_android.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d45c58286a19971e4a77e675127006c2f4d61a51 |
| --- /dev/null |
| +++ b/chrome/browser/accessibility/font_size_prefs_android.h |
| @@ -0,0 +1,68 @@ |
| +// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_ACCESSIBILITY_FONT_SIZE_PREFS_ANDROID_H_ |
| +#define CHROME_BROWSER_ACCESSIBILITY_FONT_SIZE_PREFS_ANDROID_H_ |
| + |
| +#include <jni.h> |
| +#include "base/android/scoped_java_ref.h" |
| +#include "base/observer_list.h" |
| + |
| +class PrefChangeRegistrar; |
| +class PrefService; |
| +class Profile; |
| + |
| +class FontSizePrefsAndroid { |
|
nyquist
2014/08/06 23:39:26
What does this class do? Does it have a correspond
sunangel
2014/08/07 18:50:54
Tried to describe it better...again not sure if it
|
| + public: |
| + class Observer { |
| + public: |
| + virtual void OnChangeFontSize(float font) = 0; |
| + virtual void OnChangeForceEnableZoom(bool enabled) = 0; |
| + }; |
| + |
| + FontSizePrefsAndroid(JNIEnv* env, jobject obj, Profile* profile); |
| + ~FontSizePrefsAndroid(); |
| + void Destroy(JNIEnv* env, jobject obj); |
| + |
| + void SetFontScaleFactor(JNIEnv* env, jobject obj, jfloat font); |
| + float GetFontScaleFactor(JNIEnv* env, jobject obj); |
| + void SetForceEnableZoom(JNIEnv* env, jobject obj, jboolean enabled); |
| + bool GetForceEnableZoom(JNIEnv* env, jobject obj); |
| + |
| + void AddObserver(JNIEnv* env, jobject obj, jlong obs); |
| + void RemoveObserver(JNIEnv* env, jobject obj, jlong obs); |
| + |
| + static bool Register(JNIEnv* env); |
| + |
| + private: |
| + // Callback for FontScaleFactor changes from pref change registrar. |
| + void OnFontScaleFactorPrefsChanged(); |
| + // Callback for ForceEnableZoom changes from pref change registrar. |
| + void OnForceEnableZoomPrefsChanged(); |
| + |
| + scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; |
| + PrefService* const pref_service_; |
| + ObserverList<Observer> observers_; |
| + base::android::ScopedJavaGlobalRef<jobject> java_ref_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(FontSizePrefsAndroid); |
| +}; |
| + |
| +class FontSizePrefsObserverAndroid : public FontSizePrefsAndroid::Observer { |
|
nyquist
2014/08/06 23:39:26
same as above? Refer to Java class?
sunangel
2014/08/07 18:50:54
Done.
|
| + public: |
| + FontSizePrefsObserverAndroid(JNIEnv* env, jobject obj); |
| + virtual ~FontSizePrefsObserverAndroid(); |
| + void DestroyObserverAndroid(JNIEnv* env, jobject obj); |
| + |
| + static bool Register(JNIEnv* env); |
| + |
| + // FontSizePrefs::Observer implementation. |
| + virtual void OnChangeFontSize(float font) OVERRIDE; |
| + virtual void OnChangeForceEnableZoom(bool enabled) OVERRIDE; |
| + |
| + private: |
| + base::android::ScopedJavaGlobalRef<jobject> java_ref_; |
| +}; |
| + |
| +#endif // CHROME_BROWSER_ACCESSIBILITY_FONT_SIZE_PREFS_ANDROID_H_ |