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 "ash/wm/toplevel_frame_view.h" | 5 #include "ash/wm/toplevel_frame_view.h" |
6 | 6 |
7 #include "grit/ui_resources.h" | 7 #include "grit/ui_resources.h" |
8 #include "ui/aura/cursor.h" | 8 #include "ui/aura/cursor.h" |
9 #include "ui/base/animation/throb_animation.h" | 9 #include "ui/base/animation/throb_animation.h" |
10 #include "ui/base/hit_test.h" | 10 #include "ui/base/hit_test.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 SkColor color, | 36 SkColor color, |
37 const SkBitmap& icon) | 37 const SkBitmap& icon) |
38 : views::CustomButton(listener), | 38 : views::CustomButton(listener), |
39 color_(color), | 39 color_(color), |
40 icon_(icon) { | 40 icon_(icon) { |
41 } | 41 } |
42 virtual ~WindowControlButton() {} | 42 virtual ~WindowControlButton() {} |
43 | 43 |
44 // Overridden from views::View: | 44 // Overridden from views::View: |
45 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 45 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { |
46 canvas->FillRect(GetBackgroundColor(), GetLocalBounds()); | 46 canvas->FillRect(GetLocalBounds(), GetBackgroundColor()); |
47 canvas->DrawBitmapInt(icon_, 0, 0); | 47 canvas->DrawBitmapInt(icon_, 0, 0); |
48 } | 48 } |
49 virtual gfx::Size GetPreferredSize() OVERRIDE { | 49 virtual gfx::Size GetPreferredSize() OVERRIDE { |
50 gfx::Size size(icon_.width(), icon_.height()); | 50 gfx::Size size(icon_.width(), icon_.height()); |
51 size.Enlarge(3, 2); | 51 size.Enlarge(3, 2); |
52 return size; | 52 return size; |
53 } | 53 } |
54 | 54 |
55 private: | 55 private: |
56 SkColor GetBackgroundColor() { | 56 SkColor GetBackgroundColor() { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 : ALLOW_THIS_IN_INITIALIZER_LIST( | 106 : ALLOW_THIS_IN_INITIALIZER_LIST( |
107 animation_(new ui::SlideAnimation(this))) { | 107 animation_(new ui::SlideAnimation(this))) { |
108 animation_->SetSlideDuration(kHoverFadeDurationMs); | 108 animation_->SetSlideDuration(kHoverFadeDurationMs); |
109 } | 109 } |
110 | 110 |
111 // Most of the frame components are rendered with a transparent bg. | 111 // Most of the frame components are rendered with a transparent bg. |
112 void PaintTransparentBackground(gfx::Canvas* canvas) { | 112 void PaintTransparentBackground(gfx::Canvas* canvas) { |
113 // Fill with current opacity value. | 113 // Fill with current opacity value. |
114 int opacity = animation_->CurrentValueBetween(kFrameBorderHiddenOpacity, | 114 int opacity = animation_->CurrentValueBetween(kFrameBorderHiddenOpacity, |
115 kFrameBorderVisibleOpacity); | 115 kFrameBorderVisibleOpacity); |
116 canvas->FillRect(SkColorSetARGB(opacity, | 116 canvas->FillRect(GetLocalBounds(), |
| 117 SkColorSetARGB(opacity, |
117 SkColorGetR(kFrameColor), | 118 SkColorGetR(kFrameColor), |
118 SkColorGetG(kFrameColor), | 119 SkColorGetG(kFrameColor), |
119 SkColorGetB(kFrameColor)), | 120 SkColorGetB(kFrameColor))); |
120 GetLocalBounds()); | |
121 } | 121 } |
122 | 122 |
123 // Overridden from ui::AnimationDelegate: | 123 // Overridden from ui::AnimationDelegate: |
124 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE { | 124 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE { |
125 SchedulePaint(); | 125 SchedulePaint(); |
126 } | 126 } |
127 | 127 |
128 private: | 128 private: |
129 scoped_ptr<ui::SlideAnimation> animation_; | 129 scoped_ptr<ui::SlideAnimation> animation_; |
130 | 130 |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 return aura::kCursorNorthWestResize; | 478 return aura::kCursorNorthWestResize; |
479 case HTTOPRIGHT: | 479 case HTTOPRIGHT: |
480 return aura::kCursorNorthEastResize; | 480 return aura::kCursorNorthEastResize; |
481 default: | 481 default: |
482 return aura::kCursorNull; | 482 return aura::kCursorNull; |
483 } | 483 } |
484 } | 484 } |
485 | 485 |
486 } // namespace internal | 486 } // namespace internal |
487 } // namespace ash | 487 } // namespace ash |
OLD | NEW |