@@ -304,31 +304,36 @@ class ProcessMessageDelegate : public ClientHandler::ProcessMessageDelegate {
304304 ExtensionString filename = argList->GetString (1 );
305305 ExtensionString encoding = argList->GetString (2 );
306306 std::string contents = " " ;
307+ bool preserveBOM = false ;
307308
308- error = ReadFile (filename, encoding, contents);
309+ error = ReadFile (filename, encoding, contents, preserveBOM );
309310
310311 // Set response args for this function
311312 responseArgs->SetString (2 , contents);
313+ responseArgs->SetString (3 , encoding);
314+ responseArgs->SetBool (4 , preserveBOM);
312315 }
313316 } else if (message_name == " WriteFile" ) {
314317 // Parameters:
315318 // 0: int32 - callback id
316319 // 1: string - filename
317320 // 2: string - data
318321 // 3: string - encoding
319- if (argList->GetSize () != 4 ||
322+ if (argList->GetSize () != 5 ||
320323 argList->GetType (1 ) != VTYPE_STRING ||
321324 argList->GetType (2 ) != VTYPE_STRING ||
322- argList->GetType (3 ) != VTYPE_STRING) {
325+ argList->GetType (3 ) != VTYPE_STRING ||
326+ argList->GetType (4 ) != VTYPE_BOOL) {
323327 error = ERR_INVALID_PARAMS;
324328 }
325329
326330 if (error == NO_ERROR) {
327331 ExtensionString filename = argList->GetString (1 );
328332 std::string contents = argList->GetString (2 );
329333 ExtensionString encoding = argList->GetString (3 );
334+ bool preserveBOM = argList->GetBool (4 );
330335
331- error = WriteFile (filename, contents, encoding);
336+ error = WriteFile (filename, contents, encoding, preserveBOM );
332337 // No additional response args for this function
333338 }
334339 } else if (message_name == " SetPosixPermissions" ) {
@@ -636,6 +641,9 @@ class ProcessMessageDelegate : public ClientHandler::ProcessMessageDelegate {
636641 bool enabled = argList->GetBool (2 );
637642 bool checked = argList->GetBool (3 );
638643 error = NativeMenuModel::getInstance (getMenuParent (browser)).setMenuItemState (command, enabled, checked);
644+ if (error == NO_ERROR) {
645+ error = SetMenuItemState (browser, command, enabled, checked);
646+ }
639647 }
640648 } else if (message_name == " SetMenuTitle" ) {
641649 // Parameters:
@@ -752,7 +760,13 @@ class ProcessMessageDelegate : public ClientHandler::ProcessMessageDelegate {
752760 error = InstallCommandLineTools ();
753761 }
754762
755- } else {
763+ } else if (message_name == " GetMachineHash" ) {
764+ // Parameters:
765+ // 0: int32 - callback id
766+
767+ responseArgs->SetString (2 , GetSystemUniqueID ());
768+ }
769+ else {
756770 fprintf (stderr, " Native function not implemented yet: %s\n " , message_name.c_str ());
757771 return false ;
758772 }
0 commit comments