2009-07-24 21:11:01 +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.
|
|
|
|
|
2008-12-02 16:48:14 +01:00
|
|
|
#include "base/compiler_specific.h"
|
|
|
|
|
2009-10-18 22:39:22 +02:00
|
|
|
#include "third_party/webkit/webcore/config.h"
|
2009-07-24 21:11:01 +02:00
|
|
|
MSVC_PUSH_WARNING_LEVEL(0);
|
2009-09-26 03:22:33 +02:00
|
|
|
#include "Cache.h"
|
2009-07-24 21:11:01 +02:00
|
|
|
#include "TextEncoding.h"
|
2010-01-12 02:37:00 +01:00
|
|
|
#include "third_party/WebKit/WebKit/chromium/src/WebFrameImpl.h"
|
2008-12-02 16:48:14 +01:00
|
|
|
MSVC_POP_WARNING();
|
2009-07-24 21:11:01 +02:00
|
|
|
|
2009-04-28 02:29:14 +02:00
|
|
|
#include "browser_webkit_glue.h"
|
|
|
|
|
2009-10-26 17:53:35 +01:00
|
|
|
#undef LOG
|
2009-10-03 03:36:52 +02:00
|
|
|
#include "base/logging.h"
|
2008-12-02 16:48:14 +01:00
|
|
|
#include "base/path_service.h"
|
2009-04-28 02:29:14 +02:00
|
|
|
#include "base/resource_util.h"
|
2009-07-24 21:11:01 +02:00
|
|
|
#include "base/scoped_ptr.h"
|
2008-12-02 16:48:14 +01:00
|
|
|
#include "base/string16.h"
|
2010-03-29 19:53:26 +02:00
|
|
|
#include "base/utf_string_conversions.h"
|
2008-12-02 16:48:14 +01:00
|
|
|
#include "base/win_util.h"
|
|
|
|
#include "net/base/mime_util.h"
|
2010-01-12 02:37:00 +01:00
|
|
|
#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
|
2010-02-11 19:33:33 +01:00
|
|
|
#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
|
2008-12-02 16:48:14 +01:00
|
|
|
#include "webkit/glue/webkit_glue.h"
|
2009-07-24 21:11:01 +02:00
|
|
|
|
|
|
|
// Generated by GRIT
|
|
|
|
#include "grit/webkit_resources.h"
|
|
|
|
|
2009-11-03 02:39:16 +01:00
|
|
|
using WebKit::WebFrameImpl;
|
|
|
|
|
2009-07-24 21:11:01 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2009-09-17 18:56:32 +02:00
|
|
|
base::StringPiece GetRawDataResource(HMODULE module, int resource_id) {
|
2009-07-24 21:11:01 +02:00
|
|
|
void* data_ptr;
|
|
|
|
size_t data_size;
|
|
|
|
return base::GetDataResourceFromModule(module, resource_id, &data_ptr,
|
2009-09-17 18:56:32 +02:00
|
|
|
&data_size)
|
|
|
|
? base::StringPiece(static_cast<char*>(data_ptr), data_size)
|
|
|
|
: base::StringPiece();
|
2009-07-24 21:11:01 +02:00
|
|
|
}
|
|
|
|
|
2009-09-17 18:56:32 +02:00
|
|
|
base::StringPiece NetResourceProvider(int key) {
|
2010-07-20 00:19:30 +02:00
|
|
|
HMODULE hModule = ::GetModuleHandle(L"libcef.dll");
|
|
|
|
if(!hModule)
|
|
|
|
hModule = ::GetModuleHandle(NULL);
|
|
|
|
return GetRawDataResource(hModule, key);
|
2009-07-24 21:11:01 +02:00
|
|
|
}
|
|
|
|
|
2009-09-17 18:56:32 +02:00
|
|
|
base::StringPiece GetDataResource(int resource_id) {
|
2010-07-20 00:19:30 +02:00
|
|
|
return NetResourceProvider(resource_id);
|
2009-07-24 21:11:01 +02:00
|
|
|
}
|
|
|
|
|
2009-09-17 18:56:32 +02:00
|
|
|
bool GetApplicationDirectory(FilePath* path) {
|
2009-07-24 21:11:01 +02:00
|
|
|
return PathService::Get(base::DIR_EXE, path);
|
|
|
|
}
|
|
|
|
|
2009-09-17 18:56:32 +02:00
|
|
|
bool GetExeDirectory(FilePath* path) {
|
2009-07-24 21:11:01 +02:00
|
|
|
return PathService::Get(base::DIR_EXE, path);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsPluginRunningInRendererProcess() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GetPluginFinderURL(std::string* plugin_finder_url) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsDefaultPluginEnabled() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-09-22 18:34:27 +02:00
|
|
|
bool IsProtocolSupportedForMedia(const GURL& url) {
|
|
|
|
if (url.SchemeIsFile() || url.SchemeIs("http") || url.SchemeIs("https"))
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-07-24 21:11:01 +02:00
|
|
|
std::wstring GetWebKitLocale() {
|
|
|
|
return L"en-US";
|
|
|
|
}
|
|
|
|
|
|
|
|
void InitializeTextEncoding() {
|
|
|
|
WebCore::UTF8Encoding();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CloseIdleConnections() {
|
|
|
|
// Used in benchmarking, Ignored for CEF.
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetCacheMode(bool enabled) {
|
|
|
|
// Used in benchmarking, Ignored for CEF.
|
|
|
|
}
|
|
|
|
|
2009-09-26 03:22:33 +02:00
|
|
|
void ClearCache()
|
|
|
|
{
|
|
|
|
// Clear the cache by disabling it and then re-enabling it.
|
|
|
|
WebCore::cache()->setDisabled(true);
|
|
|
|
WebCore::cache()->setDisabled(false);
|
|
|
|
}
|
|
|
|
|
2010-02-11 19:33:33 +01:00
|
|
|
WebKit::WebString StdStringToWebString(const std::string& str) {
|
|
|
|
return WebKit::WebString::fromUTF8(str.data(), str.size());
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string WebStringToStdString(const WebKit::WebString& str) {
|
|
|
|
std::string ret;
|
|
|
|
if (!str.isNull())
|
|
|
|
UTF16ToUTF8(str.data(), str.length(), &ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-06-21 20:02:39 +02:00
|
|
|
std::string GetProductVersion() {
|
|
|
|
return std::string("CEF/0.0.0.0");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-24 21:11:01 +02:00
|
|
|
} // namespace webkit_glue
|