Remove $native.alert

This commit is contained in:
Nathan Sobo
2012-08-29 20:52:14 -05:00
parent 558ffd9cbe
commit 63a0746cc5
3 changed files with 0 additions and 41 deletions

View File

@@ -4,9 +4,6 @@ var $native = {};
native function exists(path);
$native.exists = exists;
native function alert(message, detailedMessage, buttonNamesAndCallbacks);
$native.alert = alert;
native function read(path);
$native.read = read;

View File

@@ -162,42 +162,6 @@ bool Native::Execute(const CefString& name,
else if (name == "asyncList") {
return false;
}
else if (name == "alert") {
NSString *message = stringFromCefV8Value(arguments[0]);
NSString *detailedMessage = stringFromCefV8Value(arguments[1]);
CefRefPtr<CefV8Value> buttonNamesAndCallbacks;
if (arguments.size() < 3) {
buttonNamesAndCallbacks = CefV8Value::CreateArray(0);
}
else {
buttonNamesAndCallbacks = arguments[2];
}
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
[alert setMessageText:message];
[alert setInformativeText:detailedMessage];
for (int i = 0; i < buttonNamesAndCallbacks->GetArrayLength(); i++) {
std::string title = buttonNamesAndCallbacks->GetValue(i)->GetValue(0)->GetStringValue().ToString();
NSString *buttonTitle = [NSString stringWithUTF8String:title.c_str()];
NSButton *button = [alert addButtonWithTitle:buttonTitle];
[button setTag:i];
}
NSUInteger buttonTag = [alert runModal];
if (buttonNamesAndCallbacks->GetArrayLength() == 0) { // No button title if there were no buttons specified.
return true;
}
CefRefPtr<CefV8Value> callback = buttonNamesAndCallbacks->GetValue(buttonTag)->GetValue(1);
CefV8ValueList args;
callback->SetRethrowExceptions(true);
callback->ExecuteFunction(callback, args);
return true;
}
else if (name == "writeToPasteboard") {
NSString *text = stringFromCefV8Value(arguments[0]);

View File

@@ -1,7 +1,5 @@
module.exports =
class Native
@alert: (args...) -> $native.alert(args...)
@saveDialog: (args...) -> $native.saveDialog(args...)
@reload: -> $native.reload()