Exemple #1
0
bool IDispatchAPI::HasMethod(const std::string& methodName) const
{
    if (!host->isMainThread()) {
        typedef bool (IDispatchAPI::*curtype)(const std::string&) const;
        return host->CallOnMainThread(boost::bind((curtype)&IDispatchAPI::HasMethod, this, methodName));
    }
    if (is_JSAPI) {
        FB::JSAPIPtr tmp = inner.lock();
        if (tmp)
            return tmp->HasMethod(methodName);
        else 
            return false;
    }
    // This will actually just return true if the specified member exists; IDispatch doesn't really
    // differentiate further than that
    return getIDForName(FB::utf8_to_wstring(methodName)) != -1 && !HasProperty(methodName);
}
Exemple #2
0
bool NPObjectAPI::HasMethod(const std::string& methodName) const
{
    if (m_browser.expired())
        return false;

    NpapiBrowserHostPtr browser(getHost());
    if (!browser->isMainThread()) {
        typedef bool (NPObjectAPI::*curtype)(const std::string&) const;
        return browser->CallOnMainThread(boost::bind((curtype)&NPObjectAPI::HasMethod, this, methodName));
    }
    if (is_JSAPI) {
        FB::JSAPIPtr tmp = inner.lock();
        if (tmp)
            return tmp->HasMethod(methodName);
        else 
            return false;
    }
    return browser->HasMethod(obj, browser->GetStringIdentifier(methodName.c_str()));
}