Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(471)

Side by Side Diff: chrome/browser/ui/views/infobars/infobar_container_view.cc

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 17 matching lines...) Expand all
28 ContentShadow() { 28 ContentShadow() {
29 SetPaintToLayer(true); 29 SetPaintToLayer(true);
30 layer()->SetFillsBoundsOpaquely(false); 30 layer()->SetFillsBoundsOpaquely(false);
31 } 31 }
32 ~ContentShadow() override {} 32 ~ContentShadow() override {}
33 33
34 protected: 34 protected:
35 // views::View: 35 // views::View:
36 void OnPaint(gfx::Canvas* canvas) override { 36 void OnPaint(gfx::Canvas* canvas) override {
37 // The first shader (small shadow) blurs from 0 to kSmallShadowHeight. 37 // The first shader (small shadow) blurs from 0 to kSmallShadowHeight.
38 SkPaint paint; 38 CdlPaint paint;
39 paint.setShader(gfx::CreateGradientShader( 39 paint.setShader(WrapSkShader(gfx::CreateGradientShader(
40 0, kSmallShadowHeight, SkColorSetA(SK_ColorBLACK, kSmallShadowAlpha), 40 0, kSmallShadowHeight, SkColorSetA(SK_ColorBLACK, kSmallShadowAlpha),
41 SkColorSetA(SK_ColorBLACK, SK_AlphaTRANSPARENT))); 41 SkColorSetA(SK_ColorBLACK, SK_AlphaTRANSPARENT))));
42 gfx::Rect small_shadow_bounds = GetLocalBounds(); 42 gfx::Rect small_shadow_bounds = GetLocalBounds();
43 small_shadow_bounds.set_height(kSmallShadowHeight); 43 small_shadow_bounds.set_height(kSmallShadowHeight);
44 canvas->DrawRect(small_shadow_bounds, paint); 44 canvas->DrawRect(small_shadow_bounds, paint);
45 45
46 // The second shader (large shadow) is solid from 0 to kSmallShadowHeight 46 // The second shader (large shadow) is solid from 0 to kSmallShadowHeight
47 // (blending with the first shader) and then blurs from kSmallShadowHeight 47 // (blending with the first shader) and then blurs from kSmallShadowHeight
48 // to kLargeShadowHeight. 48 // to kLargeShadowHeight.
49 paint.setShader(gfx::CreateGradientShader( 49 paint.setShader(WrapSkShader(gfx::CreateGradientShader(
50 kSmallShadowHeight, height(), 50 kSmallShadowHeight, height(),
51 SkColorSetA(SK_ColorBLACK, kLargeShadowAlpha), 51 SkColorSetA(SK_ColorBLACK, kLargeShadowAlpha),
52 SkColorSetA(SK_ColorBLACK, SK_AlphaTRANSPARENT))); 52 SkColorSetA(SK_ColorBLACK, SK_AlphaTRANSPARENT))));
53 canvas->DrawRect(GetLocalBounds(), paint); 53 canvas->DrawRect(GetLocalBounds(), paint);
54 } 54 }
55 55
56 private: 56 private:
57 DISALLOW_COPY_AND_ASSIGN(ContentShadow); 57 DISALLOW_COPY_AND_ASSIGN(ContentShadow);
58 }; 58 };
59 59
60 } // namespace 60 } // namespace
61 61
62 // static 62 // static
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 infobars::InfoBar* infobar, 124 infobars::InfoBar* infobar,
125 size_t position) { 125 size_t position) {
126 AddChildViewAt(static_cast<InfoBarView*>(infobar), 126 AddChildViewAt(static_cast<InfoBarView*>(infobar),
127 static_cast<int>(position)); 127 static_cast<int>(position));
128 } 128 }
129 129
130 void InfoBarContainerView::PlatformSpecificRemoveInfoBar( 130 void InfoBarContainerView::PlatformSpecificRemoveInfoBar(
131 infobars::InfoBar* infobar) { 131 infobars::InfoBar* infobar) {
132 RemoveChildView(static_cast<InfoBarView*>(infobar)); 132 RemoveChildView(static_cast<InfoBarView*>(infobar));
133 } 133 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698