Bug 935273 - Force nocrop property in FilePicker for b2g. r=fabrice
authorAndrea Marchesini <amarchesini@mozilla.com>
Mon, 02 Dec 2013 22:37:03 -0500
changeset 174105 ed9645b3d6eca189e60310a85c1194dfe0e5790c
parent 174104 695c337d555f6c1c1c8a6b75c2bca2fb3d701294
child 174106 4d198cb36af0b6b759f22f12a972ff7c95c3d643
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfabrice
bugs935273
milestone28.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 935273 - Force nocrop property in FilePicker for b2g. r=fabrice
b2g/components/FilePicker.js
--- a/b2g/components/FilePicker.js
+++ b/b2g/components/FilePicker.js
@@ -42,16 +42,17 @@ function FilePicker() {
 
 FilePicker.prototype = {
   classID: Components.ID('{436ff8f9-0acc-4b11-8ec7-e293efba3141}'),
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIFilePicker]),
 
   /* members */
 
   mParent: undefined,
+  mExtraProps: {},
   mFilterTypes: [],
   mFileEnumerator: undefined,
   mFilePickerShownCallback: undefined,
 
   /* methods */
 
   init: function(parent, title, mode) {
     this.mParent = parent;
@@ -80,16 +81,18 @@ FilePicker.prototype = {
   },
 
   appendFilters: function(filterMask) {
     // Ci.nsIFilePicker.filterHTML is not supported
     // Ci.nsIFilePicker.filterText is not supported
 
     if (filterMask & Ci.nsIFilePicker.filterImages) {
       this.mFilterTypes = this.mFilterTypes.concat(IMAGE_FILTERS);
+      // This property is needed for the gallery app pick activity.
+      this.mExtraProps['nocrop'] = true;
     }
 
     // Ci.nsIFilePicker.filterXML is not supported
     // Ci.nsIFilePicker.filterXUL is not supported
     // Ci.nsIFilePicker.filterApps is not supported
     // Ci.nsIFilePicker.filterAllowURLs is not supported
 
     if (filterMask & Ci.nsIFilePicker.filterVideo) {
@@ -112,16 +115,22 @@ FilePicker.prototype = {
 
     cpmm.addMessageListener('file-picked', this);
 
     let detail = {};
     if (this.mFilterTypes) {
        detail.type = this.mFilterTypes;
     }
 
+    for (let prop in this.mExtraProps) {
+      if (!(prop in detail)) {
+        detail[prop] = this.mExtraProps[prop];
+      }
+    }
+
     cpmm.sendAsyncMessage('file-picker', detail);
   },
 
   fireSuccess: function(file) {
     this.mFilesEnumerator = {
       QueryInterface: XPCOMUtils.generateQI([Ci.nsISimpleEnumerator]),
 
       mFiles: [file],