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

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

Issue 2639203007: Update SetPaintToLayer to accept LayerType (Closed)
Patch Set: fix comments Created 3 years, 10 months 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_view.h" 5 #include "chrome/browser/ui/views/infobars/infobar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 child_container_(new views::View()), 73 child_container_(new views::View()),
74 icon_(nullptr), 74 icon_(nullptr),
75 close_button_(nullptr) { 75 close_button_(nullptr) {
76 set_owned_by_client(); // InfoBar deletes itself at the appropriate time. 76 set_owned_by_client(); // InfoBar deletes itself at the appropriate time.
77 set_background( 77 set_background(
78 new InfoBarBackground(infobars::InfoBar::delegate()->GetInfoBarType())); 78 new InfoBarBackground(infobars::InfoBar::delegate()->GetInfoBarType()));
79 SetEventTargeter(base::MakeUnique<views::ViewTargeter>(this)); 79 SetEventTargeter(base::MakeUnique<views::ViewTargeter>(this));
80 80
81 AddChildView(child_container_); 81 AddChildView(child_container_);
82 82
83 SetPaintToLayer(true); 83 SetPaintToLayer();
84 layer()->SetFillsBoundsOpaquely(false); 84 layer()->SetFillsBoundsOpaquely(false);
85 85
86 child_container_->SetPaintToLayer(true); 86 child_container_->SetPaintToLayer();
87 child_container_->layer()->SetMasksToBounds(true); 87 child_container_->layer()->SetMasksToBounds(true);
88 child_container_->set_background(views::Background::CreateSolidBackground( 88 child_container_->set_background(views::Background::CreateSolidBackground(
89 infobars::InfoBar::GetBackgroundColor( 89 infobars::InfoBar::GetBackgroundColor(
90 infobars::InfoBar::delegate()->GetInfoBarType()))); 90 infobars::InfoBar::delegate()->GetInfoBarType())));
91 } 91 }
92 92
93 const infobars::InfoBarContainer::Delegate* InfoBarView::container_delegate() 93 const infobars::InfoBarContainer::Delegate* InfoBarView::container_delegate()
94 const { 94 const {
95 const infobars::InfoBarContainer* infobar_container = container(); 95 const infobars::InfoBarContainer* infobar_container = container();
96 return infobar_container ? infobar_container->delegate() : NULL; 96 return infobar_container ? infobar_container->delegate() : NULL;
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 } 307 }
308 308
309 bool InfoBarView::DoesIntersectRect(const View* target, 309 bool InfoBarView::DoesIntersectRect(const View* target,
310 const gfx::Rect& rect) const { 310 const gfx::Rect& rect) const {
311 DCHECK_EQ(this, target); 311 DCHECK_EQ(this, target);
312 // Only events that intersect the portion below the arrow are interesting. 312 // Only events that intersect the portion below the arrow are interesting.
313 gfx::Rect non_arrow_bounds = GetLocalBounds(); 313 gfx::Rect non_arrow_bounds = GetLocalBounds();
314 non_arrow_bounds.Inset(0, arrow_height(), 0, 0); 314 non_arrow_bounds.Inset(0, arrow_height(), 0, 0);
315 return rect.Intersects(non_arrow_bounds); 315 return rect.Intersects(non_arrow_bounds);
316 } 316 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698