Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Port Brackets code to cefclient example code #589

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions appshell/appshell_extension_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
#include "include/cef_v8.h"

#include "appshell/appshell_helpers.h"
#include "appshell/config.h"

#ifdef OS_LINUX
#include "appshell/renderer/client_app_renderer.h"
#define BracketsApp client::ClientAppRenderer
#else
#define BracketsApp ClientApp
#endif

namespace appshell {

Expand Down Expand Up @@ -148,7 +156,7 @@ void SetList(CefRefPtr<CefListValue> source, CefRefPtr<CefV8Value> target) {
// Handles the native implementation for the appshell extension.
class AppShellExtensionHandler : public CefV8Handler {
public:
explicit AppShellExtensionHandler(CefRefPtr<ClientApp> client_app)
explicit AppShellExtensionHandler(CefRefPtr<BracketsApp> client_app)
: client_app_(client_app)
, messageId(0) {
}
Expand Down Expand Up @@ -207,12 +215,13 @@ class AppShellExtensionHandler : public CefV8Handler {
}

private:
CefRefPtr<ClientApp> client_app_;
CefRefPtr<BracketsApp> client_app_;
int32 messageId;

IMPLEMENT_REFCOUNTING(AppShellExtensionHandler);
};


// Simple stack class to ensure calls to Enter and Exit are balanced.
class StContextScope {
public:
Expand Down
5 changes: 3 additions & 2 deletions appshell/appshell_extensions_gtk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <glib/gstdio.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
#include "client_handler.h"

#include <errno.h>
#include <dirent.h>
Expand All @@ -50,7 +49,7 @@ std::string browsers[3] = {"google-chrome", "chromium-browser", "chromium"};
int ConvertLinuxErrorCode(int errorCode, bool isReading = true);
int ConvertGnomeErrorCode(GError* gerror, bool isReading = true);

extern bool isReallyClosing;
// extern bool isReallyClosing;

int GErrorToErrorCode(GError *gerror) {
int error = ConvertGnomeErrorCode(gerror);
Expand Down Expand Up @@ -533,6 +532,7 @@ void MoveFileOrDirectoryToTrash(ExtensionString filename, CefRefPtr<CefBrowser>

void CloseWindow(CefRefPtr<CefBrowser> browser)
{
/*
if (browser.get()) {
isReallyClosing = true;
// //# Hack because CEF's CloseBrowser() is bad. Should emit delete_event instead of directly destroying widget
Expand All @@ -542,6 +542,7 @@ void CloseWindow(CefRefPtr<CefBrowser> browser)
// else
browser->GetHost()->CloseBrowser(true);
}
*/
}

void BringBrowserWindowToFront(CefRefPtr<CefBrowser> browser)
Expand Down
Loading