merge
authorBenjamin Stover <bstover@mozilla.com>
Mon, 13 Sep 2010 18:15:42 -0700
changeset 66648 90463b6b0cf83bfe5d193d86e2caf66037b98338
parent 66647 ecb37b7fc1826b8128b1b9fb5a9b6a0e46087f58 (current diff)
parent 66577 a9db71caa4e759f8249775d0e137022006cf322e (diff)
child 66649 f865a1973d750f3cedce1226e856b3e42fd30bf7
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
merge
mobile/chrome/content/browser-ui.js
--- a/mobile/app/profile/extensions/Makefile.in
+++ b/mobile/app/profile/extensions/Makefile.in
@@ -39,21 +39,21 @@ DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/rules.mk
 
-ifeq (beta,$(MOZ_UPDATE_CHANNEL))
+#ifeq (beta,$(MOZ_UPDATE_CHANNEL))
 EXTENSIONS = \
   feedback@mobile.mozilla.org \
   $(NULL)
 
 define _INSTALL_EXTENSIONS
 $(PYTHON) $(topsrcdir)/config/nsinstall.py $(wildcard $(srcdir)/$(dir)/*) $(DIST)/bin/extensions/$(dir)
 
 endef # do not remove the blank line!
 
 libs::
 	$(foreach dir,$(EXTENSIONS),$(_INSTALL_EXTENSIONS))
-endif
+#endif
--- a/mobile/chrome/content/browser-ui.js
+++ b/mobile/chrome/content/browser-ui.js
@@ -1190,48 +1190,58 @@ var PageActions = {
     });
 
     let lm = this._loginManager;
     if (!lm.getLoginSavingEnabled(host.prePath))
       lm.setLoginSavingEnabled(host.prePath, true);
   },
 
   savePageAsPDF: function saveAsPDF() {
+    let browser = Browser.selectedBrowser;
+    let fileName = getDefaultFileName(browser.contentTitle, browser.documentURI, null, null);
+    fileName = fileName.trim() + ".pdf";
+#ifdef MOZ_PLATFORM_MAEMO
+    fileName = fileName.replace(/[\*\:\?]+/g, " ");
+#endif
+
+    let dm = Cc["@mozilla.org/download-manager;1"].getService(Ci.nsIDownloadManager);
+    let downloadsDir = dm.defaultDownloadsDirectory;
+
+#ifdef ANDROID
+    let file = downloadsDir.clone();
+    file.append(fileName);
+#else
     let strings = Elements.browserBundle;
     let picker = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
     picker.init(window, strings.getString("pageactions.saveas.pdf"), Ci.nsIFilePicker.modeSave);
     picker.appendFilter("PDF", "*.pdf");
     picker.defaultExtension = "pdf";
 
-    let browser = Browser.selectedBrowser;
-    let fileName = getDefaultFileName(browser.contentTitle, browser.documentURI, null, null);
-    fileName = fileName.trim();
-#ifdef MOZ_PLATFORM_MAEMO
-    fileName = fileName.replace(/[\*\:\?]+/g, " ");
-#endif
-    picker.defaultString = fileName + ".pdf";
-
-    let dm = Cc["@mozilla.org/download-manager;1"].getService(Ci.nsIDownloadManager);
-    picker.displayDirectory = dm.defaultDownloadsDirectory;
+    picker.defaultString = fileName;
+
+    picker.displayDirectory = downloadsDir;
     let rv = picker.show();
     if (rv == Ci.nsIFilePicker.returnCancel)
       return;
 
+    let file = picker.file;
+#endif
+
     // We must manually add this to the download system
     let db = dm.DBConnection;
 
     let stmt = db.createStatement(
       "INSERT INTO moz_downloads (name, source, target, startTime, endTime, state, referrer) " +
       "VALUES (:name, :source, :target, :startTime, :endTime, :state, :referrer)"
     );
 
-    let current = Browser.selectedBrowser.currentURI.spec;
-    stmt.params.name = picker.file.leafName;
+    let current = browser.currentURI.spec;
+    stmt.params.name = file.leafName;
     stmt.params.source = current;
-    stmt.params.target = Services.io.newFileURI(picker.file).spec;
+    stmt.params.target = Services.io.newFileURI(file).spec;
     stmt.params.startTime = Date.now() * 1000;
     stmt.params.endTime = Date.now() * 1000;
     stmt.params.state = Ci.nsIDownloadManager.DOWNLOAD_NOTSTARTED;
     stmt.params.referrer = current;
     stmt.execute();
     stmt.finalize();
 
     let newItemId = db.lastInsertRowID;
@@ -1241,17 +1251,17 @@ var PageActions = {
     }
     catch(e) {}
     Services.obs.notifyObservers(download, "dl-start", null);
 
     let data = {
       type: Ci.nsIPrintSettings.kOutputFormatPDF,
       id: newItemId,
       referrer: current,
-      filePath: picker.file.path
+      filePath: file.path
     };
 
     Browser.selectedBrowser.messageManager.sendAsyncMessage("Browser:SaveAs", data);
   },
 
   updatePageSaveAs: function updatePageSaveAs(aNode) {
     // Check for local XUL content
     let contentDocument = Browser.selectedBrowser.contentDocument;