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

Unified Diff: components/dom_distiller/android/java/src/org/chromium/components/dom_distiller/core/DistilledPagePrefsObserverWrapper.java

Issue 403323005: Observer Support for DistilledPagePrefs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added removeObserver after test is done, styling 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/android/java/src/org/chromium/components/dom_distiller/core/DistilledPagePrefsObserverWrapper.java
diff --git a/components/dom_distiller/android/java/src/org/chromium/components/dom_distiller/core/DistilledPagePrefsObserverWrapper.java b/components/dom_distiller/android/java/src/org/chromium/components/dom_distiller/core/DistilledPagePrefsObserverWrapper.java
new file mode 100644
index 0000000000000000000000000000000000000000..4e457eb065dd84f658a6ae238d3907379b226475
--- /dev/null
+++ b/components/dom_distiller/android/java/src/org/chromium/components/dom_distiller/core/DistilledPagePrefsObserverWrapper.java
@@ -0,0 +1,36 @@
+// Copyright 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.
+
+package org.chromium.components.dom_distiller.core;
+
+import org.chromium.base.CalledByNative;
+import org.chromium.base.JNINamespace;
+
+/**
+ * Wrapper for the dom_distiller::DistilledPagePrefsObserverWrapper.
+ */
+@JNINamespace("dom_distiller")
+public class DistilledPagePrefsObserverWrapper {
+
+ final DistilledPagePrefs.Observer mDistilledPagePrefsObserver;
robliao 2014/07/21 21:05:09 This should probably be private.
sunangel 2014/07/21 22:43:55 Done.
+ long nativeDistilledPagePrefsObserverWrapperPtr;
+
+ DistilledPagePrefsObserverWrapper(DistilledPagePrefs.Observer observer) {
+ nativeDistilledPagePrefsObserverWrapperPtr = nativeInit();
+ mDistilledPagePrefsObserver = observer;
+ }
+
+ @CalledByNative
+ private void onChangeTheme(int theme) {
+ mDistilledPagePrefsObserver.onChangeTheme(Theme.getThemeForValue(theme));
+ }
+
+ public long getNativePtr() {
+ return nativeDistilledPagePrefsObserverWrapperPtr;
+ }
+
+ private native long nativeInit();
+
+ private native void nativeDestroy(long nativeDistilledPagePrefsObserverWrapper);
+}

Powered by Google App Engine
This is Rietveld 408576698