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

Issue 251069: Support cmd-left/right for history. (Closed)

Created:
11 years, 2 months ago by Nico
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

Support cmd-left/right for history. Since cmd-left/right should not do history if the omnibox is focussed, but cmd-1-9 should work if the omnibox is focussed, we have to differentiate between window- and browser-level shortcuts. (Because performKeyEquivalent bubbles up from the window -- and if we let it bubble up to the omnibox, then the omnibox handles cmd-left/right just fine, but it swallows cmd-1 and doesn't give us a chance to intercept this. That means cmd-left doesn't work if you hit cmd-l tab, which focusses something that's neither omnibox nor tab contents. This behavior is consistent with safari and camino, and I think it's the best we can do without rewriting event dispatching. Camino does this here: http://mxr.mozilla.org/seamonkey/source/camino/src/browser/BrowserWindow.mm#128 http://mxr.mozilla.org/seamonkey/source/camino/src/browser/BrowserWrapper.mm#1031 ) BUG=12557 TEST=Focus text box on a web page. cmd-left/right should go to start/end of text. Focus webpage background. cmd-left/right \ should go history back/forward. When the omnibox is focussed, cmd-left/right should move the caret, but cmd-1-9 should still switch tabs. Note that shortcuts still don't work if a subwindow (e.g. find bar, bookmark bubble) has focus. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=28505

Patch Set 1 #

Patch Set 2 : kinda works, but cmd-left/right in omnibox should move cursor (does history atm) #

Patch Set 3 : Now full-assed! #

Patch Set 4 : cleanups #

Patch Set 5 : more cleanups #

Patch Set 6 : test #

Patch Set 7 : test #

Patch Set 8 : merge tot #

Total comments: 15

Patch Set 9 : address comments #

Patch Set 10 : One more comment #

Total comments: 4

Patch Set 11 : comments #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+145 lines, -19 lines) Patch
M chrome/browser/cocoa/chrome_browser_window.h View 8 9 10 1 chunk +10 lines, -0 lines 0 comments Download
M chrome/browser/cocoa/chrome_browser_window.mm View 8 3 chunks +30 lines, -2 lines 2 comments Download
M chrome/browser/global_keyboard_shortcuts_mac.h View 3 4 5 6 7 8 9 10 1 chunk +26 lines, -3 lines 2 comments Download
M chrome/browser/global_keyboard_shortcuts_mac.mm View 1 2 3 4 5 6 7 8 5 chunks +32 lines, -9 lines 0 comments Download
M chrome/browser/global_keyboard_shortcuts_mac_unittest.cc View 6 7 8 1 chunk +32 lines, -5 lines 0 comments Download
M chrome/browser/tab_contents/tab_contents_view_mac.mm View 1 2 3 4 5 6 7 8 2 chunks +15 lines, -0 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
Nico
11 years, 2 months ago (2009-10-08 18:05:00 UTC) #1
Nico
Turns out this is somewhat independent of issue 15090 after all.
11 years, 2 months ago (2009-10-08 18:07:56 UTC) #2
jeremy
Thanks for taking this on Nico! Code looks fine. My main concern here is to ...
11 years, 2 months ago (2009-10-08 19:43:57 UTC) #3
Nico
Thanks for the quick review! http://codereview.chromium.org/251069/diff/6006/6008 File chrome/browser/cocoa/chrome_browser_window.mm (right): http://codereview.chromium.org/251069/diff/6006/6008#newcode15 Line 15: (int(*)(bool, bool, bool, ...
11 years, 2 months ago (2009-10-08 20:16:52 UTC) #4
jeremy
LGTM :) http://codereview.chromium.org/251069/diff/10013/11003 File chrome/browser/cocoa/chrome_browser_window.h (right): http://codereview.chromium.org/251069/diff/10013/11003#newcode18 Line 18: // See global_keyboard_shortcuts_mac.h for details on ...
11 years, 2 months ago (2009-10-08 21:25:33 UTC) #5
Nico
Thanks. I will go ahead and submit this, I hope the comments are now clear ...
11 years, 2 months ago (2009-10-08 23:55:49 UTC) #6
pink (ping after 24hrs)
drive-by. http://codereview.chromium.org/251069/diff/8010/7015 File chrome/browser/cocoa/chrome_browser_window.mm (right): http://codereview.chromium.org/251069/diff/8010/7015#newcode54 Line 54: NSResponder* r = [self firstResponder]; what happens ...
11 years, 2 months ago (2009-10-09 14:36:51 UTC) #7
Nico
11 years, 2 months ago (2009-10-09 16:50:06 UTC) #8
http://codereview.chromium.org/251069/diff/8010/7015
File chrome/browser/cocoa/chrome_browser_window.mm (right):

http://codereview.chromium.org/251069/diff/8010/7015#newcode54
Line 54: NSResponder* r = [self firstResponder];
On 2009/10/09 14:36:51, pink wrote:
> what happens when the renderer is hung? Does that mean that these keys no
longer
> work? I remember discussion about how much this sucks on windows a month or so
> ago.

Yes, that will work once BrowserWindowCocoa::GetCommandId() is implemented (part
of issue 15090).

What will happen (but doesn't yet) is that the rwhvmac will not send the key to
the renderer in this case.

See RenderWidgetHost::ForwardKeyboardEvent(): it calls  ShouldSendToRenderer()
to decide if it should ipc the key, which ends up calling
Browser::IsReservedAccelerator(), which returns true if the accelerator has a
command id of IDC_SELECT_NEXT_TAB etc.

So BrowserWindowCocoa::GetCommandId() only has to look at
global_keyboard_shortcuts_mac and all should be fine.

(Having said that, jam's patch seems to have problems on linux with
international keyboard layouts, so maybe it will be backed out again. Who
knows.)

http://codereview.chromium.org/251069/diff/8010/7016
File chrome/browser/global_keyboard_shortcuts_mac.h (right):

http://codereview.chromium.org/251069/diff/8010/7016#newcode25
Line 25: // to intercept this. Hence, we need to types of keyboard shortcuts.
On 2009/10/09 14:36:51, pink wrote:
> s/to/two

D'oh. ne.

Powered by Google App Engine
This is Rietveld 408576698