Index: chrome/browser/ui/views/dropdown_bar_view.cc |
diff --git a/chrome/browser/ui/views/dropdown_bar_view.cc b/chrome/browser/ui/views/dropdown_bar_view.cc |
index 369f0e55154b4e2bc4c98be3f9a1d57e59fbddf3..45883bfd0ed49717a7c1fd157233652a6513eb87 100644 |
--- a/chrome/browser/ui/views/dropdown_bar_view.cc |
+++ b/chrome/browser/ui/views/dropdown_bar_view.cc |
@@ -20,6 +20,11 @@ |
namespace { |
+// When we are animating, we draw only the top part of the left and right |
+// edges to give the illusion that the find dialog is attached to the |
+// window during this animation; this is the height of the items we draw. |
+const int kAnimatingEdgeHeight = 5; |
+ |
// Background to paint toolbar background with rounded corners. |
class DropdownBackground : public views::Background { |
public: |
@@ -82,12 +87,41 @@ void DropdownBackground::Paint(gfx::Canvas* canvas, views::View* view) const { |
} // namespace |
-DropdownBarView::DropdownBarView(DropdownBarHost* host) : host_(host) {} |
+DropdownBarView::DropdownBarView(DropdownBarHost* host) |
+ : host_(host), |
+ animation_offset_(0) { |
+} |
DropdownBarView::~DropdownBarView() { |
} |
//////////////////////////////////////////////////////////////////////////////// |
+// DropDownBarView, public: |
+ |
+void DropdownBarView::SetAnimationOffset(int offset) { |
+ animation_offset_ = offset; |
+ set_clip_insets(gfx::Insets(animation_offset_, 0, 0, 0)); |
+} |
+ |
+// DropDownBarView, views::View overrides: |
+void DropdownBarView::OnPaint(gfx::Canvas* canvas) { |
+ OnPaintBackground(canvas); |
+ OnPaintBorder(canvas); |
+ |
+ if (animation_offset() > 0) { |
+ gfx::Canvas animating_edges( |
+ gfx::Size(bounds().width(), kAnimatingEdgeHeight), |
+ canvas->image_scale(), |
+ false); |
+ canvas->Translate(bounds().OffsetFromOrigin()); |
+ OnPaintBackground(&animating_edges); |
+ OnPaintBorder(&animating_edges); |
+ canvas->DrawImageInt(gfx::ImageSkia(animating_edges.ExtractImageRep()), |
+ bounds().x(), animation_offset()); |
+ } |
+} |
+ |
+//////////////////////////////////////////////////////////////////////////////// |
// DropDownBarView, protected: |
void DropdownBarView::SetBackground(const gfx::ImageSkia* left_alpha_mask, |