void setDataToClipBoard(WTF::String& format , WTF::String& data){

    LOGD("   setDataToClipBoard :  Enter");	
	
    JNIEnv* env = JSC::Bindings::getJNIEnv();
    if(env == NULL || format.isEmpty() || data.isEmpty())
    	return;


    jstring jFormat = env->NewString((jchar*) format.characters(), format.length());	
    jstring jData = env->NewString((jchar*) data.characters(), data.length());

    if((m_javaGlueForPasteBoard.object(env).get() == NULL )||(m_javaGlueForPasteBoard.m_setDataToClipBoard  ==  0 ))
    {
       LOGD("   setDataToClipBoard :  return with out copy");	
	return;
    }
    env->CallVoidMethod(m_javaGlueForPasteBoard.object(env).get(),
        	 m_javaGlueForPasteBoard.m_setDataToClipBoard , jFormat , jData);


    env->DeleteLocalRef(jFormat); 
    env->DeleteLocalRef(jData);
    checkException(env);
}
コード例 #2
0
static void writeString(WTF::Vector<char>& vector, const WTF::String& str)
{
    unsigned strLen = str.length();
    // Only do work if the string has data.
    if (strLen) {
        // Determine how much to grow the vector. Use the worst case for utf8 to
        // avoid reading the string twice. Add sizeof(unsigned) to hold the
        // string length in utf8.
        unsigned vectorLen = vector.size() + sizeof(unsigned);
        unsigned length = (strLen << 2) + vectorLen;
        // Grow the vector. This will change the value of v.size() but we
        // remember the original size above.
        vector.grow(length);
        // Grab the position to write to.
        char* data = vector.begin() + vectorLen;
        // Write the actual string
        int l = SkUTF16_ToUTF8(str.characters(), strLen, data);
        ALOGV("Writing string          %d %.*s", l, l, data);
        // Go back and write the utf8 length. Subtract sizeof(unsigned) from
        // data to get the position to write the length.
        memcpy(data - sizeof(unsigned), (char*)&l, sizeof(unsigned));
        // Shrink the internal state of the vector so we match what was
        // actually written.
        vector.shrink(vectorLen + l);
    } else
        vector.append((char*)&strLen, sizeof(unsigned));
}
コード例 #3
0
void ChromeClientBlackBerry::exceededDatabaseQuota(Frame* frame, const WTF::String& name)
{
#if ENABLE(DATABASE)
    Document* document = frame->document();
    if (!document)
        return;

    SecurityOrigin* origin = document->securityOrigin();
    if (m_webPage->d->m_dumpRenderTree) {
        m_webPage->d->m_dumpRenderTree->exceededDatabaseQuota(origin, name);
        return;
    }

    DatabaseTracker& tracker = DatabaseTracker::tracker(document->groupName());

    unsigned long long totalUsage = tracker.totalDatabaseUsage();
    unsigned long long originUsage = tracker.usageForOrigin(origin);

    DatabaseDetails details = tracker.detailsForNameAndOrigin(name, origin);
    unsigned long long estimatedSize = details.expectedUsage();
    const WTF::String& nameStr = details.displayName();

    WTF::String originStr = origin->databaseIdentifier();

    unsigned long long quota = m_webPage->client()->databaseQuota(originStr.characters(), originStr.length(),
        nameStr.characters(), nameStr.length(), totalUsage, originUsage, estimatedSize);

    tracker.setQuota(origin, quota);
#endif
}
コード例 #4
0
HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::method( 
        /* [retval][out] */ BSTR* result)
{
    ASSERT(m_element && m_element->hasTagName(formTag));
    WTF::String methodString = static_cast<HTMLFormElement*>(m_element)->method();
    *result = BString(methodString.characters(), methodString.length()).release();
    return S_OK;
}
コード例 #5
0
HRESULT STDMETHODCALLTYPE DOMHTMLElement::innerText( 
        /* [retval][out] */ BSTR* result)
{
    ASSERT(m_element && m_element->isHTMLElement());
    WTF::String innerTextString = static_cast<HTMLElement*>(m_element)->innerText();
    *result = BString(innerTextString.characters(), innerTextString.length()).release();
    return S_OK;
}
コード例 #6
0
HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::method( 
        /* [retval][out] */ BSTR* result)
{
    ASSERT(m_element && isHTMLFormElement(m_element));
    WTF::String methodString = toHTMLFormElement(m_element)->method();
    *result = BString(methodString.characters(), methodString.length()).release();
    return S_OK;
}
コード例 #7
0
bool ChromeClientBlackBerry::runJavaScriptConfirm(Frame* frame, const WTF::String& message)
{
    if (m_webPage->d->m_dumpRenderTree)
        return m_webPage->d->m_dumpRenderTree->runJavaScriptConfirm(message);
    TimerBase::fireTimersInNestedEventLoop();

    CString latinOrigin = frameOrigin(frame);
    return m_webPage->client()->runJavaScriptConfirm(message.characters(), message.length(), latinOrigin.data(), latinOrigin.length());

}
コード例 #8
0
HRESULT STDMETHODCALLTYPE DOMNode::nodeValue( 
    /* [retval][out] */ BSTR* result)
{
    if (!m_node)
        return E_FAIL;
    WTF::String nodeValueStr = m_node->nodeValue();
    *result = SysAllocStringLen(nodeValueStr.characters(), nodeValueStr.length());
    if (nodeValueStr.length() && !*result)
        return E_OUTOFMEMORY;
    return S_OK;
}
コード例 #9
0
HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::value( 
        /* [retval][out] */ BSTR* result)
{
    ASSERT(m_element && m_element->hasTagName(textareaTag));
    HTMLTextAreaElement* textareaElement = static_cast<HTMLTextAreaElement*>(m_element);
    WTF::String valueString = textareaElement->value();
    *result = BString(valueString.characters(), valueString.length()).release();
    if (valueString.length() && !*result)
        return E_OUTOFMEMORY;
    return S_OK;
}
コード例 #10
0
HRESULT STDMETHODCALLTYPE DOMCSSStyleDeclaration::getPropertyValue( 
    /* [in] */ BSTR propertyName,
    /* [retval][out] */ BSTR* result)
{
    WTF::String propertyNameString(propertyName);
    WTF::String value = m_style->getPropertyValue(propertyNameString);
    *result = SysAllocStringLen(value.characters(), value.length());
    if (value.length() && !*result)
        return E_OUTOFMEMORY;
    return S_OK;
}
コード例 #11
0
HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::value( 
        /* [retval][out] */ BSTR* result)
{
    ASSERT(m_element && isHTMLInputElement(m_element));
    HTMLInputElement* inputElement = toHTMLInputElement(m_element);
    WTF::String valueString = inputElement->value();
    *result = BString(valueString.characters(), valueString.length()).release();
    if (valueString.length() && !*result)
        return E_OUTOFMEMORY;
    return S_OK;
}
コード例 #12
0
static void printWebCoreString(const char* label,
        const WTF::String& string) {
    char scratch[256];
    size_t index = snprintf(scratch, sizeof(scratch), label);
    const UChar* ch = string.characters();
    while (ch && *ch && index < sizeof(scratch)) {
        UChar c = *ch++;
        if (c < ' ' || c >= 0x7f) c = ' ';
        scratch[index++] = c;
    }
    DUMP_NAV_LOGD("%.*s\"\n", index, scratch);
}
コード例 #13
0
bool ChromeClientBlackBerry::runJavaScriptPrompt(Frame* frame, const WTF::String& message, const WTF::String& defaultValue, WTF::String& result)
{
    WebString clientResult;

    if (m_webPage->d->m_dumpRenderTree) {
        result = m_webPage->d->m_dumpRenderTree->runJavaScriptPrompt(message, defaultValue);
        return true;
    }

    TimerBase::fireTimersInNestedEventLoop();

    CString latinOrigin = frameOrigin(frame);
    if (m_webPage->client()->runJavaScriptPrompt(message.characters(), message.length(), defaultValue.characters(), defaultValue.length(), latinOrigin.data(), latinOrigin.length(), clientResult)) {
        result = clientResult;
        return true;
    }
    return false;
}
コード例 #14
0
ファイル: SquirrelThread.cpp プロジェクト: eriser/kdguigl
static PBEcode SquirrelPrecompil(WTF::String& code, Vector<UChar>& codeCache) {
    PBEcode	 rt = EnumPBSuccess;
    Vector<UChar> codeFake;

    wcsncpy((wchar_t *)&codeCache[0], (const wchar_t *)code.characters(), code.length());

    int x1 = wcslen((const wchar_t *)&codeCache[0]);

    rt = StrReplaceCase_0((wchar_t *)&codeCache[0], code.length()); // 去掉注释
    if ( rt != EnumPBSuccess )
        goto Exit0;
    
    codeFake = codeCache;
    OutputDebugStringW((wchar_t *)&codeCache[0]);

    int xx = wcslen((const wchar_t *)&codeFake[0]);
    

    rt = StrReplaceCase_1((const wchar_t *)codeFake.data(), code.length(), (wchar_t *)codeCache.data(), codeCache.size()); // 识别class
    if ( rt != EnumPBSuccess )
        goto Exit0;

    OutputDebugStringW((wchar_t *)&codeCache[0]);

    rt = StrReplaceCase_2((wchar_t *)&codeCache[0], codeCache.size()); // 识别.prototype.
    if ( rt != EnumPBSuccess )
        goto Exit0;

    OutputDebugStringW((wchar_t *)&codeCache[0]);

    rt = StrReplaceCase_3((wchar_t *)&codeCache[0], codeCache.size()); // 去掉new 
    if ( rt != EnumPBSuccess )
        goto Exit0;

    rt = StrReplaceCase_4((wchar_t *)&codeCache[0], codeCache.size()); // for in
    if ( rt != EnumPBSuccess )
        goto Exit0;

    OutputDebugStringW((wchar_t *)&codeCache[0]);

Exit0:
    return rt;
}
コード例 #15
0
void DebuggerAgentManager::sendCommandToV8(const WTF::String& cmd, v8::Debug::ClientData* data)
{
    v8::Debug::SendCommand(reinterpret_cast<const uint16_t*>(cmd.characters()), cmd.length(), data);
}
コード例 #16
0
void ChromeClientBlackBerry::addMessageToConsole(MessageSource, MessageType, MessageLevel, const WTF::String& message, unsigned int lineNumber, const WTF::String& sourceID)
{
    if (m_webPage->d->m_dumpRenderTree)
        m_webPage->d->m_dumpRenderTree->addMessageToConsole(message, lineNumber, sourceID);
    m_webPage->client()->addMessageToConsole(message.characters(), message.length(), sourceID.characters(), sourceID.length(), lineNumber);
}
コード例 #17
0
jstring wtfStringToJstring(JNIEnv* env, const WTF::String& str, bool validOnZeroLength)
{
    int length = str.length();
    return length || validOnZeroLength ? env->NewString(str.characters(), length) : 0;
}