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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 animation_offset_ = offset; | 103 animation_offset_ = offset; |
104 set_clip_insets(gfx::Insets(animation_offset_, 0, 0, 0)); | 104 set_clip_insets(gfx::Insets(animation_offset_, 0, 0, 0)); |
105 } | 105 } |
106 | 106 |
107 // DropDownBarView, views::View overrides: | 107 // DropDownBarView, views::View overrides: |
108 void DropdownBarView::OnPaint(gfx::Canvas* canvas) { | 108 void DropdownBarView::OnPaint(gfx::Canvas* canvas) { |
109 OnPaintBackground(canvas); | 109 OnPaintBackground(canvas); |
110 OnPaintBorder(canvas); | 110 OnPaintBorder(canvas); |
111 | 111 |
112 if (animation_offset() > 0) { | 112 if (animation_offset() > 0) { |
113 gfx::CanvasSkia animating_edges( | 113 gfx::Canvas animating_edges( |
114 gfx::Size(bounds().width(), kAnimatingEdgeHeight), false); | 114 gfx::Size(bounds().width(), kAnimatingEdgeHeight), false); |
115 canvas->Translate(bounds().origin()); | 115 canvas->Translate(bounds().origin()); |
116 OnPaintBackground(&animating_edges); | 116 OnPaintBackground(&animating_edges); |
117 OnPaintBorder(&animating_edges); | 117 OnPaintBorder(&animating_edges); |
118 canvas->DrawBitmapInt(animating_edges.ExtractBitmap(), bounds().x(), | 118 canvas->DrawBitmapInt(animating_edges.ExtractBitmap(), bounds().x(), |
119 animation_offset()); | 119 animation_offset()); |
120 } | 120 } |
121 } | 121 } |
122 | 122 |
123 //////////////////////////////////////////////////////////////////////////////// | 123 //////////////////////////////////////////////////////////////////////////////// |
124 // DropDownBarView, protected: | 124 // DropDownBarView, protected: |
125 | 125 |
126 void DropdownBarView::SetBackground(const SkBitmap* left_alpha_mask, | 126 void DropdownBarView::SetBackground(const SkBitmap* left_alpha_mask, |
127 const SkBitmap* right_alpha_mask) { | 127 const SkBitmap* 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_bitmap_id, |
133 int middle_border_bitmap_id, | 133 int middle_border_bitmap_id, |
134 int right_border_bitmap_id) { | 134 int right_border_bitmap_id) { |
135 int border_bitmap_ids[3] = {left_border_bitmap_id, middle_border_bitmap_id, | 135 int border_bitmap_ids[3] = {left_border_bitmap_id, middle_border_bitmap_id, |
136 right_border_bitmap_id}; | 136 right_border_bitmap_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_bitmap_ids))); |
139 } | 139 } |
OLD | NEW |