Bug 788157 - Enable sharing while on Reader Mode (r=mfinkle)
authorLucas Rocha <lucasr@mozilla.com>
Tue, 11 Sep 2012 18:51:44 +0100
changeset 106821 c11b2042ea31fb449ec6c56aad67d18af0e1af72
parent 106820 dfe4be63821bd61d7b81b731c01ef6209d0141f4
child 106822 de4ea396bce32de48e0423eb0c6b083fd083ad28
push id23448
push userryanvm@gmail.com
push dateWed, 12 Sep 2012 01:39:22 +0000
treeherdermozilla-central@6e78c3efd115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs788157
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 788157 - Enable sharing while on Reader Mode (r=mfinkle)
mobile/android/base/BrowserApp.java
mobile/android/base/GeckoApp.java
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -781,18 +781,22 @@ abstract public class BrowserApp extends
         } else {
             readingList.setChecked(false);
             readingList.setIcon(R.drawable.ic_menu_reading_list_add);
         }
 
         forward.setEnabled(tab.canDoForward());
         desktopMode.setChecked(tab.getDesktopMode());
 
+        String url = tab.getURL();
+        if (ReaderModeUtils.isAboutReader(url))
+            url = ReaderModeUtils.getUrlFromAboutReader(url);
+
         // Disable share menuitem for about:, chrome:, file:, and resource: URIs
-        String scheme = Uri.parse(tab.getURL()).getScheme();
+        String scheme = Uri.parse(url).getScheme();
         share.setEnabled(!(scheme.equals("about") || scheme.equals("chrome") ||
                            scheme.equals("file") || scheme.equals("resource")));
 
         // Disable save as PDF for about:home and xul pages
         saveAsPDF.setEnabled(!(tab.getURL().equals("about:home") ||
                                tab.getContentType().equals("application/vnd.mozilla.xul+xml")));
 
         // Disable find in page for about:home, since it won't work on Java content
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -593,16 +593,19 @@ abstract public class GeckoApp
       Tab tab = Tabs.getInstance().getSelectedTab();
       if (tab == null)
         return;
 
       String url = tab.getURL();
       if (url == null)
           return;
 
+      if (ReaderModeUtils.isAboutReader(url))
+          url = ReaderModeUtils.getUrlFromAboutReader(url);
+
       GeckoAppShell.openUriExternal(url, "text/plain", "", "",
                                     Intent.ACTION_SEND, tab.getDisplayTitle());
     }
 
     protected void onSaveInstanceState(Bundle outState) {
         super.onSaveInstanceState(outState);
 
         Log.i(LOGTAG, "onSaveInstanceState");