Add support for requiring a platform-specific stylesheet

Add a getPlatform method to the native object that
is used for requiring the platform stylesheet from
within window.coffee after the atom.css is required.

This is used to provide non-native scrollbars on Linux
for an improved look and feel.
This commit is contained in:
Kevin Sawicki
2012-08-01 15:10:17 -07:00
parent dcd42316aa
commit f778345b3a
5 changed files with 33 additions and 2 deletions

View File

@@ -33,7 +33,7 @@ void throwException(const CefRefPtr<CefV8Value>& global, CefRefPtr<CefV8Exceptio
NativeHandler::NativeHandler() : CefV8Handler() {
std::string extensionCode = "var $native = {}; (function() {";
const char *functionNames[] = {"exists", "alert", "read", "write", "absolute", "list", "isFile", "isDirectory", "remove", "asyncList", "open", "openDialog", "quit", "writeToPasteboard", "readFromPasteboard", "showDevTools", "toggleDevTools", "newWindow", "saveDialog", "exit", "watchPath", "unwatchPath", "makeDirectory", "move", "moveToTrash", "reload", "lastModified", "md5ForPath", "exec"};
const char *functionNames[] = {"exists", "alert", "read", "write", "absolute", "list", "isFile", "isDirectory", "remove", "asyncList", "open", "openDialog", "quit", "writeToPasteboard", "readFromPasteboard", "showDevTools", "toggleDevTools", "newWindow", "saveDialog", "exit", "watchPath", "unwatchPath", "makeDirectory", "move", "moveToTrash", "reload", "lastModified", "md5ForPath", "exec", "getPlatform"};
NSUInteger arrayLength = sizeof(functionNames) / sizeof(const char *);
for (NSUInteger i = 0; i < arrayLength; i++) {
std::string functionName = std::string(functionNames[i]);
@@ -525,5 +525,11 @@ bool NativeHandler::Execute(const CefString& name,
return true;
}
else if (name == "getPlatform") {
NSString *platform = @"mac";
retval = CefV8Value::CreateString([platform UTF8String]);
return true;
}
return false;
};