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 <string> | 7 #include <string> |
8 | 8 |
9 #include "chrome/browser/browser.h" // TODO(beng): this dependency is awful. | 9 #include "chrome/browser/browser.h" // TODO(beng): this dependency is awful. |
10 #import "chrome/browser/cocoa/focus_tracker.h" | 10 #import "chrome/browser/cocoa/focus_tracker.h" |
| 11 #import "chrome/browser/cocoa/chrome_browser_window.h" |
| 12 #import "chrome/browser/cocoa/browser_window_controller.h" |
| 13 #include "chrome/browser/global_keyboard_shortcuts_mac.h" |
11 #include "chrome/browser/cocoa/sad_tab_view.h" | 14 #include "chrome/browser/cocoa/sad_tab_view.h" |
12 #import "chrome/browser/cocoa/web_drag_source.h" | 15 #import "chrome/browser/cocoa/web_drag_source.h" |
13 #import "chrome/browser/cocoa/web_drop_target.h" | 16 #import "chrome/browser/cocoa/web_drop_target.h" |
14 #include "chrome/browser/renderer_host/render_widget_host.h" | 17 #include "chrome/browser/renderer_host/render_widget_host.h" |
15 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 18 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
16 #include "chrome/browser/tab_contents/render_view_context_menu_mac.h" | 19 #include "chrome/browser/tab_contents/render_view_context_menu_mac.h" |
17 #include "chrome/browser/tab_contents/tab_contents.h" | 20 #include "chrome/browser/tab_contents/tab_contents.h" |
18 #include "chrome/common/notification_type.h" | 21 #include "chrome/common/notification_type.h" |
19 #include "chrome/common/notification_service.h" | 22 #include "chrome/common/notification_service.h" |
20 #include "chrome/common/render_messages.h" | 23 #include "chrome/common/render_messages.h" |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 290 |
288 - (void)setCurrentDragOperation:(NSDragOperation)operation { | 291 - (void)setCurrentDragOperation:(NSDragOperation)operation { |
289 [dropTarget_ setCurrentOperation:operation]; | 292 [dropTarget_ setCurrentOperation:operation]; |
290 } | 293 } |
291 | 294 |
292 - (TabContents*)tabContents { | 295 - (TabContents*)tabContents { |
293 return tabContentsView_->tab_contents(); | 296 return tabContentsView_->tab_contents(); |
294 } | 297 } |
295 | 298 |
296 - (void)processKeyboardEvent:(NSEvent*)event { | 299 - (void)processKeyboardEvent:(NSEvent*)event { |
| 300 // If this tab is no longer active, it's window will be |nil|. In that case, |
| 301 // best ignore the event. |
| 302 if (![self window]) |
| 303 return; |
| 304 |
| 305 ChromeBrowserWindow* window = (ChromeBrowserWindow*)[self window]; |
| 306 DCHECK([window isKindOfClass:[ChromeBrowserWindow class]]); |
| 307 if ([window handleExtraBrowserKeyboardShortcut:event]) |
| 308 return; |
| 309 if ([window handleExtraWindowKeyboardShortcut:event]) |
| 310 return; |
| 311 |
297 if ([event type] == NSKeyDown) | 312 if ([event type] == NSKeyDown) |
298 [super keyDown:event]; | 313 [super keyDown:event]; |
299 else if ([event type] == NSKeyUp) | 314 else if ([event type] == NSKeyUp) |
300 [super keyUp:event]; | 315 [super keyUp:event]; |
301 } | 316 } |
302 | 317 |
303 - (void)mouseEvent:(NSEvent *)theEvent { | 318 - (void)mouseEvent:(NSEvent *)theEvent { |
304 TabContents* tabContents = [self tabContents]; | 319 TabContents* tabContents = [self tabContents]; |
305 if (tabContents->delegate()) { | 320 if (tabContents->delegate()) { |
306 if ([theEvent type] == NSMouseMoved) | 321 if ([theEvent type] == NSMouseMoved) |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 } | 420 } |
406 | 421 |
407 - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender { | 422 - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender { |
408 return [dropTarget_ performDragOperation:sender view:self]; | 423 return [dropTarget_ performDragOperation:sender view:self]; |
409 } | 424 } |
410 | 425 |
411 // Tons of stuff goes here, where we grab events going on in Cocoaland and send | 426 // Tons of stuff goes here, where we grab events going on in Cocoaland and send |
412 // them into the C++ system. TODO(avi): all that jazz | 427 // them into the C++ system. TODO(avi): all that jazz |
413 | 428 |
414 @end | 429 @end |
OLD | NEW |