From: Paul Betts Date: Thu, 25 Jun 2015 16:25:55 +0000 (-0500) Subject: Move app commands to strings X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cde7c6a4ef92b18a54779f3d0354e21370bfde71;p=platform%2Fframework%2Fweb%2Fcrosswalk-tizen.git Move app commands to strings --- diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index 3f960ad..be615c9 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -162,8 +162,8 @@ void Window::OnDevToolsClosed() { devtools_web_contents_.Reset(); } -void Window::OnExecuteWindowsCommand(int command_id) { - Emit("app-command", command_id); +void Window::OnExecuteWindowsCommand(std::string& command_name) { + Emit("app-command", command_name); } // static diff --git a/atom/browser/api/atom_api_window.h b/atom/browser/api/atom_api_window.h index 604b477..248abf6 100644 --- a/atom/browser/api/atom_api_window.h +++ b/atom/browser/api/atom_api_window.h @@ -71,7 +71,7 @@ class Window : public mate::TrackableObject, void OnDevToolsFocus() override; void OnDevToolsOpened() override; void OnDevToolsClosed() override; - void OnExecuteWindowsCommand(int command_id) override; + void OnExecuteWindowsCommand(std::string& command_name) override; private: // APIs for NativeWindow. diff --git a/atom/browser/api/lib/app-command.coffee b/atom/browser/api/lib/app-command.coffee deleted file mode 100644 index 94455dd..0000000 --- a/atom/browser/api/lib/app-command.coffee +++ /dev/null @@ -1,55 +0,0 @@ -module.exports = - APPCOMMAND_BROWSER_BACKWARD: 1 - APPCOMMAND_BROWSER_FORWARD: 2 - APPCOMMAND_BROWSER_REFRESH: 3 - APPCOMMAND_BROWSER_STOP: 4 - APPCOMMAND_BROWSER_SEARCH: 5 - APPCOMMAND_BROWSER_FAVORITES: 6 - APPCOMMAND_BROWSER_HOME: 7 - APPCOMMAND_VOLUME_MUTE: 8 - APPCOMMAND_VOLUME_DOWN: 9 - APPCOMMAND_VOLUME_UP: 10 - APPCOMMAND_MEDIA_NEXTTRACK: 11 - APPCOMMAND_MEDIA_PREVIOUSTRACK: 12 - APPCOMMAND_MEDIA_STOP: 13 - APPCOMMAND_MEDIA_PLAY_PAUSE: 14 - APPCOMMAND_LAUNCH_MAIL: 15 - APPCOMMAND_LAUNCH_MEDIA_SELECT: 16 - APPCOMMAND_LAUNCH_APP1: 17 - APPCOMMAND_LAUNCH_APP2: 18 - APPCOMMAND_BASS_DOWN: 19 - APPCOMMAND_BASS_BOOST: 20 - APPCOMMAND_BASS_UP: 21 - APPCOMMAND_TREBLE_DOWN: 22 - APPCOMMAND_TREBLE_UP: 23 - APPCOMMAND_MICROPHONE_VOLUME_MUTE: 24 - APPCOMMAND_MICROPHONE_VOLUME_DOWN: 25 - APPCOMMAND_MICROPHONE_VOLUME_UP: 26 - APPCOMMAND_HELP: 27 - APPCOMMAND_FIND: 28 - APPCOMMAND_NEW: 29 - APPCOMMAND_OPEN: 30 - APPCOMMAND_CLOSE: 31 - APPCOMMAND_SAVE: 32 - APPCOMMAND_PRINT: 33 - APPCOMMAND_UNDO: 34 - APPCOMMAND_REDO: 35 - APPCOMMAND_COPY: 36 - APPCOMMAND_CUT: 37 - APPCOMMAND_PASTE: 38 - APPCOMMAND_REPLY_TO_MAIL: 39 - APPCOMMAND_FORWARD_MAIL: 40 - APPCOMMAND_SEND_MAIL: 41 - APPCOMMAND_SPELL_CHECK: 42 - APPCOMMAND_DICTATE_OR_COMMAND_CONTROL_TOGGLE:43 - APPCOMMAND_MIC_ON_OFF_TOGGLE: 44 - APPCOMMAND_CORRECTION_LIST: 45 - APPCOMMAND_MEDIA_PLAY: 46 - APPCOMMAND_MEDIA_PAUSE: 47 - APPCOMMAND_MEDIA_RECORD: 48 - APPCOMMAND_MEDIA_FAST_FORWARD: 49 - APPCOMMAND_MEDIA_REWIND: 50 - APPCOMMAND_MEDIA_CHANNEL_UP: 51 - APPCOMMAND_MEDIA_CHANNEL_DOWN: 52 - APPCOMMAND_DELETE: 53 - APPCOMMAND_DWM_FLIP3D: 54 diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index 47231e4..308a484 100644 --- a/atom/browser/native_window.cc +++ b/atom/browser/native_window.cc @@ -581,9 +581,11 @@ void NativeWindow::NotifyWindowUnresponsive() { } void NativeWindow::NotifyExecuteWindowsCommand(int command_id) { + std::string command = AppCommandToString(command_id); + FOR_EACH_OBSERVER(NativeWindowObserver, observers_, - OnExecuteWindowsCommand(command_id)); + OnExecuteWindowsCommand(command)); } @@ -593,4 +595,117 @@ void NativeWindow::OnCapturePageDone(const CapturePageCallback& callback, callback.Run(bitmap); } +const char* NativeWindow::AppCommandToString(int command_id) { + switch(command_id) { + case APPCOMMAND_BROWSER_BACKWARD: + return "browser-backward"; + case APPCOMMAND_BROWSER_FORWARD: + return "browser-forward"; + case APPCOMMAND_BROWSER_REFRESH: + return "browser-refresh"; + case APPCOMMAND_BROWSER_STOP: + return "browser-stop"; + case APPCOMMAND_BROWSER_SEARCH: + return "browser-search"; + case APPCOMMAND_BROWSER_FAVORITES: + return "browser-favorites"; + case APPCOMMAND_BROWSER_HOME: + return "browser-home"; + case APPCOMMAND_VOLUME_MUTE: + return "volume-mute"; + case APPCOMMAND_VOLUME_DOWN: + return "volume-down"; + case APPCOMMAND_VOLUME_UP: + return "volume-up"; + case APPCOMMAND_MEDIA_NEXTTRACK: + return "media-nexttrack"; + case APPCOMMAND_MEDIA_PREVIOUSTRACK: + return "media-previoustrack"; + case APPCOMMAND_MEDIA_STOP: + return "media-stop"; + case APPCOMMAND_MEDIA_PLAY_PAUSE: + return "media-play_pause"; + case APPCOMMAND_LAUNCH_MAIL: + return "launch-mail"; + case APPCOMMAND_LAUNCH_MEDIA_SELECT: + return "launch-media-select"; + case APPCOMMAND_LAUNCH_APP1: + return "launch-app1"; + case APPCOMMAND_LAUNCH_APP2: + return "launch-app2"; + case APPCOMMAND_BASS_DOWN: + return "bass-down"; + case APPCOMMAND_BASS_BOOST: + return "bass-boost"; + case APPCOMMAND_BASS_UP: + return "bass-up"; + case APPCOMMAND_TREBLE_DOWN: + return "treble-down"; + case APPCOMMAND_TREBLE_UP: + return "treble-up"; + case APPCOMMAND_MICROPHONE_VOLUME_MUTE: + return "microphone-volume-mute"; + case APPCOMMAND_MICROPHONE_VOLUME_DOWN: + return "microphone-volume-down"; + case APPCOMMAND_MICROPHONE_VOLUME_UP: + return "microphone-volume-up"; + case APPCOMMAND_HELP: + return "help"; + case APPCOMMAND_FIND: + return "find"; + case APPCOMMAND_NEW: + return "new"; + case APPCOMMAND_OPEN: + return "open"; + case APPCOMMAND_CLOSE: + return "close"; + case APPCOMMAND_SAVE: + return "save"; + case APPCOMMAND_PRINT: + return "print"; + case APPCOMMAND_UNDO: + return "undo"; + case APPCOMMAND_REDO: + return "redo"; + case APPCOMMAND_COPY: + return "copy"; + case APPCOMMAND_CUT: + return "cut"; + case APPCOMMAND_PASTE: + return "paste"; + case APPCOMMAND_REPLY_TO_MAIL: + return "reply-to-mail"; + case APPCOMMAND_FORWARD_MAIL: + return "forward-mail"; + case APPCOMMAND_SEND_MAIL: + return "send-mail"; + case APPCOMMAND_SPELL_CHECK: + return "spell-check"; + case APPCOMMAND_DICTATE_OR_COMMAND_CONTROL_TOGGLE: + return "dictate-or-command-control-toggle"; + case APPCOMMAND_MIC_ON_OFF_TOGGLE: + return "mic-on-off-toggle"; + case APPCOMMAND_CORRECTION_LIST: + return "correction-list"; + case APPCOMMAND_MEDIA_PLAY: + return "media-play"; + case APPCOMMAND_MEDIA_PAUSE: + return "media-pause"; + case APPCOMMAND_MEDIA_RECORD: + return "media-record"; + case APPCOMMAND_MEDIA_FAST_FORWARD: + return "media-fast-forward"; + case APPCOMMAND_MEDIA_REWIND: + return "media-rewind"; + case APPCOMMAND_MEDIA_CHANNEL_UP: + return "media-channel-up"; + case APPCOMMAND_MEDIA_CHANNEL_DOWN: + return "media-channel-down"; + case APPCOMMAND_DELETE: + return "delete"; + default: + return ""; + } +} + } // namespace atom diff --git a/atom/browser/native_window.h b/atom/browser/native_window.h index 4f302f8..d034baf 100644 --- a/atom/browser/native_window.h +++ b/atom/browser/native_window.h @@ -261,6 +261,9 @@ class NativeWindow : public content::WebContentsObserver, const SkBitmap& bitmap, content::ReadbackResponse response); + // Convert Win32 WM_APPCOMMANDS to strings + const char* AppCommandToString(int command_id); + // Observers of this window. ObserverList observers_; diff --git a/atom/browser/native_window_observer.h b/atom/browser/native_window_observer.h index bfb3342..c8a2c5e 100644 --- a/atom/browser/native_window_observer.h +++ b/atom/browser/native_window_observer.h @@ -67,7 +67,7 @@ class NativeWindowObserver { virtual void OnRendererResponsive() {} // Called on Windows when App Commands arrive (WM_APPCOMMAND) - virtual void OnExecuteWindowsCommand(int command) {} + virtual void OnExecuteWindowsCommand(std::string& command_name) {} }; } // namespace atom diff --git a/filenames.gypi b/filenames.gypi index 98ea654..562e652 100644 --- a/filenames.gypi +++ b/filenames.gypi @@ -9,7 +9,6 @@ ], 'coffee_sources': [ 'atom/browser/api/lib/app.coffee', - 'atom/browser/api/lib/app-command.coffee', 'atom/browser/api/lib/atom-delegate.coffee', 'atom/browser/api/lib/auto-updater.coffee', 'atom/browser/api/lib/browser-window.coffee', diff --git a/vendor/brightray b/vendor/brightray index b05e019..2dc473c 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit b05e019d2f66023fad1ae2f16cc765e3d62ffd5e +Subproject commit 2dc473cada4f118880241c6cd62ffb59dc58ef50 diff --git a/vendor/native_mate b/vendor/native_mate index cc4e2fc..ad207ee 160000 --- a/vendor/native_mate +++ b/vendor/native_mate @@ -1 +1 @@ -Subproject commit cc4e2fcd94b5a22e6720f0fba1c586a89640f1f6 +Subproject commit ad207eeabb0185f74c017e70ca3411d522627ff0