diff --git a/CMakeLists.txt b/CMakeLists.txt index fdc826b..e710321 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.21) PROJECT(HunanRender) -SET(CMAKE_CXX_STANDARD 17) +SET(CMAKE_CXX_STANDARD 14) SET(CMAKE_CXX_STANDARD_REQUIRED ON) SET(CMAKE_CXX_EXTENSIONS OFF) diff --git a/src/CEF/CefApp.cpp b/src/CEF/CefApp.cpp deleted file mode 100644 index 2af4535..0000000 --- a/src/CEF/CefApp.cpp +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) 2013 The Chromium Embedded Framework 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 "CEF/CefApp.h" - -#include - -#include "include/cef_browser.h" -#include "include/cef_command_line.h" -#include "include/views/cef_browser_view.h" -#include "include/views/cef_window.h" -#include "include/wrapper/cef_helpers.h" -#include "CEF/simple_handler.h" - -namespace { - -// When using the Views framework this object provides the delegate -// implementation for the CefWindow that hosts the Views-based browser. -class SimpleWindowDelegate : public CefWindowDelegate { - public: - explicit SimpleWindowDelegate(CefRefPtr browser_view) - : browser_view_(browser_view) {} - - void OnWindowCreated(CefRefPtr window) override { - // Add the browser view and show the window. - window->AddChildView(browser_view_); - window->Show(); - - // Give keyboard focus to the browser view. - browser_view_->RequestFocus(); - } - - void OnWindowDestroyed(CefRefPtr window) override { - browser_view_ = nullptr; - } - - bool CanClose(CefRefPtr window) override { - // Allow the window to close if the browser says it's OK. - CefRefPtr browser = browser_view_->GetBrowser(); - if (browser) - return browser->GetHost()->TryCloseBrowser(); - return true; - } - - CefSize GetPreferredSize(CefRefPtr view) override { - return CefSize(800, 600); - } - - private: - CefRefPtr browser_view_; - - IMPLEMENT_REFCOUNTING(SimpleWindowDelegate); - DISALLOW_COPY_AND_ASSIGN(SimpleWindowDelegate); -}; - -class SimpleBrowserViewDelegate : public CefBrowserViewDelegate { - public: - SimpleBrowserViewDelegate() {} - - bool OnPopupBrowserViewCreated(CefRefPtr browser_view, - CefRefPtr popup_browser_view, - bool is_devtools) override { - // Create a new top-level Window for the popup. It will show itself after - // creation. - CefWindow::CreateTopLevelWindow( - new SimpleWindowDelegate(popup_browser_view)); - - // We created the Window. - return true; - } - - private: - IMPLEMENT_REFCOUNTING(SimpleBrowserViewDelegate); - DISALLOW_COPY_AND_ASSIGN(SimpleBrowserViewDelegate); -}; - -} // namespace - -SimpleApp::SimpleApp() {} - -void SimpleApp::OnContextInitialized() { - CEF_REQUIRE_UI_THREAD(); - - CefRefPtr command_line = - CefCommandLine::GetGlobalCommandLine(); - - // Create the browser using the Views framework if "--use-views" is specified - // via the command-line. Otherwise, create the browser using the native - // platform framework. - const bool use_views = command_line->HasSwitch("use-views"); - - // SimpleHandler implements browser-level callbacks. - CefRefPtr handler(new SimpleHandler(use_views)); - - // Specify CEF browser settings here. - CefBrowserSettings browser_settings; - - std::string url; - - // Check if a "--url=" value was provided via the command-line. If so, use - // that instead of the default URL. - url = command_line->GetSwitchValue("url"); - if (url.empty()) - url = "http://www.google.com"; - - if (use_views) { - // Create the BrowserView. - CefRefPtr browser_view = CefBrowserView::CreateBrowserView( - handler, url, browser_settings, nullptr, nullptr, - new SimpleBrowserViewDelegate()); - - // Create the Window. It will show itself after creation. - CefWindow::CreateTopLevelWindow(new SimpleWindowDelegate(browser_view)); - } else { - // Information used when creating the native window. - CefWindowInfo window_info; - -#if defined(OS_WIN) - // On Windows we need to specify certain flags that will be passed to - // CreateWindowEx(). - window_info.SetAsPopup(nullptr, "cefsimple"); -#endif - - // Create the first browser window. - CefBrowserHost::CreateBrowser(window_info, handler, url, browser_settings, - nullptr, nullptr); - } -} - -CefRefPtr SimpleApp::GetDefaultClient() { - // Called when a new browser window is created via the Chrome runtime UI. - return SimpleHandler::GetInstance(); -} diff --git a/src/CEF/CefApp.h b/src/CEF/CefApp.h deleted file mode 100644 index 81afd54..0000000 --- a/src/CEF/CefApp.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -#ifndef CEF_TESTS_CEFSIMPLE_SIMPLE_APP_H_ -#define CEF_TESTS_CEFSIMPLE_SIMPLE_APP_H_ - -#include "include/cef_app.h" - -// Implement application-level callbacks for the browser process. -class SimpleApp : public CefApp, public CefBrowserProcessHandler { - public: - SimpleApp(); - - // CefApp methods: - CefRefPtr GetBrowserProcessHandler() override { - return this; - } - - // CefBrowserProcessHandler methods: - void OnContextInitialized() override; - CefRefPtr GetDefaultClient() override; - - private: - // Include the default reference counting implementation. - IMPLEMENT_REFCOUNTING(SimpleApp); -}; - -#endif // CEF_TESTS_CEFSIMPLE_SIMPLE_APP_H_ diff --git a/src/CEF/HuamAppRendererDelegate.cpp b/src/CEF/HuamAppRendererDelegate.cpp new file mode 100644 index 0000000..12e6e47 --- /dev/null +++ b/src/CEF/HuamAppRendererDelegate.cpp @@ -0,0 +1,377 @@ +#include "CEF/HumanAppRenderer.h" + +#include "CEF/RenderContent.h" + +PERF_TEST_FUNC(V8NullCreate) { + PERF_ITERATIONS_START() + CefRefPtr value = CefV8Value::CreateNull(); + PERF_ITERATIONS_END() +} + +PERF_TEST_FUNC(V8BoolCreate) { + PERF_ITERATIONS_START() + CefRefPtr value = CefV8Value::CreateBool(true); + PERF_ITERATIONS_END() +} + +PERF_TEST_FUNC(V8IntCreate) { + PERF_ITERATIONS_START() + CefRefPtr value = CefV8Value::CreateInt(-5); + PERF_ITERATIONS_END() +} + +PERF_TEST_FUNC(V8UIntCreate) { + PERF_ITERATIONS_START() + CefRefPtr value = CefV8Value::CreateUInt(10); + PERF_ITERATIONS_END() +} + +PERF_TEST_FUNC(V8DoubleCreate) { + PERF_ITERATIONS_START() + CefRefPtr value = CefV8Value::CreateDouble(12.432); + PERF_ITERATIONS_END() +} + +PERF_TEST_FUNC(V8DateCreate) { + static cef_time_t time = { 2012, 1, 0, 1 }; + + PERF_ITERATIONS_START() + CefRefPtr value = CefV8Value::CreateDate(time); + PERF_ITERATIONS_END() +} + +PERF_TEST_FUNC(V8StringCreate) { + CefString str = "test string"; + + PERF_ITERATIONS_START() + CefRefPtr value = CefV8Value::CreateString(str); + PERF_ITERATIONS_END() +} + +PERF_TEST_FUNC(V8ArrayCreate) { + PERF_ITERATIONS_START() + CefRefPtr value = CefV8Value::CreateArray(1); + PERF_ITERATIONS_END() +} + +PERF_TEST_FUNC(V8ArraySetValue) { + CefRefPtr val = CefV8Value::CreateBool(true); + CefRefPtr array = CefV8Value::CreateArray(1); + array->SetValue(0, val); + + PERF_ITERATIONS_START() + array->SetValue(0, val); + PERF_ITERATIONS_END() +} + +PERF_TEST_FUNC(V8ArrayGetValue) { + CefRefPtr val = CefV8Value::CreateBool(true); + CefRefPtr array = CefV8Value::CreateArray(1); + array->SetValue(0, val); + + PERF_ITERATIONS_START() + CefRefPtr ret = array->GetValue(0); + PERF_ITERATIONS_END() +} + +PERF_TEST_FUNC(V8FunctionCreate) { + class Handler : public CefV8Handler { + public: + Handler() {} + virtual bool Execute(const CefString& name, + CefRefPtr object, + const CefV8ValueList& arguments, + CefRefPtr& retval, + CefString& exception) override { + return false; + } + IMPLEMENT_REFCOUNTING(Handler); + }; + + CefString name = "name"; + CefRefPtr handler = new Handler(); + + PERF_ITERATIONS_START() + CefRefPtr value = CefV8Value::CreateFunction(name, handler); + PERF_ITERATIONS_END() +} + +PERF_TEST_FUNC(V8FunctionExecute) { + class Handler : public CefV8Handler { + public: + Handler() {} + virtual bool Execute(const CefString& name, + CefRefPtr object, + const CefV8ValueList& arguments, + CefRefPtr& retval, + CefString& exception) override { + return true; + } + IMPLEMENT_REFCOUNTING(Handler); + }; + + CefString name = "name"; + CefRefPtr handler = new Handler(); + CefRefPtr func = CefV8Value::CreateFunction(name, handler); + CefRefPtr obj = CefV8Context::GetCurrentContext()->GetGlobal(); + CefV8ValueList args; + + PERF_ITERATIONS_START() + func->ExecuteFunction(obj, args); + PERF_ITERATIONS_END() +} + +PERF_TEST_FUNC(V8FunctionExecuteWithContext) { + class Handler : public CefV8Handler { + public: + Handler() {} + virtual bool Execute(const CefString& name, + CefRefPtr object, + const CefV8ValueList& arguments, + CefRefPtr& retval, + CefString& exception) override { + return true; + } + IMPLEMENT_REFCOUNTING(Handler); + }; + + CefString name = "name"; + CefRefPtr handler = new Handler(); + CefRefPtr func = CefV8Value::CreateFunction(name, handler); + CefRefPtr context = CefV8Context::GetCurrentContext(); + CefRefPtr obj = context->GetGlobal(); + CefV8ValueList args; + + PERF_ITERATIONS_START() + func->ExecuteFunctionWithContext(context, obj, args); + PERF_ITERATIONS_END() +} + +PERF_TEST_FUNC(V8ObjectCreate) { + PERF_ITERATIONS_START() + CefRefPtr value = CefV8Value::CreateObject(nullptr, nullptr); + PERF_ITERATIONS_END() +} + +PERF_TEST_FUNC(V8ObjectCreateWithAccessor) { + class Accessor : public CefV8Accessor { + public: + Accessor() {} + virtual bool Get(const CefString& name, + const CefRefPtr object, + CefRefPtr& retval, + CefString& exception) override { + return true; + } + virtual bool Set(const CefString& name, + const CefRefPtr object, + const CefRefPtr value, + CefString& exception) override { + return true; + } + IMPLEMENT_REFCOUNTING(Accessor); + }; + + CefRefPtr accessor = new Accessor(); + + PERF_ITERATIONS_START() + CefRefPtr value = CefV8Value::CreateObject(accessor, nullptr); + PERF_ITERATIONS_END() +} + +PERF_TEST_FUNC(V8ObjectCreateWithInterceptor) { + class Interceptor : public CefV8Interceptor { + public: + Interceptor() {} + virtual bool Get(const CefString& name, + const CefRefPtr object, + CefRefPtr& retval, + CefString& exception) override { + return true; + } + virtual bool Get(int index, + const CefRefPtr object, + CefRefPtr& retval, + CefString& exception) override { + return true; + } + virtual bool Set(const CefString& name, + const CefRefPtr object, + const CefRefPtr value, + CefString& exception) override { + return true; + } + virtual bool Set(int index, + const CefRefPtr object, + const CefRefPtr value, + CefString& exception) override { + return true; + } + IMPLEMENT_REFCOUNTING(Interceptor); + }; + + CefRefPtr interceptor = new Interceptor(); + + PERF_ITERATIONS_START() + CefRefPtr value = CefV8Value::CreateObject(nullptr, interceptor); + PERF_ITERATIONS_END() +} + +PERF_TEST_FUNC(V8ObjectSetValue) { + CefString name = "name"; + CefRefPtr val = CefV8Value::CreateBool(true); + CefRefPtr obj = CefV8Value::CreateObject(nullptr, nullptr); + obj->SetValue(name, val, V8_PROPERTY_ATTRIBUTE_NONE); + + PERF_ITERATIONS_START() + obj->SetValue(name, val, V8_PROPERTY_ATTRIBUTE_NONE); + PERF_ITERATIONS_END() +} + +PERF_TEST_FUNC(V8ObjectGetValue) { + CefString name = "name"; + CefRefPtr val = CefV8Value::CreateBool(true); + CefRefPtr obj = CefV8Value::CreateObject(nullptr, nullptr); + obj->SetValue(name, val, V8_PROPERTY_ATTRIBUTE_NONE); + + PERF_ITERATIONS_START() + CefRefPtr ret = obj->GetValue(name); + PERF_ITERATIONS_END() +} + +PERF_TEST_FUNC(V8ObjectSetValueWithAccessor) { + class Accessor : public CefV8Accessor { + public: + Accessor() {} + virtual bool Get(const CefString& name, + const CefRefPtr object, + CefRefPtr& retval, + CefString& exception) override { + return true; + } + virtual bool Set(const CefString& name, + const CefRefPtr object, + const CefRefPtr value, + CefString& exception) override { + val_ = value; + return true; + } + CefRefPtr val_; + IMPLEMENT_REFCOUNTING(Accessor); + }; + + CefRefPtr accessor = new Accessor(); + + CefString name = "name"; + CefRefPtr val = CefV8Value::CreateBool(true); + CefRefPtr obj = CefV8Value::CreateObject(accessor, nullptr); + obj->SetValue(name, V8_ACCESS_CONTROL_DEFAULT, V8_PROPERTY_ATTRIBUTE_NONE); + obj->SetValue(name, val, V8_PROPERTY_ATTRIBUTE_NONE); + + PERF_ITERATIONS_START() + obj->SetValue(name, val, V8_PROPERTY_ATTRIBUTE_NONE); + PERF_ITERATIONS_END() +} + +PERF_TEST_FUNC(V8ObjectGetValueWithAccessor) { + class Accessor : public CefV8Accessor { + public: + Accessor() : val_(CefV8Value::CreateBool(true)) {} + virtual bool Get(const CefString& name, + const CefRefPtr object, + CefRefPtr& retval, + CefString& exception) override { + retval = val_; + return true; + } + virtual bool Set(const CefString& name, + const CefRefPtr object, + const CefRefPtr value, + CefString& exception) override { + return true; + } + CefRefPtr val_; + IMPLEMENT_REFCOUNTING(Accessor); + }; + + CefRefPtr accessor = new Accessor(); + + CefString name = "name"; + CefRefPtr val = CefV8Value::CreateBool(true); + CefRefPtr obj = CefV8Value::CreateObject(accessor, nullptr); + obj->SetValue(name, V8_ACCESS_CONTROL_DEFAULT, V8_PROPERTY_ATTRIBUTE_NONE); + obj->SetValue(name, val, V8_PROPERTY_ATTRIBUTE_NONE); + + PERF_ITERATIONS_START() + CefRefPtr ret = obj->GetValue(name); + PERF_ITERATIONS_END() +} + +PERF_TEST_FUNC(V8ArrayBufferCreate) { + class ReleaseCallback : public CefV8ArrayBufferReleaseCallback { + public: + void ReleaseBuffer(void* buffer) override { + std::free(buffer); + } + IMPLEMENT_REFCOUNTING(ReleaseCallback); + }; + + size_t len = 1; + size_t byte_len = len * sizeof(float); + CefRefPtr callback = new ReleaseCallback(); + + PERF_ITERATIONS_START() + float* buffer = (float*)std::malloc(byte_len); + CefRefPtr ret = + CefV8Value::CreateArrayBuffer(buffer, byte_len, callback); + PERF_ITERATIONS_END() +} + +PERF_TEST_FUNC(V8ContextEnterExit) { + CefRefPtr context = CefV8Context::GetCurrentContext(); + + PERF_ITERATIONS_START() + context->Enter(); + context->Exit(); + PERF_ITERATIONS_END() +} + +PERF_TEST_FUNC(V8ContextEval) { + CefRefPtr context = CefV8Context::GetCurrentContext(); + CefString jsCode = "var i = 0;"; + CefRefPtr retval; + CefRefPtr exception; + + PERF_ITERATIONS_START() + context->Eval(jsCode, CefString(), 0, retval, exception); + PERF_ITERATIONS_END() +} + +const PerfTestEntry kPerfTests[] = { + PERF_TEST_ENTRY(V8NullCreate), + PERF_TEST_ENTRY(V8BoolCreate), + PERF_TEST_ENTRY(V8IntCreate), + PERF_TEST_ENTRY(V8UIntCreate), + PERF_TEST_ENTRY(V8DoubleCreate), + PERF_TEST_ENTRY(V8DateCreate), + PERF_TEST_ENTRY(V8StringCreate), + PERF_TEST_ENTRY(V8ArrayCreate), + PERF_TEST_ENTRY(V8ArraySetValue), + PERF_TEST_ENTRY(V8ArrayGetValue), + PERF_TEST_ENTRY(V8FunctionCreate), + PERF_TEST_ENTRY(V8FunctionExecute), + PERF_TEST_ENTRY(V8FunctionExecuteWithContext), + PERF_TEST_ENTRY(V8ObjectCreate), + PERF_TEST_ENTRY(V8ObjectCreateWithAccessor), + PERF_TEST_ENTRY(V8ObjectCreateWithInterceptor), + PERF_TEST_ENTRY(V8ObjectSetValue), + PERF_TEST_ENTRY(V8ObjectGetValue), + PERF_TEST_ENTRY(V8ObjectSetValueWithAccessor), + PERF_TEST_ENTRY(V8ObjectGetValueWithAccessor), + PERF_TEST_ENTRY(V8ArrayBufferCreate), + PERF_TEST_ENTRY(V8ContextEnterExit), + PERF_TEST_ENTRY(V8ContextEval), +}; + +const int kPerfTestsCount = (sizeof(kPerfTests) / sizeof(kPerfTests[0])); + diff --git a/src/CEF/HumanApp.cpp b/src/CEF/HumanApp.cpp new file mode 100644 index 0000000..225a45b --- /dev/null +++ b/src/CEF/HumanApp.cpp @@ -0,0 +1,47 @@ +// Copyright (c) 2013 The Chromium Embedded Framework 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 "CEF/HumanApp.h" + +#include +#include + +#include "include/base/cef_callback.h" +#include "include/cef_app.h" +#include "include/cef_parser.h" +#include "include/views/cef_browser_view.h" +#include "include/views/cef_window.h" +#include "include/wrapper/cef_closure_task.h" +#include "include/wrapper/cef_helpers.h" + +const char kProcessType[] = "type"; +const char kRendererProcess[] = "renderer"; + + +HumanApp::HumanApp() {} + +// static +HumanApp::ProcessType HumanApp::GetProcessType( + CefRefPtr command_line) { + // The command-line flag won't be specified for the browser process. + if (!command_line->HasSwitch(kProcessType)) + return BrowserProcess; + + const std::string& process_type = command_line->GetSwitchValue(kProcessType); + if (process_type == kRendererProcess) + return RendererProcess; + + return OtherProcess; +} + + +void HumanApp::RegisterCustomSchemes(CefRawPtr registrar) { + +} + +void HumanApp::OnRegisterCustomSchemes( + CefRawPtr registrar) { + RegisterCustomSchemes(registrar); +} + diff --git a/src/CEF/HumanApp.h b/src/CEF/HumanApp.h new file mode 100644 index 0000000..b24bfee --- /dev/null +++ b/src/CEF/HumanApp.h @@ -0,0 +1,32 @@ +#pragma once + +#include "include/cef_app.h" + +#include + +class HumanApp : public CefApp { +public: + HumanApp(); + + enum ProcessType { + BrowserProcess, + RendererProcess, + ZygoteProcess, + OtherProcess, + }; + + // Determine the process type based on command-line arguments. + static ProcessType GetProcessType(CefRefPtr command_line); + +private: + // Registers custom schemes. Implemented by cefclient in + // client_app_delegates_common.cc + static void RegisterCustomSchemes(CefRawPtr registrar); + + // CefApp methods. + void OnRegisterCustomSchemes( + CefRawPtr registrar) override; + + DISALLOW_COPY_AND_ASSIGN(HumanApp); +}; + diff --git a/src/CEF/HumanAppBrowser.cpp b/src/CEF/HumanAppBrowser.cpp new file mode 100644 index 0000000..3abf79b --- /dev/null +++ b/src/CEF/HumanAppBrowser.cpp @@ -0,0 +1,111 @@ +// Copyright (c) 2013 The Chromium Embedded Framework 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 "CEF/HumanApp.h" + +#include + +#include "include/cef_browser.h" +#include "include/cef_command_line.h" +#include "include/views/cef_browser_view.h" +#include "include/views/cef_window.h" +#include "include/wrapper/cef_helpers.h" + + +HumanAppBrowser::HumanAppBrowser() { + CreateDelegates(delegates_); +} + +// static +void HumanAppBrowser::PopulateSettings(CefRefPtr command_line, + CefSettings& settings) { +#if (defined(OS_WIN) || defined(OS_LINUX)) + settings.multi_threaded_message_loop = + command_line->HasSwitch(client::switches::kMultiThreadedMessageLoop); +#endif + + if (!settings.multi_threaded_message_loop) { + settings.external_message_pump = + command_line->HasSwitch(client::switches::kExternalMessagePump); + } + + std::vector cookieable_schemes; + RegisterCookieableSchemes(cookieable_schemes); + if (!cookieable_schemes.empty()) { + std::string list_str; + for (const auto& scheme : cookieable_schemes) { + if (!list_str.empty()) + list_str += ","; + list_str += scheme; + } + CefString(&settings.cookieable_schemes_list) = list_str; + } +} + +void HumanAppBrowser::OnBeforeCommandLineProcessing( + const CefString& process_type, + CefRefPtr command_line) { + // Pass additional command-line flags to the browser process. + if (process_type.empty()) { + // Pass additional command-line flags when off-screen rendering is enabled. + if (command_line->HasSwitch(switches::kOffScreenRenderingEnabled) && + !command_line->HasSwitch(switches::kSharedTextureEnabled)) { + // Use software rendering and compositing (disable GPU) for increased FPS + // and decreased CPU usage. This will also disable WebGL so remove these + // switches if you need that capability. + // See https://bitbucket.org/chromiumembedded/cef/issues/1257 for details. + if (!command_line->HasSwitch(switches::kEnableGPU)) { + command_line->AppendSwitch("disable-gpu"); + command_line->AppendSwitch("disable-gpu-compositing"); + } + } + + if (command_line->HasSwitch(switches::kUseViews) && + !command_line->HasSwitch("top-chrome-md")) { + // Use non-material mode on all platforms by default. Among other things + // this causes menu buttons to show hover state. See usage of + // MaterialDesignController::IsModeMaterial() in Chromium code. + command_line->AppendSwitchWithValue("top-chrome-md", "non-material"); + } + + if (!command_line->HasSwitch(switches::kCachePath) && + !command_line->HasSwitch("disable-gpu-shader-disk-cache")) { + // Don't create a "GPUCache" directory when cache-path is unspecified. + command_line->AppendSwitch("disable-gpu-shader-disk-cache"); + } + + // Disable popup blocking for the chrome runtime. + command_line->AppendSwitch("disable-popup-blocking"); + +#if defined(OS_MAC) + // Disable the toolchain prompt on macOS. + command_line->AppendSwitch("use-mock-keychain"); +#endif + + DelegateSet::iterator it = delegates_.begin(); + for (; it != delegates_.end(); ++it) + (*it)->OnBeforeCommandLineProcessing(this, command_line); + } +} + +void HumanAppBrowser::OnContextInitialized() { + DelegateSet::iterator it = delegates_.begin(); + for (; it != delegates_.end(); ++it) + (*it)->OnContextInitialized(this); +} + +void HumanAppBrowser::OnBeforeChildProcessLaunch( + CefRefPtr command_line) { + DelegateSet::iterator it = delegates_.begin(); + for (; it != delegates_.end(); ++it) + (*it)->OnBeforeChildProcessLaunch(this, command_line); +} + +void HumanAppBrowser::OnScheduleMessagePumpWork(int64 delay) { + // Only used when `--external-message-pump` is passed via the command-line. + MainMessageLoopExternalPump* message_pump = + MainMessageLoopExternalPump::Get(); + if (message_pump) + message_pump->OnScheduleMessagePumpWork(delay); +} diff --git a/src/CEF/HumanAppBrowser.h b/src/CEF/HumanAppBrowser.h new file mode 100644 index 0000000..23feb87 --- /dev/null +++ b/src/CEF/HumanAppBrowser.h @@ -0,0 +1,55 @@ +#pragma once + +#include + +#include "CEF/HumanApp.h" + +// Implement application-level callbacks for the browser process. +class HumanAppBrowser : public HumanApp, public CefBrowserProcessHandler { + public: + class Delegate : public virtual CefBaseRefCounted { + public: + virtual void OnBeforeCommandLineProcessing( + CefRefPtr app, + CefRefPtr command_line) {} + + virtual void OnContextInitialized(CefRefPtr app) {} + + virtual void OnBeforeChildProcessLaunch( + CefRefPtr app, + CefRefPtr command_line) {} + }; + + using DelegateSet = std::set>; + + HumanAppBrowser(); + + static void PopulateSettings(CefRefPtr command_line, + CefSettings& settings); + +private: + static void RegisterCookieableSchemes( + std::vector& cookieable_schemes); + + static void CreateDelegates(DelegateSet& delegates); + + void OnBeforeCommandLineProcessing( + const CefString& process_type, + CefRefPtr command_line) override; + CefRefPtr GetBrowserProcessHandler() override { + return this; + } + + // CefBrowserProcessHandler methods. + void OnContextInitialized() override; + void OnBeforeChildProcessLaunch( + CefRefPtr command_line) override; + void OnScheduleMessagePumpWork(int64 delay) override; + + + DelegateSet delegates_; + + IMPLEMENT_REFCOUNTING(HumanAppBrowser); + DISALLOW_COPY_AND_ASSIGN(HumanAppBrowser); +}; + diff --git a/src/CEF/HumanAppOther.cpp b/src/CEF/HumanAppOther.cpp new file mode 100644 index 0000000..954a090 --- /dev/null +++ b/src/CEF/HumanAppOther.cpp @@ -0,0 +1,7 @@ +// Copyright (c) 2012 The Chromium Embedded Framework 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 "CEF/HumanAppOther.h" + +HumanAppOther::HumanAppOther() {} diff --git a/src/CEF/HumanAppOther.h b/src/CEF/HumanAppOther.h new file mode 100644 index 0000000..87c7413 --- /dev/null +++ b/src/CEF/HumanAppOther.h @@ -0,0 +1,15 @@ +#pragma once + +#include + +#include "CEF/HumanApp.h" + +class HumanAppOther + : public HumanApp{ +public: + HumanAppOther(); +private: + IMPLEMENT_REFCOUNTING(HumanAppOther); + DISALLOW_COPY_AND_ASSIGN(HumanAppOther); +}; + diff --git a/src/CEF/HumanAppRenderer.cpp b/src/CEF/HumanAppRenderer.cpp new file mode 100644 index 0000000..440eae6 --- /dev/null +++ b/src/CEF/HumanAppRenderer.cpp @@ -0,0 +1,314 @@ +// Copyright (c) 2012 The Chromium Embedded Framework 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 "CEF/HumanAppRenderer.h" + +#include +#include + +#include "include/cef_crash_util.h" +#include "include/cef_dom.h" +#include "include/wrapper/cef_helpers.h" +#include "include/wrapper/cef_message_router.h" + +#include "CEF/RenderContent.h" + +const char kFocusedNodeChangedMessage[] = "ClientRenderer.FocusedNodeChanged"; + +class ClientRenderDelegate : public HumanAppRenderer::Delegate { + public: + ClientRenderDelegate() : last_node_is_editable_(false) {} + + void OnWebKitInitialized(CefRefPtr app) override { + if (CefCrashReportingEnabled()) { + // Set some crash keys for testing purposes. Keys must be defined in the + // "crash_reporter.cfg" file. See cef_crash_util.h for details. + CefSetCrashKeyValue("testkey_small1", "value1_small_renderer"); + CefSetCrashKeyValue("testkey_small2", "value2_small_renderer"); + CefSetCrashKeyValue("testkey_medium1", "value1_medium_renderer"); + CefSetCrashKeyValue("testkey_medium2", "value2_medium_renderer"); + CefSetCrashKeyValue("testkey_large1", "value1_large_renderer"); + CefSetCrashKeyValue("testkey_large2", "value2_large_renderer"); + } + + // Create the renderer-side router for query handling. + CefMessageRouterConfig config; + message_router_ = CefMessageRouterRendererSide::Create(config); + } + + void OnContextCreated(CefRefPtr app, + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context) override { + message_router_->OnContextCreated(browser, frame, context); + } + + void OnContextReleased(CefRefPtr app, + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context) override { + message_router_->OnContextReleased(browser, frame, context); + } + + void OnFocusedNodeChanged(CefRefPtr app, + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr node) override { + bool is_editable = (node.get() && node->IsEditable()); + if (is_editable != last_node_is_editable_) { + // Notify the browser of the change in focused element type. + last_node_is_editable_ = is_editable; + CefRefPtr message = + CefProcessMessage::Create(kFocusedNodeChangedMessage); + message->GetArgumentList()->SetBool(0, is_editable); + frame->SendProcessMessage(PID_BROWSER, message); + } + } + + bool OnProcessMessageReceived(CefRefPtr app, + CefRefPtr browser, + CefRefPtr frame, + CefProcessId source_process, + CefRefPtr message) override { + return message_router_->OnProcessMessageReceived(browser, frame, + source_process, message); + } + + private: + bool last_node_is_editable_; + + // Handles the renderer side of query routing. + CefRefPtr message_router_; + + DISALLOW_COPY_AND_ASSIGN(ClientRenderDelegate); + IMPLEMENT_REFCOUNTING(ClientRenderDelegate); +}; + + + +const char kGetPerfTests[] = "GetPerfTests"; +const char kRunPerfTest[] = "RunPerfTest"; +const char kPerfTestReturnValue[] = "PerfTestReturnValue"; + +class V8Handler : public CefV8Handler { +public: + V8Handler() {} + + virtual bool Execute(const CefString& name, + CefRefPtr object, + const CefV8ValueList& arguments, + CefRefPtr& retval, + CefString& exception) override { + if (name == kRunPerfTest) { + if (arguments.size() == 1 && arguments[0]->IsString()) { + bool found = false; + + std::string test = arguments[0]->GetStringValue(); + for (int i = 0; i < kPerfTestsCount; ++i) { + if (test == kPerfTests[i].name) { + // Execute the test. + int64 delta = kPerfTests[i].test(kPerfTests[i].iterations); + + retval = CefV8Value::CreateInt(delta); + found = true; + break; + } + } + + if (!found) { + std::string msg = "Unknown test: "; + msg.append(test); + exception = msg; + } + } else { + exception = "Invalid function parameters"; + } + } else if (name == kGetPerfTests) { + // Retrieve the list of perf tests. + retval = CefV8Value::CreateArray(kPerfTestsCount); + for (int i = 0; i < kPerfTestsCount; ++i) { + CefRefPtr val = CefV8Value::CreateArray(2); + val->SetValue(0, CefV8Value::CreateString(kPerfTests[i].name)); + val->SetValue(1, CefV8Value::CreateUInt(kPerfTests[i].iterations)); + retval->SetValue(i, val); + } + } else if (name == kPerfTestReturnValue) { + if (arguments.size() == 0) { + retval = CefV8Value::CreateInt(1); + } else if (arguments.size() == 1 && arguments[0]->IsInt()) { + int32 type = arguments[0]->GetIntValue(); + CefTime date; + switch (type) { + case 0: + retval = CefV8Value::CreateUndefined(); + break; + case 1: + retval = CefV8Value::CreateNull(); + break; + case 2: + retval = CefV8Value::CreateBool(true); + break; + case 3: + retval = CefV8Value::CreateInt(1); + break; + case 4: + retval = CefV8Value::CreateUInt(1); + break; + case 5: + retval = CefV8Value::CreateDouble(1.234); + break; + case 6: + date.Now(); + retval = CefV8Value::CreateDate(date); + break; + case 7: + retval = CefV8Value::CreateString("Hello, world!"); + break; + case 8: + retval = CefV8Value::CreateObject(nullptr, nullptr); + break; + case 9: + retval = CefV8Value::CreateArray(8); + break; + case 10: + // retval = CefV8Value::CreateFunction(...); + exception = "Not implemented"; + break; + default: + exception = "Not supported"; + } + } + } + + return true; + } + +private: + IMPLEMENT_REFCOUNTING(V8Handler); +}; + +// Handle bindings in the render process. +class RenderDelegate : public HumanAppRenderer::Delegate { +public: + RenderDelegate() {} + + virtual void OnContextCreated(CefRefPtr app, + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context) override { + CefRefPtr object = context->GetGlobal(); + + CefRefPtr handler = new V8Handler(); + + // Bind test functions. + object->SetValue(kGetPerfTests, + CefV8Value::CreateFunction(kGetPerfTests, handler), + V8_PROPERTY_ATTRIBUTE_READONLY); + object->SetValue(kRunPerfTest, + CefV8Value::CreateFunction(kRunPerfTest, handler), + V8_PROPERTY_ATTRIBUTE_READONLY); + object->SetValue(kPerfTestReturnValue, + CefV8Value::CreateFunction(kPerfTestReturnValue, handler), + V8_PROPERTY_ATTRIBUTE_READONLY); + } + +private: + IMPLEMENT_REFCOUNTING(RenderDelegate); +}; + + + + +HumanAppRenderer::HumanAppRenderer() { + CreateDelegates(delegates_); +} + + +void HumanAppRenderer::CreateDelegates(DelegateSet& delegates) { + delegates.insert(new ClientRenderDelegate); +} + +void HumanAppRenderer::OnWebKitInitialized() { + DelegateSet::iterator it = delegates_.begin(); + for (; it != delegates_.end(); ++it) + (*it)->OnWebKitInitialized(this); +} + +void HumanAppRenderer::OnBrowserCreated( + CefRefPtr browser, + CefRefPtr extra_info) { + DelegateSet::iterator it = delegates_.begin(); + for (; it != delegates_.end(); ++it) + (*it)->OnBrowserCreated(this, browser, extra_info); +} + +void HumanAppRenderer::OnBrowserDestroyed(CefRefPtr browser) { + DelegateSet::iterator it = delegates_.begin(); + for (; it != delegates_.end(); ++it) + (*it)->OnBrowserDestroyed(this, browser); +} + +CefRefPtr HumanAppRenderer::GetLoadHandler() { + CefRefPtr load_handler; + DelegateSet::iterator it = delegates_.begin(); + for (; it != delegates_.end() && !load_handler.get(); ++it) + load_handler = (*it)->GetLoadHandler(this); + + return load_handler; +} + +void HumanAppRenderer::OnContextCreated(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context) { + DelegateSet::iterator it = delegates_.begin(); + for (; it != delegates_.end(); ++it) + (*it)->OnContextCreated(this, browser, frame, context); +} + +void HumanAppRenderer::OnContextReleased(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context) { + DelegateSet::iterator it = delegates_.begin(); + for (; it != delegates_.end(); ++it) + (*it)->OnContextReleased(this, browser, frame, context); +} + +void HumanAppRenderer::OnUncaughtException( + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context, + CefRefPtr exception, + CefRefPtr stackTrace) { + DelegateSet::iterator it = delegates_.begin(); + for (; it != delegates_.end(); ++it) { + (*it)->OnUncaughtException(this, browser, frame, context, exception, + stackTrace); + } +} + +void HumanAppRenderer::OnFocusedNodeChanged(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr node) { + DelegateSet::iterator it = delegates_.begin(); + for (; it != delegates_.end(); ++it) + (*it)->OnFocusedNodeChanged(this, browser, frame, node); +} + +bool HumanAppRenderer::OnProcessMessageReceived( + CefRefPtr browser, + CefRefPtr frame, + CefProcessId source_process, + CefRefPtr message) { + DCHECK_EQ(source_process, PID_BROWSER); + + bool handled = false; + + DelegateSet::iterator it = delegates_.begin(); + for (; it != delegates_.end() && !handled; ++it) { + handled = (*it)->OnProcessMessageReceived(this, browser, frame, + source_process, message); + } + + return handled; +} diff --git a/src/CEF/HumanAppRenderer.h b/src/CEF/HumanAppRenderer.h new file mode 100644 index 0000000..1507566 --- /dev/null +++ b/src/CEF/HumanAppRenderer.h @@ -0,0 +1,103 @@ +#pragma once + +#include + +#include "CEF/HumanApp.h" + +class HumanAppRenderer + : public HumanApp + , public CefRenderProcessHandler { +public: + class Delegate : public virtual CefBaseRefCounted { + public: + virtual void OnWebKitInitialized(CefRefPtr app) {} + + virtual void OnBrowserCreated(CefRefPtr app, + CefRefPtr browser, + CefRefPtr extra_info) {} + + virtual void OnBrowserDestroyed(CefRefPtr app, + CefRefPtr browser) {} + + virtual CefRefPtr GetLoadHandler( + CefRefPtr app) { + return nullptr; + } + + virtual void OnContextCreated(CefRefPtr app, + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context) {} + + virtual void OnContextReleased(CefRefPtr app, + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context) {} + + virtual void OnUncaughtException(CefRefPtr app, + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context, + CefRefPtr exception, + CefRefPtr stackTrace) {} + + virtual void OnFocusedNodeChanged(CefRefPtr app, + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr node) {} + + virtual bool OnProcessMessageReceived( + CefRefPtr app, + CefRefPtr browser, + CefRefPtr frame, + CefProcessId source_process, + CefRefPtr message) { + return false; + } + }; + + using DelegateSet = std::set>; + + + HumanAppRenderer(); + +private: + static void CreateDelegates(DelegateSet& delegates); + + // CefApp methods. + CefRefPtr GetRenderProcessHandler() override { + return this; + } + + // CefRenderProcessHandler methods. + void OnWebKitInitialized() override; + void OnBrowserCreated(CefRefPtr browser, + CefRefPtr extra_info) override; + void OnBrowserDestroyed(CefRefPtr browser) override; + CefRefPtr GetLoadHandler() override; + void OnContextCreated(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context) override; + void OnContextReleased(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context) override; + void OnUncaughtException(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context, + CefRefPtr exception, + CefRefPtr stackTrace) override; + void OnFocusedNodeChanged(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr node) override; + bool OnProcessMessageReceived(CefRefPtr browser, + CefRefPtr frame, + CefProcessId source_process, + CefRefPtr message) override; + +private: + DelegateSet delegates_; + + IMPLEMENT_REFCOUNTING(HumanAppRenderer); + DISALLOW_COPY_AND_ASSIGN(HumanAppRenderer); +}; + diff --git a/src/CEF/Main.cpp b/src/CEF/Main.cpp new file mode 100644 index 0000000..cb446e2 --- /dev/null +++ b/src/CEF/Main.cpp @@ -0,0 +1,83 @@ +#if 1 +#include + +#include "Core/Core.h" + +#include "include/cef_command_line.h" +#include "include/cef_sandbox_win.h" +#include "CEF/HumanAppBrowser.h" +#include "CEF/HumanAppRenderer.h" +#include "CEF/HumanAppOther.h" + + +static int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, + _In_ LPWSTR lpCmdLine, _In_ int nCmdShow) { + Logger::Init(); + UNREFERENCED_PARAMETER(hPrevInstance); + UNREFERENCED_PARAMETER(lpCmdLine); + + // Enable High-DPI support on Windows 7 or newer. + CefEnableHighDPISupport(); + + void* sandbox_info = nullptr; + +#if defined(CEF_USE_SANDBOX) + // Manage the life span of the sandbox information object. This is necessary + // for sandbox support on Windows. See cef_sandbox_win.h for complete details. + CefScopedSandboxInfo scoped_sandbox; + sandbox_info = scoped_sandbox.sandbox_info(); +#endif + + // Provide CEF with command-line arguments. + CefMainArgs main_args(hInstance); + + // CEF applications have multiple sub-processes (render, GPU, etc) that share + // the same executable. This function checks the command-line and, if this is + // a sub-process, executes the appropriate logic. + int exit_code = CefExecuteProcess(main_args, nullptr, sandbox_info); + if (exit_code >= 0) { + // The sub-process has completed so return here. + return exit_code; + } + + // Parse command-line arguments for use in this method. + CefRefPtr command_line = CefCommandLine::CreateCommandLine(); + command_line->InitFromString(::GetCommandLineW()); + + // Specify CEF global settings here. + CefSettings settings; + + if (command_line->HasSwitch("enable-chrome-runtime")) { + // Enable experimental Chrome runtime. See issue #2969 for details. + settings.chrome_runtime = true; + } + +#if !defined(CEF_USE_SANDBOX) + settings.no_sandbox = true; +#endif + + // SimpleApp implements application-level callbacks for the browser process. + // It will create the first browser instance in OnContextInitialized() after + // CEF has initialized. + CefRefPtr app; + HumanApp::ProcessType process_type = HumanApp::GetProcessType(command_line); + if (process_type == HumanApp::BrowserProcess) + app = new HumanAppBrowser(); + else if (process_type == HumanApp::RendererProcess) + app = new HumanAppRenderer(); + else if (process_type == HumanApp::OtherProcess) + app = new HumanAppOther(); + + // Initialize CEF. + CefInitialize(main_args, settings, app.get(), sandbox_info); + + // Run the CEF message loop. This will block until CefQuitMessageLoop() is + // called. + CefRunMessageLoop(); + + // Shut down CEF. + CefShutdown(); + + return 0; +} +#endif diff --git a/src/CEF/RenderContent.h b/src/CEF/RenderContent.h new file mode 100644 index 0000000..8070433 --- /dev/null +++ b/src/CEF/RenderContent.h @@ -0,0 +1,90 @@ +#pragma once + +#include "include/base/cef_logging.h" +#include "include/base/cef_macros.h" + +// Default number of iterations. +extern const int kDefaultIterations; + +// Test name. +#define PERF_TEST_NAME(name) PerfTest##name + +// Entry in test array. +#define PERF_TEST_ENTRY_EX(name, iterations) \ + { #name, PERF_TEST_NAME(name), iterations } +#define PERF_TEST_ENTRY(name) PERF_TEST_ENTRY_EX(name, kDefaultIterations) + +// Test function declaration. +#define PERF_TEST_RESULT int64 +#define PERF_TEST_PARAM_ITERATIONS iterations +#define PERF_TEST_PARAMS int PERF_TEST_PARAM_ITERATIONS +#define PERF_TEST_FUNC(name) \ + PERF_TEST_RESULT PERF_TEST_NAME(name)(PERF_TEST_PARAMS) + +// Typedef for test pointers. +typedef PERF_TEST_RESULT(PerfTest(PERF_TEST_PARAMS)); + +class CefTimer { +public: + CefTimer() : running_(false) {} + + bool IsRunning() { + return running_; + } + + void Start() { + DCHECK(!running_); + running_ = true; + start_.Now(); + } + + void Stop() { + stop_.Now(); + DCHECK(running_); + running_ = false; + } + + int64 Delta() { + DCHECK(!running_); + return start_.Delta(stop_); + } + +private: + bool running_; + CefTime start_; + CefTime stop_; + + DISALLOW_COPY_AND_ASSIGN(CefTimer); +}; + +// Peform test iterations using a user-provided timing result variable. +#define PERF_ITERATIONS_START_EX() \ + { \ + CefTimer _timer; \ + _timer.Start(); \ + for (int _i = 0; _i < PERF_TEST_PARAM_ITERATIONS; ++_i) { +#define PERF_ITERATIONS_END_EX(result) \ + } \ + _timer.Stop(); \ + result = _timer.Delta(); \ + } + +// Perform test iterations and return the timing result. +#define PERF_ITERATIONS_START() \ + int64 _result = 0; \ + PERF_ITERATIONS_START_EX() + +#define PERF_ITERATIONS_END() \ + PERF_ITERATIONS_END_EX(_result) \ + return _result; + +// Perf test entry structure. +struct PerfTestEntry { + const char* name; + PerfTest* test; + int iterations; +}; + +// Array of perf tests. +extern const PerfTestEntry kPerfTests[]; +extern const int kPerfTestsCount; \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3824fa3..2cf2abf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,11 +9,17 @@ FILE(GLOB_RECURSE CPP_FILES ./*.cpp) FILE(GLOB_RECURSE CC_FILES ./*.cc) FILE(GLOB_RECURSE CC_FILES ./*.c) +SET( + RC_FILE + cefsimple.rc +) + SET( ALL_FILES ${HEADER_FILES} ${CPP_FILES} ${CC_FILES} + ${RC_FILE} ) INCLUDE_DIRECTORIES( @@ -87,13 +93,13 @@ SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${Proj TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ) -# -#add_custom_command(TARGET ${PROJECT_NAME} -# POST_BUILD -# -# COMMAND mt.exe -# -manifest \"${CMAKE_CURRENT_SOURCE_DIR}\\${PROJECT_NAME}.manifest\" -# -inputresource:\"$\" -# -outputresource:\"$\" -#) -# \ No newline at end of file + +add_custom_command(TARGET ${PROJECT_NAME} + POST_BUILD + + COMMAND mt.exe -nologo + -manifest \"${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.exe.manifest\" + \"${CMAKE_CURRENT_SOURCE_DIR}/compatibility.manifest\" + -inputresource:\"$\" + -outputresource:\"$\" +) diff --git a/src/HumanRender.exe.manifest b/src/HumanRender.exe.manifest new file mode 100644 index 0000000..d36f084 --- /dev/null +++ b/src/HumanRender.exe.manifest @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/HumanRender.manifest b/src/HumanRender.manifest deleted file mode 100644 index 7392aa3..0000000 --- a/src/HumanRender.manifest +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/src/Main.cpp b/src/Main.cpp index ed1a1cd..93d647b 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -1,3 +1,4 @@ +#if 0 #if 1 #include @@ -188,3 +189,5 @@ static int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevI return 0; } #endif + +#endif diff --git a/src/cefsimple.rc b/src/cefsimple.rc new file mode 100644 index 0000000..e4645e2 --- /dev/null +++ b/src/cefsimple.rc @@ -0,0 +1,79 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_CEFSIMPLE ICON "res\cefsimple.ico" +IDI_SMALL ICON "res\small.ico" + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/compatibility.manifest b/src/compatibility.manifest new file mode 100644 index 0000000..755c272 --- /dev/null +++ b/src/compatibility.manifest @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/res/cefsimple.ico b/src/res/cefsimple.ico new file mode 100644 index 0000000..d551aa3 Binary files /dev/null and b/src/res/cefsimple.ico differ diff --git a/src/res/small.ico b/src/res/small.ico new file mode 100644 index 0000000..d551aa3 Binary files /dev/null and b/src/res/small.ico differ diff --git a/src/resource.h b/src/resource.h new file mode 100644 index 0000000..ba1f3a9 --- /dev/null +++ b/src/resource.h @@ -0,0 +1,26 @@ +// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by cefsimple.rc +// + +#define IDI_CEFSIMPLE 100 +#define IDI_SMALL 101 + +// Avoid files associated with MacOS +#define _X86_ + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 32700 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 102 +#endif +#endif