Add shell.beep() API.

This commit is contained in:
Cheng Zhao 2013-04-29 22:10:03 +08:00
parent 157c978aa8
commit a34a63797a
4 changed files with 14 additions and 0 deletions

View file

@ -80,12 +80,19 @@ v8::Handle<v8::Value> Shell::MoveItemToTrash(const v8::Arguments &args) {
return v8::Undefined();
}
// static
v8::Handle<v8::Value> Shell::Beep(const v8::Arguments &args) {
platform_util::Beep();
return v8::Undefined();
}
// static
void Shell::Initialize(v8::Handle<v8::Object> target) {
node::SetMethod(target, "showItemInFolder", ShowItemInFolder);
node::SetMethod(target, "openItem", OpenItem);
node::SetMethod(target, "openExternal", OpenExternal);
node::SetMethod(target, "moveItemToTrash", MoveItemToTrash);
node::SetMethod(target, "beep", Beep);
}
} // namespace api

View file

@ -21,6 +21,7 @@ class Shell {
static v8::Handle<v8::Value> OpenItem(const v8::Arguments &args);
static v8::Handle<v8::Value> OpenExternal(const v8::Arguments &args);
static v8::Handle<v8::Value> MoveItemToTrash(const v8::Arguments &args);
static v8::Handle<v8::Value> Beep(const v8::Arguments &args);
DISALLOW_IMPLICIT_CONSTRUCTORS(Shell);
};

View file

@ -28,6 +28,8 @@ void OpenExternal(const GURL& url);
// Move a file to trash.
void MoveItemToTrash(const base::FilePath& full_path);
void Beep();
} // platform_util
#endif // ATOM_COMMON_PLATFORM_UTIL_H_

View file

@ -141,4 +141,8 @@ void MoveItemToTrash(const base::FilePath& full_path) {
<< " to trash";
}
void Beep() {
NSBeep();
}
} // namespace platform_util