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

Unified Diff: chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java

Issue 183893029: Add UI hook for distilling web pages for test shell (relanding) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix DEPS after wrong rebase Created 6 years, 9 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: chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java
diff --git a/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java b/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java
index 64ac18997b5a8fccdef12cae817002b379c85386..e68e396813f89c8887068eae0321690f4d01e1b7 100644
--- a/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java
+++ b/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java
@@ -28,6 +28,7 @@ import org.chromium.chrome.browser.appmenu.AppMenuPropertiesDelegate;
import org.chromium.chrome.browser.printing.PrintingControllerFactory;
import org.chromium.chrome.browser.printing.TabPrinter;
import org.chromium.chrome.shell.sync.SyncController;
+import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils;
import org.chromium.content.browser.ActivityContentVideoViewClient;
import org.chromium.content.browser.BrowserStartupController;
import org.chromium.content.browser.ContentView;
@@ -42,6 +43,7 @@ import org.chromium.ui.base.WindowAndroid;
*/
public class ChromeShellActivity extends Activity implements AppMenuPropertiesDelegate {
private static final String TAG = "ChromeShellActivity";
+ private static final String CHROME_DISTILLER_SCHEME = "chrome-distiller";
private WindowAndroid mWindow;
private TabManager mTabManager;
@@ -233,6 +235,12 @@ public class ChromeShellActivity extends Activity implements AppMenuPropertiesDe
mPrintingController.startPrint(new TabPrinter(getActiveTab()));
}
return true;
+ case R.id.distill_page:
+ TestShellTab activeTab = getActiveTab();
+ String viewUrl = DomDistillerUrlUtils.getDistillerViewUrlFromUrl(
+ CHROME_DISTILLER_SCHEME, getActiveTab().getUrl());
+ activeTab.loadUrlWithSanitization(viewUrl);
+ return true;
case R.id.back_menu_id:
if (getActiveTab().canGoBack()) getActiveTab().goBack();
return true;
@@ -283,6 +291,9 @@ public class ChromeShellActivity extends Activity implements AppMenuPropertiesDe
menu.findItem(R.id.print).setVisible(ApiCompatibilityUtils.isPrintingSupported());
+ menu.findItem(R.id.distill_page).setVisible(
+ CommandLine.getInstance().hasSwitch(TestShellSwitches.ENABLE_DOM_DISTILLER));
+
menu.setGroupVisible(R.id.MAIN_MENU, true);
}
« no previous file with comments | « chrome/android/shell/DEPS ('k') | chrome/android/shell/java/src/org/chromium/chrome/shell/TestShellSwitches.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698