OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <cmath> | 9 #include <cmath> |
10 #include <limits> | 10 #include <limits> |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 forButtonState:image_button_cell::kDefaultState]; | 388 forButtonState:image_button_cell::kDefaultState]; |
389 [[newTabButton_ cell] setImageID:IDR_NEWTAB_BUTTON_H | 389 [[newTabButton_ cell] setImageID:IDR_NEWTAB_BUTTON_H |
390 forButtonState:image_button_cell::kHoverState]; | 390 forButtonState:image_button_cell::kHoverState]; |
391 [[newTabButton_ cell] setImageID:IDR_NEWTAB_BUTTON_P | 391 [[newTabButton_ cell] setImageID:IDR_NEWTAB_BUTTON_P |
392 forButtonState:image_button_cell::kPressedState]; | 392 forButtonState:image_button_cell::kPressedState]; |
393 newTabButtonShowingHoverImage_ = NO; | 393 newTabButtonShowingHoverImage_ = NO; |
394 newTabTrackingArea_.reset( | 394 newTabTrackingArea_.reset( |
395 [[CrTrackingArea alloc] initWithRect:[newTabButton_ bounds] | 395 [[CrTrackingArea alloc] initWithRect:[newTabButton_ bounds] |
396 options:(NSTrackingMouseEnteredAndExited | | 396 options:(NSTrackingMouseEnteredAndExited | |
397 NSTrackingActiveAlways) | 397 NSTrackingActiveAlways) |
398 proxiedOwner:self | 398 owner:self |
399 userInfo:nil]); | 399 userInfo:nil]); |
400 if (browserWindow) // Nil for Browsers without a tab strip (e.g. popups). | 400 if (browserWindow) // Nil for Browsers without a tab strip (e.g. popups). |
401 [newTabTrackingArea_ clearOwnerWhenWindowWillClose:browserWindow]; | 401 [newTabTrackingArea_ clearOwnerWhenWindowWillClose:browserWindow]; |
402 [newTabButton_ addTrackingArea:newTabTrackingArea_.get()]; | 402 [newTabButton_ addTrackingArea:newTabTrackingArea_.get()]; |
403 targetFrames_.reset([[NSMutableDictionary alloc] init]); | 403 targetFrames_.reset([[NSMutableDictionary alloc] init]); |
404 | 404 |
405 dragBlockingView_.reset( | 405 dragBlockingView_.reset( |
406 [[TabStripControllerDragBlockingView alloc] initWithFrame:NSZeroRect | 406 [[TabStripControllerDragBlockingView alloc] initWithFrame:NSZeroRect |
407 controller:self]); | 407 controller:self]); |
408 [self addSubviewToPermanentList:dragBlockingView_]; | 408 [self addSubviewToPermanentList:dragBlockingView_]; |
(...skipping 13 matching lines...) Expand all Loading... |
422 selector:@selector(tabViewFrameChanged:) | 422 selector:@selector(tabViewFrameChanged:) |
423 name:NSViewFrameDidChangeNotification | 423 name:NSViewFrameDidChangeNotification |
424 object:tabStripView_]; | 424 object:tabStripView_]; |
425 | 425 |
426 trackingArea_.reset([[CrTrackingArea alloc] | 426 trackingArea_.reset([[CrTrackingArea alloc] |
427 initWithRect:NSZeroRect // Ignored by NSTrackingInVisibleRect | 427 initWithRect:NSZeroRect // Ignored by NSTrackingInVisibleRect |
428 options:NSTrackingMouseEnteredAndExited | | 428 options:NSTrackingMouseEnteredAndExited | |
429 NSTrackingMouseMoved | | 429 NSTrackingMouseMoved | |
430 NSTrackingActiveAlways | | 430 NSTrackingActiveAlways | |
431 NSTrackingInVisibleRect | 431 NSTrackingInVisibleRect |
432 proxiedOwner:self | 432 owner:self |
433 userInfo:nil]); | 433 userInfo:nil]); |
434 if (browserWindow) // Nil for Browsers without a tab strip (e.g. popups). | 434 if (browserWindow) // Nil for Browsers without a tab strip (e.g. popups). |
435 [trackingArea_ clearOwnerWhenWindowWillClose:browserWindow]; | 435 [trackingArea_ clearOwnerWhenWindowWillClose:browserWindow]; |
436 [tabStripView_ addTrackingArea:trackingArea_.get()]; | 436 [tabStripView_ addTrackingArea:trackingArea_.get()]; |
437 | 437 |
438 // Check to see if the mouse is currently in our bounds so we can | 438 // Check to see if the mouse is currently in our bounds so we can |
439 // enable the tracking areas. Otherwise we won't get hover states | 439 // enable the tracking areas. Otherwise we won't get hover states |
440 // or tab gradients if we load the window up under the mouse. | 440 // or tab gradients if we load the window up under the mouse. |
441 NSPoint mouseLoc = [[view window] mouseLocationOutsideOfEventStream]; | 441 NSPoint mouseLoc = [[view window] mouseLocationOutsideOfEventStream]; |
442 mouseLoc = [view convertPoint:mouseLoc fromView:nil]; | 442 mouseLoc = [view convertPoint:mouseLoc fromView:nil]; |
(...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2121 NSInteger index = [self indexFromModelIndex:modelIndex]; | 2121 NSInteger index = [self indexFromModelIndex:modelIndex]; |
2122 BrowserWindowController* controller = | 2122 BrowserWindowController* controller = |
2123 (BrowserWindowController*)[[switchView_ window] windowController]; | 2123 (BrowserWindowController*)[[switchView_ window] windowController]; |
2124 DCHECK(index >= 0); | 2124 DCHECK(index >= 0); |
2125 if (index >= 0) { | 2125 if (index >= 0) { |
2126 [controller setTab:[self viewAtIndex:index] isDraggable:YES]; | 2126 [controller setTab:[self viewAtIndex:index] isDraggable:YES]; |
2127 } | 2127 } |
2128 } | 2128 } |
2129 | 2129 |
2130 @end | 2130 @end |
OLD | NEW |