mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2024-12-16 11:28:54 +01:00
199a3faafe
- The CefSettings.release_dcheck_enabled option has been removed. This functionality can be enabled by setting the dcheck_always_on=1 gyp variable before building CEF/Chromium. See http://crbug.com/350462 for details. - The UR_FLAG_ALLOW_COOKIES option has been removed and the functionality has been merged into UR_FLAG_ALLOW_CACHED_CREDENTIALS. - Mac: [NSApplication sharedApplication] should no longer be called in the renderer process. See http://crbug.com/306348 for details. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1641 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
99 lines
3.1 KiB
C++
99 lines
3.1 KiB
C++
// Copyright (c) 2012 The Chromium Embedded Framework Authors.
|
|
// Portions copyright (c) 2011 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
// MSVC++ requires this to be set before any other includes to get M_PI.
|
|
// Otherwise there will be compile errors in wtf/MathExtras.h.
|
|
#define _USE_MATH_DEFINES
|
|
|
|
// Defines required to access Blink internals (unwrap WebNode).
|
|
#undef BLINK_IMPLEMENTATION
|
|
#define BLINK_IMPLEMENTATION 1
|
|
#undef INSIDE_BLINK
|
|
#define INSIDE_BLINK 1
|
|
|
|
#include "libcef/renderer/webkit_glue.h"
|
|
|
|
#include "base/compiler_specific.h"
|
|
|
|
#include "config.h"
|
|
MSVC_PUSH_WARNING_LEVEL(0);
|
|
#include "third_party/WebKit/public/platform/WebString.h"
|
|
#include "third_party/WebKit/public/web/WebDocument.h"
|
|
#include "third_party/WebKit/public/web/WebElement.h"
|
|
#include "third_party/WebKit/public/web/WebNode.h"
|
|
#include "third_party/WebKit/public/web/WebViewClient.h"
|
|
|
|
#include "third_party/WebKit/Source/core/dom/Node.h"
|
|
#include "third_party/WebKit/Source/web/WebFrameImpl.h"
|
|
#include "third_party/WebKit/Source/web/WebViewImpl.h"
|
|
MSVC_POP_WARNING();
|
|
#undef LOG
|
|
|
|
#include "base/logging.h"
|
|
#include "content/public/renderer/render_frame.h"
|
|
|
|
namespace webkit_glue {
|
|
|
|
const int64 kInvalidFrameId = -1;
|
|
|
|
bool CanGoBack(blink::WebView* view) {
|
|
if (!view)
|
|
return false;
|
|
blink::WebViewImpl* impl = reinterpret_cast<blink::WebViewImpl*>(view);
|
|
return (impl->client()->historyBackListCount() > 0);
|
|
}
|
|
|
|
bool CanGoForward(blink::WebView* view) {
|
|
if (!view)
|
|
return false;
|
|
blink::WebViewImpl* impl = reinterpret_cast<blink::WebViewImpl*>(view);
|
|
return (impl->client()->historyForwardListCount() > 0);
|
|
}
|
|
|
|
void GoBack(blink::WebView* view) {
|
|
if (!view)
|
|
return;
|
|
blink::WebViewImpl* impl = reinterpret_cast<blink::WebViewImpl*>(view);
|
|
if (impl->client()->historyBackListCount() > 0)
|
|
impl->client()->navigateBackForwardSoon(-1);
|
|
}
|
|
|
|
void GoForward(blink::WebView* view) {
|
|
if (!view)
|
|
return;
|
|
blink::WebViewImpl* impl = reinterpret_cast<blink::WebViewImpl*>(view);
|
|
if (impl->client()->historyForwardListCount() > 0)
|
|
impl->client()->navigateBackForwardSoon(1);
|
|
}
|
|
|
|
std::string DumpDocumentText(blink::WebFrame* frame) {
|
|
// We use the document element's text instead of the body text here because
|
|
// not all documents have a body, such as XML documents.
|
|
blink::WebElement document_element = frame->document().documentElement();
|
|
if (document_element.isNull())
|
|
return std::string();
|
|
|
|
return document_element.innerText().utf8();
|
|
}
|
|
|
|
bool SetNodeValue(blink::WebNode& node, const blink::WebString& value) {
|
|
WebCore::Node* web_node = node.unwrap<WebCore::Node>();
|
|
web_node->setNodeValue(value);
|
|
return true;
|
|
}
|
|
|
|
int64 GetIdentifier(blink::WebFrame* frame) {
|
|
// Each WebFrame will have an associated RenderFrame. The RenderFrame
|
|
// routing IDs are unique within a given renderer process.
|
|
content::RenderFrame* render_frame =
|
|
content::RenderFrame::FromWebFrame(frame);
|
|
DCHECK(render_frame);
|
|
if (render_frame)
|
|
return render_frame->GetRoutingID();
|
|
return kInvalidFrameId;
|
|
}
|
|
|
|
} // webkit_glue
|