| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_button_cocoa.h" | 5 #import "chrome/browser/ui/cocoa/toolbar/toolbar_button_cocoa.h" |
| 6 | 6 |
| 7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
| 8 #include "base/mac/sdk_forward_declarations.h" | 8 #include "base/mac/sdk_forward_declarations.h" |
| 9 #import "chrome/browser/ui/cocoa/image_button_cell.h" | 9 #import "chrome/browser/ui/cocoa/image_button_cell.h" |
| 10 #import "chrome/browser/ui/cocoa/view_id_util.h" | 10 #import "chrome/browser/ui/cocoa/view_id_util.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 NSBezierPath* roundedRectPath = | 83 NSBezierPath* roundedRectPath = |
| 84 [NSBezierPath bezierPathWithRoundedRect:destRect xRadius:2 yRadius:2]; | 84 [NSBezierPath bezierPathWithRoundedRect:destRect xRadius:2 yRadius:2]; |
| 85 | 85 |
| 86 // Determine the fill color. | 86 // Determine the fill color. |
| 87 NSColor* fillColor = nil; | 87 NSColor* fillColor = nil; |
| 88 switch (imageRep.style) { | 88 switch (imageRep.style) { |
| 89 case ToolbarButtonImageBackgroundStyle::HOVER: | 89 case ToolbarButtonImageBackgroundStyle::HOVER: |
| 90 fillColor = [NSColor colorWithCalibratedWhite:0 alpha:0.08]; | 90 fillColor = [NSColor colorWithCalibratedWhite:0 alpha:0.08]; |
| 91 break; | 91 break; |
| 92 case ToolbarButtonImageBackgroundStyle::HOVER_THEMED: | 92 case ToolbarButtonImageBackgroundStyle::HOVER_THEMED: |
| 93 fillColor = [NSColor colorWithCalibratedWhite:1 alpha:0.08]; | 93 fillColor = [NSColor colorWithCalibratedWhite:1 alpha:0.12]; |
| 94 break; | 94 break; |
| 95 case ToolbarButtonImageBackgroundStyle::PRESSED: | 95 case ToolbarButtonImageBackgroundStyle::PRESSED: |
| 96 fillColor = [NSColor colorWithCalibratedWhite:0 alpha:0.12]; | 96 fillColor = [NSColor colorWithCalibratedWhite:0 alpha:0.12]; |
| 97 break; | 97 break; |
| 98 case ToolbarButtonImageBackgroundStyle::PRESSED_THEMED: | 98 case ToolbarButtonImageBackgroundStyle::PRESSED_THEMED: |
| 99 fillColor = [NSColor colorWithCalibratedWhite:1 alpha:0.12]; | 99 fillColor = [NSColor colorWithCalibratedWhite:1 alpha:0.16]; |
| 100 break; | 100 break; |
| 101 } | 101 } |
| 102 | 102 |
| 103 // Fill the path. | 103 // Fill the path. |
| 104 [fillColor set]; | 104 [fillColor set]; |
| 105 [roundedRectPath fill]; | 105 [roundedRectPath fill]; |
| 106 | 106 |
| 107 // Center the icon within the button. | 107 // Center the icon within the button. |
| 108 NSSize iconSize = [imageRep.icon size]; | 108 NSSize iconSize = [imageRep.icon size]; |
| 109 CGFloat iconInset = (kMDButtonBounds.size.width - iconSize.width) / 2; | 109 CGFloat iconInset = (kMDButtonBounds.size.width - iconSize.width) / 2; |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 // Update the hover and pressed image backgrounds to match the current theme. | 351 // Update the hover and pressed image backgrounds to match the current theme. |
| 352 if (ui::MaterialDesignController::IsModeMaterial()) { | 352 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 353 [self resetButtonStateImages]; | 353 [self resetButtonStateImages]; |
| 354 } | 354 } |
| 355 } | 355 } |
| 356 | 356 |
| 357 - (void)windowDidChangeActive { | 357 - (void)windowDidChangeActive { |
| 358 } | 358 } |
| 359 | 359 |
| 360 @end | 360 @end |
| OLD | NEW |