| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #import "base/chrome_application_mac.h" | 11 #import "base/chrome_application_mac.h" |
| 12 #include "chrome/browser/browser.h" // TODO(beng): this dependency is awful. | 12 #include "chrome/browser/browser.h" // TODO(beng): this dependency is awful. |
| 13 #import "chrome/browser/cocoa/focus_tracker.h" | 13 #import "chrome/browser/cocoa/focus_tracker.h" |
| 14 #import "chrome/browser/cocoa/chrome_browser_window.h" | 14 #import "chrome/browser/cocoa/chrome_browser_window.h" |
| 15 #import "chrome/browser/cocoa/browser_window_controller.h" | 15 #import "chrome/browser/cocoa/browser_window_controller.h" |
| 16 #include "chrome/browser/global_keyboard_shortcuts_mac.h" | 16 #include "chrome/browser/global_keyboard_shortcuts_mac.h" |
| 17 #include "chrome/browser/cocoa/sad_tab_controller.h" | 17 #include "chrome/browser/cocoa/sad_tab_controller.h" |
| 18 #import "chrome/browser/cocoa/web_drag_source.h" | 18 #import "chrome/browser/cocoa/web_drag_source.h" |
| 19 #import "chrome/browser/cocoa/web_drop_target.h" | 19 #import "chrome/browser/cocoa/web_drop_target.h" |
| 20 #import "chrome/browser/cocoa/view_id_util.h" |
| 20 #include "chrome/browser/renderer_host/render_view_host.h" | 21 #include "chrome/browser/renderer_host/render_view_host.h" |
| 21 #include "chrome/browser/renderer_host/render_view_host_factory.h" | 22 #include "chrome/browser/renderer_host/render_view_host_factory.h" |
| 22 #include "chrome/browser/renderer_host/render_widget_host.h" | 23 #include "chrome/browser/renderer_host/render_widget_host.h" |
| 23 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 24 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
| 24 #include "chrome/browser/tab_contents/render_view_context_menu_mac.h" | 25 #include "chrome/browser/tab_contents/render_view_context_menu_mac.h" |
| 25 #include "chrome/browser/tab_contents/tab_contents.h" | 26 #include "chrome/browser/tab_contents/tab_contents.h" |
| 26 #include "chrome/common/notification_type.h" | 27 #include "chrome/common/notification_type.h" |
| 27 #include "chrome/common/notification_service.h" | 28 #include "chrome/common/notification_service.h" |
| 28 #include "chrome/common/render_messages.h" | 29 #include "chrome/common/render_messages.h" |
| 29 #include "skia/ext/skia_utils_mac.h" | 30 #include "skia/ext/skia_utils_mac.h" |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 | 324 |
| 324 @implementation TabContentsViewCocoa | 325 @implementation TabContentsViewCocoa |
| 325 | 326 |
| 326 - (id)initWithTabContentsViewMac:(TabContentsViewMac*)w { | 327 - (id)initWithTabContentsViewMac:(TabContentsViewMac*)w { |
| 327 self = [super initWithFrame:NSZeroRect]; | 328 self = [super initWithFrame:NSZeroRect]; |
| 328 if (self != nil) { | 329 if (self != nil) { |
| 329 tabContentsView_ = w; | 330 tabContentsView_ = w; |
| 330 dropTarget_.reset( | 331 dropTarget_.reset( |
| 331 [[WebDropTarget alloc] initWithTabContents:[self tabContents]]); | 332 [[WebDropTarget alloc] initWithTabContents:[self tabContents]]); |
| 332 [self registerDragTypes]; | 333 [self registerDragTypes]; |
| 334 // TabContentsViewCocoa's ViewID may be changed to VIEW_ID_DEV_TOOLS_DOCKED |
| 335 // by TabContentsController, so we can't just override -viewID method to |
| 336 // return it. |
| 337 view_id_util::SetID(self, VIEW_ID_TAB_CONTAINER); |
| 333 } | 338 } |
| 334 return self; | 339 return self; |
| 335 } | 340 } |
| 336 | 341 |
| 337 - (void)dealloc { | 342 - (void)dealloc { |
| 343 view_id_util::UnsetID(self); |
| 344 |
| 338 // Cancel any deferred tab closes, just in case. | 345 // Cancel any deferred tab closes, just in case. |
| 339 [self cancelDeferredClose]; | 346 [self cancelDeferredClose]; |
| 340 | 347 |
| 341 // This probably isn't strictly necessary, but can't hurt. | 348 // This probably isn't strictly necessary, but can't hurt. |
| 342 [self unregisterDraggedTypes]; | 349 [self unregisterDraggedTypes]; |
| 343 [super dealloc]; | 350 [super dealloc]; |
| 344 } | 351 } |
| 345 | 352 |
| 346 // Registers for the view for the appropriate drag types. | 353 // Registers for the view for the appropriate drag types. |
| 347 - (void)registerDragTypes { | 354 - (void)registerDragTypes { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 [NSObject cancelPreviousPerformRequestsWithTarget:self | 465 [NSObject cancelPreviousPerformRequestsWithTarget:self |
| 459 selector:aSel | 466 selector:aSel |
| 460 object:nil]; | 467 object:nil]; |
| 461 } | 468 } |
| 462 | 469 |
| 463 - (void)closeTabAfterEvent { | 470 - (void)closeTabAfterEvent { |
| 464 tabContentsView_->CloseTab(); | 471 tabContentsView_->CloseTab(); |
| 465 } | 472 } |
| 466 | 473 |
| 467 @end | 474 @end |
| OLD | NEW |