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 #ifndef COMPONENTS_DOM_DISTILLER_CORE_DISTILLED_PAGE_PREFS_ANDROID_H_ | 5 #ifndef COMPONENTS_DOM_DISTILLER_CORE_DISTILLED_PAGE_PREFS_ANDROID_H_ |
6 #define COMPONENTS_DOM_DISTILLER_CORE_DISTILLED_PAGE_PREFS_ANDROID_H_ | 6 #define COMPONENTS_DOM_DISTILLER_CORE_DISTILLED_PAGE_PREFS_ANDROID_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
11 #include "components/dom_distiller/core/distilled_page_prefs.h" | 11 #include "components/dom_distiller/core/distilled_page_prefs.h" |
12 | 12 |
13 namespace dom_distiller { | 13 namespace dom_distiller { |
14 namespace android { | 14 namespace android { |
15 | 15 |
16 class DistilledPagePrefsAndroid { | 16 class DistilledPagePrefsAndroid { |
17 public: | 17 public: |
18 DistilledPagePrefsAndroid(JNIEnv* env, | 18 DistilledPagePrefsAndroid(JNIEnv* env, |
19 jobject obj, | 19 jobject obj, |
20 DistilledPagePrefs* distillerPagePrefsPtr); | 20 DistilledPagePrefs* distilled_page_prefs_ptr); |
21 virtual ~DistilledPagePrefsAndroid(); | 21 virtual ~DistilledPagePrefsAndroid(); |
22 static bool Register(JNIEnv* env); | 22 static bool Register(JNIEnv* env); |
23 void SetTheme(JNIEnv* env, jobject obj, jint theme); | 23 void SetTheme(JNIEnv* env, jobject obj, jint theme); |
24 jint GetTheme(JNIEnv* env, jobject obj); | 24 jint GetTheme(JNIEnv* env, jobject obj); |
| 25 void AddObserver(JNIEnv* env, jobject obj, jlong obs); |
| 26 void RemoveObserver(JNIEnv* env, jobject obj, jlong obs); |
25 | 27 |
26 private: | 28 private: |
27 DistilledPagePrefs* distilled_page_prefs_; | 29 DistilledPagePrefs* distilled_page_prefs_; |
28 | 30 |
29 DISALLOW_COPY_AND_ASSIGN(DistilledPagePrefsAndroid); | 31 DISALLOW_COPY_AND_ASSIGN(DistilledPagePrefsAndroid); |
30 }; | 32 }; |
31 | 33 |
| 34 class DistilledPagePrefsObserverAndroid : public DistilledPagePrefs::Observer { |
| 35 public: |
| 36 DistilledPagePrefsObserverAndroid(JNIEnv* env, jobject obj); |
| 37 virtual ~DistilledPagePrefsObserverAndroid(); |
| 38 |
| 39 // DistilledPagePrefs::Observer implementation. |
| 40 virtual void OnChangeTheme(DistilledPagePrefs::Theme new_theme) OVERRIDE; |
| 41 |
| 42 virtual void DestroyObserverAndroid(JNIEnv* env, jobject obj); |
| 43 |
| 44 private: |
| 45 base::android::ScopedJavaGlobalRef<jobject> java_ref_; |
| 46 }; |
| 47 |
32 } // namespace android | 48 } // namespace android |
33 } // namespace dom_distiller | 49 } // namespace dom_distiller |
34 | 50 |
35 #endif // COMPONENTS_DOM_DISTILLER_CORE_DISTILLED_PAGE_PREFS_ANDROID_H_ | 51 #endif // COMPONENTS_DOM_DISTILLER_CORE_DISTILLED_PAGE_PREFS_ANDROID_H_ |
OLD | NEW |