// Copyright (c) 2008 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 "precompiled_libcef.h" #include "browser_webkit_glue.h" #include "base/compiler_specific.h" #include "config.h" #include "webkit_version.h" MSVC_PUSH_WARNING_LEVEL(0); #include "Markup.h" #include "TextEncoding.h" #include "webkit/glue/webframe_impl.h" MSVC_POP_WARNING(); #undef LOG #include "base/path_service.h" #include "base/scoped_ptr.h" #include "base/string16.h" #include "base/win_util.h" #include "net/base/mime_util.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/screen_info.h" #include "webkit/glue/webframe.h" #include "webkit/glue/webkit_glue.h" // Generated by GRIT #include "grit/webkit_resources.h" 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; } std::string GetDataResource(int resource_id) { if (resource_id == IDR_BROKENIMAGE) { // Use webkit's broken image icon (16x16) static unsigned char broken_image_data[] = { 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x10, 0x00, 0x10, 0x00, 0xD5, 0x00, 0x00, 0x20, 0x68, 0xB0, 0x70, 0x98, 0xC0, 0x28, 0x78, 0xB8, 0x20, 0x70, 0xB8, 0x88, 0xB8, 0xD8, 0x78, 0x98, 0xC8, 0x28, 0x80, 0xC0, 0xF8, 0xF8, 0xF8, 0xF0, 0xF0, 0xF8, 0xE0, 0xE8, 0xF0, 0xD0, 0xE0, 0xF0, 0xB8, 0xD0, 0xE8, 0xC0, 0xD8, 0xE8, 0x98, 0xC0, 0xE0, 0x68, 0x90, 0xC0, 0x70, 0x90, 0xC0, 0x30, 0x80, 0xC0, 0x28, 0x88, 0xC0, 0x30, 0x78, 0xB8, 0x88, 0xB8, 0xE0, 0x78, 0xA0, 0xC8, 0x20, 0x70, 0xB0, 0x90, 0xA8, 0xD0, 0x88, 0xA8, 0xD0, 0x70, 0x98, 0xC8, 0x90, 0xB0, 0xD0, 0x80, 0xA0, 0xC8, 0x28, 0x88, 0xC8, 0x20, 0x78, 0xB8, 0x40, 0x90, 0xC8, 0x50, 0x98, 0xC8, 0x28, 0x78, 0xC0, 0x50, 0x90, 0xC8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x06, 0x8F, 0xC0, 0x8C, 0x70, 0x48, 0x2C, 0x66, 0x2C, 0x87, 0xA4, 0x72, 0xB9, 0xB4, 0x20, 0x37, 0xD0, 0xA8, 0x14, 0x7A, 0xB0, 0x5C, 0x0E, 0x51, 0x83, 0x76, 0x1B, 0x3D, 0x5C, 0xAE, 0x91, 0x88, 0x76, 0x32, 0x59, 0x34, 0x3A, 0x86, 0xB0, 0x57, 0x73, 0xD8, 0x12, 0x12, 0x86, 0xCE, 0x21, 0xF1, 0xD1, 0x1E, 0x34, 0xEC, 0xAD, 0x87, 0x20, 0x80, 0x1C, 0x10, 0x02, 0x76, 0x78, 0x6D, 0x06, 0x1F, 0x02, 0x87, 0x0D, 0x0C, 0x20, 0x1C, 0x82, 0x14, 0x07, 0x87, 0x87, 0x1C, 0x20, 0x04, 0x1C, 0x95, 0x87, 0x07, 0x14, 0x05, 0x07, 0x95, 0x95, 0x03, 0x12, 0x12, 0x03, 0x9C, 0x1C, 0x07, 0x05, 0x18, 0x07, 0x03, 0xA8, 0x03, 0x15, 0x0A, 0x0A, 0x15, 0xA9, 0x03, 0x07, 0x18, 0x01, 0xA7, 0xA9, 0xAB, 0xAD, 0xAF, 0x07, 0x01, 0x0F, 0x07, 0x15, 0xBD, 0x15, 0x00, 0xC0, 0x00, 0xBE, 0x15, 0x07, 0x0F, 0x0E, 0xBC, 0xC3, 0xC9, 0xBD, 0x07, 0x0E, 0xC7, 0x4C, 0xCF, 0x49, 0xCD, 0xD2, 0xD3, 0xD4, 0xD2, 0x41, 0x00, 0x3B }; return reinterpret_cast(broken_image_data); } else if (resource_id == IDR_FEED_PREVIEW) { // It is necessary to return a feed preview template that contains // a {{URL}} substring where the feed URL should go; see the code // that computes feed previews in feed_preview.cc:MakeFeedPreview. // This fixes issue #932714. return std::string("Feed preview for {{URL}}"); } else { return std::string(); } } bool GetApplicationDirectory(std::wstring *path) { return PathService::Get(base::DIR_EXE, path); } GURL GetInspectorURL() { return GURL("cef-resource://inspector/inspector.html"); } std::string GetUIResourceProtocol() { return "cef-resource"; } bool GetExeDirectory(std::wstring *path) { return PathService::Get(base::DIR_EXE, path); } bool SpellCheckWord(const wchar_t* word, int word_len, int* misspelling_start, int* misspelling_len) { // Report all words being correctly spelled. *misspelling_start = 0; *misspelling_len = 0; return true; } ScreenInfo GetScreenInfo(gfx::NativeView window) { return GetScreenInfoHelper(window); } bool IsPluginRunningInRendererProcess() { return true; } bool GetPluginFinderURL(std::string* plugin_finder_url) { return false; } bool IsDefaultPluginEnabled() { return false; } std::wstring GetWebKitLocale() { return L"en-US"; } std::string GetDocumentString(WebFrame* frame) { WebFrameImpl* webFrameImpl = static_cast(frame); WebCore::Frame* core_frame = webFrameImpl->frame(); return StringToStdString(WebCore::createMarkup(core_frame->document())); } ScreenInfo GetScreenInfo(gfx::NativeViewId window) { return GetScreenInfoHelper(gfx::NativeViewFromId(window)); } void InitializeTextEncoding() { WebCore::UTF8Encoding(); } } // namespace webkit_glue