B2G/gecko/browser/components/places/src/PlacesUIUtils.jsm
/**
   * Constructs a Transaction for the drop or paste of a blob of data into
   * a container.
   * @param   data
   *          The unwrapped data blob of dropped or pasted data.
   * @param   type
   *          The content type of the data
   * @param   container
   *          The container the data was dropped or pasted into
   * @param   index
   *          The index within the container the item was dropped or pasted at
   * @param   copy
   *          The drag action was copy, so don't move folders or links.
   * @returns An object implementing nsITransaction that can perform
   *          the move/insert.
   */
Constructs a Transaction for the drop or paste of a blob of data into
a container.
@param   data
The unwrapped data blob of dropped or pasted data.
@param   type
The content type of the data
@param   container
The container the data was dropped or pasted into
@param   index
The index within the container the item was dropped or pasted at
@param   copy
The drag action was copy, so don't move folders or links.
@returns An object implementing nsITransaction that can perform
the move/insert.
Constructs a Transaction for the drop or paste of a blob of data into a container . @param data The unwrapped data blob of dropped or pasted data . @param type The content type of the data @param container The container the data was dropped or pasted into @param index The index within the container the item was dropped or pasted at @param copy The drag action was copy so don ' t move folders or links . @returns An object implementing nsITransaction that can perform the move / insert .
function PUIU_makeTransaction(data, type, container, index, copy)
  {
    switch (data.type) {
      case PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER:
        if (copy) {
          return this._getFolderCopyTransaction(data, container, index);
        }
        return new PlacesMoveItemTransaction(data.id, container, index);
        break;
      case PlacesUtils.TYPE_X_MOZ_PLACE:
        if (copy || data.id == -1) { 
          return this._getURIItemCopyTransaction(data, container, index);
        }
        return new PlacesMoveItemTransaction(data.id, container, index);
        break;
      case PlacesUtils.TYPE_X_MOZ_PLACE_SEPARATOR:
        if (copy) {
          return new PlacesCreateSeparatorTransaction(container, index);
        }
        return new PlacesMoveItemTransaction(data.id, container, index);
        break;
      default:
        if (type == PlacesUtils.TYPE_X_MOZ_URL ||
            type == PlacesUtils.TYPE_UNICODE ||
            type == this.TYPE_TAB_DROP) {
          let title = type != PlacesUtils.TYPE_UNICODE ? data.title
                                                       : data.uri;
          return new PlacesCreateBookmarkTransaction(PlacesUtils._uri(data.uri),
                                                     container, index, title);
        }
    }
    return null;
  }
function PUIU_makeTransaction ( data , type , container , index , copy ) { switch ( data . type ) { case PlacesUtils . TYPE_X_MOZ_PLACE_CONTAINER : if ( copy ) { return this . _getFolderCopyTransaction ( data , container , index ) ; } return new PlacesMoveItemTransaction ( data . id , container , index ) ; break ; case PlacesUtils . TYPE_X_MOZ_PLACE : if ( copy || data . id == - 1 ) { return this . _getURIItemCopyTransaction ( data , container , index ) ; } return new PlacesMoveItemTransaction ( data . id , container , index ) ; break ; case PlacesUtils . TYPE_X_MOZ_PLACE_SEPARATOR : if ( copy ) { return new PlacesCreateSeparatorTransaction ( container , index ) ; } return new PlacesMoveItemTransaction ( data . id , container , index ) ; break ; default : if ( type == PlacesUtils . TYPE_X_MOZ_URL || type == PlacesUtils . TYPE_UNICODE || type == this . TYPE_TAB_DROP ) { let title = type != PlacesUtils . TYPE_UNICODE ? data . title : data . uri ; return new PlacesCreateBookmarkTransaction ( PlacesUtils . _uri ( data . uri ) , container , index , title ) ; } } return null ; }
Constructs a Transaction for the drop or paste of a blob of data into
 a container.
Constructs a Transaction for the drop or paste of a blob of data into a container .
// Otherwise move the item. // Id is -1 if the place is not bookmarked. // Otherwise move the item. // There is no data in a separator, so copying it just amounts to // inserting a new separator. // Otherwise move the item.