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

Side by Side Diff: chrome/browser/ui/views/infobars/confirm_infobar.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/confirm_infobar.h" 5 #include "chrome/browser/ui/views/infobars/confirm_infobar.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "chrome/browser/infobars/infobar_service.h" 11 #include "chrome/browser/infobars/infobar_service.h"
12 #include "chrome/browser/ui/views/elevation_icon_setter.h" 12 #include "chrome/browser/ui/views/elevation_icon_setter.h"
13 #include "components/infobars/core/confirm_infobar_delegate.h" 13 #include "components/infobars/core/confirm_infobar_delegate.h"
14 #include "ui/base/material_design/material_design_controller.h" 14 #include "ui/base/material_design/material_design_controller.h"
15 #include "ui/base/window_open_disposition.h" 15 #include "ui/base/window_open_disposition.h"
16 #include "ui/views/controls/button/label_button.h" 16 #include "ui/views/controls/button/label_button.h"
17 #include "ui/views/controls/button/md_text_button.h" 17 #include "ui/views/controls/button/md_text_button.h"
18 #include "ui/views/controls/label.h" 18 #include "ui/views/controls/label.h"
19 #include "ui/views/controls/link.h" 19 #include "ui/views/controls/link.h"
20 20
21 // InfoBarService ------------------------------------------------------------- 21 // InfoBarService -------------------------------------------------------------
22 22
23 std::unique_ptr<infobars::InfoBar> InfoBarService::CreateConfirmInfoBar( 23 std::unique_ptr<infobars::InfoBar> InfoBarService::CreateConfirmInfoBar(
24 std::unique_ptr<ConfirmInfoBarDelegate> delegate) { 24 std::unique_ptr<ConfirmInfoBarDelegate> delegate) {
25 return base::WrapUnique(new ConfirmInfoBar(std::move(delegate))); 25 return base::MakeUnique<ConfirmInfoBar>(std::move(delegate));
26 } 26 }
27 27
28 28
29 // ConfirmInfoBar ------------------------------------------------------------- 29 // ConfirmInfoBar -------------------------------------------------------------
30 30
31 ConfirmInfoBar::ConfirmInfoBar(std::unique_ptr<ConfirmInfoBarDelegate> delegate) 31 ConfirmInfoBar::ConfirmInfoBar(std::unique_ptr<ConfirmInfoBarDelegate> delegate)
32 : InfoBarView(std::move(delegate)), 32 : InfoBarView(std::move(delegate)),
33 label_(nullptr), 33 label_(nullptr),
34 ok_button_(nullptr), 34 ok_button_(nullptr),
35 cancel_button_(nullptr), 35 cancel_button_(nullptr),
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } 160 }
161 161
162 int ConfirmInfoBar::NonLabelWidth() const { 162 int ConfirmInfoBar::NonLabelWidth() const {
163 int width = (label_->text().empty() || (!ok_button_ && !cancel_button_)) ? 163 int width = (label_->text().empty() || (!ok_button_ && !cancel_button_)) ?
164 0 : kEndOfLabelSpacing; 164 0 : kEndOfLabelSpacing;
165 if (ok_button_) 165 if (ok_button_)
166 width += ok_button_->width() + (cancel_button_ ? kButtonButtonSpacing : 0); 166 width += ok_button_->width() + (cancel_button_ ? kButtonButtonSpacing : 0);
167 width += cancel_button_ ? cancel_button_->width() : 0; 167 width += cancel_button_ ? cancel_button_->width() : 0;
168 return width + ((link_->text().empty() || !width) ? 0 : kEndOfLabelSpacing); 168 return width + ((link_->text().empty() || !width) ? 0 : kEndOfLabelSpacing);
169 } 169 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/infobars/alternate_nav_infobar_view.cc ('k') | chrome/browser/ui/views/infobars/infobar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698