FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
FB::JSAPIPtr IDispatchAPI::getJSAPI ( ) const
virtual

Get associated FB::JSAPI.

Implements FB::JSObject.

Definition at line 606 of file IDispatchAPI.cpp.

607 {
608  if (m_browser.expired() || m_obj.expired()) {
609  return FB::JSAPIPtr();
610  }
611  JSAPI_IDispatchExBase* p(NULL);
612  try {
613  CComQIPtr<IFireBreathObject> fbObj(getIDispatch());
614  // If it's our own element then both of these will pass! This means it isn't us!
615  CComQIPtr<IHTMLElement> testObj(getIDispatch());
616  if (!testObj && fbObj && (p = dynamic_cast<JSAPI_IDispatchExBase*>(getIDispatch()))) {
617  return p->getAPI();
618  }
619  } catch (...) {}
620 
621  return FB::JSAPIPtr();
622 }
boost::shared_ptr< FB::JSAPI > JSAPIPtr
Defines an alias for a JSAPI shared_ptr (you should never use a JSAPI* directly)
Definition: APITypes.h:94