| 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 "ui/aura_shell/toplevel_frame_view.h" | 5 #include "ui/aura_shell/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/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 SkColor color, | 39 SkColor color, |
| 40 const SkBitmap& icon) | 40 const SkBitmap& icon) |
| 41 : views::CustomButton(listener), | 41 : views::CustomButton(listener), |
| 42 color_(color), | 42 color_(color), |
| 43 icon_(icon) { | 43 icon_(icon) { |
| 44 } | 44 } |
| 45 virtual ~WindowControlButton() {} | 45 virtual ~WindowControlButton() {} |
| 46 | 46 |
| 47 // Overridden from views::View: | 47 // Overridden from views::View: |
| 48 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 48 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { |
| 49 canvas->FillRectInt(GetBackgroundColor(), 0, 0, width(), height()); | 49 canvas->FillRect(GetBackgroundColor(), GetLocalBounds()); |
| 50 canvas->DrawBitmapInt(icon_, 0, 0); | 50 canvas->DrawBitmapInt(icon_, 0, 0); |
| 51 } | 51 } |
| 52 virtual gfx::Size GetPreferredSize() OVERRIDE { | 52 virtual gfx::Size GetPreferredSize() OVERRIDE { |
| 53 gfx::Size size(icon_.width(), icon_.height()); | 53 gfx::Size size(icon_.width(), icon_.height()); |
| 54 size.Enlarge(3, 2); | 54 size.Enlarge(3, 2); |
| 55 return size; | 55 return size; |
| 56 } | 56 } |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 SkColor GetBackgroundColor() { | 59 SkColor GetBackgroundColor() { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 : ALLOW_THIS_IN_INITIALIZER_LIST( | 109 : ALLOW_THIS_IN_INITIALIZER_LIST( |
| 110 animation_(new ui::SlideAnimation(this))) { | 110 animation_(new ui::SlideAnimation(this))) { |
| 111 animation_->SetSlideDuration(kHoverFadeDurationMs); | 111 animation_->SetSlideDuration(kHoverFadeDurationMs); |
| 112 } | 112 } |
| 113 | 113 |
| 114 // Most of the frame components are rendered with a transparent bg. | 114 // Most of the frame components are rendered with a transparent bg. |
| 115 void PaintTransparentBackground(gfx::Canvas* canvas) { | 115 void PaintTransparentBackground(gfx::Canvas* canvas) { |
| 116 // Fill with current opacity value. | 116 // Fill with current opacity value. |
| 117 int opacity = animation_->CurrentValueBetween(kFrameBorderHiddenOpacity, | 117 int opacity = animation_->CurrentValueBetween(kFrameBorderHiddenOpacity, |
| 118 kFrameBorderVisibleOpacity); | 118 kFrameBorderVisibleOpacity); |
| 119 canvas->FillRectInt(SkColorSetARGB(opacity, | 119 canvas->FillRect(SkColorSetARGB(opacity, |
| 120 SkColorGetR(kFrameColor), | 120 SkColorGetR(kFrameColor), |
| 121 SkColorGetG(kFrameColor), | 121 SkColorGetG(kFrameColor), |
| 122 SkColorGetB(kFrameColor)), | 122 SkColorGetB(kFrameColor)), |
| 123 0, 0, width(), height()); | 123 GetLocalBounds()); |
| 124 } | 124 } |
| 125 | 125 |
| 126 // Overridden from ui::AnimationDelegate: | 126 // Overridden from ui::AnimationDelegate: |
| 127 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE { | 127 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE { |
| 128 SchedulePaint(); | 128 SchedulePaint(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 private: | 131 private: |
| 132 scoped_ptr<ui::SlideAnimation> animation_; | 132 scoped_ptr<ui::SlideAnimation> animation_; |
| 133 | 133 |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 return aura::kCursorNorthWestResize; | 490 return aura::kCursorNorthWestResize; |
| 491 case HTTOPRIGHT: | 491 case HTTOPRIGHT: |
| 492 return aura::kCursorNorthEastResize; | 492 return aura::kCursorNorthEastResize; |
| 493 default: | 493 default: |
| 494 return aura::kCursorNull; | 494 return aura::kCursorNull; |
| 495 } | 495 } |
| 496 } | 496 } |
| 497 | 497 |
| 498 } // namespace internal | 498 } // namespace internal |
| 499 } // namespace aura_shell | 499 } // namespace aura_shell |
| OLD | NEW |