Places/AsyncAPIsForSync: Difference between revisions

→‎Detailed Proposal: History proposal
(→‎Notes and feedback on Proposal: Bookmark API Feedback (responding to philikon))
(→‎Detailed Proposal: History proposal)
Line 296: Line 296:
==Detailed Proposal==
==Detailed Proposal==


Introduce
interface nsIVisitInfo : nsISupports
{
  // visit id (moz_historyvisits.id)
  readonly long long id;
  readonly PRTime date;
  readonly long transitionType;
}


* addVisitsAsync(uri, title, [array of visits], callback)
interface nsIPlaceInfo : nsISupports
{
  // place id
  readonly long long id;
  readonly nsIURI uri;
  readonly AString title;
  readonly ACString guid;
  /**
    * An array of nsIVisitInfo objects for the place.
    */
  readonly nsIVariant visits;
}


TODO flesh out
interface nsIPlaceInfoCallback : nsISupports
{
  /**
    * Called when one of the visit methods has added a visit.
    *
    * @param aResultCode
    *        nsresult of the visit addition.  Success indicated by Components.isSuccessCode(aResultCode).
    * @param aPlaceInfo
    *        The information about the visit.
    */
  void onComplete(in nsresult aResultCode,
                  in nsIPlaceInfo aPlaceInfo);
}
 
/**
  * Adds a set of visits for a place info object.  The callback is called once for each visit.  Ignores duplicates.  Also updates the guid or title.
  *
  * @param aPlaceInfo
  *        Information about the place to add.
  * @param [optional] aCallback
  *        Callback to be notified.
  */
void updatePlaceAndAddVisits(in nsIPlaceInfo aPlaceInfo,
                              [optional] in nsIVisitInfoCallback aCallback);
 
 
/**
  * Just like updatePlaceAndAddVisits.
  *
  * @param aPlaceInfos
  *        Information about the places to add.
  * @param aPlaces
  *        The number of aPlaceInfos.
  * @param [optional] aCallback
  *        Callback to be notified.
  */
void updatePlacesAndAddVisits([array, size_is(aPlaces)] in nsIPlaceInfo aPlaceInfos,
                              in unsigned long aPlaces,
                              [optional] in nsIVisitInfoCallback aCallback);
590

edits