| 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 #include "chrome/app/vector_icons/vector_icons.h" | 9 #include "chrome/app/vector_icons/vector_icons.h" |
| 10 #import "chrome/browser/ui/cocoa/image_button_cell.h" | 10 #import "chrome/browser/ui/cocoa/image_button_cell.h" |
| 11 #import "chrome/browser/ui/cocoa/l10n_util.h" | 11 #import "chrome/browser/ui/cocoa/l10n_util.h" |
| 12 #import "chrome/browser/ui/cocoa/view_id_util.h" | 12 #import "chrome/browser/ui/cocoa/view_id_util.h" |
| 13 #include "skia/ext/skia_utils_mac.h" | 13 #include "skia/ext/skia_utils_mac.h" |
| 14 #import "ui/base/cocoa/nsview_additions.h" | 14 #import "ui/base/cocoa/nsview_additions.h" |
| 15 #include "ui/base/material_design/material_design_controller.h" | 15 #include "ui/base/material_design/material_design_controller.h" |
| 16 #include "ui/base/theme_provider.h" | 16 #include "ui/base/theme_provider.h" |
| 17 #include "ui/gfx/image/image_skia_util_mac.h" | 17 #include "ui/gfx/image/image_skia_util_mac.h" |
| 18 #include "ui/gfx/paint_vector_icon.h" | 18 #include "ui/gfx/paint_vector_icon.h" |
| 19 #include "ui/vector_icons/vector_icons.h" |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| 22 // Toolbar buttons are 24x24 in Material Design. | 23 // Toolbar buttons are 24x24 in Material Design. |
| 23 const NSRect kMDButtonBounds = NSMakeRect(0, 0, 24, 24); | 24 const NSRect kMDButtonBounds = NSMakeRect(0, 0, 24, 24); |
| 24 | 25 |
| 25 // The size of a toolbar button icon in Material Design. A toolbar button image | 26 // The size of a toolbar button icon in Material Design. A toolbar button image |
| 26 // consists of a border and background, with a centered icon. | 27 // consists of a border and background, with a centered icon. |
| 27 const NSSize kMDButtonIconSize = NSMakeSize(16, 16); | 28 const NSSize kMDButtonIconSize = NSMakeSize(16, 16); |
| 28 | 29 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 // Match the hover image's bezel. | 203 // Match the hover image's bezel. |
| 203 [[NSBezierPath bezierPathWithRoundedRect:NSInsetRect([self bounds], 2, 2) | 204 [[NSBezierPath bezierPathWithRoundedRect:NSInsetRect([self bounds], 2, 2) |
| 204 xRadius:2 | 205 xRadius:2 |
| 205 yRadius:2] fill]; | 206 yRadius:2] fill]; |
| 206 } | 207 } |
| 207 | 208 |
| 208 - (const gfx::VectorIcon*)vectorIcon { | 209 - (const gfx::VectorIcon*)vectorIcon { |
| 209 BOOL isRTL = cocoa_l10n_util::ShouldDoExperimentalRTLLayout(); | 210 BOOL isRTL = cocoa_l10n_util::ShouldDoExperimentalRTLLayout(); |
| 210 switch ([self viewID]) { | 211 switch ([self viewID]) { |
| 211 case VIEW_ID_BACK_BUTTON: | 212 case VIEW_ID_BACK_BUTTON: |
| 212 return isRTL ? &kNavigateForwardIcon : &kNavigateBackIcon; | 213 return isRTL ? &ui::kForwardArrowIcon : &ui::kBackArrowIcon; |
| 213 case VIEW_ID_FORWARD_BUTTON: | 214 case VIEW_ID_FORWARD_BUTTON: |
| 214 return isRTL ? &kNavigateBackIcon : &kNavigateForwardIcon; | 215 return isRTL ? &ui::kBackArrowIcon : &ui::kForwardArrowIcon; |
| 215 case VIEW_ID_HOME_BUTTON: | 216 case VIEW_ID_HOME_BUTTON: |
| 216 return &kNavigateHomeIcon; | 217 return &kNavigateHomeIcon; |
| 217 case VIEW_ID_APP_MENU: | 218 case VIEW_ID_APP_MENU: |
| 218 return &kBrowserToolsIcon; | 219 return &kBrowserToolsIcon; |
| 219 default: | 220 default: |
| 220 break; | 221 break; |
| 221 } | 222 } |
| 222 | 223 |
| 223 return nullptr; | 224 return nullptr; |
| 224 } | 225 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 | 378 |
| 378 - (void)windowDidChangeTheme { | 379 - (void)windowDidChangeTheme { |
| 379 // Update the hover and pressed image backgrounds to match the current theme. | 380 // Update the hover and pressed image backgrounds to match the current theme. |
| 380 [self resetButtonStateImages]; | 381 [self resetButtonStateImages]; |
| 381 } | 382 } |
| 382 | 383 |
| 383 - (void)windowDidChangeActive { | 384 - (void)windowDidChangeActive { |
| 384 } | 385 } |
| 385 | 386 |
| 386 @end | 387 @end |
| OLD | NEW |