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

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

Issue 1550053002: Convert Pass()→std::move() in //chrome/browser/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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>
8
7 #include "base/logging.h" 9 #include "base/logging.h"
8 #include "chrome/browser/infobars/infobar_service.h" 10 #include "chrome/browser/infobars/infobar_service.h"
9 #include "chrome/browser/ui/views/elevation_icon_setter.h" 11 #include "chrome/browser/ui/views/elevation_icon_setter.h"
10 #include "components/infobars/core/confirm_infobar_delegate.h" 12 #include "components/infobars/core/confirm_infobar_delegate.h"
11 #include "ui/base/resource/material_design/material_design_controller.h" 13 #include "ui/base/resource/material_design/material_design_controller.h"
12 #include "ui/base/window_open_disposition.h" 14 #include "ui/base/window_open_disposition.h"
13 #include "ui/views/controls/button/label_button.h" 15 #include "ui/views/controls/button/label_button.h"
14 #include "ui/views/controls/label.h" 16 #include "ui/views/controls/label.h"
15 #include "ui/views/controls/link.h" 17 #include "ui/views/controls/link.h"
16 18
17 // InfoBarService ------------------------------------------------------------- 19 // InfoBarService -------------------------------------------------------------
18 20
19 scoped_ptr<infobars::InfoBar> InfoBarService::CreateConfirmInfoBar( 21 scoped_ptr<infobars::InfoBar> InfoBarService::CreateConfirmInfoBar(
20 scoped_ptr<ConfirmInfoBarDelegate> delegate) { 22 scoped_ptr<ConfirmInfoBarDelegate> delegate) {
21 return make_scoped_ptr(new ConfirmInfoBar(delegate.Pass())); 23 return make_scoped_ptr(new ConfirmInfoBar(std::move(delegate)));
22 } 24 }
23 25
24 26
25 // ConfirmInfoBar ------------------------------------------------------------- 27 // ConfirmInfoBar -------------------------------------------------------------
26 28
27 ConfirmInfoBar::ConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate> delegate) 29 ConfirmInfoBar::ConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate> delegate)
28 : InfoBarView(delegate.Pass()), 30 : InfoBarView(std::move(delegate)),
29 label_(NULL), 31 label_(NULL),
30 ok_button_(NULL), 32 ok_button_(NULL),
31 cancel_button_(NULL), 33 cancel_button_(NULL),
32 link_(NULL) { 34 link_(NULL) {}
33 }
34 35
35 ConfirmInfoBar::~ConfirmInfoBar() { 36 ConfirmInfoBar::~ConfirmInfoBar() {
36 // Ensure |elevation_icon_setter_| is destroyed before |ok_button_|. 37 // Ensure |elevation_icon_setter_| is destroyed before |ok_button_|.
37 elevation_icon_setter_.reset(); 38 elevation_icon_setter_.reset();
38 } 39 }
39 40
40 void ConfirmInfoBar::Layout() { 41 void ConfirmInfoBar::Layout() {
41 InfoBarView::Layout(); 42 InfoBarView::Layout();
42 43
43 int x = StartX(); 44 int x = StartX();
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 132 }
132 133
133 int ConfirmInfoBar::NonLabelWidth() const { 134 int ConfirmInfoBar::NonLabelWidth() const {
134 int width = (label_->text().empty() || (!ok_button_ && !cancel_button_)) ? 135 int width = (label_->text().empty() || (!ok_button_ && !cancel_button_)) ?
135 0 : kEndOfLabelSpacing; 136 0 : kEndOfLabelSpacing;
136 if (ok_button_) 137 if (ok_button_)
137 width += ok_button_->width() + (cancel_button_ ? kButtonButtonSpacing : 0); 138 width += ok_button_->width() + (cancel_button_ ? kButtonButtonSpacing : 0);
138 width += cancel_button_ ? cancel_button_->width() : 0; 139 width += cancel_button_ ? cancel_button_->width() : 0;
139 return width + ((link_->text().empty() || !width) ? 0 : kEndOfLabelSpacing); 140 return width + ((link_->text().empty() || !width) ? 0 : kEndOfLabelSpacing);
140 } 141 }
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