| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 const gfx::ImageSkia* left_alpha_mask, | 49 const gfx::ImageSkia* left_alpha_mask, |
| 50 const gfx::ImageSkia* right_alpha_mask) | 50 const gfx::ImageSkia* right_alpha_mask) |
| 51 : browser_view_(browser_view), | 51 : browser_view_(browser_view), |
| 52 left_alpha_mask_(left_alpha_mask), | 52 left_alpha_mask_(left_alpha_mask), |
| 53 right_alpha_mask_(right_alpha_mask) { | 53 right_alpha_mask_(right_alpha_mask) { |
| 54 } | 54 } |
| 55 | 55 |
| 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()->GetWindowBoundsInScreen().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 gfx::ImageSkia background = *tp->GetImageSkiaNamed(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(); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 } | 130 } |
| 131 | 131 |
| 132 void DropdownBarView::SetBorder(int left_border_image_id, | 132 void DropdownBarView::SetBorder(int left_border_image_id, |
| 133 int middle_border_image_id, | 133 int middle_border_image_id, |
| 134 int right_border_image_id) { | 134 int right_border_image_id) { |
| 135 int border_image_ids[3] = {left_border_image_id, middle_border_image_id, | 135 int border_image_ids[3] = {left_border_image_id, middle_border_image_id, |
| 136 right_border_image_id}; | 136 right_border_image_id}; |
| 137 set_border(views::Border::CreateBorderPainter( | 137 set_border(views::Border::CreateBorderPainter( |
| 138 new views::HorizontalPainter(border_image_ids))); | 138 new views::HorizontalPainter(border_image_ids))); |
| 139 } | 139 } |
| OLD | NEW |