FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
void NPObjectAPI::getMemberNames ( std::vector< std::string > &  nameVector) const
virtual

Called by the browser to enumerate the members of this JSAPI object.

This must be implemented by anything extending JSAPI directly. JSAPIAuto implements this for you.

Parameters
[out]nameVectorThe name vector.

Implements FB::JSAPI.

Definition at line 52 of file NPObjectAPI.cpp.

53 {
54  if (m_browser.expired())
55  return;
56 
57  NpapiBrowserHostPtr browser(getHost());
58  if (!browser->isMainThread()) {
59  typedef void (FB::JSAPI::*getMemberNamesType)(std::vector<std::string> *nameVector) const;
60  browser->CallOnMainThread(boost::bind((getMemberNamesType)&FB::JSAPI::getMemberNames, this, &nameVector));
61  return;
62  }
63  if (is_JSAPI) {
64  FB::JSAPIPtr tmp = inner.lock();
65  if (tmp)
66  tmp->getMemberNames(nameVector);
67  return;
68  }
69  NPIdentifier *idArray(NULL);
70  uint32_t count;
71 
72  browser->Enumerate(obj, &idArray, &count);
73  for (uint32_t i = 0; i < count; i++) {
74  nameVector.push_back(browser->StringFromIdentifier(idArray[i]));
75  }
76  browser->MemFree(idArray);
77 }
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
JavaScript API class – provides a javascript interface that can be exposed to the browser...
Definition: JSAPI.h:56