| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/dropdown_bar_view.h" | 5 #include "chrome/browser/ui/views/dropdown_bar_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/themes/theme_service.h" | 7 #include "chrome/browser/themes/theme_service.h" |
| 8 #include "chrome/browser/ui/view_ids.h" | 8 #include "chrome/browser/ui/view_ids.h" |
| 9 #include "chrome/browser/ui/views/frame/browser_view.h" | 9 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 10 #include "grit/generated_resources.h" | 10 #include "grit/generated_resources.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 void DropdownBackground::Paint(gfx::Canvas* canvas, views::View* view) const { | 56 void DropdownBackground::Paint(gfx::Canvas* canvas, views::View* view) const { |
| 57 // Find the offset from which to tile the toolbar background image. | 57 // Find the offset from which to tile the toolbar background image. |
| 58 // First, get the origin with respect to the screen. | 58 // First, get the origin with respect to the screen. |
| 59 gfx::Point origin = view->GetWidget()->GetWindowScreenBounds().origin(); | 59 gfx::Point origin = view->GetWidget()->GetWindowScreenBounds().origin(); |
| 60 // Now convert from screen to parent coordinates. | 60 // Now convert from screen to parent coordinates. |
| 61 view->ConvertPointToView(NULL, browser_view_, &origin); | 61 view->ConvertPointToView(NULL, browser_view_, &origin); |
| 62 // Finally, calculate the background image tiling offset. | 62 // Finally, calculate the background image tiling offset. |
| 63 origin = browser_view_->OffsetPointForToolbarBackgroundImage(origin); | 63 origin = browser_view_->OffsetPointForToolbarBackgroundImage(origin); |
| 64 | 64 |
| 65 ui::ThemeProvider* tp = view->GetThemeProvider(); | 65 ui::ThemeProvider* tp = view->GetThemeProvider(); |
| 66 SkBitmap background = *tp->GetBitmapNamed(IDR_THEME_TOOLBAR); | 66 gfx::ImageSkia background = *tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR); |
| 67 | 67 |
| 68 int left_edge_width = left_alpha_mask_->width(); | 68 int left_edge_width = left_alpha_mask_->width(); |
| 69 int right_edge_width = right_alpha_mask_->width(); | 69 int right_edge_width = right_alpha_mask_->width(); |
| 70 int mask_height = left_alpha_mask_->height(); | 70 int mask_height = left_alpha_mask_->height(); |
| 71 int height = view->bounds().height(); | 71 int height = view->bounds().height(); |
| 72 | 72 |
| 73 // Stretch the middle background to cover the entire area. | 73 // Stretch the middle background to cover the entire area. |
| 74 canvas->TileImageInt(background, origin.x(), origin.y(), | 74 canvas->TileImageInt(background, origin.x(), origin.y(), |
| 75 0, 0, view->bounds().width(), height); | 75 0, 0, view->bounds().width(), height); |
| 76 | 76 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 //////////////////////////////////////////////////////////////////////////////// | 123 //////////////////////////////////////////////////////////////////////////////// |
| 124 // DropDownBarView, protected: | 124 // DropDownBarView, protected: |
| 125 | 125 |
| 126 void DropdownBarView::SetBackground(const gfx::ImageSkia* left_alpha_mask, | 126 void DropdownBarView::SetBackground(const gfx::ImageSkia* left_alpha_mask, |
| 127 const gfx::ImageSkia* right_alpha_mask) { | 127 const gfx::ImageSkia* right_alpha_mask) { |
| 128 set_background(new DropdownBackground(host()->browser_view(), left_alpha_mask, | 128 set_background(new DropdownBackground(host()->browser_view(), left_alpha_mask, |
| 129 right_alpha_mask)); | 129 right_alpha_mask)); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void DropdownBarView::SetBorder(int left_border_bitmap_id, | 132 void DropdownBarView::SetBorder(int left_border_image_id, |
| 133 int middle_border_bitmap_id, | 133 int middle_border_image_id, |
| 134 int right_border_bitmap_id) { | 134 int right_border_image_id) { |
| 135 int border_bitmap_ids[3] = {left_border_bitmap_id, middle_border_bitmap_id, | 135 int border_image_ids[3] = {left_border_image_id, middle_border_image_id, |
| 136 right_border_bitmap_id}; | 136 right_border_image_id}; |
| 137 set_border(views::Border::CreateBorderPainter( | 137 set_border(views::Border::CreateBorderPainter( |
| 138 new views::HorizontalPainter(border_bitmap_ids))); | 138 new views::HorizontalPainter(border_image_ids))); |
| 139 } | 139 } |
| OLD | NEW |