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

Commit b858d45

Browse files
authored
Merge pull request #654 from adobe/master
Merging master to release for 1.13
2 parents 67abaa3 + 66072d0 commit b858d45

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1611
-70
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ xcodebuild/*
1414
*.vcxproj
1515
*.vcxproj.filters
1616
*.vcxproj.user
17-
*.sln
1817

1918
*.pbxuser
2019
*.perspective

Gruntfile.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports = function (grunt) {
2727
var common = require("./tasks/common")(grunt),
2828
platform = common.platform(),
2929
staging,
30-
cef_version = "3.2623.1397";
30+
cef_version = "3.2623.1402";
3131

3232
if (platform === "mac") {
3333
staging = "installer/mac/staging/<%= build.name %>.app/Contents";
@@ -37,8 +37,10 @@ module.exports = function (grunt) {
3737
staging = "installer/linux/debian/package-root/opt/brackets";
3838
}
3939

40-
if (platform === "linux") {
41-
cef_version = "3.2785.1486";
40+
if (platform === "mac") {
41+
cef_version = "3.2704.1434";
42+
} else if (platform === "linux") {
43+
cef_version = "3.2785.1487";
4244
}
4345

4446
grunt.initConfig({
@@ -192,6 +194,19 @@ module.exports = function (grunt) {
192194
}
193195
]
194196
},
197+
"winInstallerDLLs": {
198+
"files": [
199+
{
200+
"flatten" : true,
201+
"expand" : true,
202+
"src" : [
203+
"installer/win/LaunchBrackets/LaunchBrackets/bin/Release/LaunchBrackets.CA.dll",
204+
"installer/win/BracketsConfigurator/BracketsConfigurator/bin/Release/BracketsConfigurator.CA.dll"
205+
],
206+
"dest" : "installer/win/"
207+
}
208+
]
209+
},
195210
"mac": {
196211
"files": [
197212
{
@@ -333,4 +348,4 @@ module.exports = function (grunt) {
333348
grunt.loadNpmTasks("grunt-curl");
334349

335350
grunt.registerTask("default", ["setup", "build"]);
336-
};
351+
};

appshell/appshell_extensions.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#endif
3535

3636
#include <algorithm>
37+
#include "update.h"
3738

3839
extern std::vector<CefString> gDroppedFiles;
3940

@@ -507,7 +508,21 @@ class ProcessMessageDelegate : public ClientHandler::ProcessMessageDelegate {
507508
error = CopyFile(src, dest);
508509
// No additional response args for this function
509510
}
510-
} else if (message_name == "GetDroppedFiles") {
511+
} else if (message_name == "SetUpdateParams") {
512+
// Parameters:
513+
// 0: int32 - callback id
514+
// 1: string - update parameters json object
515+
516+
size_t numArgs = argList->GetSize();
517+
if (numArgs < 2 ||
518+
argList->GetType(1) != VTYPE_STRING) {
519+
error = ERR_INVALID_PARAMS;
520+
}
521+
if(error == NO_ERROR){
522+
CefString updateJson = argList->GetString(1);
523+
error = SetInstallerCommandLineArgs(updateJson);
524+
}
525+
} else if (message_name == "GetDroppedFiles") {
511526
// Parameters:
512527
// 0: int32 - callback id
513528
if (argList->GetSize() != 1) {

appshell/appshell_extensions.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,20 @@ if (!brackets) {
643643
appshell.app.getRemoteDebuggingPort = function () {
644644
return GetRemoteDebuggingPort();
645645
};
646-
646+
647+
648+
/**
649+
* Set the parameters for auto update, to be used by installer on Win/Update Script on Mac as command line arguments.
650+
*
651+
* @param {string} updateInfoObj - update info json object
652+
* @param {function(err)=} callback Asynchronous callback function.
653+
* @return None.
654+
*/
655+
native function SetUpdateParams();
656+
appshell.app.setUpdateParams = function (updateInfoObj, callback) {
657+
SetUpdateParams(callback || _dummyCallback, updateInfoObj);
658+
}
659+
647660
/**
648661
* Set menu enabled/checked state.
649662
* @param {string} command ID of the menu item.

appshell/appshell_extensions_gtk.cpp

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@
9595

9696
typedef char s8;
9797

98+
bool StMenuCommandSkipper::sSkipMenuCommand = false;
99+
98100
extern CefRefPtr<ClientHandler> g_handler;
99101

100102
// Supported browsers (order matters):
@@ -721,6 +723,12 @@ int ShowFolderInOSWindow(ExtensionString pathname)
721723
GError *gerror = NULL;
722724
gchar *uri = NULL, *parentdir = NULL;
723725

726+
// Check if file exist in OS
727+
struct stat fileStat;
728+
if (stat(pathname.c_str(), &fileStat) != 0) {
729+
return ERR_NOT_FOUND;
730+
}
731+
724732
if (g_file_test(pathname.c_str(), G_FILE_TEST_IS_DIR)) {
725733
uri = g_filename_to_uri(pathname.c_str(), NULL, NULL);
726734
if (!gtk_show_uri(NULL, uri, GDK_CURRENT_TIME, &gerror)) {
@@ -1062,6 +1070,7 @@ int32 AddMenuItem(CefRefPtr<CefBrowser> browser, ExtensionString parentCommand,
10621070

10631071
ExtensionString commandId = model.getCommandId(tag);
10641072
model.setOsItem(tag, entry);
1073+
model.setKey(tag, key);
10651074
ParseShortcut(browser, entry, key, commandId);
10661075
GtkWidget* menuHeader = (GtkWidget*) model.getOsItem(parentTag);
10671076
GtkWidget* menuWidget = gtk_menu_item_get_submenu(GTK_MENU_ITEM(menuHeader));
@@ -1098,16 +1107,60 @@ int32 GetMenuItemState(CefRefPtr<CefBrowser> browser, ExtensionString commandId,
10981107
return NO_ERROR;
10991108
}
11001109

1110+
int _getMenuItemPosition(GtkWidget* parent, GtkWidget* menuItem)
1111+
{
1112+
GList* children = gtk_container_get_children(GTK_CONTAINER(parent));
1113+
int index = 0;
1114+
do {
1115+
GtkWidget* widget = (GtkWidget*) children->data;
1116+
if (widget == menuItem) {
1117+
return index;
1118+
}
1119+
index++;
1120+
} while ((children = g_list_next(children)) != NULL);
1121+
1122+
return -1;
1123+
}
1124+
11011125
int32 SetMenuItemState(CefRefPtr<CefBrowser> browser, ExtensionString command, bool& enabled, bool& checked)
11021126
{
1103-
// TODO: Implement functionality for checked
11041127
NativeMenuModel& model = NativeMenuModel::getInstance(getMenuParent(browser));
11051128
int tag = model.getTag(command);
11061129
if (tag == kTagNotFound) {
11071130
return ERR_NOT_FOUND;
11081131
}
11091132
GtkWidget* menuItem = (GtkWidget*) model.getOsItem(tag);
1110-
gtk_widget_set_sensitive(menuItem, enabled);
1133+
if (menuItem == NULL) {
1134+
return ERR_UNKNOWN;
1135+
}
1136+
GtkWidget* parent = gtk_widget_get_parent(menuItem);
1137+
if (parent == NULL) {
1138+
return ERR_UNKNOWN;
1139+
}
1140+
int position = _getMenuItemPosition(parent, menuItem);
1141+
if (position < 0) {
1142+
return ERR_UNKNOWN;
1143+
}
1144+
const gchar* label = gtk_menu_item_get_label(GTK_MENU_ITEM(menuItem));
1145+
1146+
GtkWidget* newMenuItem;
1147+
if (checked == true) {
1148+
newMenuItem = gtk_check_menu_item_new_with_label(label);
1149+
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(newMenuItem), true);
1150+
} else {
1151+
newMenuItem = gtk_menu_item_new_with_label(label);
1152+
}
1153+
gtk_widget_destroy(menuItem);
1154+
1155+
InstallMenuHandler(newMenuItem, browser, tag);
1156+
1157+
model.setOsItem(tag, newMenuItem);
1158+
ExtensionString key = model.getKey(tag);
1159+
ParseShortcut(browser, newMenuItem, key, command);
1160+
gtk_menu_shell_insert(GTK_MENU_SHELL(parent), newMenuItem, position);
1161+
gtk_widget_set_sensitive(newMenuItem, enabled);
1162+
gtk_widget_show(newMenuItem);
1163+
11111164
return NO_ERROR;
11121165
}
11131166

@@ -1148,13 +1201,15 @@ int32 GetMenuTitle(CefRefPtr<CefBrowser> browser, ExtensionString commandId, Ext
11481201

11491202
int32 SetMenuItemShortcut(CefRefPtr<CefBrowser> browser, ExtensionString commandId, ExtensionString shortcut, ExtensionString displayStr)
11501203
{
1151-
NativeMenuModel model = NativeMenuModel::getInstance(getMenuParent(browser));
1152-
int32 tag = model.getTag(commandId);
1204+
NativeMenuModel& model = NativeMenuModel::getInstance(getMenuParent(browser));
1205+
int tag = model.getTag(commandId);
11531206
if (tag == kTagNotFound) {
11541207
return ERR_NOT_FOUND;
11551208
}
11561209
GtkWidget* entry = (GtkWidget*) model.getOsItem(tag);
1210+
model.setKey(tag, shortcut);
11571211
ParseShortcut(browser, entry, shortcut, commandId);
1212+
11581213
return NO_ERROR;
11591214
}
11601215

@@ -1353,5 +1408,3 @@ std::string GetSystemUniqueID()
13531408

13541409
return buf;
13551410
}
1356-
1357-

appshell/appshell_extensions_platform.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "appshell/browser/main_context.h"
88
#include "appshell/browser/root_window_manager.h"
99
#include "appshell/browser/root_window_gtk.h"
10+
#include <unicode/unistr.h>
1011
#endif
1112

1213
#define UTF8_BOM "\xEF\xBB\xBF"

appshell/appshell_extensions_platform.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333

3434
#ifdef OS_LINUX
3535
#include <gtk/gtk.h>
36+
#include <unicode/ucnv_err.h>
37+
#include <unicode/uenum.h>
38+
#include <unicode/localpointer.h>
3639
#endif
3740

3841
// Extension error codes. These MUST be in sync with the error
@@ -60,6 +63,7 @@ static const int ERR_CL_TOOLS_NOTSUPPORTED = 17;
6063
static const int ERR_ENCODE_FILE_FAILED = 18;
6164
static const int ERR_DECODE_FILE_FAILED = 19;
6265
static const int ERR_UNSUPPORTED_UTF16_ENCODING = 20;
66+
static const int ERR_UPDATE_ARGS_INIT_FAILED = 21;
6367

6468
static const int ERR_PID_NOT_FOUND = -9999; // negative int to avoid confusion with real PIDs
6569

@@ -108,6 +112,20 @@ class CharSetEncode
108112
void operator()(std::string &contents);
109113
};
110114

115+
#if defined(OS_LINUX)
116+
class StMenuCommandSkipper {
117+
public:
118+
119+
StMenuCommandSkipper() { sSkipMenuCommand = true; }
120+
~StMenuCommandSkipper() { sSkipMenuCommand = false;}
121+
122+
static bool GetMenuCmdSkipFlag () { return sSkipMenuCommand;}
123+
124+
private:
125+
static bool sSkipMenuCommand;
126+
};
127+
#endif
128+
111129
#if defined(OS_MACOSX) || defined(OS_LINUX)
112130
void DecodeContents(std::string &contents, const std::string& encoding);
113131
#endif

appshell/appshell_extensions_win.cpp

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -913,26 +913,6 @@ std::wstring StringToWString(const std::string& str)
913913
return converterX.from_bytes(str);
914914
}
915915

916-
class ReadFileHandle {
917-
HANDLE hFile;
918-
public:
919-
ReadFileHandle(const std::wstring& filename) {
920-
hFile = CreateFile(filename.c_str(), GENERIC_READ,
921-
FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
922-
if (INVALID_HANDLE_VALUE == hFile)
923-
throw "Could not initialize read handle";
924-
}
925-
~ReadFileHandle() {
926-
if (hFile)
927-
CloseHandle(hFile);
928-
}
929-
operator HANDLE() {
930-
return hFile;
931-
}
932-
};
933-
934-
935-
936916
int32 ReadFile(ExtensionString filename, ExtensionString& encoding, std::string& contents, bool& preserveBOM)
937917
{
938918
if (encoding == L"utf8") {
@@ -946,10 +926,13 @@ int32 ReadFile(ExtensionString filename, ExtensionString& encoding, std::string&
946926
if (dwAttr & FILE_ATTRIBUTE_DIRECTORY)
947927
return ERR_CANT_READ;
948928

949-
ReadFileHandle readFileHandle(filename);
950-
HANDLE hFile = readFileHandle;
929+
HANDLE hFile = CreateFile(filename.c_str(), GENERIC_READ,
930+
FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
951931
int32 error = NO_ERROR;
952932

933+
if (INVALID_HANDLE_VALUE == hFile)
934+
return ConvertWinErrorCode(GetLastError());
935+
953936
DWORD dwFileSize = GetFileSize(hFile, NULL);
954937

955938
if (dwFileSize == 0) {
@@ -986,6 +969,7 @@ int32 ReadFile(ExtensionString filename, ExtensionString& encoding, std::string&
986969
detectedCharSet = conv.to_bytes(encoding);
987970
}
988971
if (detectedCharSet == "UTF-16LE" || detectedCharSet == "UTF-16BE") {
972+
CloseHandle(hFile);
989973
return ERR_UNSUPPORTED_UTF16_ENCODING;
990974
}
991975
std::transform(detectedCharSet.begin(), detectedCharSet.end(), detectedCharSet.begin(), ::toupper);
@@ -1027,6 +1011,7 @@ int32 ReadFile(ExtensionString filename, ExtensionString& encoding, std::string&
10271011
}
10281012
}
10291013
}
1014+
CloseHandle(hFile);
10301015
return error;
10311016
}
10321017

appshell/browser/client_handler.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ void ClientHandler::OnDownloadUpdated(
323323
}
324324
}
325325

326+
#ifndef OS_LINUX
326327
bool ClientHandler::OnDragEnter(CefRefPtr<CefBrowser> browser,
327328
CefRefPtr<CefDragData> dragData,
328329
CefDragHandler::DragOperationsMask mask) {
@@ -334,14 +335,19 @@ bool ClientHandler::OnDragEnter(CefRefPtr<CefBrowser> browser,
334335

335336
return false;
336337
}
338+
#endif
337339

340+
#ifndef OS_LINUX
341+
//We do not plan to add any feature to parent class(::ClientHandler) implementation of this function.
342+
//So override is useless, modern compilers will complain about this.
338343
void ClientHandler::OnDraggableRegionsChanged(
339344
CefRefPtr<CefBrowser> browser,
340345
const std::vector<CefDraggableRegion>& regions) {
341346
CEF_REQUIRE_UI_THREAD();
342347

343348
NotifyDraggableRegions(regions);
344349
}
350+
#endif
345351

346352
bool ClientHandler::OnRequestGeolocationPermission(
347353
CefRefPtr<CefBrowser> browser,

appshell/browser/client_handler.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,12 @@ class ClientHandler :
105105
CefRefPtr<CefDownloadHandler> GetDownloadHandler() OVERRIDE {
106106
return this;
107107
}
108+
#ifndef OS_LINUX
108109
CefRefPtr<CefDragHandler> GetDragHandler() OVERRIDE {
109110
return this;
110111
}
112+
#endif
113+
111114
CefRefPtr<CefGeolocationHandler> GetGeolocationHandler() OVERRIDE {
112115
return this;
113116
}
@@ -173,13 +176,19 @@ class ClientHandler :
173176
CefRefPtr<CefDownloadItemCallback> callback) OVERRIDE;
174177

175178
// CefDragHandler methods
179+
#ifndef OS_LINUX
176180
bool OnDragEnter(CefRefPtr<CefBrowser> browser,
177181
CefRefPtr<CefDragData> dragData,
178182
CefDragHandler::DragOperationsMask mask) OVERRIDE;
183+
#endif
179184

185+
#ifndef OS_LINUX
186+
//We do not plan to add any feature to parent class(::ClientHandler) implementation of this function.
187+
//So override is useless, modern compilers will complain about this.
180188
void OnDraggableRegionsChanged(
181189
CefRefPtr<CefBrowser> browser,
182190
const std::vector<CefDraggableRegion>& regions) OVERRIDE;
191+
#endif
183192

184193
// CefGeolocationHandler methods
185194
bool OnRequestGeolocationPermission(

0 commit comments

Comments
 (0)