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

Unified Diff: chrome/browser/tab_contents/tab_contents_view_mac.mm

Issue 3153039: Fix tabbing into web area not focusing first element.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host_view_mac.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/tab_contents_view_mac.mm
===================================================================
--- chrome/browser/tab_contents/tab_contents_view_mac.mm (revision 64127)
+++ chrome/browser/tab_contents/tab_contents_view_mac.mm (working copy)
@@ -56,6 +56,7 @@
offset:(NSPoint)offset;
- (void)cancelDeferredClose;
- (void)closeTabAfterEvent;
+- (void)viewDidBecomeFirstResponder:(NSNotification*)notification;
@end
// static
@@ -346,6 +347,12 @@
// by TabContentsController, so we can't just override -viewID method to
// return it.
view_id_util::SetID(self, VIEW_ID_TAB_CONTAINER);
+
+ [[NSNotificationCenter defaultCenter]
+ addObserver:self
+ selector:@selector(viewDidBecomeFirstResponder:)
+ name:kViewDidBecomeFirstResponder
+ object:nil];
}
return self;
}
@@ -358,6 +365,9 @@
// This probably isn't strictly necessary, but can't hurt.
[self unregisterDraggedTypes];
+
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+
[super dealloc];
}
@@ -482,4 +492,19 @@
tabContentsView_->CloseTab();
}
+- (void)viewDidBecomeFirstResponder:(NSNotification*)notification {
+ NSView* view = [notification object];
+ if (![[self subviews] containsObject:view])
+ return;
+
+ NSSelectionDirection direction =
+ [[[notification userInfo] objectForKey:kSelectionDirection]
+ unsignedIntegerValue];
+ if (direction == NSDirectSelection)
+ return;
+
+ [self tabContents]->
+ FocusThroughTabTraversal(direction == NSSelectingPrevious);
+}
+
@end
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host_view_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698