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/toolbar/toolbar_controller.h" | 5 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 [[locationBar_ cell] | 354 [[locationBar_ cell] |
355 accessibilitySetOverrideValue:description | 355 accessibilitySetOverrideValue:description |
356 forAttribute:NSAccessibilityDescriptionAttribute]; | 356 forAttribute:NSAccessibilityDescriptionAttribute]; |
357 description = l10n_util::GetNSStringWithFixup(IDS_ACCNAME_APP); | 357 description = l10n_util::GetNSStringWithFixup(IDS_ACCNAME_APP); |
358 [[wrenchButton_ cell] | 358 [[wrenchButton_ cell] |
359 accessibilitySetOverrideValue:description | 359 accessibilitySetOverrideValue:description |
360 forAttribute:NSAccessibilityDescriptionAttribute]; | 360 forAttribute:NSAccessibilityDescriptionAttribute]; |
361 } | 361 } |
362 | 362 |
363 - (void)mouseExited:(NSEvent*)theEvent { | 363 - (void)mouseExited:(NSEvent*)theEvent { |
364 [[hoveredButton_ cell] setMouseInside:NO animate:YES]; | 364 [[hoveredButton_ cell] setIsMouseInside:NO]; |
365 [hoveredButton_ release]; | 365 [hoveredButton_ release]; |
366 hoveredButton_ = nil; | 366 hoveredButton_ = nil; |
367 } | 367 } |
368 | 368 |
369 - (NSButton*)hoverButtonForEvent:(NSEvent*)theEvent { | 369 - (NSButton*)hoverButtonForEvent:(NSEvent*)theEvent { |
370 NSButton* targetView = (NSButton*)[[self view] | 370 NSButton* targetView = (NSButton*)[[self view] |
371 hitTest:[theEvent locationInWindow]]; | 371 hitTest:[theEvent locationInWindow]]; |
372 | 372 |
373 // Only interpret the view as a hoverButton_ if it's both button and has a | 373 // Only interpret the view as a hoverButton_ if it's both button and has a |
374 // button cell that cares. GradientButtonCell derived cells care. | 374 // button cell that cares. GradientButtonCell derived cells care. |
375 if (([targetView isKindOfClass:[NSButton class]]) && | 375 if (([targetView isKindOfClass:[NSButton class]]) && |
376 ([[targetView cell] | 376 ([[targetView cell] |
377 respondsToSelector:@selector(setMouseInside:animate:)])) | 377 respondsToSelector:@selector(setIsMouseInside:)])) |
378 return targetView; | 378 return targetView; |
379 return nil; | 379 return nil; |
380 } | 380 } |
381 | 381 |
382 - (void)mouseMoved:(NSEvent*)theEvent { | 382 - (void)mouseMoved:(NSEvent*)theEvent { |
383 NSButton* targetView = [self hoverButtonForEvent:theEvent]; | 383 NSButton* targetView = [self hoverButtonForEvent:theEvent]; |
384 if (hoveredButton_ != targetView) { | 384 if (hoveredButton_ != targetView) { |
385 [[hoveredButton_ cell] setMouseInside:NO animate:YES]; | 385 [[hoveredButton_ cell] setIsMouseInside:NO]; |
386 [[targetView cell] setMouseInside:YES animate:YES]; | 386 [[targetView cell] setIsMouseInside:YES]; |
387 [hoveredButton_ release]; | 387 [hoveredButton_ release]; |
388 hoveredButton_ = [targetView retain]; | 388 hoveredButton_ = [targetView retain]; |
389 } | 389 } |
390 } | 390 } |
391 | 391 |
392 - (void)mouseEntered:(NSEvent*)event { | 392 - (void)mouseEntered:(NSEvent*)event { |
393 [self mouseMoved:event]; | 393 [self mouseMoved:event]; |
394 } | 394 } |
395 | 395 |
396 - (LocationBarViewMac*)locationBarBridge { | 396 - (LocationBarViewMac*)locationBarBridge { |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 - (void)hideDropURLsIndicatorInView:(NSView*)view { | 854 - (void)hideDropURLsIndicatorInView:(NSView*)view { |
855 // Do nothing. | 855 // Do nothing. |
856 } | 856 } |
857 | 857 |
858 // (URLDropTargetController protocol) | 858 // (URLDropTargetController protocol) |
859 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { | 859 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { |
860 return drag_util::IsUnsupportedDropData(profile_, info); | 860 return drag_util::IsUnsupportedDropData(profile_, info); |
861 } | 861 } |
862 | 862 |
863 @end | 863 @end |
OLD | NEW |