-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 077f668
Showing
245 changed files
with
54,399 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Рекурсивно игнорируем все файлы | ||
ThirdParty/cef_win32/** | ||
|
||
# но не директории | ||
!ThirdParty/cef_win32/**/ | ||
|
||
# чтобы оставить файл | ||
!ThirdParty/cef_win32/cmake/cef_variables.cmake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include "Application.h" | ||
#include "Client.h" | ||
|
||
// CEF | ||
#include <include/wrapper/cef_helpers.h> | ||
|
||
// cmark-gfm | ||
#include <../extensions/cmark-gfm-core-extensions.h> | ||
#include <registry.h> | ||
|
||
|
||
Application::Application() | ||
{ | ||
// Регистрируем расширения cmark-gfm | ||
cmark_gfm_core_extensions_ensure_registered(); | ||
} | ||
|
||
|
||
Application::~Application() | ||
{ | ||
// Уничтожаем все расширения cmark-gfm. | ||
// Примечение: Должно быть вызвано после уничтожения всех документов | ||
cmark_release_plugins(); | ||
} | ||
|
||
|
||
static std::string GetUrl() | ||
{ | ||
CefRefPtr<CefCommandLine> commandLine = CefCommandLine::GetGlobalCommandLine(); | ||
CefCommandLine::ArgumentList arguments; | ||
commandLine->GetArguments(arguments); | ||
|
||
if (!arguments.empty()) | ||
return arguments.front(); | ||
|
||
return "about:blank"; | ||
} | ||
|
||
|
||
void Application::OnContextInitialized() | ||
{ | ||
CEF_REQUIRE_UI_THREAD(); | ||
|
||
CefRefPtr<Client> client(new Client()); | ||
client->OpenNewWindow(GetUrl()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#pragma once | ||
|
||
#include <include/cef_app.h> | ||
|
||
|
||
// Все методы этого класса вызываются из главного процесса (browser process) | ||
class Application | ||
: public CefApp | ||
, public CefBrowserProcessHandler | ||
{ | ||
private: | ||
// Реализуем счетчик ссылок | ||
IMPLEMENT_REFCOUNTING(Application); | ||
|
||
public: | ||
Application(); | ||
~Application(); | ||
|
||
// =========== Методы CefApp | ||
|
||
// Указываем, что реализованы обработчики CefBrowserProcessHandler | ||
CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() override | ||
{ | ||
return this; | ||
} | ||
|
||
// =========== Методы CefBrowserProcessHandler | ||
|
||
// Вызывается при старте главного процесса | ||
void OnContextInitialized() override; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "Client.h" | ||
|
||
#include <include/cef_command_line.h> | ||
#include <include/cef_parser.h> | ||
|
||
|
||
std::string GetCurrentProcessType() | ||
{ | ||
CefRefPtr<CefCommandLine> commandLine = CefCommandLine::GetGlobalCommandLine(); | ||
|
||
if (!commandLine->HasSwitch("type")) | ||
return "browser"; | ||
|
||
return commandLine->GetSwitchValue("type"); | ||
} | ||
|
||
|
||
std::string GetDataURI(const std::string& data, const std::string& mime_type) | ||
{ | ||
return "data:" + mime_type + ";base64," | ||
+ CefURIEncode(CefBase64Encode(data.data(), data.size()), false) | ||
.ToString(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
|
||
// Возвращает тип текущего процесса. | ||
// Примечание: CEF запускает кучу процессов, выполняющих разные задачи | ||
std::string GetCurrentProcessType(); | ||
|
||
|
||
// Кодирует содержимое страницы в адресе | ||
std::string GetDataURI(const std::string& data, const std::string& mime_type); |
Oops, something went wrong.