| 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 13 matching lines...) Expand all  Loading... | 
| 24 } | 24 } | 
| 25 | 25 | 
| 26 void BackButton::SetLeadingMargin(int margin) { | 26 void BackButton::SetLeadingMargin(int margin) { | 
| 27   // Adjust border insets to follow the margin change, | 27   // Adjust border insets to follow the margin change, | 
| 28   // which will be reflected in where the border is painted | 28   // which will be reflected in where the border is painted | 
| 29   // through |GetThemePaintRect|. | 29   // through |GetThemePaintRect|. | 
| 30   views::LabelButtonBorder* border = new views::LabelButtonBorder(style()); | 30   views::LabelButtonBorder* border = new views::LabelButtonBorder(style()); | 
| 31   const gfx::Insets insets(border->GetInsets()); | 31   const gfx::Insets insets(border->GetInsets()); | 
| 32   border->set_insets(gfx::Insets(insets.top(), insets.left() + margin, | 32   border->set_insets(gfx::Insets(insets.top(), insets.left() + margin, | 
| 33                                  insets.bottom(), insets.right())); | 33                                  insets.bottom(), insets.right())); | 
| 34   set_border(border); | 34   UpdateThemedBorder(border); | 
| 35 | 35 | 
| 36   // Similarly fiddle the focus border. Value consistent with LabelButton | 36   // Similarly fiddle the focus border. Value consistent with LabelButton | 
| 37   // and TextButton. | 37   // and TextButton. | 
| 38   // TODO(gbillock): Refactor this magic number somewhere global to views, | 38   // TODO(gbillock): Refactor this magic number somewhere global to views, | 
| 39   // probably a FocusBorder constant. | 39   // probably a FocusBorder constant. | 
| 40   const int kFocusRectInset = 3; | 40   const int kFocusRectInset = 3; | 
| 41   SetFocusPainter(views::Painter::CreateDashedFocusPainterWithInsets( | 41   SetFocusPainter(views::Painter::CreateDashedFocusPainterWithInsets( | 
| 42                       gfx::Insets(kFocusRectInset, kFocusRectInset + margin, | 42                       gfx::Insets(kFocusRectInset, kFocusRectInset + margin, | 
| 43                                   kFocusRectInset, kFocusRectInset))); | 43                                   kFocusRectInset, kFocusRectInset))); | 
| 44 | 44 | 
| 45   margin_leading_ = margin; | 45   margin_leading_ = margin; | 
| 46   InvalidateLayout(); | 46   InvalidateLayout(); | 
| 47 } | 47 } | 
| OLD | NEW | 
|---|