本文整理汇总了C++中AutoJObject::get方法的典型用法代码示例。如果您正苦于以下问题:C++ AutoJObject::get方法的具体用法?C++ AutoJObject::get怎么用?C++ AutoJObject::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AutoJObject
的用法示例。
在下文中一共展示了AutoJObject::get方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddItem
void WebHistory::AddItem(const AutoJObject& list, WebCore::HistoryItem* item)
{
LOG_ASSERT(item, "newItem must take a valid HistoryItem!");
// Item already added. Should only happen when we are inflating the list.
if (item->bridge() || !list.get())
return;
JNIEnv* env = list.env();
// Allocate a blank WebHistoryItem
jclass clazz = env->FindClass("android/webkit/WebHistoryItem");
jobject newItem = env->NewObject(clazz, gWebHistoryItem.mInit);
// Create the bridge, make it active, and attach it to the item.
WebHistoryItem* bridge = new WebHistoryItem(env, newItem, item);
bridge->setActive();
item->setBridge(bridge);
// Update the history item which will flatten the data and call update on
// the java item.
bridge->updateHistoryItem(item);
// Add it to the list.
env->CallVoidMethod(list.get(), gWebBackForwardList.mAddHistoryItem, newItem);
// Delete our local reference.
env->DeleteLocalRef(newItem);
}
示例2: createJavaPlayerIfNeeded
void createJavaPlayerIfNeeded()
{
// Check if we have been already created.
if (m_glue->m_javaProxy)
return;
JNIEnv* env = JSC::Bindings::getJNIEnv();
if (!env)
return;
jclass clazz = env->FindClass(g_ProxyJavaClassAudio);
if (!clazz)
return;
FrameView* frameView = m_player->mediaPlayerClient()->mediaPlayerOwningDocument()->view();
if (!frameView)
return;
AutoJObject javaObject = WebViewCore::getWebViewCore(frameView)->getJavaObject();
if (!javaObject.get())
return;
jobject obj = 0;
// Get the HTML5Audio instance
obj = env->NewObject(clazz, m_glue->m_newInstance, javaObject.get(), this);
m_glue->m_javaProxy = env->NewGlobalRef(obj);
// Clean up.
if (obj)
env->DeleteLocalRef(obj);
env->DeleteLocalRef(clazz);
checkException(env);
}
示例3: javaObject
void
JavaBridge::stopSharedTimer()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = javaObject(env);
if (!obj.get())
return;
env->CallVoidMethod(obj.get(), mStopSharedTimer);
}
示例4: signalServiceFuncPtrQueue
void JavaBridge::signalServiceFuncPtrQueue()
{
// In order to signal the main thread we must go through JNI. This
// is the only usage on most threads, so we need to ensure a JNI
// environment is setup.
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = javaObject(env);
if (!obj.get())
return;
env->CallVoidMethod(obj.get(), mSignalFuncPtrQueue);
}
示例5: String
WTF::String
JavaBridge::getPluginSharedDataDirectory()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = javaObject(env);
if (!obj.get())
return String();
jstring ret = (jstring)env->CallObjectMethod(obj.get(), mGetPluginSharedDataDirectory);
WTF::String path = jstringToWtfString(env, ret);
checkException(env);
return path;
}
示例6: resolveFilePathForContentUri
WTF::String JavaBridge::resolveFilePathForContentUri(const WTF::String& uri) {
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = javaObject(env);
if (!obj.get())
return String();
jstring jUri = wtfStringToJstring(env, uri);
jstring path = static_cast<jstring>(env->CallObjectMethod(obj.get(), mResolveFilePathForContentUri, jUri));
WTF::String ret = jstringToWtfString(env, path);
env->DeleteLocalRef(jUri);
env->DeleteLocalRef(path);
return ret;
}
示例7: getSignedPublicKeyAndChallengeString
WTF::String JavaBridge::getSignedPublicKeyAndChallengeString(unsigned index,
const WTF::String& challenge, const WebCore::KURL& url) {
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = javaObject(env);
if (!obj.get())
return String();
jstring jChallenge = wtfStringToJstring(env, challenge);
const WTF::String& urlStr = url.string();
jstring jUrl = wtfStringToJstring(env, urlStr);
jstring key = (jstring) env->CallObjectMethod(obj.get(),
mGetSignedPublicKey, index, jChallenge, jUrl);
WTF::String ret = jstringToWtfString(env, key);
env->DeleteLocalRef(jChallenge);
env->DeleteLocalRef(jUrl);
env->DeleteLocalRef(key);
return ret;
}
示例8: setDrawingModel
bool PluginWidgetAndroid::setDrawingModel(ANPDrawingModel model) {
if (model == kOpenGL_ANPDrawingModel && m_layer == 0) {
jobject webview = m_core->getWebViewJavaObject();
AutoJObject webViewCore = m_core->getJavaObject();
m_layer = new WebCore::MediaLayer(webview, webViewCore.get());
}
else if (model != kOpenGL_ANPDrawingModel && m_layer != 0) {
m_layer->unref();
m_layer = 0;
}
if (m_drawingModel != model) {
// Trigger layer computation in RenderLayerCompositor
m_pluginView->getElement()->setNeedsStyleRecalc(SyntheticStyleChange);
}
m_drawingModel = model;
return true;
}
示例9: UpdateHistoryIndex
void WebHistory::UpdateHistoryIndex(const AutoJObject& list, int newIndex)
{
if (list.get())
list.env()->CallVoidMethod(list.get(), gWebBackForwardList.mSetCurrentIndex, newIndex);
}
示例10: RemoveItem
void WebHistory::RemoveItem(const AutoJObject& list, int index)
{
if (list.get())
list.env()->CallVoidMethod(list.get(), gWebBackForwardList.mRemoveHistoryItem, index);
}
示例11: updateHistoryItem
void WebHistoryItem::updateHistoryItem(WebCore::HistoryItem* item) {
// Do not want to update during inflation.
if (!m_active)
return;
WebHistoryItem* webItem = this;
// Now we need to update the top-most WebHistoryItem based on the top-most
// HistoryItem.
if (m_parent) {
webItem = m_parent.get();
if (webItem->hasOneRef()) {
// if the parent only has one ref, it is from this WebHistoryItem.
// This means that the matching WebCore::HistoryItem has been freed.
// This can happen during clear().
LOGW("Can't updateHistoryItem as the top HistoryItem is gone");
return;
}
while (webItem->parent())
webItem = webItem->parent();
item = webItem->historyItem();
if (!item) {
// If a HistoryItem only exists for page cache, it is possible that
// the parent HistoryItem destroyed before the child HistoryItem. If
// it happens, skip updating.
LOGW("Can't updateHistoryItem as the top HistoryItem is gone");
return;
}
}
JNIEnv* env = JSC::Bindings::getJNIEnv();
if (!env)
return;
// Don't do anything if the item has been gc'd already
AutoJObject realItem = getRealObject(env, webItem->m_object);
if (!realItem.get())
return;
const WebCore::String& urlString = item->urlString();
jstring urlStr = NULL;
if (!urlString.isNull())
urlStr = env->NewString((unsigned short*)urlString.characters(), urlString.length());
const WebCore::String& originalUrlString = item->originalURLString();
jstring originalUrlStr = NULL;
if (!originalUrlString.isNull()) {
originalUrlStr = env->NewString(
(unsigned short*) originalUrlString.characters(),
originalUrlString.length());
}
const WebCore::String& titleString = item->title();
jstring titleStr = NULL;
if (!titleString.isNull())
titleStr = env->NewString((unsigned short*)titleString.characters(), titleString.length());
// Try to get the favicon from the history item. For some pages like Grand
// Prix, there are history items with anchors. If the icon fails for the
// item, try to get the icon using the url without the ref.
jobject favicon = NULL;
WebCore::String url = item->urlString();
if (item->url().hasFragmentIdentifier()) {
int refIndex = url.reverseFind('#');
url = url.substring(0, refIndex);
}
WebCore::Image* icon = WebCore::iconDatabase()->iconForPageURL(url,
WebCore::IntSize(16, 16));
if (icon)
favicon = webcoreImageToJavaBitmap(env, icon);
WTF::Vector<char> data;
jbyteArray array = WebHistory::Flatten(env, data, item);
env->CallVoidMethod(realItem.get(), gWebHistoryItem.mUpdate, urlStr,
originalUrlStr, titleStr, favicon, array);
env->DeleteLocalRef(urlStr);
env->DeleteLocalRef(originalUrlStr);
env->DeleteLocalRef(titleStr);
if (favicon)
env->DeleteLocalRef(favicon);
env->DeleteLocalRef(array);
}