mirror of
https://github.com/ONLYOFFICE/desktop-sdk.git
synced 2026-03-31 10:23:12 +08:00
3.3904 (#75)
This commit is contained in:
@ -7,10 +7,20 @@ TEMPLATE = app
|
||||
|
||||
CORE_ROOT_DIR = $$PWD/../../../core
|
||||
PWD_ROOT_DIR = $$PWD
|
||||
|
||||
CONFIG += core_static_link_libstd
|
||||
include($$CORE_ROOT_DIR/Common/base.pri)
|
||||
include($$CORE_ROOT_DIR/Common/3dParty/icu/icu.pri)
|
||||
|
||||
include($$CORE_ROOT_DIR/../desktop-sdk/ChromiumBasedEditors/lib/AscDocumentsCore_base.pri)
|
||||
CEF_PROJECT_PRI=$$PWD_ROOT_DIR/../../ChromiumBasedEditors/lib/cef_pri
|
||||
build_xp {
|
||||
include($$CEF_PROJECT_PRI/cef_base_xp.pri)
|
||||
include($$CEF_PROJECT_PRI/cef_client_xp.pri)
|
||||
} else {
|
||||
include($$CEF_PROJECT_PRI/cef_base.pri)
|
||||
include($$CEF_PROJECT_PRI/cef_client.pri)
|
||||
}
|
||||
|
||||
ADD_DEPENDENCY(graphics, kernel, UnicodeConverter)
|
||||
|
||||
DESTDIR=$$CORE_BUILDS_LIBRARIES_PATH
|
||||
@ -25,20 +35,7 @@ SOURCES += \
|
||||
SOURCES += \
|
||||
$$PWD/src/main.cpp
|
||||
|
||||
win32 {
|
||||
include($$CORE_ROOT_DIR/../desktop-sdk/ChromiumBasedEditors/lib/AscDocumentsCore_windows.pri)
|
||||
}
|
||||
linux-g++ | linux-g++-64 | linux-g++-32 {
|
||||
include($$CORE_ROOT_DIR/../desktop-sdk/ChromiumBasedEditors/lib/AscDocumentsCore_linux.pri)
|
||||
|
||||
CONFIG += link_pkgconfig c++11
|
||||
PKGCONFIG += glib-2.0 gdk-2.0 atk cairo gtk+-unix-print-2.0
|
||||
LIBS += -lX11
|
||||
|
||||
QMAKE_LFLAGS += "-Wl,-rpath,\'\$$ORIGIN\'"
|
||||
QMAKE_LFLAGS += "-Wl,-rpath,\'\$$ORIGIN/converter\'"
|
||||
QMAKE_LFLAGS += -static-libstdc++ -static-libgcc
|
||||
}
|
||||
|
||||
DEFINES += ASC_HIDE_WINDOW
|
||||
#DEFINES += DEBUG_WINDOW_SHOW
|
||||
#DESTDIR=$$CORE_ROOT_DIR/HtmlFile/test/Debug/HtmlFileInternal
|
||||
|
||||
#core_debug:DESTDIR=$$CORE_ROOT_DIR/HtmlFile/test/Debug/HtmlFileInternal
|
||||
|
||||
@ -33,11 +33,19 @@
|
||||
#ifndef CEF_ASC_CLIENT_APP_H_
|
||||
#define CEF_ASC_CLIENT_APP_H_
|
||||
|
||||
#ifdef CEF_2623
|
||||
#include "cefclient/common/client_app.h"
|
||||
#include "cefclient/browser/client_app_browser.h"
|
||||
#include "cefclient/renderer/client_app_renderer.h"
|
||||
#include "cefclient/common/client_app_other.h"
|
||||
#include "cefclient/renderer/client_renderer.h"
|
||||
#else
|
||||
#include "tests/shared/common/client_app.h"
|
||||
#include "tests/shared/browser/client_app_browser.h"
|
||||
#include "tests/shared/renderer/client_app_renderer.h"
|
||||
#include "tests/shared/common/client_app_other.h"
|
||||
#include "tests/cefclient/renderer/client_renderer.h"
|
||||
#endif
|
||||
|
||||
#include "./clienthandler.h"
|
||||
|
||||
|
||||
@ -30,8 +30,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tests/cefclient/renderer/client_renderer.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
@ -304,10 +302,8 @@ public:
|
||||
fclose(f);
|
||||
#endif
|
||||
|
||||
CefRefPtr<CefBrowser> browser = CefV8Context::GetCurrentContext()->GetBrowser();
|
||||
|
||||
CefRefPtr<CefProcessMessage> message = CefProcessMessage::Create("Exit");
|
||||
browser->SendProcessMessage(PID_BROWSER, message);
|
||||
SEND_MESSAGE_TO_BROWSER_PROCESS(message);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -425,7 +421,12 @@ class ClientRenderDelegate : public client::ClientAppRenderer::Delegate {
|
||||
// add AscEditorNative
|
||||
CefRefPtr<CefV8Value> object = context->GetGlobal();
|
||||
|
||||
#ifdef CEF_2623
|
||||
CefRefPtr<CefV8Value> objNative = CefV8Value::CreateObject(NULL);
|
||||
#else
|
||||
CefRefPtr<CefV8Value> objNative = CefV8Value::CreateObject(NULL, NULL);
|
||||
#endif
|
||||
|
||||
CAscEditorNativeV8Handler* pNativeHandlerWrapper = new CAscEditorNativeV8Handler();
|
||||
pNativeHandlerWrapper->sync_command_check = &sync_command_check;
|
||||
|
||||
@ -478,6 +479,9 @@ class ClientRenderDelegate : public client::ClientAppRenderer::Delegate {
|
||||
virtual bool OnProcessMessageReceived(
|
||||
CefRefPtr<client::ClientAppRenderer> app,
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
#ifndef MESSAGE_IN_BROWSER
|
||||
CefRefPtr<CefFrame> messageFrame,
|
||||
#endif
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message) OVERRIDE
|
||||
{
|
||||
@ -485,7 +489,11 @@ class ClientRenderDelegate : public client::ClientAppRenderer::Delegate {
|
||||
std::string sMessageName = message->GetName().ToString();
|
||||
|
||||
return message_router_->OnProcessMessageReceived(
|
||||
browser, source_process, message);
|
||||
browser,
|
||||
#ifndef MESSAGE_IN_BROWSER
|
||||
messageFrame,
|
||||
#endif
|
||||
source_process, message);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@ -40,20 +40,47 @@
|
||||
#include "include/base/cef_bind.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "include/wrapper/cef_closure_task.h"
|
||||
#include "tests/cefclient/browser/client_handler.h"
|
||||
#include "tests/shared/common/client_switches.h"
|
||||
#include "include/cef_app.h"
|
||||
|
||||
#include "tests/cefclient/renderer/client_renderer.h"
|
||||
#include "tests/shared/browser/main_message_loop.h"
|
||||
|
||||
#include "../../../core/DesktopEditor/common/File.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "tests/cefclient/browser/root_window_manager.h"
|
||||
#ifdef CEF_2623
|
||||
#include "cefclient/browser/client_handler.h"
|
||||
#include "cefclient/common/client_switches.h"
|
||||
#include "cefclient/renderer/client_renderer.h"
|
||||
#include "cefclient/browser/main_context_impl.h"
|
||||
#include "cefclient/browser/main_message_loop_std.h"
|
||||
#else
|
||||
#include "tests/cefclient/browser/client_handler.h"
|
||||
#include "tests/shared/common/client_switches.h"
|
||||
#include "tests/cefclient/renderer/client_renderer.h"
|
||||
#include "tests/cefclient/browser/main_context_impl.h"
|
||||
#include "tests/shared/browser/main_message_loop_std.h"
|
||||
#endif
|
||||
|
||||
#ifdef CEF_2623
|
||||
#define CefRawPtr CefRefPtr
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#ifdef CEF_2623
|
||||
#define MESSAGE_IN_BROWSER
|
||||
#else
|
||||
// с версии выше 74 - убрать определение
|
||||
//#define MESSAGE_IN_BROWSER
|
||||
#endif
|
||||
|
||||
#ifdef MESSAGE_IN_BROWSER
|
||||
#define SEND_MESSAGE_TO_BROWSER_PROCESS(message) CefV8Context::GetCurrentContext()->GetBrowser()->SendProcessMessage(PID_BROWSER, message)
|
||||
#define SEND_MESSAGE_TO_RENDERER_PROCESS(browser, message) browser->SendProcessMessage(PID_RENDERER, message)
|
||||
#else
|
||||
#define SEND_MESSAGE_TO_BROWSER_PROCESS(message) CefV8Context::GetCurrentContext()->GetFrame()->SendProcessMessage(PID_BROWSER, message)
|
||||
#define SEND_MESSAGE_TO_RENDERER_PROCESS(browser, message) browser->GetMainFrame()->SendProcessMessage(PID_RENDERER, message)
|
||||
#endif
|
||||
|
||||
class CGlobalHtmlFileParams
|
||||
{
|
||||
public:
|
||||
@ -74,12 +101,19 @@ class CHtmlRenderHandler : public CefRenderHandler
|
||||
public:
|
||||
CHtmlRenderHandler() {}
|
||||
|
||||
public:
|
||||
public:
|
||||
#ifdef CEF_2623
|
||||
virtual bool GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect)
|
||||
{
|
||||
rect = CefRect(0, 0, 1000, 1000);
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
virtual void GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect)
|
||||
{
|
||||
rect = CefRect(0, 0, 1000, 1000);
|
||||
}
|
||||
#endif
|
||||
virtual void OnPaint(CefRefPtr<CefBrowser> browser,
|
||||
PaintElementType type,
|
||||
const RectList& dirtyRects,
|
||||
@ -110,12 +144,12 @@ public:
|
||||
|
||||
public:
|
||||
CHtmlClientHandler(CGlobalHtmlFileParams* params) : client::ClientHandler(this,
|
||||
#ifdef DEBUG_WINDOW_SHOW
|
||||
false,
|
||||
#else
|
||||
true,
|
||||
#endif
|
||||
"html_file")
|
||||
#ifdef DEBUG_WINDOW_SHOW
|
||||
false,
|
||||
#else
|
||||
true,
|
||||
#endif
|
||||
"html_file")
|
||||
{
|
||||
m_global = params;
|
||||
m_render = new CHtmlRenderHandler();
|
||||
@ -124,9 +158,17 @@ public:
|
||||
|
||||
virtual CefRefPtr<CefRenderHandler> GetRenderHandler()
|
||||
{
|
||||
#ifdef DEBUG_WINDOW_SHOW
|
||||
return NULL;
|
||||
#else
|
||||
return m_render;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef CEF_2623
|
||||
virtual void OnAutoResize(const CefSize& new_size) OVERRIDE {}
|
||||
#endif
|
||||
|
||||
void Init()
|
||||
{
|
||||
std::vector<std::wstring>& arSdks = m_global->sSdkPath;
|
||||
@ -277,24 +319,33 @@ window.onload = function ()\
|
||||
return m_sCachePath;
|
||||
}
|
||||
|
||||
virtual bool OnBeforePopup(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
const CefString& target_url,
|
||||
const CefString& target_frame_name,
|
||||
const CefPopupFeatures& popupFeatures,
|
||||
CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient>& client,
|
||||
CefBrowserSettings& settings,
|
||||
bool* no_javascript_access)
|
||||
virtual bool OnBeforePopup(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
const CefString& target_url,
|
||||
const CefString& target_frame_name,
|
||||
CefLifeSpanHandler::WindowOpenDisposition target_disposition,
|
||||
bool user_gesture,
|
||||
const CefPopupFeatures& popupFeatures,
|
||||
CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient>& client,
|
||||
CefBrowserSettings& settings,
|
||||
#ifndef MESSAGE_IN_BROWSER
|
||||
CefRefPtr<CefDictionaryValue>& extra_info,
|
||||
#endif
|
||||
bool* no_javascript_access) OVERRIDE
|
||||
{
|
||||
CEF_REQUIRE_IO_THREAD();
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
bool is_redirect)
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
#ifndef CEF_2623
|
||||
bool user_gesture,
|
||||
#endif
|
||||
bool is_redirect) OVERRIDE
|
||||
{
|
||||
//std::wstring sUrl = request->GetURL().ToWString();
|
||||
bool bIsMain = frame->IsMain();
|
||||
@ -310,7 +361,7 @@ window.onload = function ()\
|
||||
virtual void OnBeforeDownload(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDownloadItem> download_item,
|
||||
const CefString& suggested_name,
|
||||
CefRefPtr<CefBeforeDownloadCallback> callback)
|
||||
CefRefPtr<CefBeforeDownloadCallback> callback) OVERRIDE
|
||||
{
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
callback->Continue("", false);
|
||||
@ -325,8 +376,11 @@ window.onload = function ()\
|
||||
}
|
||||
|
||||
virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
|
||||
#ifndef MESSAGE_IN_BROWSER
|
||||
CefRefPtr<CefFrame> frame,
|
||||
#endif
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message)
|
||||
CefRefPtr<CefProcessMessage> message) OVERRIDE
|
||||
{
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
|
||||
@ -344,6 +398,9 @@ window.onload = function ()\
|
||||
}
|
||||
|
||||
virtual bool OnConsoleMessage(CefRefPtr<CefBrowser> browser,
|
||||
#ifndef CEF_2623
|
||||
cef_log_severity_t level,
|
||||
#endif
|
||||
const CefString& message,
|
||||
const CefString& source,
|
||||
int line) OVERRIDE
|
||||
@ -370,66 +427,49 @@ window.onload = function ()\
|
||||
void Exit()
|
||||
{
|
||||
if (m_browser && m_browser->GetHost())
|
||||
m_browser->GetHost()->CloseBrowser(true);
|
||||
client::MainMessageLoop::Get()->Quit();
|
||||
m_browser->GetHost()->CloseBrowser(true);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
// Called when the browser is created.
|
||||
virtual void OnBrowserCreated(CefRefPtr<CefBrowser> browser)
|
||||
{
|
||||
m_browser = browser;
|
||||
}
|
||||
virtual void OnBrowserCreated(CefRefPtr<CefBrowser> browser) OVERRIDE
|
||||
{
|
||||
m_browser = browser;
|
||||
}
|
||||
|
||||
// Called when the browser is closing.
|
||||
virtual void OnBrowserClosing(CefRefPtr<CefBrowser> browser)
|
||||
{
|
||||
}
|
||||
virtual void OnBrowserClosing(CefRefPtr<CefBrowser> browser) OVERRIDE {}
|
||||
|
||||
// Called when the browser has been closed.
|
||||
virtual void OnBrowserClosed(CefRefPtr<CefBrowser> browser)
|
||||
{
|
||||
}
|
||||
virtual void OnBrowserClosed(CefRefPtr<CefBrowser> browser) OVERRIDE
|
||||
{
|
||||
client::MainMessageLoop::Get()->Quit();
|
||||
}
|
||||
|
||||
// Set the window URL address.
|
||||
virtual void OnSetAddress(const std::string& url)
|
||||
{
|
||||
}
|
||||
virtual void OnSetAddress(const std::string& url) OVERRIDE {}
|
||||
|
||||
// Set the window title.
|
||||
virtual void OnSetTitle(const std::string& title)
|
||||
{
|
||||
}
|
||||
|
||||
// Set the Favicon image.
|
||||
virtual void OnSetFavicon(CefRefPtr<CefImage> image){};
|
||||
virtual void OnSetTitle(const std::string& title) OVERRIDE {}
|
||||
|
||||
// Set fullscreen mode.
|
||||
virtual void OnSetFullscreen(bool fullscreen)
|
||||
{
|
||||
}
|
||||
virtual void OnSetFullscreen(bool fullscreen) OVERRIDE {}
|
||||
|
||||
// Set the loading state.
|
||||
virtual void OnSetLoadingState(bool isLoading,
|
||||
bool canGoBack,
|
||||
bool canGoForward)
|
||||
{
|
||||
}
|
||||
virtual void OnSetLoadingState(bool isLoading, bool canGoBack, bool canGoForward) OVERRIDE {}
|
||||
|
||||
// Set the draggable regions.
|
||||
virtual void OnSetDraggableRegions(
|
||||
const std::vector<CefDraggableRegion>& regions)
|
||||
{
|
||||
}
|
||||
virtual void OnSetDraggableRegions(const std::vector<CefDraggableRegion>& regions) OVERRIDE {}
|
||||
|
||||
#ifndef CEF_2623
|
||||
// Set the Favicon image.
|
||||
virtual void OnSetFavicon(CefRefPtr<CefImage> image) OVERRIDE {}
|
||||
|
||||
// Set focus to the next/previous control.
|
||||
virtual void OnTakeFocus(bool next) {}
|
||||
virtual void OnTakeFocus(bool next) OVERRIDE {}
|
||||
|
||||
// Called on the UI thread before a context menu is displayed.
|
||||
virtual void OnBeforeContextMenu(CefRefPtr<CefMenuModel> model) {}
|
||||
|
||||
#ifdef CEF_3202
|
||||
virtual void OnAutoResize(const CefSize& new_size) OVERRIDE {}
|
||||
virtual void OnBeforeContextMenu(CefRefPtr<CefMenuModel> model) OVERRIDE {}
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
@ -37,10 +37,6 @@
|
||||
#include "./src/clienthandler.h"
|
||||
#include "./src/client_app.h"
|
||||
|
||||
#include "tests/shared/common/client_switches.h"
|
||||
#include "tests/cefclient/browser/main_context_impl.h"
|
||||
#include "tests/shared/browser/main_message_loop_std.h"
|
||||
|
||||
#ifdef GetTempPath
|
||||
#undef GetTempPath
|
||||
#endif
|
||||
@ -202,9 +198,11 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
|
||||
// Initialize CEF.
|
||||
context->Initialize(main_args, settings, app, NULL);
|
||||
|
||||
#ifdef CEF_2623
|
||||
CefRefPtr<CefCookieManager> manager = CefCookieManager::GetGlobalManager(NULL);
|
||||
manager->SetStoragePath(sCachePath, true, NULL);
|
||||
manager->SetStoragePath(sCachePath, true, NULL);
|
||||
manager = NULL;
|
||||
#endif
|
||||
|
||||
#ifdef _LINUX
|
||||
// Install a signal handler so we clean up after ourselves.
|
||||
@ -222,10 +220,13 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
|
||||
window_info.SetAsWindowless(NULL);
|
||||
#endif
|
||||
|
||||
CefRefPtr<CefRequestContext> request_context;
|
||||
CefBrowserSettings browser_settings;
|
||||
browser_settings.plugins = STATE_DISABLED;
|
||||
CefBrowserHost::CreateBrowser(window_info, client_handler.get(), client_handler->GetUrl(), browser_settings, request_context);
|
||||
CefBrowserHost::CreateBrowser(window_info, client_handler.get(), client_handler->GetUrl(), browser_settings, NULL
|
||||
#ifndef CEF_2623
|
||||
, NULL
|
||||
#endif
|
||||
);
|
||||
|
||||
scoped_ptr<client::MainMessageLoop> message_loop;
|
||||
message_loop.reset(new client::MainMessageLoopStd);
|
||||
|
||||
Reference in New Issue
Block a user