OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #import <Carbon/Carbon.h> | 5 #import <Carbon/Carbon.h> |
6 | 6 |
7 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" | 7 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "chrome/browser/browser_shutdown.h" | 11 #include "chrome/browser/browser_shutdown.h" |
12 #import "chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegat
e.h" | 12 #import "chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegat
e.h" |
13 #include "chrome/browser/tab_contents/render_view_context_menu_mac.h" | 13 #include "chrome/browser/tab_contents/render_view_context_menu_mac.h" |
| 14 #include "chrome/browser/tab_contents/web_drag_bookmark_handler_mac.h" |
14 #import "chrome/browser/ui/cocoa/focus_tracker.h" | 15 #import "chrome/browser/ui/cocoa/focus_tracker.h" |
15 #import "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h" | 16 #import "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h" |
16 #import "chrome/browser/ui/cocoa/tab_contents/web_drop_target.h" | 17 #import "chrome/browser/ui/cocoa/tab_contents/web_drop_target.h" |
17 #import "chrome/browser/ui/cocoa/view_id_util.h" | 18 #import "chrome/browser/ui/cocoa/view_id_util.h" |
18 #include "content/browser/renderer_host/render_view_host.h" | 19 #include "content/browser/renderer_host/render_view_host.h" |
19 #include "content/browser/renderer_host/render_view_host_factory.h" | 20 #include "content/browser/renderer_host/render_view_host_factory.h" |
20 #include "content/browser/renderer_host/render_widget_host.h" | 21 #include "content/browser/renderer_host/render_widget_host.h" |
21 #include "content/browser/renderer_host/render_widget_host_view_mac.h" | 22 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
22 #include "content/browser/tab_contents/popup_menu_helper_mac.h" | 23 #include "content/browser/tab_contents/popup_menu_helper_mac.h" |
23 #include "content/browser/tab_contents/tab_contents.h" | 24 #include "content/browser/tab_contents/tab_contents.h" |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 } | 414 } |
414 | 415 |
415 @implementation TabContentsViewCocoa | 416 @implementation TabContentsViewCocoa |
416 | 417 |
417 - (id)initWithTabContentsViewMac:(TabContentsViewMac*)w { | 418 - (id)initWithTabContentsViewMac:(TabContentsViewMac*)w { |
418 self = [super initWithFrame:NSZeroRect]; | 419 self = [super initWithFrame:NSZeroRect]; |
419 if (self != nil) { | 420 if (self != nil) { |
420 tabContentsView_ = w; | 421 tabContentsView_ = w; |
421 dropTarget_.reset( | 422 dropTarget_.reset( |
422 [[WebDropTarget alloc] initWithTabContents:[self tabContents]]); | 423 [[WebDropTarget alloc] initWithTabContents:[self tabContents]]); |
| 424 bookmarkHandler_.reset(new WebDragBookmarkHandlerMac); |
| 425 [dropTarget_ setDragDelegate: |
| 426 static_cast<content::WebDragDestDelegate*>(bookmarkHandler_.get())]; |
423 [self registerDragTypes]; | 427 [self registerDragTypes]; |
424 // TabContentsViewCocoa's ViewID may be changed to VIEW_ID_DEV_TOOLS_DOCKED | 428 // TabContentsViewCocoa's ViewID may be changed to VIEW_ID_DEV_TOOLS_DOCKED |
425 // by TabContentsController, so we can't just override -viewID method to | 429 // by TabContentsController, so we can't just override -viewID method to |
426 // return it. | 430 // return it. |
427 view_id_util::SetID(self, VIEW_ID_TAB_CONTAINER); | 431 view_id_util::SetID(self, VIEW_ID_TAB_CONTAINER); |
428 | 432 |
429 [[NSNotificationCenter defaultCenter] | 433 [[NSNotificationCenter defaultCenter] |
430 addObserver:self | 434 addObserver:self |
431 selector:@selector(viewDidBecomeFirstResponder:) | 435 selector:@selector(viewDidBecomeFirstResponder:) |
432 name:kViewDidBecomeFirstResponder | 436 name:kViewDidBecomeFirstResponder |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 [[[notification userInfo] objectForKey:kSelectionDirection] | 596 [[[notification userInfo] objectForKey:kSelectionDirection] |
593 unsignedIntegerValue]; | 597 unsignedIntegerValue]; |
594 if (direction == NSDirectSelection) | 598 if (direction == NSDirectSelection) |
595 return; | 599 return; |
596 | 600 |
597 [self tabContents]-> | 601 [self tabContents]-> |
598 FocusThroughTabTraversal(direction == NSSelectingPrevious); | 602 FocusThroughTabTraversal(direction == NSSelectingPrevious); |
599 } | 603 } |
600 | 604 |
601 @end | 605 @end |
OLD | NEW |