2010-10-03 23:04:50 +02:00
|
|
|
// Copyright (c) 2008-2009 The Chromium Embedded Framework Authors.
|
|
|
|
// Portions copyright (c) 2006-2008 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.
|
|
|
|
|
|
|
|
#include "base/compiler_specific.h"
|
|
|
|
|
|
|
|
#include "third_party/webkit/webcore/config.h"
|
|
|
|
MSVC_PUSH_WARNING_LEVEL(0);
|
2010-11-16 17:01:14 +01:00
|
|
|
#include "MemoryCache.h"
|
2010-10-03 23:04:50 +02:00
|
|
|
#include "TextEncoding.h"
|
2010-10-16 21:10:11 +02:00
|
|
|
#include "third_party/WebKit/WebCore/platform/network/HTTPParsers.h"
|
2010-10-03 23:04:50 +02:00
|
|
|
#include "third_party/WebKit/WebKit/chromium/src/WebFrameImpl.h"
|
|
|
|
MSVC_POP_WARNING();
|
|
|
|
|
|
|
|
#include "browser_webkit_glue.h"
|
|
|
|
|
|
|
|
#undef LOG
|
2010-11-18 22:05:25 +01:00
|
|
|
#include "cef_context.h"
|
|
|
|
|
2010-10-03 23:04:50 +02:00
|
|
|
#include "base/logging.h"
|
|
|
|
#include "base/path_service.h"
|
|
|
|
#include "base/scoped_ptr.h"
|
|
|
|
#include "base/string16.h"
|
|
|
|
#include "net/base/mime_util.h"
|
|
|
|
#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
|
|
|
|
#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
|
|
|
|
#include "webkit/glue/webkit_glue.h"
|
|
|
|
|
|
|
|
// Generated by GRIT
|
|
|
|
#include "grit/webkit_resources.h"
|
|
|
|
|
|
|
|
using WebKit::WebFrameImpl;
|
|
|
|
|
|
|
|
namespace webkit_glue {
|
|
|
|
|
|
|
|
bool IsMediaPlayerAvailable() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void PrecacheUrl(const char16* url, int url_length) {}
|
|
|
|
|
|
|
|
void AppendToLog(const char* file, int line, const char* msg) {
|
|
|
|
logging::LogMessage(file, line).stream() << msg;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GetApplicationDirectory(FilePath* path) {
|
|
|
|
return PathService::Get(base::DIR_EXE, path);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GetExeDirectory(FilePath* path) {
|
|
|
|
return PathService::Get(base::DIR_EXE, path);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsPluginRunningInRendererProcess() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GetPluginFinderURL(std::string* plugin_finder_url) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsDefaultPluginEnabled() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsProtocolSupportedForMedia(const GURL& url) {
|
|
|
|
if (url.SchemeIsFile() || url.SchemeIs("http") || url.SchemeIs("https"))
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string GetWebKitLocale() {
|
2010-11-18 22:05:25 +01:00
|
|
|
const CefSettings& settings = _Context->settings();
|
2010-11-22 18:49:46 +01:00
|
|
|
if (settings.locale.length > 0)
|
|
|
|
return CefString(&settings.locale);
|
2010-10-03 23:04:50 +02:00
|
|
|
return "en-US";
|
|
|
|
}
|
|
|
|
|
|
|
|
void InitializeTextEncoding() {
|
|
|
|
WebCore::UTF8Encoding();
|
|
|
|
}
|
|
|
|
|
|
|
|
v8::Handle<v8::Context> GetV8Context(WebKit::WebFrame* frame)
|
|
|
|
{
|
|
|
|
WebFrameImpl* webFrameImpl = static_cast<WebFrameImpl*>(frame);
|
|
|
|
WebCore::Frame* core_frame = webFrameImpl->frame();
|
|
|
|
return WebCore::V8Proxy::context(core_frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CloseIdleConnections() {
|
|
|
|
// Used in benchmarking, Ignored for CEF.
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetCacheMode(bool enabled) {
|
|
|
|
// Used in benchmarking, Ignored for CEF.
|
|
|
|
}
|
|
|
|
|
|
|
|
void ClearCache()
|
|
|
|
{
|
|
|
|
// Clear the cache by disabling it and then re-enabling it.
|
|
|
|
WebCore::cache()->setDisabled(true);
|
|
|
|
WebCore::cache()->setDisabled(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string GetProductVersion() {
|
2010-11-18 22:05:25 +01:00
|
|
|
const CefSettings& settings = _Context->settings();
|
2010-11-22 18:49:46 +01:00
|
|
|
if (settings.product_version.length > 0) {
|
|
|
|
return CefString(&settings.product_version);
|
|
|
|
}
|
2010-11-18 22:05:25 +01:00
|
|
|
return "Chrome/7.0.517.0";
|
2010-10-03 23:04:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool IsSingleProcess() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(OS_LINUX)
|
|
|
|
int MatchFontWithFallback(const std::string& face, bool bold,
|
|
|
|
bool italic, int charset) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GetFontTable(int fd, uint32_t table, uint8_t* output,
|
|
|
|
size_t* output_length) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void EnableSpdy(bool enable) {
|
|
|
|
// Used in benchmarking, Ignored for CEF.
|
|
|
|
}
|
|
|
|
|
2010-10-16 21:10:11 +02:00
|
|
|
bool IsContentDispositionAttachment(const std::string& cd_header,
|
|
|
|
std::string& file_name) {
|
|
|
|
WTF::String cd_str(cd_header.c_str(), cd_header.length());
|
|
|
|
if (WebCore::contentDispositionType(cd_str) ==
|
|
|
|
WebCore::ContentDispositionAttachment) {
|
|
|
|
WTF::String name_str =
|
|
|
|
WebCore::filenameFromHTTPContentDisposition(cd_str);
|
|
|
|
if (!name_str.isEmpty()) {
|
2010-10-23 19:00:47 +02:00
|
|
|
WTF::CString cstr(name_str.utf8());
|
|
|
|
file_name = std::string(cstr.data(), cstr.length());
|
2010-10-16 21:10:11 +02:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-10-03 23:04:50 +02:00
|
|
|
} // namespace webkit_glue
|