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):{
message(linux32)
}
mac {
PLATFORM_BUILD = mac
message(mac)
}
CONFIG(debug, debug|release) {
PLATFORM_BUILD2 = $$PLATFORM_BUILD/debug
DESTDIR = $$PWD/build/$$PLATFORM_BUILD/Debug
......@@ -41,8 +46,47 @@ SOURCES += \
win32 {
LIBS += -L$$PWD/../../cefbuilds/$$PLATFORM_BUILD -llibcef
} else {
}
linux {
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
......@@ -7,14 +7,18 @@
QT -= core
QT -= gui
TARGET = ASCDocumentEditor
TARGET = $$quote(ASCDocumentEditor Helper)
TEMPLATE = app
#CONFIG += console
CONFIG += app_bundle
CONFIG += c++11
INCLUDEPATH += \
$$PWD/../../../lib/src/cef/mac
LIBS += -L../../../../../../SDK/lib/mac_64 -lgraphics
DEFINES += \
"V8_DEPRECATION_WARNINGS" \
"PSAPI_VERSION=1" \
......@@ -72,7 +76,6 @@ DEFINES += \
"NVALGRIND" \
"DYNAMIC_ANNOTATIONS_ENABLED=0"
#PROJECT_PATH = /Users/Oleg/Desktop/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents/DesktopEditor/ChromiumBasedEditors\ 2/app/test/src
PROJECT_PATH = ../
QMAKE_LFLAGS += -F$${PROJECT_PATH}/../../cefbuilds/mac
......@@ -228,7 +231,10 @@ SOURCES += \
../../../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_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 += \
../../../lib/src/cef/mac/cefclient/browser/binding_test.h \
......@@ -544,8 +550,7 @@ OBJECTIVE_SOURCES += \
../../../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/temp_window_mac.mm \
../../../lib/src/cef/mac/cefclient/browser/window_test_mac.mm \
../../../lib/src/cef/mac/cefclient/cefclient_mac.mm
../../../lib/src/cef/mac/cefclient/browser/window_test_mac.mm
BUNDLE_TARGET = $${PROJECT_PATH}/mac_Debug/$${TARGET}.app
......@@ -555,5 +560,5 @@ cp -R $${PROJECT_PATH}/../../cefbuilds/mac/Chromium\ Embedded\ Framework.framewo
install_name_tool \
-change \
@executable_path/Chromium\ Embedded\ Framework \
@executable_path/../Frameworks/Chromium\ Embedded\ Framework.framework/Chromium\ Embedded\ Framework \
ASCDocumentEditor.app/Contents/MacOS/ASCDocumentEditor
@executable_path/../../../../Frameworks/Chromium\ Embedded\ Framework.framework/Chromium\ Embedded\ Framework \
ASCDocumentEditor\ Helper.app/Contents/MacOS/ASCDocumentEditor\ Helper
......@@ -60,3 +60,13 @@ linux-g++ {
CONFIG += link_pkgconfig
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 @@
#ifdef _MAC
#define WindowHandleId XID
#define WindowHandleId void*
#endif
......
......@@ -36,7 +36,7 @@ class ClientAppBrowser : public ClientApp,
ClientAppBrowser();
private:
protected:
// Creates all of the Delegate objects. Implemented by cefclient in
// client_app_delegates_browser.cc
static void CreateDelegates(DelegateSet& delegates);
......
......@@ -260,7 +260,7 @@ class ClientHandler : public CefClient,
// Returns true if this handler uses off-screen rendering.
bool is_osr() const { return is_osr_; }
private:
protected:
// 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
// proceed with popup browser creation or false to cancel the popup browser.
......
......@@ -7,6 +7,8 @@
#include "cefclient/common/client_app_other.h"
#include "cefclient/renderer/client_app_renderer.h"
#include "../../../cefwrapper/client_app.h"
namespace client {
int RunMain(int argc, char* argv[]) {
......@@ -20,9 +22,9 @@ int RunMain(int argc, char* argv[]) {
CefRefPtr<CefApp> app;
ClientApp::ProcessType process_type = ClientApp::GetProcessType(command_line);
if (process_type == ClientApp::RendererProcess)
app = new ClientAppRenderer();
app = new CAscClientAppRenderer();
else if (process_type == ClientApp::OtherProcess)
app = new ClientAppOther();
app = new CAscClientAppOther();
// Execute the secondary process.
return CefExecuteProcess(main_args, app, NULL);
......
......@@ -125,7 +125,7 @@ class ClientAppRenderer : public ClientApp,
CefProcessId source_process,
CefRefPtr<CefProcessMessage> message) OVERRIDE;
private:
protected:
// Set of supported Delegates.
DelegateSet delegates_;
......
......@@ -201,7 +201,7 @@ void CApplicationCEF::Init_CEF(CAscApplicationManager* pManager, int argc, char*
settings.cache_path = _cache;
// 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);
#else
bool bInit = CefInitialize(main_args, settings, m_pInternal->m_app.get(), sandbox_info);
......@@ -230,7 +230,7 @@ void CApplicationCEF::Close()
{
if (NULL != m_pInternal)
{
#if defined(_LINUX) && !defined(_MAC)
#if defined(_LINUX)
m_pInternal->context->Shutdown();
#else
// Shut down CEF.
......@@ -243,7 +243,7 @@ void CApplicationCEF::Close()
int CApplicationCEF::RunMessageLoop(bool& is_runned)
{
#if defined(_LINUX) && !defined(_MAC)
#if defined(_LINUX)
is_runned = true;
return m_pInternal->message_loop->Run();
#else
......@@ -259,7 +259,7 @@ void CApplicationCEF::DoMessageLoopEvent()
bool CApplicationCEF::ExitMessageLoop()
{
#if defined(_LINUX) && !defined(_MAC)
#if defined(_LINUX)
m_pInternal->message_loop->Quit();
return true;
#else
......
......@@ -48,6 +48,10 @@ LRESULT CALLBACK MyMouseHook(int nCode, WPARAM wp, LPARAM lp)
#include <X11/Xlib.h>
#endif
#ifdef _MAC
#include "mac_common.h"
#endif
class CPagePrintData
{
public:
......@@ -619,15 +623,21 @@ void CCefFileDownloader::DownloadFile(CAscApplicationManager* pManager, const st
rect.top = 0;
rect.right = 10;
rect.bottom = 10;
#else
info.SetAsChild(hWnd, rect);
#endif
#if defined(_LINUX) && !defined(_MAC)
CefRect rect;
rect.x = 0;
rect.y = 0;
rect.width = 10;
rect.height = 10;
info.SetAsChild(hWnd, rect);
#endif
info.SetAsChild(hWnd, rect);
#ifdef _MAC
info.SetAsChild(hWnd, 0, 0, 10, 10);
#endif
// Creat the new child browser window
CefBrowserHost::CreateBrowser(info, m_pInternal, "ascdesktop://emptydownload.html", _settings, NULL);
......@@ -1822,15 +1832,23 @@ void CCefView::load(const std::wstring& url)
rect.top = 0;
rect.right = m_pInternal->m_pWidgetImpl->parent_width() - 1;
rect.bottom = m_pInternal->m_pWidgetImpl->parent_height() - 1;
#else
info.SetAsChild(hWnd, rect);
#endif
#if defined(_LINUX) && !defined(_MAC)
CefRect rect;
rect.x = 0;
rect.y = 0;
rect.width = m_pInternal->m_pWidgetImpl->parent_width();
rect.height = m_pInternal->m_pWidgetImpl->parent_height();
info.SetAsChild(hWnd, rect);
#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;
......@@ -1969,6 +1987,12 @@ void CCefView::resizeEvent(int width, int height)
XConfigureWindow(xdisplay, xwindow, CWHeight | CWWidth | CWY, &changes);
#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();
}
......
......@@ -10,7 +10,6 @@
#include "../../../../common/File.h"
#include "../../../../common/Directory.h"
#include "../../../../graphics/BaseThread.h"
#include "../../src/filedownloader.h"
#include "../../../../raster/ImageFileFormatChecker.h"
namespace asc_client_renderer
......@@ -63,7 +62,7 @@ public:
const CefV8ValueList& arguments,
CefRefPtr<CefV8Value>& retval,
CefString& exception) OVERRIDE
{
{
if (name == "Copy")
{
CefV8Context::GetCurrentContext()->GetFrame()->Copy();
......@@ -795,10 +794,29 @@ public:
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 sUrlSrc = L"";
if (CFileDownloader::IsNeedDownload(sUrl))
if (IsNeedDownload(sUrl))
{
sUrlSrc = sUrl;
}
......@@ -841,20 +859,6 @@ public:
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.
IMPLEMENT_REFCOUNTING(CAscEditorNativeV8Handler);
};
......
......@@ -376,7 +376,9 @@ protected :
bool m_bDelete; // Удалять ли файл в деструкторе
};
#else
#endif
#if defined(LINUX) && !defined(MAC)
#include <iostream>
#include <unistd.h>
......@@ -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 // 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