OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" | 5 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" |
6 | 6 |
7 #include "chrome/browser/browser.h" // TODO(beng): this dependency is awful. | 7 #include "chrome/browser/browser.h" // TODO(beng): this dependency is awful. |
8 #include "chrome/browser/cocoa/sad_tab_view.h" | 8 #include "chrome/browser/cocoa/sad_tab_view.h" |
9 #include "chrome/browser/renderer_host/render_widget_host.h" | 9 #include "chrome/browser/renderer_host/render_widget_host.h" |
10 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 10 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 void TabContentsViewMac::RestoreFocus() { | 119 void TabContentsViewMac::RestoreFocus() { |
120 // TODO(port) | 120 // TODO(port) |
121 // For now just assume we are viewing the tab for the first time. | 121 // For now just assume we are viewing the tab for the first time. |
122 SetInitialFocus(); | 122 SetInitialFocus(); |
123 } | 123 } |
124 | 124 |
125 void TabContentsViewMac::UpdateDragCursor(bool is_drop_target) { | 125 void TabContentsViewMac::UpdateDragCursor(bool is_drop_target) { |
126 NOTIMPLEMENTED(); | 126 NOTIMPLEMENTED(); |
127 } | 127 } |
128 | 128 |
| 129 // This is called when we the renderer asks us to take focus back (i.e., it has |
| 130 // iterated past the last focusable element on the page). |
129 void TabContentsViewMac::TakeFocus(bool reverse) { | 131 void TabContentsViewMac::TakeFocus(bool reverse) { |
130 [cocoa_view_.get() becomeFirstResponder]; | 132 if (reverse) { |
| 133 [[cocoa_view_ window] selectPreviousKeyView:cocoa_view_.get()]; |
| 134 } else { |
| 135 [[cocoa_view_ window] selectNextKeyView:cocoa_view_.get()]; |
| 136 } |
131 } | 137 } |
132 | 138 |
133 void TabContentsViewMac::HandleKeyboardEvent( | 139 void TabContentsViewMac::HandleKeyboardEvent( |
134 const NativeWebKeyboardEvent& event) { | 140 const NativeWebKeyboardEvent& event) { |
135 [cocoa_view_.get() processKeyboardEvent:event.os_event]; | 141 [cocoa_view_.get() processKeyboardEvent:event.os_event]; |
136 } | 142 } |
137 | 143 |
138 void TabContentsViewMac::ShowContextMenu(const ContextMenuParams& params) { | 144 void TabContentsViewMac::ShowContextMenu(const ContextMenuParams& params) { |
139 RenderViewContextMenuMac menu(web_contents(), | 145 RenderViewContextMenuMac menu(web_contents(), |
140 params, | 146 params, |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 } | 244 } |
239 | 245 |
240 - (void)paste:(id)sender { | 246 - (void)paste:(id)sender { |
241 TabContentsView_->web_contents()->Paste(); | 247 TabContentsView_->web_contents()->Paste(); |
242 } | 248 } |
243 | 249 |
244 // Tons of stuff goes here, where we grab events going on in Cocoaland and send | 250 // Tons of stuff goes here, where we grab events going on in Cocoaland and send |
245 // them into the C++ system. TODO(avi): all that jazz | 251 // them into the C++ system. TODO(avi): all that jazz |
246 | 252 |
247 @end | 253 @end |
OLD | NEW |