Commit 293e4ff6 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov
parent 209acad2
...@@ -24,6 +24,11 @@ linux-g++:!contains(QMAKE_HOST.arch, x86_64):{ ...@@ -24,6 +24,11 @@ linux-g++:!contains(QMAKE_HOST.arch, x86_64):{
message(linux32) message(linux32)
} }
mac {
PLATFORM_BUILD = mac
message(mac)
}
CONFIG(debug, debug|release) { CONFIG(debug, debug|release) {
PLATFORM_BUILD2 = $$PLATFORM_BUILD/debug PLATFORM_BUILD2 = $$PLATFORM_BUILD/debug
DESTDIR = $$PWD/build/$$PLATFORM_BUILD/Debug DESTDIR = $$PWD/build/$$PLATFORM_BUILD/Debug
...@@ -41,8 +46,47 @@ SOURCES += \ ...@@ -41,8 +46,47 @@ SOURCES += \
win32 { win32 {
LIBS += -L$$PWD/../../cefbuilds/$$PLATFORM_BUILD -llibcef LIBS += -L$$PWD/../../cefbuilds/$$PLATFORM_BUILD -llibcef
} else { }
linux {
LIBS += -L$$PWD/../../cefbuilds/$$PLATFORM_BUILD -lcef LIBS += -L$$PWD/../../cefbuilds/$$PLATFORM_BUILD -lcef
} }
mac {
DEFINES += _MAC
#PROJECT_PATH = $$PWD
PROJECT_PATH = ..
QMAKE_LFLAGS += -F$${PROJECT_PATH}/../../cefbuilds/mac
LIBS += -framework "Chromium Embedded Framework"
BUNDLE_TARGET = $${PROJECT_PATH}/build/mac/Debug/$${TARGET}.app
QMAKE_POST_LINK += mkdir -p $${BUNDLE_TARGET}/Contents/Frameworks;
QMAKE_POST_LINK += cp -R $${PROJECT_PATH}/../../cefbuilds/mac/ASCDocumentEditor\ Helper.app $${BUNDLE_TARGET}/Contents/Frameworks;
QMAKE_POST_LINK += cp -R $${PROJECT_PATH}/../../cefbuilds/mac/Chromium\ Embedded\ Framework.framework $${BUNDLE_TARGET}/Contents/Frameworks;
QMAKE_POST_LINK += cp -R $${PROJECT_PATH}/../../corebuilds/mac/debug/libascdocumentscore.dylib $${BUNDLE_TARGET}/Contents/Frameworks;
QMAKE_POST_LINK += install_name_tool \
-change \
@executable_path/Chromium\ Embedded\ Framework \
@executable_path/../Frameworks/Chromium\ Embedded\ Framework.framework/Chromium\ Embedded\ Framework \
$${BUNDLE_TARGET}/Contents/MacOS/ASCDocumentEditor;
QMAKE_POST_LINK += install_name_tool \
-change \
libascdocumentscore.dylib \
@executable_path/../Frameworks/libascdocumentscore.dylib \
$${BUNDLE_TARGET}/Contents/MacOS/ASCDocumentEditor;
QMAKE_POST_LINK += install_name_tool \
-change \
@executable_path/Chromium\ Embedded\ Framework \
@executable_path/../Frameworks/Chromium\ Embedded\ Framework.framework/Chromium\ Embedded\ Framework \
$${BUNDLE_TARGET}/Contents/Frameworks/libascdocumentscore.dylib
}
LIBS += -L$$PWD/../../corebuilds/$$PLATFORM_BUILD2 -lascdocumentscore LIBS += -L$$PWD/../../corebuilds/$$PLATFORM_BUILD2 -lascdocumentscore
...@@ -7,14 +7,18 @@ ...@@ -7,14 +7,18 @@
QT -= core QT -= core
QT -= gui QT -= gui
TARGET = ASCDocumentEditor TARGET = $$quote(ASCDocumentEditor Helper)
TEMPLATE = app TEMPLATE = app
#CONFIG += console #CONFIG += console
CONFIG += app_bundle CONFIG += app_bundle
CONFIG += c++11
INCLUDEPATH += \ INCLUDEPATH += \
$$PWD/../../../lib/src/cef/mac $$PWD/../../../lib/src/cef/mac
LIBS += -L../../../../../../SDK/lib/mac_64 -lgraphics
DEFINES += \ DEFINES += \
"V8_DEPRECATION_WARNINGS" \ "V8_DEPRECATION_WARNINGS" \
"PSAPI_VERSION=1" \ "PSAPI_VERSION=1" \
...@@ -72,7 +76,6 @@ DEFINES += \ ...@@ -72,7 +76,6 @@ DEFINES += \
"NVALGRIND" \ "NVALGRIND" \
"DYNAMIC_ANNOTATIONS_ENABLED=0" "DYNAMIC_ANNOTATIONS_ENABLED=0"
#PROJECT_PATH = /Users/Oleg/Desktop/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents/DesktopEditor/ChromiumBasedEditors\ 2/app/test/src
PROJECT_PATH = ../ PROJECT_PATH = ../
QMAKE_LFLAGS += -F$${PROJECT_PATH}/../../cefbuilds/mac QMAKE_LFLAGS += -F$${PROJECT_PATH}/../../cefbuilds/mac
...@@ -228,7 +231,10 @@ SOURCES += \ ...@@ -228,7 +231,10 @@ SOURCES += \
../../../lib/src/cef/mac/libcef_dll/wrapper/cef_zip_archive.cc \ ../../../lib/src/cef/mac/libcef_dll/wrapper/cef_zip_archive.cc \
../../../lib/src/cef/mac/libcef_dll/wrapper/libcef_dll_wrapper.cc \ ../../../lib/src/cef/mac/libcef_dll/wrapper/libcef_dll_wrapper.cc \
../../../lib/src/cef/mac/libcef_dll/wrapper/libcef_dll_wrapper2.cc \ ../../../lib/src/cef/mac/libcef_dll/wrapper/libcef_dll_wrapper2.cc \
../../../lib/src/cef/mac/libcef_dll/transfer_util.cc ../../../lib/src/cef/mac/libcef_dll/transfer_util.cc \
../../../lib/src/cef/mac/cefclient/process_helper_mac.cc \
../../../lib/src/cefwrapper/client_renderer_wrapper.cpp \
../../../lib/src/cefwrapper/client_scheme_wrapper.cpp
HEADERS += \ HEADERS += \
../../../lib/src/cef/mac/cefclient/browser/binding_test.h \ ../../../lib/src/cef/mac/cefclient/browser/binding_test.h \
...@@ -544,8 +550,7 @@ OBJECTIVE_SOURCES += \ ...@@ -544,8 +550,7 @@ OBJECTIVE_SOURCES += \
../../../lib/src/cef/mac/cefclient/browser/resource_util_mac.mm \ ../../../lib/src/cef/mac/cefclient/browser/resource_util_mac.mm \
../../../lib/src/cef/mac/cefclient/browser/root_window_mac.mm \ ../../../lib/src/cef/mac/cefclient/browser/root_window_mac.mm \
../../../lib/src/cef/mac/cefclient/browser/temp_window_mac.mm \ ../../../lib/src/cef/mac/cefclient/browser/temp_window_mac.mm \
../../../lib/src/cef/mac/cefclient/browser/window_test_mac.mm \ ../../../lib/src/cef/mac/cefclient/browser/window_test_mac.mm
../../../lib/src/cef/mac/cefclient/cefclient_mac.mm
BUNDLE_TARGET = $${PROJECT_PATH}/mac_Debug/$${TARGET}.app BUNDLE_TARGET = $${PROJECT_PATH}/mac_Debug/$${TARGET}.app
...@@ -555,5 +560,5 @@ cp -R $${PROJECT_PATH}/../../cefbuilds/mac/Chromium\ Embedded\ Framework.framewo ...@@ -555,5 +560,5 @@ cp -R $${PROJECT_PATH}/../../cefbuilds/mac/Chromium\ Embedded\ Framework.framewo
install_name_tool \ install_name_tool \
-change \ -change \
@executable_path/Chromium\ Embedded\ Framework \ @executable_path/Chromium\ Embedded\ Framework \
@executable_path/../Frameworks/Chromium\ Embedded\ Framework.framework/Chromium\ Embedded\ Framework \ @executable_path/../../../../Frameworks/Chromium\ Embedded\ Framework.framework/Chromium\ Embedded\ Framework \
ASCDocumentEditor.app/Contents/MacOS/ASCDocumentEditor ASCDocumentEditor\ Helper.app/Contents/MacOS/ASCDocumentEditor\ Helper
...@@ -60,3 +60,13 @@ linux-g++ { ...@@ -60,3 +60,13 @@ linux-g++ {
CONFIG += link_pkgconfig CONFIG += link_pkgconfig
PKGCONFIG += glib-2.0 gdk-2.0 gtkglext-1.0 atk cairo gtk+-unix-print-2.0 PKGCONFIG += glib-2.0 gdk-2.0 gtkglext-1.0 atk cairo gtk+-unix-print-2.0
} }
mac {
DEFINES += \
MAC \
_MAC \
_LINUX
LIBS += -framework AppKit
LIBS += -framework OpenGl
}
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#ifdef _MAC #ifdef _MAC
#define WindowHandleId XID #define WindowHandleId void*
#endif #endif
......
...@@ -36,7 +36,7 @@ class ClientAppBrowser : public ClientApp, ...@@ -36,7 +36,7 @@ class ClientAppBrowser : public ClientApp,
ClientAppBrowser(); ClientAppBrowser();
private: protected:
// Creates all of the Delegate objects. Implemented by cefclient in // Creates all of the Delegate objects. Implemented by cefclient in
// client_app_delegates_browser.cc // client_app_delegates_browser.cc
static void CreateDelegates(DelegateSet& delegates); static void CreateDelegates(DelegateSet& delegates);
......
...@@ -260,7 +260,7 @@ class ClientHandler : public CefClient, ...@@ -260,7 +260,7 @@ class ClientHandler : public CefClient,
// Returns true if this handler uses off-screen rendering. // Returns true if this handler uses off-screen rendering.
bool is_osr() const { return is_osr_; } bool is_osr() const { return is_osr_; }
private: protected:
// Create a new popup window using the specified information. |is_devtools| // Create a new popup window using the specified information. |is_devtools|
// will be true if the window will be used for DevTools. Return true to // will be true if the window will be used for DevTools. Return true to
// proceed with popup browser creation or false to cancel the popup browser. // proceed with popup browser creation or false to cancel the popup browser.
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#include "cefclient/common/client_app_other.h" #include "cefclient/common/client_app_other.h"
#include "cefclient/renderer/client_app_renderer.h" #include "cefclient/renderer/client_app_renderer.h"
#include "../../../cefwrapper/client_app.h"
namespace client { namespace client {
int RunMain(int argc, char* argv[]) { int RunMain(int argc, char* argv[]) {
...@@ -20,9 +22,9 @@ int RunMain(int argc, char* argv[]) { ...@@ -20,9 +22,9 @@ int RunMain(int argc, char* argv[]) {
CefRefPtr<CefApp> app; CefRefPtr<CefApp> app;
ClientApp::ProcessType process_type = ClientApp::GetProcessType(command_line); ClientApp::ProcessType process_type = ClientApp::GetProcessType(command_line);
if (process_type == ClientApp::RendererProcess) if (process_type == ClientApp::RendererProcess)
app = new ClientAppRenderer(); app = new CAscClientAppRenderer();
else if (process_type == ClientApp::OtherProcess) else if (process_type == ClientApp::OtherProcess)
app = new ClientAppOther(); app = new CAscClientAppOther();
// Execute the secondary process. // Execute the secondary process.
return CefExecuteProcess(main_args, app, NULL); return CefExecuteProcess(main_args, app, NULL);
......
...@@ -125,7 +125,7 @@ class ClientAppRenderer : public ClientApp, ...@@ -125,7 +125,7 @@ class ClientAppRenderer : public ClientApp,
CefProcessId source_process, CefProcessId source_process,
CefRefPtr<CefProcessMessage> message) OVERRIDE; CefRefPtr<CefProcessMessage> message) OVERRIDE;
private: protected:
// Set of supported Delegates. // Set of supported Delegates.
DelegateSet delegates_; DelegateSet delegates_;
......
...@@ -201,7 +201,7 @@ void CApplicationCEF::Init_CEF(CAscApplicationManager* pManager, int argc, char* ...@@ -201,7 +201,7 @@ void CApplicationCEF::Init_CEF(CAscApplicationManager* pManager, int argc, char*
settings.cache_path = _cache; settings.cache_path = _cache;
// Initialize CEF. // Initialize CEF.
#if defined(_LINUX) && !defined(_MAC) #if defined(_LINUX)
bool bInit = m_pInternal->context->Initialize(main_args, settings, m_pInternal->m_app.get(), sandbox_info); bool bInit = m_pInternal->context->Initialize(main_args, settings, m_pInternal->m_app.get(), sandbox_info);
#else #else
bool bInit = CefInitialize(main_args, settings, m_pInternal->m_app.get(), sandbox_info); bool bInit = CefInitialize(main_args, settings, m_pInternal->m_app.get(), sandbox_info);
...@@ -230,7 +230,7 @@ void CApplicationCEF::Close() ...@@ -230,7 +230,7 @@ void CApplicationCEF::Close()
{ {
if (NULL != m_pInternal) if (NULL != m_pInternal)
{ {
#if defined(_LINUX) && !defined(_MAC) #if defined(_LINUX)
m_pInternal->context->Shutdown(); m_pInternal->context->Shutdown();
#else #else
// Shut down CEF. // Shut down CEF.
...@@ -243,7 +243,7 @@ void CApplicationCEF::Close() ...@@ -243,7 +243,7 @@ void CApplicationCEF::Close()
int CApplicationCEF::RunMessageLoop(bool& is_runned) int CApplicationCEF::RunMessageLoop(bool& is_runned)
{ {
#if defined(_LINUX) && !defined(_MAC) #if defined(_LINUX)
is_runned = true; is_runned = true;
return m_pInternal->message_loop->Run(); return m_pInternal->message_loop->Run();
#else #else
...@@ -259,7 +259,7 @@ void CApplicationCEF::DoMessageLoopEvent() ...@@ -259,7 +259,7 @@ void CApplicationCEF::DoMessageLoopEvent()
bool CApplicationCEF::ExitMessageLoop() bool CApplicationCEF::ExitMessageLoop()
{ {
#if defined(_LINUX) && !defined(_MAC) #if defined(_LINUX)
m_pInternal->message_loop->Quit(); m_pInternal->message_loop->Quit();
return true; return true;
#else #else
......
...@@ -48,6 +48,10 @@ LRESULT CALLBACK MyMouseHook(int nCode, WPARAM wp, LPARAM lp) ...@@ -48,6 +48,10 @@ LRESULT CALLBACK MyMouseHook(int nCode, WPARAM wp, LPARAM lp)
#include <X11/Xlib.h> #include <X11/Xlib.h>
#endif #endif
#ifdef _MAC
#include "mac_common.h"
#endif
class CPagePrintData class CPagePrintData
{ {
public: public:
...@@ -619,15 +623,21 @@ void CCefFileDownloader::DownloadFile(CAscApplicationManager* pManager, const st ...@@ -619,15 +623,21 @@ void CCefFileDownloader::DownloadFile(CAscApplicationManager* pManager, const st
rect.top = 0; rect.top = 0;
rect.right = 10; rect.right = 10;
rect.bottom = 10; rect.bottom = 10;
#else info.SetAsChild(hWnd, rect);
#endif
#if defined(_LINUX) && !defined(_MAC)
CefRect rect; CefRect rect;
rect.x = 0; rect.x = 0;
rect.y = 0; rect.y = 0;
rect.width = 10; rect.width = 10;
rect.height = 10; rect.height = 10;
info.SetAsChild(hWnd, rect);
#endif #endif
info.SetAsChild(hWnd, rect); #ifdef _MAC
info.SetAsChild(hWnd, 0, 0, 10, 10);
#endif
// Creat the new child browser window // Creat the new child browser window
CefBrowserHost::CreateBrowser(info, m_pInternal, "ascdesktop://emptydownload.html", _settings, NULL); CefBrowserHost::CreateBrowser(info, m_pInternal, "ascdesktop://emptydownload.html", _settings, NULL);
...@@ -1822,15 +1832,23 @@ void CCefView::load(const std::wstring& url) ...@@ -1822,15 +1832,23 @@ void CCefView::load(const std::wstring& url)
rect.top = 0; rect.top = 0;
rect.right = m_pInternal->m_pWidgetImpl->parent_width() - 1; rect.right = m_pInternal->m_pWidgetImpl->parent_width() - 1;
rect.bottom = m_pInternal->m_pWidgetImpl->parent_height() - 1; rect.bottom = m_pInternal->m_pWidgetImpl->parent_height() - 1;
#else info.SetAsChild(hWnd, rect);
#endif
#if defined(_LINUX) && !defined(_MAC)
CefRect rect; CefRect rect;
rect.x = 0; rect.x = 0;
rect.y = 0; rect.y = 0;
rect.width = m_pInternal->m_pWidgetImpl->parent_width(); rect.width = m_pInternal->m_pWidgetImpl->parent_width();
rect.height = m_pInternal->m_pWidgetImpl->parent_height(); rect.height = m_pInternal->m_pWidgetImpl->parent_height();
info.SetAsChild(hWnd, rect);
#endif #endif
info.SetAsChild(hWnd, rect); #ifdef _MAC
info.SetAsChild(hWnd, 0, 0,
m_pInternal->m_pWidgetImpl->parent_width(),
m_pInternal->m_pWidgetImpl->parent_height());
#endif
CefString sUrl = url; CefString sUrl = url;
...@@ -1969,6 +1987,12 @@ void CCefView::resizeEvent(int width, int height) ...@@ -1969,6 +1987,12 @@ void CCefView::resizeEvent(int width, int height)
XConfigureWindow(xdisplay, xwindow, CWHeight | CWWidth | CWY, &changes); XConfigureWindow(xdisplay, xwindow, CWHeight | CWWidth | CWY, &changes);
#endif #endif
#ifdef _MAC
MAC_COMMON_set_window_handle_sizes(hwnd, 0, 0,
(0 == width) ? (m_pInternal->m_pWidgetImpl->parent_width()) : width,
(0 == height) ? (m_pInternal->m_pWidgetImpl->parent_height()) : height);
#endif
focus(); focus();
} }
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "../../../../common/File.h" #include "../../../../common/File.h"
#include "../../../../common/Directory.h" #include "../../../../common/Directory.h"
#include "../../../../graphics/BaseThread.h" #include "../../../../graphics/BaseThread.h"
#include "../../src/filedownloader.h"
#include "../../../../raster/ImageFileFormatChecker.h" #include "../../../../raster/ImageFileFormatChecker.h"
namespace asc_client_renderer namespace asc_client_renderer
...@@ -795,10 +794,29 @@ public: ...@@ -795,10 +794,29 @@ public:
return false; return false;
} }
bool IsNeedDownload(const std::wstring& FilePath)
{
int n1 = FilePath.find(L"www.");
int n2 = FilePath.find(L"http://");
int n3 = FilePath.find(L"ftp://");
int n4 = FilePath.find(L"https://");
if (n1 != std::wstring::npos && n1 < 10)
return true;
if (n2 != std::wstring::npos && n2 < 10)
return true;
if (n3 != std::wstring::npos && n3 < 10)
return true;
if (n4 != std::wstring::npos && n4 < 10)
return true;
return false;
}
std::wstring GetFullUrl(const std::wstring& sUrl, const std::wstring& sBaseUrl) std::wstring GetFullUrl(const std::wstring& sUrl, const std::wstring& sBaseUrl)
{ {
std::wstring sUrlSrc = L""; std::wstring sUrlSrc = L"";
if (CFileDownloader::IsNeedDownload(sUrl)) if (IsNeedDownload(sUrl))
{ {
sUrlSrc = sUrl; sUrlSrc = sUrl;
} }
...@@ -841,20 +859,6 @@ public: ...@@ -841,20 +859,6 @@ public:
return sUrlSrc; return sUrlSrc;
} }
bool DownloadFile(const std::wstring& sUrl, const std::wstring& sDst, const std::wstring& sBaseUrl)
{
std::wstring sUrlSrc = GetFullUrl(sUrl, sBaseUrl);
CFileDownloader oDownloader(sUrlSrc, false);
oDownloader.SetFilePath(sDst);
oDownloader.Start( 0 );
while ( oDownloader.IsRunned() )
{
NSThreads::Sleep(10);
}
return oDownloader.IsFileDownloaded();
}
// Provide the reference counting implementation for this class. // Provide the reference counting implementation for this class.
IMPLEMENT_REFCOUNTING(CAscEditorNativeV8Handler); IMPLEMENT_REFCOUNTING(CAscEditorNativeV8Handler);
}; };
......
...@@ -376,7 +376,9 @@ protected : ...@@ -376,7 +376,9 @@ protected :
bool m_bDelete; // Удалять ли файл в деструкторе bool m_bDelete; // Удалять ли файл в деструкторе
}; };
#else #endif
#if defined(LINUX) && !defined(MAC)
#include <iostream> #include <iostream>
#include <unistd.h> #include <unistd.h>
...@@ -530,6 +532,96 @@ protected : ...@@ -530,6 +532,96 @@ protected :
}; };
#endif
#ifdef MAC
class CFileDownloader : public NSThreads::CBaseThread
{
public :
CFileDownloader(std::wstring sFileUrl, bool bDelete = true) : NSThreads::CBaseThread()
{
m_sFilePath = L"";
m_sFileUrl = sFileUrl;
m_bComplete = false;
m_bDelete = bDelete;
}
~CFileDownloader ()
{
if ( m_sFilePath.length() > 0 && m_bDelete )
{
NSFile::CFileBinary::Remove(m_sFilePath);
m_sFilePath = L"";
}
}
void SetFilePath(const std::wstring& sPath)
{
m_sFilePath = sPath;
}
std::wstring GetFilePath()
{
return m_sFilePath;
}
bool IsFileDownloaded()
{
return m_bComplete;
}
protected :
virtual DWORD ThreadProc ()
{
m_bComplete = false;
if ( true )
{
int hrResultAll = DownloadFileAll(m_sFileUrl);
if (0 != hrResultAll)
{
m_bRunThread = FALSE;
return 0;
}
}
m_bComplete = true;
m_bRunThread = FALSE;
return 0;
}
int DownloadFileAll(std::wstring sFileURL);
public:
static bool IsNeedDownload(const std::wstring& FilePath)
{
int n1 = FilePath.find(L"www.");
int n2 = FilePath.find(L"http://");
int n3 = FilePath.find(L"ftp://");
int n4 = FilePath.find(L"https://");
if (n1 != std::wstring::npos && n1 < 10)
return true;
if (n2 != std::wstring::npos && n2 < 10)
return true;
if (n3 != std::wstring::npos && n3 < 10)
return true;
if (n4 != std::wstring::npos && n4 < 10)
return true;
return false;
}
protected :
std::wstring m_sFilePath; // Путь к сохраненному файлу на диске
std::wstring m_sFileUrl; // Ссылка на скачивание файла
bool m_bComplete; // Закачался файл или нет
bool m_bDelete; // Удалять ли файл в деструкторе
};
#endif #endif
#endif // CEF_FILE_DOWNLOADER #endif // CEF_FILE_DOWNLOADER
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment