| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/views/toolbar/back_button.h" | 5 #include "chrome/browser/ui/views/toolbar/back_button.h" |
| 6 | 6 |
| 7 #include "ui/gfx/insets.h" | 7 #include "ui/gfx/insets.h" |
| 8 #include "ui/views/controls/button/label_button_border.h" | 8 #include "ui/views/controls/button/label_button_border.h" |
| 9 #include "ui/views/painter.h" | 9 #include "ui/views/painter.h" |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // TODO(gbillock): Refactor this magic number somewhere global to views, | 31 // TODO(gbillock): Refactor this magic number somewhere global to views, |
| 32 // probably a FocusBorder constant. | 32 // probably a FocusBorder constant. |
| 33 const int kFocusRectInset = 3; | 33 const int kFocusRectInset = 3; |
| 34 SetFocusPainter(views::Painter::CreateDashedFocusPainterWithInsets( | 34 SetFocusPainter(views::Painter::CreateDashedFocusPainterWithInsets( |
| 35 gfx::Insets(kFocusRectInset, kFocusRectInset + margin, | 35 gfx::Insets(kFocusRectInset, kFocusRectInset + margin, |
| 36 kFocusRectInset, kFocusRectInset))); | 36 kFocusRectInset, kFocusRectInset))); |
| 37 | 37 |
| 38 InvalidateLayout(); | 38 InvalidateLayout(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 scoped_ptr<views::Border> BackButton::CreateDefaultBorder() const { | 41 void BackButton::SetDefaultBorderInsets(views::LabelButtonBorder* border) { |
| 42 ToolbarButton::SetDefaultBorderInsets(border); |
| 43 |
| 42 // Adjust border insets to follow the margin change, | 44 // Adjust border insets to follow the margin change, |
| 43 // which will be reflected in where the border is painted | 45 // which will be reflected in where the border is painted |
| 44 // through |GetThemePaintRect|. | 46 // through |GetThemePaintRect|. |
| 45 scoped_ptr<views::LabelButtonBorder> border( | |
| 46 new views::LabelButtonBorder(style())); | |
| 47 const gfx::Insets insets(border->GetInsets()); | 47 const gfx::Insets insets(border->GetInsets()); |
| 48 border->set_insets(gfx::Insets(insets.top(), insets.left() + margin_leading_, | 48 border->set_insets(gfx::Insets(insets.top(), insets.left() + margin_leading_, |
| 49 insets.bottom(), insets.right())); | 49 insets.bottom(), insets.right())); |
| 50 return border.PassAs<views::Border>(); | |
| 51 } | 50 } |
| OLD | NEW |