本文整理汇总了C++中webcore::Frame::page方法的典型用法代码示例。如果您正苦于以下问题:C++ Frame::page方法的具体用法?C++ Frame::page怎么用?C++ Frame::page使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webcore::Frame
的用法示例。
在下文中一共展示了Frame::page方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WebHistoryInflate
static void WebHistoryInflate(JNIEnv* env, jobject obj, jint frame, jbyteArray data)
{
LOG_ASSERT(frame, "Inflate needs a valid frame pointer!");
LOG_ASSERT(data, "Inflate needs a valid data pointer!");
// Get the actual bytes and the length from the java array.
const jbyte* bytes = env->GetByteArrayElements(data, NULL);
jsize size = env->GetArrayLength(data);
// Inflate the history tree into one HistoryItem or null if the inflation
// failed.
RefPtr<WebCore::HistoryItem> newItem = WebCore::HistoryItem::create();
RefPtr<WebHistoryItem> bridge = new WebHistoryItem(env, obj, newItem.get());
newItem->setBridge(bridge.get());
// Inflate the item recursively. If it fails, that is ok. We'll have an
// incomplete HistoryItem but that is better than crashing due to a null
// item.
// We have a 2nd local variable since read_item_recursive may change the
// ptr's value. We can't pass &bytes since we have to send bytes to
// ReleaseByteArrayElements unchanged.
const char* ptr = reinterpret_cast<const char*>(bytes);
read_item_recursive(newItem.get(), &ptr, (int)size);
env->ReleaseByteArrayElements(data, const_cast<jbyte*>(bytes), JNI_ABORT);
bridge->setActive();
// Add the new item to the back/forward list.
WebCore::Frame* pFrame = (WebCore::Frame*)frame;
pFrame->page()->backForwardList()->addItem(newItem);
// Update the item.
bridge->updateHistoryItem(newItem.get());
}
示例2: createWindow
Page* ChromeClientAndroid::createWindow(Frame* frame, const FrameLoadRequest&,
const WindowFeatures& features, const NavigationAction&)
{
ASSERT(frame);
#ifdef ANDROID_MULTIPLE_WINDOWS
if (frame->settings() && !(frame->settings()->supportMultipleWindows()))
// If the client doesn't support multiple windows, just return the current page
return frame->page();
#endif
const WebCoreViewBridge* bridge = frame->view()->platformWidget();
bool dialog = features.dialog || !features.resizable
|| (features.heightSet && features.height < bridge->height()
&& features.widthSet && features.width < bridge->width())
|| (!features.menuBarVisible && !features.statusBarVisible
&& !features.toolBarVisible && !features.locationBarVisible
&& !features.scrollbarsVisible);
// fullscreen definitely means no dialog
if (features.fullscreen)
dialog = false;
WebCore::Frame* newFrame = m_webFrame->createWindow(dialog,
ScriptController::processingUserGesture());
if (newFrame) {
WebCore::Page* page = newFrame->page();
page->setGroupName(frame->page()->groupName());
return page;
}
return NULL;
}
示例3: ASSERT
PassRefPtr<Frame> FrameLoaderClientEfl::createFrame(const URL& url, const String& name, HTMLFrameOwnerElement* ownerElement, const String& referrer, bool /*allowsScrolling*/, int /*marginWidth*/, int /*marginHeight*/)
{
ASSERT(m_frame);
ASSERT(m_view);
Evas_Object* subFrame = ewk_frame_child_add(m_frame, name, ownerElement);
if (!subFrame)
return 0;
WebCore::Frame* coreSubFrame = EWKPrivate::coreFrame(subFrame);
ASSERT(coreSubFrame);
// The creation of the frame may have run arbitrary JavaScript that removed it from the page already.
if (!coreSubFrame->page()) {
evas_object_del(subFrame);
return 0;
}
evas_object_smart_callback_call(m_view, "frame,created", subFrame);
EWKPrivate::coreFrame(m_frame)->loader().loadURLIntoChildFrame(url, referrer, coreSubFrame);
// The frame's onload handler may have removed it from the document.
// See fast/dom/null-page-show-modal-dialog-crash.html for an example.
if (!coreSubFrame->tree().parent()) {
evas_object_del(subFrame);
return 0;
}
ewk_view_frame_rect_changed(m_view);
return coreSubFrame;
}
示例4: createWindow
Page* ChromeClientAndroid::createWindow(Frame* frame, const FrameLoadRequest&,
const WindowFeatures& features)
{
ASSERT(frame);
#ifdef ANDROID_MULTIPLE_WINDOWS
if (frame->settings() && !(frame->settings()->supportMultipleWindows()))
// If the client doesn't support multiple windows, just return the current page
return frame->page();
#endif
WTF::PassRefPtr<WebCore::Screen> screen = WebCore::Screen::create(frame);
bool dialog = features.dialog || !features.resizable
|| (features.heightSet && features.height < screen.get()->height()
&& features.widthSet && features.width < screen.get()->width())
|| (!features.menuBarVisible && !features.statusBarVisible
&& !features.toolBarVisible && !features.locationBarVisible
&& !features.scrollbarsVisible);
// fullscreen definitely means no dialog
if (features.fullscreen)
dialog = false;
WebCore::Frame* newFrame = m_webFrame->createWindow(dialog,
frame->script()->processingUserGesture(mainThreadNormalWorld()));
if (newFrame) {
WebCore::Page* page = newFrame->page();
page->setGroupName(frame->page()->groupName());
return page;
}
return NULL;
}
示例5: WebHistoryRestoreIndex
static void WebHistoryRestoreIndex(JNIEnv* env, jobject obj, jint frame, jint index)
{
LOG_ASSERT(frame, "RestoreState needs a valid Frame pointer!");
WebCore::Frame* pFrame = (WebCore::Frame*)frame;
WebCore::Page* page = pFrame->page();
WebCore::HistoryItem* currentItem =
page->backForwardList()->entries()[index].get();
// load the current page with FrameLoadTypeIndexedBackForward so that it
// will use cache when it is possible
page->goToItem(currentItem, FrameLoadTypeIndexedBackForward);
}
示例6: ASSERT
DebuggerAgentImpl* DebuggerAgentManager::findAgentForCurrentV8Context()
{
if (!s_attachedAgentsMap)
return 0;
ASSERT(!s_attachedAgentsMap->isEmpty());
WebCore::Frame* frame = WebCore::V8Proxy::retrieveFrameForEnteredContext();
if (!frame)
return 0;
WebCore::Page* page = frame->page();
for (AttachedAgentsMap::iterator it = s_attachedAgentsMap->begin(); it != s_attachedAgentsMap->end(); ++it) {
if (it->second->page() == page)
return it->second;
}
return 0;
}
示例7: WebHistoryInflate
static jint WebHistoryInflate(JNIEnv* env, jobject obj, jint frame, jbyteArray data)
{
ALOG_ASSERT(frame, "Inflate needs a valid frame pointer!");
ALOG_ASSERT(data, "Inflate needs a valid data pointer!");
// Get the actual bytes and the length from the java array.
const jbyte* bytes = env->GetByteArrayElements(data, NULL);
jsize size = env->GetArrayLength(data);
// Inflate the history tree into one HistoryItem or null if the inflation
// failed.
RefPtr<WebCore::HistoryItem> newItem = WebCore::HistoryItem::create();
WebHistoryItem* bridge = new WebHistoryItem(newItem.get());
newItem->setBridge(bridge);
// Inflate the item recursively. If it fails, that is ok. We'll have an
// incomplete HistoryItem but that is better than crashing due to a null
// item.
// We have a 2nd local variable since read_item_recursive may change the
// ptr's value. We can't pass &bytes since we have to send bytes to
// ReleaseByteArrayElements unchanged.
const char* ptr = reinterpret_cast<const char*>(bytes);
readItemRecursive(newItem.get(), &ptr, (int)size);
env->ReleaseByteArrayElements(data, const_cast<jbyte*>(bytes), JNI_ABORT);
bridge->setActive();
// Add the new item to the back/forward list.
WebCore::Frame* pFrame = (WebCore::Frame*)frame;
pFrame->page()->backForwardList()->addItem(newItem);
// Update the item.
bridge->updateHistoryItem(newItem.get());
// Ref here because Java expects to adopt the reference, and as such will not
// call ref on it. However, setBridge has also adopted the reference
// TODO: This is confusing as hell, clean up ownership and have setBridge
// take a RefPtr instead of a raw ptr and calling adoptRef on it
bridge->ref();
return reinterpret_cast<jint>(bridge);
}
示例8: currentToplevelCallback
/*static void webkit_web_view_settings_notify(WebKitWebView* webView, GParamSpec* pspec, gpointer userdata)
{
printf("##########%s:%d (%s)\n", __FILE__, __LINE__, WTF_PRETTY_FUNCTION );
const gchar* name = g_intern_string(pspec->name);
printf("name = %s\n", name);
}*/
static GtkWidget* currentToplevelCallback(WebKitSoupAuthDialog* feature, SoupMessage* message, gpointer userData)
{
gpointer messageData = g_object_get_data(G_OBJECT(message), "resourceHandle");
if (!messageData)
return NULL;
ResourceHandle* handle = static_cast<ResourceHandle*>(messageData);
if (!handle)
return NULL;
ResourceHandleInternal* d = handle->getInternal();
if (!d)
return NULL;
WebCore::Frame* frame = d->m_frame;
if (!frame)
return NULL;
GtkWidget* toplevel = gtk_widget_get_toplevel(GTK_WIDGET(frame->page()->chrome()->platformPageClient()));
if (GTK_WIDGET_TOPLEVEL(toplevel))
return toplevel;
else
return NULL;
}
示例9: scalePageBy
void DumpRenderTreeSupportQt::scalePageBy(QWebFrameAdapter* adapter, float scalefactor, const QPoint& origin)
{
WebCore::Frame* coreFrame = adapter->frame;
if (Page* page = coreFrame->page())
page->setPageScaleFactor(scalefactor, origin);
}
示例10: WebHistoryClose
static void WebHistoryClose(JNIEnv* env, jobject obj, jint frame)
{
LOG_ASSERT(frame, "Close needs a valid Frame pointer!");
WebCore::Frame* pFrame = (WebCore::Frame*)frame;
WebCore::BackForwardList* list = pFrame->page()->backForwardList();
RefPtr<WebCore::HistoryItem> current = list->currentItem();
// Remove each item instead of using close(). close() is intended to be used
// right before the list is deleted.
WebCore::HistoryItemVector& entries = list->entries();
int size = entries.size();
for (int i = size - 1; i >= 0; --i)
list->removeItem(entries[i].get());
// Add the current item back to the list.
if (current) {
current->setBridge(0);
// addItem will update the children to match the newly created bridge
list->addItem(current);
/*
* The Grand Prix site uses anchor navigations to change the display.
* WebKit tries to be smart and not load child frames that have the
* same history urls during an anchor navigation. This means that the
* current history item stored in the child frame's loader does not
* match the item found in the history tree. If we remove all the
* entries in the back/foward list, we have to restore the entire tree
* or else a HistoryItem might have a deleted parent.
*
* In order to restore the history tree correctly, we have to look up
* all the frames first and then look up the history item. We do this
* because the history item in the tree may be null at this point.
* Unfortunately, a HistoryItem can only search its immediately
* children so we do a breadth-first rebuild of the tree.
*/
// Keep a small list of child frames to traverse.
WTF::Vector<WebCore::Frame*> frameQueue;
// Fix the top-level item.
pFrame->loader()->history()->setCurrentItem(current.get());
WebCore::Frame* child = pFrame->tree()->firstChild();
// Remember the parent history item so we can search for a child item.
RefPtr<WebCore::HistoryItem> parent = current;
while (child) {
// Use the old history item since the current one may have a
// deleted parent.
WebCore::HistoryItem* item = parent->childItemWithTarget(child->tree()->name());
child->loader()->history()->setCurrentItem(item);
// Append the first child to the queue if it exists. If there is no
// item, then we do not need to traverse the children since there
// will be no parent history item.
WebCore::Frame* firstChild;
if (item && (firstChild = child->tree()->firstChild()))
frameQueue.append(firstChild);
child = child->tree()->nextSibling();
// If we don't have a sibling for this frame and the queue isn't
// empty, use the next entry in the queue.
if (!child && !frameQueue.isEmpty()) {
child = frameQueue.at(0);
frameQueue.remove(0);
// Figure out the parent history item used when searching for
// the history item to use.
parent = child->tree()->parent()->loader()->history()->currentItem();
}
}
}
}
示例11: scalePageBy
void DumpRenderTreeSupportQt::scalePageBy(QWebFrame* frame, float scalefactor, const QPoint& origin)
{
WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
if (Page* page = coreFrame->page())
page->setPageScaleFactor(scalefactor, origin);
}
示例12: Sync
//.........这里部分代码省略.........
str = (jstring)env->GetObjectField(obj, gFieldIds->mDatabasePath);
if (str) {
String path = jstringToWtfString(env, str);
DatabaseTracker::tracker().setDatabaseDirectoryPath(path);
// This database is created when the first HTML5 Database object is
// instantiated. If the file doesn't exist, we create it and set its
// permissions. The filename must match that in
// DatabaseTracker.cpp.
String filename = SQLiteFileSystem::appendDatabaseFileNameToPath(path, "Databases.db");
int fd = open(filename.utf8().data(), O_CREAT | O_EXCL, permissionFlags660);
if (fd >= 0)
close(fd);
}
}
#endif
#if ENABLE(DOM_STORAGE)
flag = env->GetBooleanField(obj, gFieldIds->mDomStorageEnabled);
s->setLocalStorageEnabled(flag);
str = (jstring)env->GetObjectField(obj, gFieldIds->mDatabasePath);
if (str) {
WTF::String localStorageDatabasePath = jstringToWtfString(env,str);
if (localStorageDatabasePath.length()) {
localStorageDatabasePath = WebCore::pathByAppendingComponent(
localStorageDatabasePath, "localstorage");
// We need 770 for folders
mkdir(localStorageDatabasePath.utf8().data(),
permissionFlags660 | S_IXUSR | S_IXGRP);
s->setLocalStorageDatabasePath(localStorageDatabasePath);
}
}
#endif
flag = env->GetBooleanField(obj, gFieldIds->mGeolocationEnabled);
GeolocationPermissions::setAlwaysDeny(!flag);
str = (jstring)env->GetObjectField(obj, gFieldIds->mGeolocationDatabasePath);
if (str) {
String path = jstringToWtfString(env, str);
GeolocationPermissions::setDatabasePath(path);
GeolocationPositionCache::instance()->setDatabasePath(path);
// This database is created when the first Geolocation object is
// instantiated. If the file doesn't exist, we create it and set its
// permissions. The filename must match that in
// GeolocationPositionCache.cpp.
String filename = SQLiteFileSystem::appendDatabaseFileNameToPath(path, "CachedGeoposition.db");
int fd = open(filename.utf8().data(), O_CREAT | O_EXCL, permissionFlags660);
if (fd >= 0)
close(fd);
}
flag = env->GetBooleanField(obj, gFieldIds->mXSSAuditorEnabled);
s->setXSSAuditorEnabled(flag);
#if ENABLE(LINK_PREFETCH)
flag = env->GetBooleanField(obj, gFieldIds->mLinkPrefetchEnabled);
s->setLinkPrefetchEnabled(flag);
#endif
size = env->GetIntField(obj, gFieldIds->mPageCacheCapacity);
if (size > 0) {
s->setUsesPageCache(true);
WebCore::pageCache()->setCapacity(size);
} else
s->setUsesPageCache(false);
#if ENABLE(WEB_AUTOFILL)
flag = env->GetBooleanField(obj, gFieldIds->mAutoFillEnabled);
// TODO: This updates the Settings WebCore side with the user's
// preference for autofill and will stop WebCore making requests
// into the chromium autofill code. That code in Chromium also has
// a notion of being enabled/disabled that gets read from the users
// preferences. At the moment, it's hardcoded to true on Android
// (see chrome/browser/autofill/autofill_manager.cc:405). This
// setting should probably be synced into Chromium also.
s->setAutoFillEnabled(flag);
if (flag) {
EditorClientAndroid* editorC = static_cast<EditorClientAndroid*>(pFrame->page()->editorClient());
WebAutofill* webAutofill = editorC->getAutofill();
// Set the active AutofillProfile data.
jobject autoFillProfile = env->GetObjectField(obj, gFieldIds->mAutoFillProfile);
if (autoFillProfile)
syncAutoFillProfile(env, autoFillProfile, webAutofill);
else {
// The autofill profile is null. We need to tell Chromium about this because
// this may be because the user just deleted their profile but left the
// autofill feature setting enabled.
webAutofill->clearProfiles();
}
}
#endif
// This is required to enable the XMLTreeViewer when loading an XML document that
// has no style attached to it. http://trac.webkit.org/changeset/79799
s->setDeveloperExtrasEnabled(true);
s->setSpatialNavigationEnabled(true);
bool echoPassword = env->GetBooleanField(obj,
gFieldIds->mPasswordEchoEnabled);
s->setPasswordEchoEnabled(echoPassword);
}