OLD | NEW |
---|---|
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 "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
11 #include "chrome/browser/ui/views/elevation_icon_setter.h" | 11 #include "chrome/browser/ui/views/elevation_icon_setter.h" |
12 #include "components/autofill/core/browser/autofill_cc_infobar_delegate.h" | |
12 #include "components/infobars/core/confirm_infobar_delegate.h" | 13 #include "components/infobars/core/confirm_infobar_delegate.h" |
13 #include "ui/base/resource/material_design/material_design_controller.h" | 14 #include "ui/base/resource/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/label.h" | 17 #include "ui/views/controls/label.h" |
17 #include "ui/views/controls/link.h" | 18 #include "ui/views/controls/link.h" |
18 | 19 |
19 // InfoBarService ------------------------------------------------------------- | 20 // InfoBarService ------------------------------------------------------------- |
20 | 21 |
21 scoped_ptr<infobars::InfoBar> InfoBarService::CreateConfirmInfoBar( | 22 scoped_ptr<infobars::InfoBar> InfoBarService::CreateConfirmInfoBar( |
22 scoped_ptr<ConfirmInfoBarDelegate> delegate) { | 23 scoped_ptr<ConfirmInfoBarDelegate> delegate) { |
23 return make_scoped_ptr(new ConfirmInfoBar(std::move(delegate))); | 24 return make_scoped_ptr(new ConfirmInfoBar(std::move(delegate))); |
24 } | 25 } |
25 | 26 |
27 scoped_ptr<infobars::InfoBar> InfoBarService::CreateAutofillCCInfoBar( | |
28 scoped_ptr<autofill::AutofillCCInfoBarDelegate> delegate) { | |
29 return CreateConfirmInfoBar(std::move(delegate)); | |
Justin Donnelly
2016/01/07 18:15:40
If we keep this, add a comment explaining that Vie
please use gerrit instead
2016/01/08 00:07:05
Done.
| |
30 } | |
26 | 31 |
27 // ConfirmInfoBar ------------------------------------------------------------- | 32 // ConfirmInfoBar ------------------------------------------------------------- |
28 | 33 |
29 ConfirmInfoBar::ConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate> delegate) | 34 ConfirmInfoBar::ConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate> delegate) |
30 : InfoBarView(std::move(delegate)), | 35 : InfoBarView(std::move(delegate)), |
31 label_(NULL), | 36 label_(NULL), |
32 ok_button_(NULL), | 37 ok_button_(NULL), |
33 cancel_button_(NULL), | 38 cancel_button_(NULL), |
34 link_(NULL) {} | 39 link_(NULL) {} |
35 | 40 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 } | 143 } |
139 | 144 |
140 int ConfirmInfoBar::NonLabelWidth() const { | 145 int ConfirmInfoBar::NonLabelWidth() const { |
141 int width = (label_->text().empty() || (!ok_button_ && !cancel_button_)) ? | 146 int width = (label_->text().empty() || (!ok_button_ && !cancel_button_)) ? |
142 0 : kEndOfLabelSpacing; | 147 0 : kEndOfLabelSpacing; |
143 if (ok_button_) | 148 if (ok_button_) |
144 width += ok_button_->width() + (cancel_button_ ? kButtonButtonSpacing : 0); | 149 width += ok_button_->width() + (cancel_button_ ? kButtonButtonSpacing : 0); |
145 width += cancel_button_ ? cancel_button_->width() : 0; | 150 width += cancel_button_ ? cancel_button_->width() : 0; |
146 return width + ((link_->text().empty() || !width) ? 0 : kEndOfLabelSpacing); | 151 return width + ((link_->text().empty() || !width) ? 0 : kEndOfLabelSpacing); |
147 } | 152 } |
OLD | NEW |