Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(765)

Issue 23812010: Implement first part of supporting global extension commands. (Closed)

Created:
7 years, 3 months ago by Finnur
Modified:
7 years, 2 months ago
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, tfarina, extensions-reviews_chromium.org
Visibility:
Public.

Description

Implement first part of supporting global extension commands. This first part simply reads the optional "global" flag from the manifest and registers the shortcut as global if it is set to true. The intent is to let developers register Ctrl+Shift+[0..9] (and nothing else) as global shortcuts but let users override that -- delete the shortcut, change it to whatever other combination (not restricted to Ctrl+Shift+[0..9] or even make it non-global. There's no UI at the moment to do so, but that is a separate CL that is almost ready. This CL implements this functionality for Windows and stubs out the other platforms. The GTK stub has been fleshed out in parallel, but that's also another CL. BUG=302437 R=erg@chromium.org, sky@chromium.org, thakis@chromium.org, yoz@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=228176

Patch Set 1 : Working set #

Patch Set 2 : Polishing a bit #

Total comments: 13

Patch Set 3 : Addressing review comments #

Patch Set 4 : Now using RegisterHotkey #

Patch Set 5 : Fix compile error on other platforms #

Patch Set 6 : One more file #

Patch Set 7 : Fix compile error in macro #

Patch Set 8 : Fewer if-defs #

Total comments: 11

Patch Set 9 : Less work is moar bettar. #

Total comments: 4

Patch Set 10 : Stubbing out Linux side #

Patch Set 11 : Deleting unnecessary file #

Patch Set 12 : Remove Views-ism #

Patch Set 13 : Add Mac stub #

Patch Set 14 : Linux => GTK #

Patch Set 15 : ChromeOS stub #

Total comments: 1

Patch Set 16 : Fix unit test and add aurax11 stub #

Patch Set 17 : Ensure hwnd is created before we start #

Patch Set 18 : gclient sync+merge conflict resolved #

Patch Set 19 : Another gclient sync #

Patch Set 20 : Workaround an unrelated crash #

Patch Set 21 : Devs can only set Ctrl+Shift+[0..9] #

Patch Set 22 : No change, just reuploading (last attempt was incomplete) #

Total comments: 40

Patch Set 23 : Addressing review comments #

Patch Set 24 : #

Patch Set 25 : Minor cleanup #

Patch Set 26 : Minor polish #

Patch Set 27 : git cl try #

Total comments: 4

Patch Set 28 : Just a gclient sync #

Patch Set 29 : Address Yoyo's comments #

Patch Set 30 : gclient sync #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1133 lines, -107 lines) Patch
M chrome/browser/extensions/api/commands/command_service.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 3 chunks +15 lines, -2 lines 0 comments Download
M chrome/browser/extensions/api/commands/command_service.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 6 chunks +28 lines, -3 lines 0 comments Download
M chrome/browser/extensions/api/commands/commands.cc View 1 chunk +1 line, -0 lines 0 comments Download
A chrome/browser/extensions/extension_commands_global_registry.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 chunk +76 lines, -0 lines 0 comments Download
A chrome/browser/extensions/extension_commands_global_registry.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 chunk +107 lines, -0 lines 0 comments Download
M chrome/browser/extensions/extension_keybinding_registry.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 4 chunks +20 lines, -1 line 0 comments Download
M chrome/browser/extensions/extension_keybinding_registry.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 2 chunks +28 lines, -2 lines 0 comments Download
A chrome/browser/extensions/global_shortcut_listener.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 1 chunk +65 lines, -0 lines 0 comments Download
A chrome/browser/extensions/global_shortcut_listener.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +62 lines, -0 lines 0 comments Download
A chrome/browser/extensions/global_shortcut_listener_aurax11.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +46 lines, -0 lines 0 comments Download
A chrome/browser/extensions/global_shortcut_listener_aurax11.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +75 lines, -0 lines 0 comments Download
A chrome/browser/extensions/global_shortcut_listener_chromeos.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +48 lines, -0 lines 0 comments Download
A chrome/browser/extensions/global_shortcut_listener_chromeos.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +75 lines, -0 lines 0 comments Download
A chrome/browser/extensions/global_shortcut_listener_gtk.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +46 lines, -0 lines 0 comments Download
A chrome/browser/extensions/global_shortcut_listener_gtk.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +75 lines, -0 lines 0 comments Download
A chrome/browser/extensions/global_shortcut_listener_mac.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +46 lines, -0 lines 0 comments Download
A chrome/browser/extensions/global_shortcut_listener_mac.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +75 lines, -0 lines 0 comments Download
A chrome/browser/extensions/global_shortcut_listener_win.h View 1 2 3 1 chunk +59 lines, -0 lines 0 comments Download
A chrome/browser/extensions/global_shortcut_listener_win.cc View 1 2 3 17 18 19 20 21 22 23 1 chunk +112 lines, -0 lines 0 comments Download
M chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 3 chunks +2 lines, -11 lines 0 comments Download
M chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 2 chunks +3 lines, -9 lines 0 comments Download
M chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 3 chunks +2 lines, -11 lines 0 comments Download
M chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2 chunks +10 lines, -21 lines 0 comments Download
M chrome/browser/ui/views/browser_actions_container.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/extensions/extension_keybinding_registry_views.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 3 chunks +2 lines, -10 lines 0 comments Download
M chrome/browser/ui/views/extensions/extension_keybinding_registry_views.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 2 chunks +7 lines, -20 lines 0 comments Download
M chrome/browser/ui/webui/extensions/command_handler.cc View 1 chunk +1 line, -0 lines 0 comments Download
M chrome/chrome_browser_extensions.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 2 chunks +14 lines, -0 lines 0 comments Download
M chrome/common/extensions/api/_manifest_features.json View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 1 chunk +5 lines, -0 lines 0 comments Download
M chrome/common/extensions/api/commands/commands_handler.cc View 1 chunk +2 lines, -1 line 0 comments Download
M chrome/common/extensions/command.h View 1 2 3 4 3 chunks +4 lines, -1 line 0 comments Download
M chrome/common/extensions/command.cc View 3 chunks +10 lines, -3 lines 0 comments Download
M extensions/common/manifest_constants.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +1 line, -0 lines 0 comments Download
M extensions/common/manifest_constants.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 1 chunk +1 line, -0 lines 0 comments Download
M ui/gfx/win/singleton_hwnd.h View 1 2 3 17 18 19 20 21 22 1 chunk +1 line, -1 line 0 comments Download
M ui/gfx/win/singleton_hwnd.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 2 chunks +8 lines, -10 lines 0 comments Download

Messages

Total messages: 47 (0 generated)
zhchbin
https://codereview.chromium.org/23812010/diff/5001/chrome/browser/extensions/global_shortcut_listener.cc File chrome/browser/extensions/global_shortcut_listener.cc (right): https://codereview.chromium.org/23812010/diff/5001/chrome/browser/extensions/global_shortcut_listener.cc#newcode30 chrome/browser/extensions/global_shortcut_listener.cc:30: } On linux I need to know which accelerator ...
7 years, 3 months ago (2013-09-20 07:49:23 UTC) #1
Finnur
https://codereview.chromium.org/23812010/diff/5001/chrome/browser/extensions/global_shortcut_listener.cc File chrome/browser/extensions/global_shortcut_listener.cc (right): https://codereview.chromium.org/23812010/diff/5001/chrome/browser/extensions/global_shortcut_listener.cc#newcode30 chrome/browser/extensions/global_shortcut_listener.cc:30: } I'm not sure I understand this comment. You ...
7 years, 3 months ago (2013-09-20 13:01:11 UTC) #2
Finnur
https://codereview.chromium.org/23812010/diff/5001/chrome/browser/extensions/global_shortcut_listener_win.cc File chrome/browser/extensions/global_shortcut_listener_win.cc (right): https://codereview.chromium.org/23812010/diff/5001/chrome/browser/extensions/global_shortcut_listener_win.cc#newcode45 chrome/browser/extensions/global_shortcut_listener_win.cc:45: keyboard_hook_ = SetWindowsHookEx(WH_KEYBOARD_LL, &KeyboardHook, NULL, 0L); Well, I take ...
7 years, 3 months ago (2013-09-20 13:15:56 UTC) #3
zhchbin
https://codereview.chromium.org/23812010/diff/5001/chrome/browser/extensions/global_shortcut_listener.cc File chrome/browser/extensions/global_shortcut_listener.cc (right): https://codereview.chromium.org/23812010/diff/5001/chrome/browser/extensions/global_shortcut_listener.cc#newcode30 chrome/browser/extensions/global_shortcut_listener.cc:30: } I mean to said that this function should ...
7 years, 3 months ago (2013-09-21 02:07:50 UTC) #4
Finnur
https://codereview.chromium.org/23812010/diff/5001/chrome/browser/extensions/global_shortcut_listener.cc File chrome/browser/extensions/global_shortcut_listener.cc (right): https://codereview.chromium.org/23812010/diff/5001/chrome/browser/extensions/global_shortcut_listener.cc#newcode30 chrome/browser/extensions/global_shortcut_listener.cc:30: } I see. I'll take a look on Monday. ...
7 years, 3 months ago (2013-09-21 12:23:50 UTC) #5
Finnur
See what you think of this last version.
7 years, 3 months ago (2013-09-23 16:29:58 UTC) #6
zhchbin
Wonderful! The problem from mek@ in the API proposal: "If there are multiple chrome profiles, ...
7 years, 3 months ago (2013-09-24 02:41:22 UTC) #7
Finnur
> The problem from mek@ in the API proposal: > "If there are multiple chrome ...
7 years, 3 months ago (2013-09-24 10:53:23 UTC) #8
zhchbin
> b) The user is barred from setting the shortcut because another profile is > ...
7 years, 3 months ago (2013-09-24 11:25:26 UTC) #9
Finnur
https://codereview.chromium.org/23812010/diff/61001/chrome/browser/ui/views/extensions/extension_commands_global_registry_views.cc File chrome/browser/ui/views/extensions/extension_commands_global_registry_views.cc (right): https://codereview.chromium.org/23812010/diff/61001/chrome/browser/ui/views/extensions/extension_commands_global_registry_views.cc#newcode100 chrome/browser/ui/views/extensions/extension_commands_global_registry_views.cc:100: // This object only handles named commands, not browser/page ...
7 years, 2 months ago (2013-09-25 13:11:40 UTC) #10
Finnur
Huh, I could have sworn that I added Boris to this list. Guess not. Hmmm ...
7 years, 2 months ago (2013-09-25 13:12:38 UTC) #11
zhchbin
https://codereview.chromium.org/23812010/diff/61001/chrome/browser/ui/views/extensions/extension_commands_global_registry_views.cc File chrome/browser/ui/views/extensions/extension_commands_global_registry_views.cc (right): https://codereview.chromium.org/23812010/diff/61001/chrome/browser/ui/views/extensions/extension_commands_global_registry_views.cc#newcode100 chrome/browser/ui/views/extensions/extension_commands_global_registry_views.cc:100: // This object only handles named commands, not browser/page ...
7 years, 2 months ago (2013-09-25 13:27:13 UTC) #12
Finnur
Updated just a bit. Now working on providing a stub implementation for Linux (just the ...
7 years, 2 months ago (2013-09-26 13:53:07 UTC) #13
Finnur
OK, Linux stub implementation provided (global_shortcut_listener_linux.cc and .h) for your perusal. I'm hoping if it ...
7 years, 2 months ago (2013-09-26 14:34:15 UTC) #14
zhchbin
https://codereview.chromium.org/23812010/diff/61001/chrome/browser/ui/views/extensions/extension_commands_global_registry_views.cc File chrome/browser/ui/views/extensions/extension_commands_global_registry_views.cc (right): https://codereview.chromium.org/23812010/diff/61001/chrome/browser/ui/views/extensions/extension_commands_global_registry_views.cc#newcode100 chrome/browser/ui/views/extensions/extension_commands_global_registry_views.cc:100: // This object only handles named commands, not browser/page ...
7 years, 2 months ago (2013-09-26 14:44:58 UTC) #15
zhchbin
On 2013/09/26 14:34:15, Finnur wrote: > OK, Linux stub implementation provided (global_shortcut_listener_linux.cc and > .h) ...
7 years, 2 months ago (2013-09-26 14:54:04 UTC) #16
Finnur
https://codereview.chromium.org/23812010/diff/61001/chrome/browser/ui/views/extensions/extension_commands_global_registry_views.cc File chrome/browser/ui/views/extensions/extension_commands_global_registry_views.cc (right): https://codereview.chromium.org/23812010/diff/61001/chrome/browser/ui/views/extensions/extension_commands_global_registry_views.cc#newcode100 chrome/browser/ui/views/extensions/extension_commands_global_registry_views.cc:100: // This object only handles named commands, not browser/page ...
7 years, 2 months ago (2013-09-26 15:00:59 UTC) #17
zhchbin
https://codereview.chromium.org/23812010/diff/61001/chrome/browser/ui/views/extensions/extension_commands_global_registry_views.cc File chrome/browser/ui/views/extensions/extension_commands_global_registry_views.cc (right): https://codereview.chromium.org/23812010/diff/61001/chrome/browser/ui/views/extensions/extension_commands_global_registry_views.cc#newcode100 chrome/browser/ui/views/extensions/extension_commands_global_registry_views.cc:100: // This object only handles named commands, not browser/page ...
7 years, 2 months ago (2013-09-26 15:13:05 UTC) #18
Finnur
ExtensionCommandsGlobalRegistry no longer is tied to Views (see latest CL) and seems to work fine ...
7 years, 2 months ago (2013-09-26 15:21:42 UTC) #19
zhchbin
On 2013/09/26 15:21:42, Finnur wrote: > ExtensionCommandsGlobalRegistry no longer is tied to Views (see latest ...
7 years, 2 months ago (2013-09-26 15:44:33 UTC) #20
Finnur
Mac stub: yes. In fact I already uploaded it. ChromeOS stub: I was planning on ...
7 years, 2 months ago (2013-09-26 15:51:33 UTC) #21
Finnur
Re: ChromeOS: Oh, right... You mentioned you need GTK, so it won't work on ChromeOS. ...
7 years, 2 months ago (2013-09-26 15:56:57 UTC) #22
zhchbin
On 2013/09/26 15:56:57, Finnur wrote: > Re: ChromeOS: Oh, right... You mentioned you need GTK, ...
7 years, 2 months ago (2013-09-27 09:30:06 UTC) #23
Finnur
Elliot, This is not a formal review request (at least not yet) :) But I ...
7 years, 2 months ago (2013-09-27 17:01:55 UTC) #24
Elliot Glaysher
+piman I don't actually know if XGrabKey is the appropriate thing to do here in ...
7 years, 2 months ago (2013-09-27 20:27:36 UTC) #25
zhchbin
On 2013/09/27 17:01:55, Finnur wrote: > Elliot, > > This is not a formal review ...
7 years, 2 months ago (2013-09-28 03:33:10 UTC) #26
Elliot Glaysher
aurax11 is any aura configuration that runs on X11, including chromeos. You can also just ...
7 years, 2 months ago (2013-09-30 21:26:40 UTC) #27
Finnur
Sorry, forgot to reply. The feature bug is here (and it points to the launch ...
7 years, 2 months ago (2013-10-02 11:38:11 UTC) #28
Elliot Glaysher
On 2013/10/02 11:38:11, Finnur wrote: > We are discussing ways of mitigating this, such as ...
7 years, 2 months ago (2013-10-02 19:42:22 UTC) #29
zhchbin
> If you're going to do a global XGrabKey implementation, you should share it > ...
7 years, 2 months ago (2013-10-03 00:27:59 UTC) #30
Elliot Glaysher
On 2013/10/03 00:27:59, zhchbin wrote: > Actually, gtk version has done here: [0], currently my ...
7 years, 2 months ago (2013-10-03 00:53:25 UTC) #31
Finnur
> Are these keyboard shortcuts on by default? I assume they're opt-out instead of > ...
7 years, 2 months ago (2013-10-03 11:01:06 UTC) #32
Finnur
Yoyo, can I ask you to review this CL (except for singleton_hwnd)? Scott, can you ...
7 years, 2 months ago (2013-10-03 15:55:11 UTC) #33
Finnur
> There are a lot of comments already on this CL because I threw it ...
7 years, 2 months ago (2013-10-03 16:23:07 UTC) #34
(unused - use chromium)
My file says "error: old chunk mismatch" – can you try reuploading? On Thu, Oct ...
7 years, 2 months ago (2013-10-03 16:36:10 UTC) #35
Nico
Are there any tests for this? I couldn't see any filenames matching "_test" https://codereview.chromium.org/23812010/diff/223001/chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa.mm File ...
7 years, 2 months ago (2013-10-03 16:48:52 UTC) #36
Elliot Glaysher
gtk stub lgtm
7 years, 2 months ago (2013-10-03 17:39:31 UTC) #37
sky
https://codereview.chromium.org/23812010/diff/223001/ui/gfx/win/singleton_hwnd.h File ui/gfx/win/singleton_hwnd.h (right): https://codereview.chromium.org/23812010/diff/223001/ui/gfx/win/singleton_hwnd.h#newcode37 ui/gfx/win/singleton_hwnd.h:37: void Init(); Is there a way not to expose ...
7 years, 2 months ago (2013-10-03 18:01:21 UTC) #38
Finnur
Nico: No, there's no test yet, mostly because.. a) This is implemented on Windows only. ...
7 years, 2 months ago (2013-10-03 21:57:57 UTC) #39
Yoyo Zhou
https://codereview.chromium.org/23812010/diff/223001/chrome/browser/extensions/api/commands/command_service.cc File chrome/browser/extensions/api/commands/command_service.cc (right): https://codereview.chromium.org/23812010/diff/223001/chrome/browser/extensions/api/commands/command_service.cc#newcode61 chrome/browser/extensions/api/commands/command_service.cc:61: bool WhitelistedGlobalShortcut(const ui::Accelerator& accelerator) { IsWhitelisted... seems like a ...
7 years, 2 months ago (2013-10-03 22:08:50 UTC) #40
sky
https://codereview.chromium.org/23812010/diff/223001/ui/gfx/win/singleton_hwnd.h File ui/gfx/win/singleton_hwnd.h (right): https://codereview.chromium.org/23812010/diff/223001/ui/gfx/win/singleton_hwnd.h#newcode37 ui/gfx/win/singleton_hwnd.h:37: void Init(); On 2013/10/03 21:57:58, Finnur wrote: > Sure, ...
7 years, 2 months ago (2013-10-03 23:30:10 UTC) #41
Finnur
Updated to address review comments. PTAL. https://codereview.chromium.org/23812010/diff/223001/chrome/browser/extensions/api/commands/command_service.cc File chrome/browser/extensions/api/commands/command_service.cc (right): https://codereview.chromium.org/23812010/diff/223001/chrome/browser/extensions/api/commands/command_service.cc#newcode61 chrome/browser/extensions/api/commands/command_service.cc:61: bool WhitelistedGlobalShortcut(const ui::Accelerator& ...
7 years, 2 months ago (2013-10-04 17:57:01 UTC) #42
Yoyo Zhou
LGTM https://codereview.chromium.org/23812010/diff/223001/chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa.mm File chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa.mm (right): https://codereview.chromium.org/23812010/diff/223001/chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa.mm#newcode150 chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa.mm:150: // no further work is required. On 2013/10/04 ...
7 years, 2 months ago (2013-10-04 18:12:06 UTC) #43
sky
LGTM
7 years, 2 months ago (2013-10-04 18:32:23 UTC) #44
Nico
cocoa file lgtm (If I were the main reviewer, I wouldn't let this in without ...
7 years, 2 months ago (2013-10-04 20:57:22 UTC) #45
Finnur
Nico: Understood. Given the amount of total work, I felt both that I needed to ...
7 years, 2 months ago (2013-10-11 10:59:22 UTC) #46
Finnur
7 years, 2 months ago (2013-10-11 13:13:58 UTC) #47
Message was sent while issue was closed.
Committed patchset #30 manually as r228176 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698