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

Unified Diff: components/dom_distiller/core/distilled_page_prefs_observer_wrapper.cc

Issue 403323005: Observer Support for DistilledPagePrefs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: formatting Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: components/dom_distiller/core/distilled_page_prefs_observer_wrapper.cc
diff --git a/components/dom_distiller/core/distilled_page_prefs_observer_wrapper.cc b/components/dom_distiller/core/distilled_page_prefs_observer_wrapper.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6c67238d2776091af11e9cf0fc57769204b1bc00
--- /dev/null
+++ b/components/dom_distiller/core/distilled_page_prefs_observer_wrapper.cc
@@ -0,0 +1,39 @@
+#include "base/android/jni_weak_ref.h"
+#include "components/dom_distiller/core/distilled_page_prefs.h"
+#include "components/dom_distiller/core/distilled_page_prefs_observer_wrapper.h"
+
+#include "jni/DistilledPagePrefsObserverWrapper_jni.h"
+
+namespace dom_distiller {
+
+DistilledPagePrefsObserverWrapper::DistilledPagePrefsObserverWrapper(
+ JNIEnv* env,
+ jobject obj) {
+ java_ref_.Reset(env, obj);
+}
+
+DistilledPagePrefsObserverWrapper::~DistilledPagePrefsObserverWrapper() {
+}
+
+bool DistilledPagePrefsObserverWrapper::Register(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+void DistilledPagePrefsObserverWrapper::Destroy(JNIEnv* env, jobject obj) {
+ delete this;
+}
+
+void DistilledPagePrefsObserverWrapper::OnChangeTheme(
+ DistilledPagePrefs::Theme new_theme) {
+ JNIEnv* env = base::android::AttachCurrentThread();
+ Java_DistilledPagePrefsObserverWrapper_onChangeTheme(
+ env, java_ref_.obj(), (int)new_theme);
+}
+
+jlong Init(JNIEnv* env, jobject obj) {
+ DistilledPagePrefsObserverWrapper* native_observer_wrapper_ =
nyquist 2014/07/22 22:51:37 the _ suffix is only for members.
sunangel 2014/07/23 16:22:04 Done.
+ new DistilledPagePrefsObserverWrapper(env, obj);
+ return reinterpret_cast<intptr_t>(native_observer_wrapper_);
+}
+
+} // namespace dom_distiller

Powered by Google App Engine
This is Rietveld 408576698