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 #include "chrome/browser/ui/cocoa/gradient_button_cell.h" | 5 #include "chrome/browser/ui/cocoa/gradient_button_cell.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 themeProvider->HasCustomImage(IDR_THEME_BUTTON_BACKGROUND)) { | 368 themeProvider->HasCustomImage(IDR_THEME_BUTTON_BACKGROUND)) { |
369 backgroundImageColor = | 369 backgroundImageColor = |
370 themeProvider->GetNSImageColorNamed(IDR_THEME_BUTTON_BACKGROUND); | 370 themeProvider->GetNSImageColorNamed(IDR_THEME_BUTTON_BACKGROUND); |
371 } | 371 } |
372 useThemeGradient = backgroundImageColor ? YES : NO; | 372 useThemeGradient = backgroundImageColor ? YES : NO; |
373 } | 373 } |
374 | 374 |
375 // The basic gradient shown inside; see above. | 375 // The basic gradient shown inside; see above. |
376 NSGradient* gradient; | 376 NSGradient* gradient; |
377 if (hoverAlpha == 0 && !useThemeGradient) { | 377 if (hoverAlpha == 0 && !useThemeGradient) { |
378 gradient = defaultGradient ? defaultGradient | 378 gradient = defaultGradient ? defaultGradient : gradient_.get(); |
379 : gradient_; | |
380 } else { | 379 } else { |
381 gradient = [self gradientForHoverAlpha:hoverAlpha | 380 gradient = [self gradientForHoverAlpha:hoverAlpha |
382 isThemed:useThemeGradient]; | 381 isThemed:useThemeGradient]; |
383 } | 382 } |
384 | 383 |
385 // If we're drawing a background image, show that; else possibly show the | 384 // If we're drawing a background image, show that; else possibly show the |
386 // clicked gradient. | 385 // clicked gradient. |
387 if (backgroundImageColor) { | 386 if (backgroundImageColor) { |
388 [backgroundImageColor set]; | 387 [backgroundImageColor set]; |
389 // Set the phase to match window. | 388 // Set the phase to match window. |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 options:options | 786 options:options |
788 owner:self | 787 owner:self |
789 userInfo:nil]); | 788 userInfo:nil]); |
790 if (isMouseInside_ != mouseInView) { | 789 if (isMouseInside_ != mouseInView) { |
791 [self setMouseInside:mouseInView animate:NO]; | 790 [self setMouseInside:mouseInView animate:NO]; |
792 [controlView setNeedsDisplay:YES]; | 791 [controlView setNeedsDisplay:YES]; |
793 } | 792 } |
794 } | 793 } |
795 | 794 |
796 @end | 795 @end |
OLD | NEW |