| 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 "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
| 6 | 6 |
| 7 #import <QuartzCore/QuartzCore.h> | 7 #import <QuartzCore/QuartzCore.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 // Set the images from code because Cocoa fails to find them in our sub | 318 // Set the images from code because Cocoa fails to find them in our sub |
| 319 // bundle during tests. | 319 // bundle during tests. |
| 320 [newTabButton_ setImage:app::mac::GetCachedImageWithName(kNewTabImage)]; | 320 [newTabButton_ setImage:app::mac::GetCachedImageWithName(kNewTabImage)]; |
| 321 [newTabButton_ setAlternateImage: | 321 [newTabButton_ setAlternateImage: |
| 322 app::mac::GetCachedImageWithName(kNewTabPressedImage)]; | 322 app::mac::GetCachedImageWithName(kNewTabPressedImage)]; |
| 323 newTabButtonShowingHoverImage_ = NO; | 323 newTabButtonShowingHoverImage_ = NO; |
| 324 newTabTrackingArea_.reset( | 324 newTabTrackingArea_.reset( |
| 325 [[CrTrackingArea alloc] initWithRect:[newTabButton_ bounds] | 325 [[CrTrackingArea alloc] initWithRect:[newTabButton_ bounds] |
| 326 options:(NSTrackingMouseEnteredAndExited | | 326 options:(NSTrackingMouseEnteredAndExited | |
| 327 NSTrackingActiveAlways) | 327 NSTrackingActiveAlways) |
| 328 owner:self | 328 proxiedOwner:self |
| 329 userInfo:nil]); | 329 userInfo:nil]); |
| 330 if (browserWindow) // Nil for Browsers without a tab strip (e.g. popups). | 330 if (browserWindow) // Nil for Browsers without a tab strip (e.g. popups). |
| 331 [newTabTrackingArea_ clearOwnerWhenWindowWillClose:browserWindow]; | 331 [newTabTrackingArea_ clearOwnerWhenWindowWillClose:browserWindow]; |
| 332 [newTabButton_ addTrackingArea:newTabTrackingArea_.get()]; | 332 [newTabButton_ addTrackingArea:newTabTrackingArea_.get()]; |
| 333 targetFrames_.reset([[NSMutableDictionary alloc] init]); | 333 targetFrames_.reset([[NSMutableDictionary alloc] init]); |
| 334 | 334 |
| 335 dragBlockingView_.reset( | 335 dragBlockingView_.reset( |
| 336 [[TabStripControllerDragBlockingView alloc] initWithFrame:NSZeroRect | 336 [[TabStripControllerDragBlockingView alloc] initWithFrame:NSZeroRect |
| 337 controller:self]); | 337 controller:self]); |
| 338 [self addSubviewToPermanentList:dragBlockingView_]; | 338 [self addSubviewToPermanentList:dragBlockingView_]; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 352 selector:@selector(tabViewFrameChanged:) | 352 selector:@selector(tabViewFrameChanged:) |
| 353 name:NSViewFrameDidChangeNotification | 353 name:NSViewFrameDidChangeNotification |
| 354 object:tabStripView_]; | 354 object:tabStripView_]; |
| 355 | 355 |
| 356 trackingArea_.reset([[CrTrackingArea alloc] | 356 trackingArea_.reset([[CrTrackingArea alloc] |
| 357 initWithRect:NSZeroRect // Ignored by NSTrackingInVisibleRect | 357 initWithRect:NSZeroRect // Ignored by NSTrackingInVisibleRect |
| 358 options:NSTrackingMouseEnteredAndExited | | 358 options:NSTrackingMouseEnteredAndExited | |
| 359 NSTrackingMouseMoved | | 359 NSTrackingMouseMoved | |
| 360 NSTrackingActiveAlways | | 360 NSTrackingActiveAlways | |
| 361 NSTrackingInVisibleRect | 361 NSTrackingInVisibleRect |
| 362 owner:self | 362 proxiedOwner:self |
| 363 userInfo:nil]); | 363 userInfo:nil]); |
| 364 if (browserWindow) // Nil for Browsers without a tab strip (e.g. popups). | 364 if (browserWindow) // Nil for Browsers without a tab strip (e.g. popups). |
| 365 [trackingArea_ clearOwnerWhenWindowWillClose:browserWindow]; | 365 [trackingArea_ clearOwnerWhenWindowWillClose:browserWindow]; |
| 366 [tabStripView_ addTrackingArea:trackingArea_.get()]; | 366 [tabStripView_ addTrackingArea:trackingArea_.get()]; |
| 367 | 367 |
| 368 // Check to see if the mouse is currently in our bounds so we can | 368 // Check to see if the mouse is currently in our bounds so we can |
| 369 // enable the tracking areas. Otherwise we won't get hover states | 369 // enable the tracking areas. Otherwise we won't get hover states |
| 370 // or tab gradients if we load the window up under the mouse. | 370 // or tab gradients if we load the window up under the mouse. |
| 371 NSPoint mouseLoc = [[view window] mouseLocationOutsideOfEventStream]; | 371 NSPoint mouseLoc = [[view window] mouseLocationOutsideOfEventStream]; |
| 372 mouseLoc = [view convertPoint:mouseLoc fromView:nil]; | 372 mouseLoc = [view convertPoint:mouseLoc fromView:nil]; |
| (...skipping 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1899 NSInteger index = [self indexFromModelIndex:modelIndex]; | 1899 NSInteger index = [self indexFromModelIndex:modelIndex]; |
| 1900 BrowserWindowController* controller = | 1900 BrowserWindowController* controller = |
| 1901 (BrowserWindowController*)[[switchView_ window] windowController]; | 1901 (BrowserWindowController*)[[switchView_ window] windowController]; |
| 1902 DCHECK(index >= 0); | 1902 DCHECK(index >= 0); |
| 1903 if (index >= 0) { | 1903 if (index >= 0) { |
| 1904 [controller setTab:[self viewAtIndex:index] isDraggable:YES]; | 1904 [controller setTab:[self viewAtIndex:index] isDraggable:YES]; |
| 1905 } | 1905 } |
| 1906 } | 1906 } |
| 1907 | 1907 |
| 1908 @end | 1908 @end |
| OLD | NEW |