| 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 "chrome/browser/ui/views/infobars/infobar_container_view.h" | 5 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/infobar_container_delegate.h" | 7 #include "chrome/browser/ui/infobar_container_delegate.h" |
| 8 #include "chrome/browser/ui/view_ids.h" | 8 #include "chrome/browser/ui/view_ids.h" |
| 9 #include "chrome/browser/ui/views/infobars/infobar_view.h" | 9 #include "chrome/browser/ui/views/infobars/infobar_view.h" |
| 10 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 SetPaintToLayer(true); | 30 SetPaintToLayer(true); |
| 31 layer()->SetFillsBoundsOpaquely(false); | 31 layer()->SetFillsBoundsOpaquely(false); |
| 32 } | 32 } |
| 33 ~ContentShadow() override {} | 33 ~ContentShadow() override {} |
| 34 | 34 |
| 35 protected: | 35 protected: |
| 36 // views::View: | 36 // views::View: |
| 37 void OnPaint(gfx::Canvas* canvas) override { | 37 void OnPaint(gfx::Canvas* canvas) override { |
| 38 // The first shader (small shadow) blurs from 0 to kSmallShadowHeight. | 38 // The first shader (small shadow) blurs from 0 to kSmallShadowHeight. |
| 39 SkPaint paint; | 39 SkPaint paint; |
| 40 skia::RefPtr<SkShader> shader = gfx::CreateGradientShader( | 40 paint.setShader(gfx::CreateGradientShader( |
| 41 0, kSmallShadowHeight, SkColorSetA(SK_ColorBLACK, kSmallShadowAlpha), | 41 0, kSmallShadowHeight, SkColorSetA(SK_ColorBLACK, kSmallShadowAlpha), |
| 42 SkColorSetA(SK_ColorBLACK, SK_AlphaTRANSPARENT)); | 42 SkColorSetA(SK_ColorBLACK, SK_AlphaTRANSPARENT))); |
| 43 paint.setShader(shader.get()); | |
| 44 gfx::Rect small_shadow_bounds = GetLocalBounds(); | 43 gfx::Rect small_shadow_bounds = GetLocalBounds(); |
| 45 small_shadow_bounds.set_height(kSmallShadowHeight); | 44 small_shadow_bounds.set_height(kSmallShadowHeight); |
| 46 canvas->DrawRect(small_shadow_bounds, paint); | 45 canvas->DrawRect(small_shadow_bounds, paint); |
| 47 | 46 |
| 48 // The second shader (large shadow) is solid from 0 to kSmallShadowHeight | 47 // The second shader (large shadow) is solid from 0 to kSmallShadowHeight |
| 49 // (blending with the first shader) and then blurs from kSmallShadowHeight | 48 // (blending with the first shader) and then blurs from kSmallShadowHeight |
| 50 // to kLargeShadowHeight. | 49 // to kLargeShadowHeight. |
| 51 shader = gfx::CreateGradientShader( | 50 paint.setShader(gfx::CreateGradientShader( |
| 52 kSmallShadowHeight, height(), | 51 kSmallShadowHeight, height(), |
| 53 SkColorSetA(SK_ColorBLACK, kLargeShadowAlpha), | 52 SkColorSetA(SK_ColorBLACK, kLargeShadowAlpha), |
| 54 SkColorSetA(SK_ColorBLACK, SK_AlphaTRANSPARENT)); | 53 SkColorSetA(SK_ColorBLACK, SK_AlphaTRANSPARENT))); |
| 55 paint.setShader(shader.get()); | |
| 56 canvas->DrawRect(GetLocalBounds(), paint); | 54 canvas->DrawRect(GetLocalBounds(), paint); |
| 57 } | 55 } |
| 58 | 56 |
| 59 private: | 57 private: |
| 60 DISALLOW_COPY_AND_ASSIGN(ContentShadow); | 58 DISALLOW_COPY_AND_ASSIGN(ContentShadow); |
| 61 }; | 59 }; |
| 62 | 60 |
| 63 } // namespace | 61 } // namespace |
| 64 | 62 |
| 65 // static | 63 // static |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 infobars::InfoBar* infobar, | 131 infobars::InfoBar* infobar, |
| 134 size_t position) { | 132 size_t position) { |
| 135 AddChildViewAt(static_cast<InfoBarView*>(infobar), | 133 AddChildViewAt(static_cast<InfoBarView*>(infobar), |
| 136 static_cast<int>(position)); | 134 static_cast<int>(position)); |
| 137 } | 135 } |
| 138 | 136 |
| 139 void InfoBarContainerView::PlatformSpecificRemoveInfoBar( | 137 void InfoBarContainerView::PlatformSpecificRemoveInfoBar( |
| 140 infobars::InfoBar* infobar) { | 138 infobars::InfoBar* infobar) { |
| 141 RemoveChildView(static_cast<InfoBarView*>(infobar)); | 139 RemoveChildView(static_cast<InfoBarView*>(infobar)); |
| 142 } | 140 } |
| OLD | NEW |