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

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

Issue 2251263003: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 InfoBarView::InfoBarView(std::unique_ptr<infobars::InfoBarDelegate> delegate) 81 InfoBarView::InfoBarView(std::unique_ptr<infobars::InfoBarDelegate> delegate)
82 : infobars::InfoBar(std::move(delegate)), 82 : infobars::InfoBar(std::move(delegate)),
83 views::ExternalFocusTracker(this, nullptr), 83 views::ExternalFocusTracker(this, nullptr),
84 child_container_(new views::View()), 84 child_container_(new views::View()),
85 icon_(nullptr), 85 icon_(nullptr),
86 close_button_(nullptr) { 86 close_button_(nullptr) {
87 set_owned_by_client(); // InfoBar deletes itself at the appropriate time. 87 set_owned_by_client(); // InfoBar deletes itself at the appropriate time.
88 set_background( 88 set_background(
89 new InfoBarBackground(infobars::InfoBar::delegate()->GetInfoBarType())); 89 new InfoBarBackground(infobars::InfoBar::delegate()->GetInfoBarType()));
90 SetEventTargeter(base::WrapUnique(new views::ViewTargeter(this))); 90 SetEventTargeter(base::MakeUnique<views::ViewTargeter>(this));
91 91
92 AddChildView(child_container_); 92 AddChildView(child_container_);
93 93
94 SetPaintToLayer(true); 94 SetPaintToLayer(true);
95 layer()->SetFillsBoundsOpaquely(false); 95 layer()->SetFillsBoundsOpaquely(false);
96 96
97 if (ui::MaterialDesignController::IsModeMaterial()) { 97 if (ui::MaterialDesignController::IsModeMaterial()) {
98 child_container_->SetPaintToLayer(true); 98 child_container_->SetPaintToLayer(true);
99 child_container_->layer()->SetMasksToBounds(true); 99 child_container_->layer()->SetMasksToBounds(true);
100 // Since MD doesn't use a gradient, we can set a solid bg color. 100 // Since MD doesn't use a gradient, we can set a solid bg color.
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 } 427 }
428 428
429 bool InfoBarView::DoesIntersectRect(const View* target, 429 bool InfoBarView::DoesIntersectRect(const View* target,
430 const gfx::Rect& rect) const { 430 const gfx::Rect& rect) const {
431 DCHECK_EQ(this, target); 431 DCHECK_EQ(this, target);
432 // Only events that intersect the portion below the arrow are interesting. 432 // Only events that intersect the portion below the arrow are interesting.
433 gfx::Rect non_arrow_bounds = GetLocalBounds(); 433 gfx::Rect non_arrow_bounds = GetLocalBounds();
434 non_arrow_bounds.Inset(0, arrow_height(), 0, 0); 434 non_arrow_bounds.Inset(0, arrow_height(), 0, 0);
435 return rect.Intersects(non_arrow_bounds); 435 return rect.Intersects(non_arrow_bounds);
436 } 436 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698