diff --git a/browser/metro/base/content/browser-ui.js b/browser/metro/base/content/browser-ui.js index 23dbe6ffc32..8311620b2e2 100644 --- a/browser/metro/base/content/browser-ui.js +++ b/browser/metro/base/content/browser-ui.js @@ -758,6 +758,28 @@ var BrowserUI = { } }, + openFile: function() { + try { + const nsIFilePicker = Ci.nsIFilePicker; + let fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker); + let self = this; + let fpCallback = function fpCallback_done(aResult) { + if (aResult == nsIFilePicker.returnOK) { + self.goToURI(fp.fileURL.spec); + } + }; + + let windowTitle = Strings.browser.GetStringFromName("browserForOpenLocation"); + fp.init(window, windowTitle, nsIFilePicker.modeOpen); + fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filterText | + nsIFilePicker.filterImages | nsIFilePicker.filterXML | + nsIFilePicker.filterHTML); + fp.open(fpCallback); + } catch (ex) { + dump ('BrowserUI openFile exception: ' + ex + '\n'); + } + }, + receiveMessage: function receiveMessage(aMessage) { let browser = aMessage.target; let json = aMessage.json; @@ -812,6 +834,7 @@ var BrowserUI = { case "cmd_zoomout": case "cmd_volumeLeft": case "cmd_volumeRight": + case "cmd_openFile": isSupported = true; break; default: @@ -935,6 +958,9 @@ var BrowserUI = { // Zoom out (portrait) or in (landscape) Browser.zoom(Util.isPortrait() ? 1 : -1); break; + case "cmd_openFile": + this.openFile(); + break; } } }; diff --git a/browser/metro/base/content/browser.xul b/browser/metro/base/content/browser.xul index e8db2dbbd92..574c2f77d7c 100644 --- a/browser/metro/base/content/browser.xul +++ b/browser/metro/base/content/browser.xul @@ -67,6 +67,7 @@ + @@ -133,6 +134,7 @@ + diff --git a/browser/metro/locales/en-US/chrome/browser.properties b/browser/metro/locales/en-US/chrome/browser.properties index e856861de74..672799e417c 100644 --- a/browser/metro/locales/en-US/chrome/browser.properties +++ b/browser/metro/locales/en-US/chrome/browser.properties @@ -21,6 +21,7 @@ helpOnlineCharm=Help (online) # General browserForSaveLocation=Save Location +browserForOpenLocation=Open Location # Download Manager downloadsUnknownSize=Unknown size