Chromium Code Reviews| 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 "cc/paint/paint_shader.h" | |
|
danakj
2017/01/20 23:34:14
should include paint_flags too?
| |
| 7 #include "chrome/browser/ui/infobar_container_delegate.h" | 8 #include "chrome/browser/ui/infobar_container_delegate.h" |
| 8 #include "chrome/browser/ui/view_ids.h" | 9 #include "chrome/browser/ui/view_ids.h" |
| 9 #include "chrome/browser/ui/views/infobars/infobar_view.h" | 10 #include "chrome/browser/ui/views/infobars/infobar_view.h" |
| 10 #include "chrome/grit/generated_resources.h" | 11 #include "chrome/grit/generated_resources.h" |
| 11 #include "ui/accessibility/ax_node_data.h" | 12 #include "ui/accessibility/ax_node_data.h" |
| 12 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
| 13 #include "ui/gfx/canvas.h" | 14 #include "ui/gfx/canvas.h" |
| 14 #include "ui/gfx/skia_util.h" | 15 #include "ui/gfx/skia_util.h" |
| 15 #include "ui/views/view_targeter.h" | 16 #include "ui/views/view_targeter.h" |
| 16 | 17 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 28 ContentShadow() { | 29 ContentShadow() { |
| 29 SetPaintToLayer(true); | 30 SetPaintToLayer(true); |
| 30 layer()->SetFillsBoundsOpaquely(false); | 31 layer()->SetFillsBoundsOpaquely(false); |
| 31 } | 32 } |
| 32 ~ContentShadow() override {} | 33 ~ContentShadow() override {} |
| 33 | 34 |
| 34 protected: | 35 protected: |
| 35 // views::View: | 36 // views::View: |
| 36 void OnPaint(gfx::Canvas* canvas) override { | 37 void OnPaint(gfx::Canvas* canvas) override { |
| 37 // The first shader (small shadow) blurs from 0 to kSmallShadowHeight. | 38 // The first shader (small shadow) blurs from 0 to kSmallShadowHeight. |
| 38 SkPaint paint; | 39 cc::PaintFlags paint; |
| 39 paint.setShader(gfx::CreateGradientShader( | 40 paint.setShader(gfx::CreateGradientShader( |
| 40 0, kSmallShadowHeight, SkColorSetA(SK_ColorBLACK, kSmallShadowAlpha), | 41 0, kSmallShadowHeight, SkColorSetA(SK_ColorBLACK, kSmallShadowAlpha), |
| 41 SkColorSetA(SK_ColorBLACK, SK_AlphaTRANSPARENT))); | 42 SkColorSetA(SK_ColorBLACK, SK_AlphaTRANSPARENT))); |
| 42 gfx::Rect small_shadow_bounds = GetLocalBounds(); | 43 gfx::Rect small_shadow_bounds = GetLocalBounds(); |
| 43 small_shadow_bounds.set_height(kSmallShadowHeight); | 44 small_shadow_bounds.set_height(kSmallShadowHeight); |
| 44 canvas->DrawRect(small_shadow_bounds, paint); | 45 canvas->DrawRect(small_shadow_bounds, paint); |
| 45 | 46 |
| 46 // The second shader (large shadow) is solid from 0 to kSmallShadowHeight | 47 // The second shader (large shadow) is solid from 0 to kSmallShadowHeight |
| 47 // (blending with the first shader) and then blurs from kSmallShadowHeight | 48 // (blending with the first shader) and then blurs from kSmallShadowHeight |
| 48 // to kLargeShadowHeight. | 49 // to kLargeShadowHeight. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 infobars::InfoBar* infobar, | 125 infobars::InfoBar* infobar, |
| 125 size_t position) { | 126 size_t position) { |
| 126 AddChildViewAt(static_cast<InfoBarView*>(infobar), | 127 AddChildViewAt(static_cast<InfoBarView*>(infobar), |
| 127 static_cast<int>(position)); | 128 static_cast<int>(position)); |
| 128 } | 129 } |
| 129 | 130 |
| 130 void InfoBarContainerView::PlatformSpecificRemoveInfoBar( | 131 void InfoBarContainerView::PlatformSpecificRemoveInfoBar( |
| 131 infobars::InfoBar* infobar) { | 132 infobars::InfoBar* infobar) { |
| 132 RemoveChildView(static_cast<InfoBarView*>(infobar)); | 133 RemoveChildView(static_cast<InfoBarView*>(infobar)); |
| 133 } | 134 } |
| OLD | NEW |