Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/dom_distiller/DomDistillerTabUtils.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/dom_distiller/DomDistillerTabUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/dom_distiller/DomDistillerTabUtils.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..06b75628985073bf2c1ec3234fc0baa18339bf50 |
| --- /dev/null |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/dom_distiller/DomDistillerTabUtils.java |
| @@ -0,0 +1,32 @@ |
| +// 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.chrome.browser.dom_distiller; |
| + |
| +import org.chromium.base.JNINamespace; |
| +import org.chromium.chrome.browser.Tab; |
| +import org.chromium.content_public.browser.WebContents; |
| + |
| +/** |
| + * A helper class for using the DOM Distiller. |
| + */ |
| +@JNINamespace("dom_distiller::tab_utils::android") |
| +public class DomDistillerTabUtils { |
| + |
| + private DomDistillerTabUtils() { |
| + } |
| + |
| + /** |
| + * Creates a new WebContents and navigates the {@link Tab} to view the URL of the current page, |
| + * while in the background starts distilling the current page. This method takes ownership |
| + * over the old WebContents after swapping in the new one. |
| + * |
| + * @param tab the {@link Tab} to distill and navigate. |
| + */ |
| + public static void distillCurrentPageAndView(Tab tab) { |
|
Yaron
2014/05/06 00:23:20
Just pass WebContents directly. Comment seems out
nyquist
2014/05/06 03:52:27
DomDistillerService should not depend on WebConten
nyquist
2014/05/15 10:15:35
Changed to take WebContents here.
|
| + nativeDistillCurrentPageAndViewJava(tab.getContentViewCore().getWebContents()); |
| + } |
| + |
| + private static native void nativeDistillCurrentPageAndViewJava(WebContents webContents); |
| +} |