| 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/l10n_util.h" |
| 10 #import "chrome/browser/ui/cocoa/view_id_util.h" | 11 #import "chrome/browser/ui/cocoa/view_id_util.h" |
| 11 #include "skia/ext/skia_utils_mac.h" | 12 #include "skia/ext/skia_utils_mac.h" |
| 12 #import "ui/base/cocoa/nsview_additions.h" | 13 #import "ui/base/cocoa/nsview_additions.h" |
| 13 #include "ui/base/material_design/material_design_controller.h" | 14 #include "ui/base/material_design/material_design_controller.h" |
| 14 #include "ui/base/theme_provider.h" | 15 #include "ui/base/theme_provider.h" |
| 15 #include "ui/gfx/image/image_skia_util_mac.h" | 16 #include "ui/gfx/image/image_skia_util_mac.h" |
| 16 #include "ui/gfx/paint_vector_icon.h" | 17 #include "ui/gfx/paint_vector_icon.h" |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } | 198 } |
| 198 | 199 |
| 199 - (void)drawFocusRingMask { | 200 - (void)drawFocusRingMask { |
| 200 // Match the hover image's bezel. | 201 // Match the hover image's bezel. |
| 201 [[NSBezierPath bezierPathWithRoundedRect:NSInsetRect([self bounds], 2, 2) | 202 [[NSBezierPath bezierPathWithRoundedRect:NSInsetRect([self bounds], 2, 2) |
| 202 xRadius:2 | 203 xRadius:2 |
| 203 yRadius:2] fill]; | 204 yRadius:2] fill]; |
| 204 } | 205 } |
| 205 | 206 |
| 206 - (gfx::VectorIconId)vectorIconId { | 207 - (gfx::VectorIconId)vectorIconId { |
| 208 BOOL isRTL = cocoa_l10n_util::ShouldDoExperimentalRTLLayout(); |
| 207 switch ([self viewID]) { | 209 switch ([self viewID]) { |
| 208 case VIEW_ID_BACK_BUTTON: | 210 case VIEW_ID_BACK_BUTTON: |
| 209 return gfx::VectorIconId::NAVIGATE_BACK; | 211 return isRTL ? gfx::VectorIconId::NAVIGATE_FORWARD |
| 212 : gfx::VectorIconId::NAVIGATE_BACK; |
| 210 case VIEW_ID_FORWARD_BUTTON: | 213 case VIEW_ID_FORWARD_BUTTON: |
| 211 return gfx::VectorIconId::NAVIGATE_FORWARD; | 214 return isRTL ? gfx::VectorIconId::NAVIGATE_BACK |
| 215 : gfx::VectorIconId::NAVIGATE_FORWARD; |
| 212 case VIEW_ID_HOME_BUTTON: | 216 case VIEW_ID_HOME_BUTTON: |
| 213 return gfx::VectorIconId::NAVIGATE_HOME; | 217 return gfx::VectorIconId::NAVIGATE_HOME; |
| 214 case VIEW_ID_APP_MENU: | 218 case VIEW_ID_APP_MENU: |
| 215 return gfx::VectorIconId::BROWSER_TOOLS; | 219 return gfx::VectorIconId::BROWSER_TOOLS; |
| 216 default: | 220 default: |
| 217 break; | 221 break; |
| 218 } | 222 } |
| 219 | 223 |
| 220 return gfx::VectorIconId::VECTOR_ICON_NONE; | 224 return gfx::VectorIconId::VECTOR_ICON_NONE; |
| 221 } | 225 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 | 378 |
| 375 - (void)windowDidChangeTheme { | 379 - (void)windowDidChangeTheme { |
| 376 // 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. |
| 377 [self resetButtonStateImages]; | 381 [self resetButtonStateImages]; |
| 378 } | 382 } |
| 379 | 383 |
| 380 - (void)windowDidChangeActive { | 384 - (void)windowDidChangeActive { |
| 381 } | 385 } |
| 382 | 386 |
| 383 @end | 387 @end |
| OLD | NEW |