| 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 #include "chrome/browser/ui/views/infobars/infobar_button_border.h" | 5 #include "chrome/browser/ui/views/infobars/infobar_button_border.h" |
| 6 | 6 |
| 7 #include "grit/theme_resources.h" | 7 #include "grit/theme_resources.h" |
| 8 #include "third_party/skia/include/core/SkBitmap.h" | 8 #include "third_party/skia/include/core/SkBitmap.h" |
| 9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
| 10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 pushed_set_.bottom = rb.GetBitmapNamed(IDR_INFOBARBUTTON_BOTTOM_P); | 43 pushed_set_.bottom = rb.GetBitmapNamed(IDR_INFOBARBUTTON_BOTTOM_P); |
| 44 pushed_set_.bottom_right = | 44 pushed_set_.bottom_right = |
| 45 rb.GetBitmapNamed(IDR_INFOBARBUTTON_BOTTOM_RIGHT_P); | 45 rb.GetBitmapNamed(IDR_INFOBARBUTTON_BOTTOM_RIGHT_P); |
| 46 } | 46 } |
| 47 | 47 |
| 48 InfoBarButtonBorder::~InfoBarButtonBorder() { | 48 InfoBarButtonBorder::~InfoBarButtonBorder() { |
| 49 } | 49 } |
| 50 | 50 |
| 51 void InfoBarButtonBorder::GetInsets(gfx::Insets* insets) const { | 51 void InfoBarButtonBorder::GetInsets(gfx::Insets* insets) const { |
| 52 static const int kPreferredPaddingHorizontal = 6; | 52 static const int kPreferredPaddingHorizontal = 6; |
| 53 #ifdef TOUCH_UI |
| 54 static const int kPreferredPaddingVertical = 12; |
| 55 #else |
| 53 static const int kPreferredPaddingVertical = 5; | 56 static const int kPreferredPaddingVertical = 5; |
| 57 #endif |
| 54 insets->Set(kPreferredPaddingVertical, kPreferredPaddingHorizontal, | 58 insets->Set(kPreferredPaddingVertical, kPreferredPaddingHorizontal, |
| 55 kPreferredPaddingVertical, kPreferredPaddingHorizontal); | 59 kPreferredPaddingVertical, kPreferredPaddingHorizontal); |
| 56 } | 60 } |
| 57 | 61 |
| 58 void InfoBarButtonBorder::Paint(const views::View& view, | 62 void InfoBarButtonBorder::Paint(const views::View& view, |
| 59 gfx::Canvas* canvas) const { | 63 gfx::Canvas* canvas) const { |
| 60 const views::TextButton* mb = static_cast<const views::TextButton*>(&view); | 64 const views::TextButton* mb = static_cast<const views::TextButton*>(&view); |
| 61 int state = mb->state(); | 65 int state = mb->state(); |
| 62 const MBBImageSet* set = &normal_set_; | 66 const MBBImageSet* set = &normal_set_; |
| 63 if (state == views::TextButton::BS_HOT) | 67 if (state == views::TextButton::BS_HOT) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 set->bottom->height(), set->bottom_left->width(), | 110 set->bottom->height(), set->bottom_left->width(), |
| 107 bounds.height() - set->bottom->height(), | 111 bounds.height() - set->bottom->height(), |
| 108 bounds.width() - set->bottom_right->width() - set->bottom_left->width(), | 112 bounds.width() - set->bottom_right->width() - set->bottom_left->width(), |
| 109 set->bottom->height(), false); | 113 set->bottom->height(), false); |
| 110 | 114 |
| 111 // Draw bottom right image. | 115 // Draw bottom right image. |
| 112 canvas->DrawBitmapInt(*set->bottom_right, | 116 canvas->DrawBitmapInt(*set->bottom_right, |
| 113 bounds.width() - set->bottom_right->width(), | 117 bounds.width() - set->bottom_right->width(), |
| 114 bounds.height() - set->bottom_right->height()); | 118 bounds.height() - set->bottom_right->height()); |
| 115 } | 119 } |
| OLD | NEW |