]> khamidou — GitHub mirrors - electron.git/commitdiff
Add shell.beep() API.
authorCheng Zhao <zcbenz@gmail.com>
Mon, 29 Apr 2013 14:10:03 +0000 (22:10 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 29 Apr 2013 14:10:03 +0000 (22:10 +0800)
common/api/atom_api_shell.cc
common/api/atom_api_shell.h
common/platform_util.h
common/platform_util_mac.mm

index 5e99b3cd570dbde33c0104ddbeadbdd3733c2af1..97671cad07d773ff29d613ad1f5840652905ca61 100644 (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
index 4188413665ccbe9378998514827a972adba1c38b..7d06599383577be06429f4a9ad3ded393ce5ab0b 100644 (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);
 };
index 5e8c561d5a2c29c9654bac5249677366ad1d74f8..c8652d2f603bea7a964a0b77f7dbd1559c422864 100644 (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_
index 2652586c26ab27917c2b3bab4442f028c5d4febc..1c4c90b9434aa87f4e84820a2d21bbccd9a0a59b 100644 (file)
@@ -141,4 +141,8 @@ void MoveItemToTrash(const base::FilePath& full_path) {
                  << " to trash";
 }
 
+void Beep() {
+  NSBeep();
+}
+
 }  // namespace platform_util