// 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); #include "Cache.h" #include "TextEncoding.h" #include "third_party/WebKit/WebKit/chromium/src/WebFrameImpl.h" MSVC_POP_WARNING(); #include "browser_webkit_glue.h" #undef LOG #include "base/logging.h" #include "base/path_service.h" #include "base/resource_util.h" #include "base/scoped_ptr.h" #include "base/string16.h" #include "base/utf_string_conversions.h" #include "base/win_util.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; } base::StringPiece GetRawDataResource(HMODULE module, int resource_id) { void* data_ptr; size_t data_size; return base::GetDataResourceFromModule(module, resource_id, &data_ptr, &data_size) ? base::StringPiece(static_cast(data_ptr), data_size) : base::StringPiece(); } base::StringPiece NetResourceProvider(int key) { HMODULE hModule = ::GetModuleHandle(L"libcef.dll"); if(!hModule) hModule = ::GetModuleHandle(NULL); return GetRawDataResource(hModule, key); } base::StringPiece GetDataResource(int resource_id) { return NetResourceProvider(resource_id); } 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::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. } void ClearCache() { // Clear the cache by disabling it and then re-enabling it. WebCore::cache()->setDisabled(true); WebCore::cache()->setDisabled(false); } 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; } std::string GetProductVersion() { return std::string("CEF/0.0.0.0"); } } // namespace webkit_glue