-
Notifications
You must be signed in to change notification settings - Fork 617
[Linux only] Upgrading to CEF 2704 #619
Changes from all commits
f986980
1e00e5c
219a728
8fc916e
078c8e9
a2d697c
635a6d8
f080a82
1e0a0c2
9a0e979
1d55890
f9ba9ed
cb10755
eba8b29
1b45720
17b1f90
bd60656
df39ad7
e9e5b02
947dc08
e7845f6
5734112
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,11 @@ | |
#include "appshell_node_process.h" | ||
#include "config.h" | ||
|
||
#ifdef OS_LINUX | ||
#include "appshell/browser/main_context.h" | ||
#include "appshell/browser/root_window_manager.h" | ||
#endif | ||
|
||
#include <algorithm> | ||
|
||
extern std::vector<CefString> gDroppedFiles; | ||
|
@@ -394,10 +399,15 @@ class ProcessMessageDelegate : public ClientHandler::ProcessMessageDelegate { | |
CefWindowInfo wi; | ||
CefBrowserSettings settings; | ||
|
||
#if defined(OS_WIN) | ||
wi.SetAsPopup(NULL, "DevTools"); | ||
#endif | ||
browser->GetHost()->ShowDevTools(wi, browser->GetHost()->GetClient(), settings, CefPoint()); | ||
#if defined(OS_WIN) | ||
wi.SetAsPopup(NULL, "DevTools"); | ||
#elif defined(OS_LINUX) | ||
handler->ShowDevTools(browser, CefPoint()); | ||
#endif | ||
|
||
#ifndef OS_LINUX | ||
browser->GetHost()->ShowDevTools(wi, browser->GetHost()->GetClient(), settings, CefPoint()); | ||
#endif | ||
|
||
} else if (message_name == "GetNodeState") { | ||
// Parameters: | ||
|
@@ -423,7 +433,15 @@ class ProcessMessageDelegate : public ClientHandler::ProcessMessageDelegate { | |
|
||
// The DispatchCloseToNextBrowser() call initiates a quit sequence. The app will | ||
// quit if all browser windows are closed. | ||
handler->DispatchCloseToNextBrowser(); | ||
#ifdef OS_LINUX | ||
if(client::MainContext::Get() && | ||
client::MainContext::Get()->GetRootWindowManager()){ | ||
client::MainContext::Get()->GetRootWindowManager()->DispatchCloseToNextWindow(); | ||
} | ||
#else | ||
handler->DispatchCloseToNextBrowser(); | ||
#endif | ||
|
||
|
||
} else if (message_name == "AbortQuit") { | ||
// Parameters - none | ||
|
@@ -765,8 +783,53 @@ class ProcessMessageDelegate : public ClientHandler::ProcessMessageDelegate { | |
// 0: int32 - callback id | ||
|
||
responseArgs->SetString(2, GetSystemUniqueID()); | ||
} | ||
else { | ||
} | ||
else if (message_name == "ReadDirWithStats") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please highlight the place where this message is called. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So here is the thing. In my testing what I figured out was |
||
// Parameters: | ||
// 0: int32 - callback id | ||
|
||
CefRefPtr<CefListValue> uberDict = CefListValue::Create(); | ||
CefRefPtr<CefListValue> dirContents = CefListValue::Create(); | ||
CefRefPtr<CefListValue> allStats = CefListValue::Create(); | ||
|
||
ExtensionString path = argList->GetString(1); | ||
ReadDir(path, dirContents); | ||
|
||
// Now we iterator through the contents of directoryContents. | ||
size_t theSize = dirContents->GetSize(); | ||
for ( size_t iFileEntry = 0; iFileEntry < theSize ; ++iFileEntry) { | ||
CefRefPtr<CefListValue> fileStats = CefListValue::Create(); | ||
|
||
#ifdef OS_WIN | ||
ExtensionString theFile = path + L"/"; | ||
#else | ||
ExtensionString theFile = path + "/"; | ||
#endif | ||
|
||
ExtensionString fileName = dirContents->GetString(iFileEntry); | ||
theFile = theFile + fileName; | ||
|
||
ExtensionString realPath; | ||
uint32 modtime; | ||
double size; | ||
bool isDir; | ||
GetFileInfo(theFile, modtime, isDir, size, realPath); | ||
|
||
fileStats->SetInt(0, modtime); | ||
fileStats->SetBool(1, isDir); | ||
fileStats->SetInt(2, size); | ||
fileStats->SetString(3, realPath); | ||
|
||
allStats->SetList(iFileEntry, fileStats); | ||
|
||
} | ||
|
||
uberDict->SetList(0, dirContents); | ||
uberDict->SetList(1, allStats); | ||
responseArgs->SetList(2, uberDict); | ||
} | ||
|
||
else { | ||
fprintf(stderr, "Native function not implemented yet: %s\n", message_name.c_str()); | ||
return false; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This statement seems to be executed in case of MAC, so can we have a separate
#elif
case in line 406 only.Something like
#ifdef OS_MAC
, it would make it more readable.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This statement needs to be executed for MAC as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will see if I can simplify this for better readability.