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 3 // found in the LICENSE file. 4 5 #include "chrome/browser/ui/views/infobars/infobar_label_button_border.h" 6 7 #include "chrome/browser/defaults.h" 8 #include "grit/theme_resources.h" 9 #include "ui/views/painter.h" 10 11 namespace { 12 13 const int kNormalImageSet[] = IMAGE_GRID(IDR_INFOBARBUTTON_NORMAL); 14 const int kHoveredImageSet[] = IMAGE_GRID(IDR_INFOBARBUTTON_HOVER); 15 const int kPressedImageSet[] = IMAGE_GRID(IDR_INFOBARBUTTON_PRESSED); 16 17 } // namespace 18 19 InfoBarLabelButtonBorder::InfoBarLabelButtonBorder() 20 : views::LabelButtonBorder(views::Button::STYLE_TEXTBUTTON) { 21 SetPainter(false, views::Button::STATE_NORMAL, 22 views::Painter::CreateImageGridPainter(kNormalImageSet)); 23 SetPainter(false, views::Button::STATE_HOVERED, 24 views::Painter::CreateImageGridPainter(kHoveredImageSet)); 25 SetPainter(false, views::Button::STATE_PRESSED, 26 views::Painter::CreateImageGridPainter(kPressedImageSet)); 27 } 28 29 InfoBarLabelButtonBorder::~InfoBarLabelButtonBorder() { 30 } 31 32 gfx::Insets InfoBarLabelButtonBorder::GetInsets() const{ 33 gfx::Insets insets = views::LabelButtonBorder::GetInsets(); 34 return gfx::Insets(browser_defaults::kInfoBarBorderPaddingVertical, 35 insets.left(), 36 browser_defaults::kInfoBarBorderPaddingVertical, 37 insets.right()); 38 } 39