Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
AESpyglassSuiteHandler Class Reference

#include <nsAESpyglassSuiteHandler.h>

Collaboration diagram for AESpyglassSuiteHandler:
Collaboration graph
[legend]

List of all members.

Public Types

enum  {
  kSuiteSignature = 'WWW!', kOpenURLEvent = 'OURL', kRegisterURLEchoEvent = 'RGUE', kUnregisterURLEchoEvent = 'UNRU',
  kRegisterViewerEvent = 'RGVW', kUnregisterViewerEvent = 'UNRV', kShowFileEvent = 'SHWF', kParseAnchorEvent = 'PRSA',
  kSpyActivateEvent = 'ACTV', kSpyListWindowsEvent = 'LSTW', kGetWindowInfoEvent = 'WNFO', kRegisterWinCloseEvent = 'RGWC',
  kUnregisterWinCloseEvent = 'UNRC', kRegisterProtocolEvent = 'RGPR', kUnregisterProtocolEvent = 'UNRP', kCancelProgressEvent = 'CNCL',
  kFindURLEvent = 'FURL', kSpyglassSendSignature = 'WWW?', kSendURLEchoEvent = 'URLE'
}
enum  {
  kParamSaveToFileDest = 'INTO', kParamOpenInWindow = 'WIND', kParamOpenFlags = 'FLGS', kParamPostData = 'POST',
  kParamPostType = 'MIME', kParamProgressApp = 'PROG'
}

Public Member Functions

 AESpyglassSuiteHandler ()
 ~AESpyglassSuiteHandler ()
void HandleSpyglassSuiteEvent (const AppleEvent *appleEvent, AppleEvent *reply)

Protected Member Functions

void HandleOpenURLEvent (const AppleEvent *appleEvent, AppleEvent *reply)
void HandleRegisterURLEchoEvent (const AppleEvent *appleEvent, AppleEvent *reply)
void HandleUnregisterURLEchoEvent (const AppleEvent *appleEvent, AppleEvent *reply)

Protected Attributes

nsDocLoadObservermDocObserver

Detailed Description

Definition at line 47 of file nsAESpyglassSuiteHandler.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
kSuiteSignature 
kOpenURLEvent 
kRegisterURLEchoEvent 
kUnregisterURLEchoEvent 
kRegisterViewerEvent 
kUnregisterViewerEvent 
kShowFileEvent 
kParseAnchorEvent 
kSpyActivateEvent 
kSpyListWindowsEvent 
kGetWindowInfoEvent 
kRegisterWinCloseEvent 
kUnregisterWinCloseEvent 
kRegisterProtocolEvent 
kUnregisterProtocolEvent 
kCancelProgressEvent 
kFindURLEvent 
kSpyglassSendSignature 
kSendURLEchoEvent 

Definition at line 50 of file nsAESpyglassSuiteHandler.h.

            {
              kSuiteSignature                                  = 'WWW!',
                            
              kOpenURLEvent                             = 'OURL',                   // OpenURL
              kRegisterURLEchoEvent              = 'RGUE',                   // Register URL echo handler
              kUnregisterURLEchoEvent     = 'UNRU',                   // Unregister URL echo handler

// the following are unhandled in Mozilla
              kRegisterViewerEvent               = 'RGVW',                   // RegisterViewer
              kUnregisterViewerEvent      = 'UNRV',                   // UnregisterViewer
              kShowFileEvent                                   = 'SHWF',                   // ShowFile
              kParseAnchorEvent                  = 'PRSA',                   // ParseAnchor
              kSpyActivateEvent                  = 'ACTV',                   // Activate
              kSpyListWindowsEvent        = 'LSTW',                   // ListWindows
              kGetWindowInfoEvent         = 'WNFO',                   // GetWindowInfo
              kRegisterWinCloseEvent      = 'RGWC',                   // RegisterWindowClose
              kUnregisterWinCloseEvent    = 'UNRC',                   // UnregisterWindowClose
              kRegisterProtocolEvent             = 'RGPR',                   // RegisterProtocol
              kUnregisterProtocolEvent    = 'UNRP',                   // UnregisterProtocol
              kCancelProgressEvent        = 'CNCL',                   // Cancel download
              kFindURLEvent                             = 'FURL',                   // Find the URL for the file

// Spyglass send events

              kSpyglassSendSignature      = 'WWW?',
              kSendURLEchoEvent                  = 'URLE'

       };
anonymous enum
Enumerator:
kParamSaveToFileDest 
kParamOpenInWindow 
kParamOpenFlags 
kParamPostData 
kParamPostType 
kParamProgressApp 

Definition at line 80 of file nsAESpyglassSuiteHandler.h.

            {
              kParamSaveToFileDest        = 'INTO',            // FSSpec save to file
              kParamOpenInWindow          = 'WIND',            // long, target window (window ID)
              kParamOpenFlags                    = 'FLGS',            // long, Binary: any combination of 1, 2 and 4 is allowed: 1 and 2 mean force reload the document. 4 is ignored
              kParamPostData                     = 'POST',            // text, Form posting data
              kParamPostType                     = 'MIME',            // text, MIME type of the posting data. Defaults to application/x-www-form-urlencoded
              kParamProgressApp                  = 'PROG'             // 'psn ', Application that will display progress
       };

Constructor & Destructor Documentation

Definition at line 49 of file nsAESpyglassSuiteHandler.cpp.

Definition at line 58 of file nsAESpyglassSuiteHandler.cpp.


Member Function Documentation

void AESpyglassSuiteHandler::HandleOpenURLEvent ( const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected]

Definition at line 123 of file nsAESpyglassSuiteHandler.cpp.

{
       StAEDesc             directParameter;
       FSSpec        saveToFile;
       Boolean              gotSaveToFile = false;
       SInt32        targetWindowID = -1;
       SInt32        openFlags = 0;
       OSErr         err;
       
       // extract the direct parameter (an object specifier)
       err = ::AEGetKeyDesc(appleEvent, keyDirectObject, typeWildCard, &directParameter);
       ThrowIfOSErr(err);

       // look for the save to file param
       StAEDesc             targetFileDesc;
       err = ::AEGetKeyDesc(appleEvent, kParamSaveToFileDest, typeFSS, &targetFileDesc);
       if (err != errAEDescNotFound)
       {
              targetFileDesc.GetFileSpec(saveToFile);
              gotSaveToFile = true;
       }
       
#if 0
       // look for the target window param
       StAEDesc             openInWindowDesc;
       err = ::AEGetKeyDesc(appleEvent, kParamOpenInWindow, typeLongInteger, &openInWindowDesc);
       if (err != errAEDescNotFound)
              targetWindowID = openInWindowDesc.GetLong();

       // look for the open flags
       StAEDesc             openFlagsDesc;
       err = ::AEGetKeyDesc(appleEvent, kParamOpenFlags, typeLongInteger, &openFlagsDesc);
       if (err != errAEDescNotFound)
              openFlags = openFlagsDesc.GetLong();

        // do something with targetWindowID and openFlags...
#endif
       
       long          dataSize = directParameter.GetDataSize();
       char*  urlString = (char *)nsMemory::Alloc(dataSize + 1);
       ThrowIfNil(urlString);
       
       directParameter.GetCString(urlString, dataSize + 1);
       
       nsMacCommandLine&  cmdLine = nsMacCommandLine::GetMacCommandLine();
       cmdLine.DispatchURLToNewBrowser(urlString);
       
       nsMemory::Free(urlString);  
}

Here is the call graph for this function:

Here is the caller graph for this function:

void AESpyglassSuiteHandler::HandleRegisterURLEchoEvent ( const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected]

Definition at line 179 of file nsAESpyglassSuiteHandler.cpp.

{
       // extract the direct parameter (the requester's signature)
       StAEDesc directParameter;
       OSErr err = ::AEGetKeyDesc(appleEvent, keyDirectObject, typeType, &directParameter);
       ThrowIfOSErr(err);

       if (typeType == directParameter.descriptorType)
       {
           if (mDocObserver == nsnull) {
              mDocObserver = new nsDocLoadObserver;
              ThrowIfNil(mDocObserver);
              NS_ADDREF(mDocObserver);        // our owning ref
       }
       OSType requester;
       if (AEGetDescData(&directParameter, &requester, sizeof(requester)) == noErr)
              mDocObserver->AddEchoRequester(requester);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void AESpyglassSuiteHandler::HandleSpyglassSuiteEvent ( const AppleEvent *  appleEvent,
AppleEvent *  reply 
)

Definition at line 68 of file nsAESpyglassSuiteHandler.cpp.

{
       OSErr         err = noErr;
       
       AEEventID            eventID;
       OSType        typeCode;
       Size                 actualSize    = 0L;
       
       // Get the event ID
       err = AEGetAttributePtr(appleEvent,       keyEventIDAttr, 
                                                               typeType, 
                                                               &typeCode, 
                                                               (Ptr)&eventID, 
                                                               sizeof(eventID), 
                                                               &actualSize);
       ThrowIfOSErr(err);
       
       try
       {
              switch (eventID)
              {
                     case kOpenURLEvent:
                            HandleOpenURLEvent(appleEvent, reply);
                            break;
                     
                     case kRegisterURLEchoEvent:
                            HandleRegisterURLEchoEvent(appleEvent, reply);
                            break;
                            
                     case kUnregisterURLEchoEvent:
                            HandleUnregisterURLEchoEvent(appleEvent, reply);
                            break;
                     
                     default:
                            ThrowOSErr(errAEEventNotHandled);
                            break;
              }
       }
       catch (OSErr catchErr)
       {
              PutReplyErrorNumber(reply, catchErr);
              throw;
       }
       catch ( ... )
       {
              PutReplyErrorNumber(reply, paramErr);
              throw;
       }
}

Here is the call graph for this function:

void AESpyglassSuiteHandler::HandleUnregisterURLEchoEvent ( const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected]

Definition at line 203 of file nsAESpyglassSuiteHandler.cpp.

{
       // extract the direct parameter (the requester's signature)
       StAEDesc directParameter;
       OSErr err = ::AEGetKeyDesc(appleEvent, keyDirectObject, typeType, &directParameter);
       ThrowIfOSErr(err);

       if (typeType == directParameter.descriptorType)
       {
           if (mDocObserver)
              mDocObserver->RemoveEchoRequester(**(OSType**)directParameter.dataHandle);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 103 of file nsAESpyglassSuiteHandler.h.


The documentation for this class was generated from the following files: