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

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

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 "chrome/browser/infobars/infobar_service.h" 11 #include "chrome/browser/infobars/infobar_service.h"
11 #include "chrome/browser/ui/views/elevation_icon_setter.h" 12 #include "chrome/browser/ui/views/elevation_icon_setter.h"
12 #include "components/infobars/core/confirm_infobar_delegate.h" 13 #include "components/infobars/core/confirm_infobar_delegate.h"
13 #include "ui/base/material_design/material_design_controller.h" 14 #include "ui/base/material_design/material_design_controller.h"
14 #include "ui/base/window_open_disposition.h" 15 #include "ui/base/window_open_disposition.h"
15 #include "ui/views/controls/button/label_button.h" 16 #include "ui/views/controls/button/label_button.h"
16 #include "ui/views/controls/button/md_text_button.h" 17 #include "ui/views/controls/button/md_text_button.h"
17 #include "ui/views/controls/label.h" 18 #include "ui/views/controls/label.h"
18 #include "ui/views/controls/link.h" 19 #include "ui/views/controls/link.h"
19 20
20 // InfoBarService ------------------------------------------------------------- 21 // InfoBarService -------------------------------------------------------------
21 22
22 scoped_ptr<infobars::InfoBar> InfoBarService::CreateConfirmInfoBar( 23 std::unique_ptr<infobars::InfoBar> InfoBarService::CreateConfirmInfoBar(
23 scoped_ptr<ConfirmInfoBarDelegate> delegate) { 24 std::unique_ptr<ConfirmInfoBarDelegate> delegate) {
24 return make_scoped_ptr(new ConfirmInfoBar(std::move(delegate))); 25 return base::WrapUnique(new ConfirmInfoBar(std::move(delegate)));
25 } 26 }
26 27
27 28
28 // ConfirmInfoBar ------------------------------------------------------------- 29 // ConfirmInfoBar -------------------------------------------------------------
29 30
30 ConfirmInfoBar::ConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate> delegate) 31 ConfirmInfoBar::ConfirmInfoBar(std::unique_ptr<ConfirmInfoBarDelegate> delegate)
31 : InfoBarView(std::move(delegate)), 32 : InfoBarView(std::move(delegate)),
32 label_(nullptr), 33 label_(nullptr),
33 ok_button_(nullptr), 34 ok_button_(nullptr),
34 cancel_button_(nullptr), 35 cancel_button_(nullptr),
35 link_(nullptr) {} 36 link_(nullptr) {}
36 37
37 ConfirmInfoBar::~ConfirmInfoBar() { 38 ConfirmInfoBar::~ConfirmInfoBar() {
38 // Ensure |elevation_icon_setter_| is destroyed before |ok_button_|. 39 // Ensure |elevation_icon_setter_| is destroyed before |ok_button_|.
39 elevation_icon_setter_.reset(); 40 elevation_icon_setter_.reset();
40 } 41 }
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 160 }
160 161
161 int ConfirmInfoBar::NonLabelWidth() const { 162 int ConfirmInfoBar::NonLabelWidth() const {
162 int width = (label_->text().empty() || (!ok_button_ && !cancel_button_)) ? 163 int width = (label_->text().empty() || (!ok_button_ && !cancel_button_)) ?
163 0 : kEndOfLabelSpacing; 164 0 : kEndOfLabelSpacing;
164 if (ok_button_) 165 if (ok_button_)
165 width += ok_button_->width() + (cancel_button_ ? kButtonButtonSpacing : 0); 166 width += ok_button_->width() + (cancel_button_ ? kButtonButtonSpacing : 0);
166 width += cancel_button_ ? cancel_button_->width() : 0; 167 width += cancel_button_ ? cancel_button_->width() : 0;
167 return width + ((link_->text().empty() || !width) ? 0 : kEndOfLabelSpacing); 168 return width + ((link_->text().empty() || !width) ? 0 : kEndOfLabelSpacing);
168 } 169 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/infobars/confirm_infobar.h ('k') | chrome/browser/ui/views/infobars/infobar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698