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

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

Issue 812823002: Remove dependency of infobars component on the embedder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests by instanciating a TestConfirmInfoBarDelegateFactory Created 6 years 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 "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/infobars/chrome_confirm_infobar_delegate_factory.h"
8 #include "chrome/browser/ui/views/elevation_icon_setter.h" 9 #include "chrome/browser/ui/views/elevation_icon_setter.h"
9 #include "components/infobars/core/confirm_infobar_delegate.h" 10 #include "components/infobars/core/confirm_infobar_delegate.h"
10 #include "ui/base/window_open_disposition.h" 11 #include "ui/base/window_open_disposition.h"
11 #include "ui/views/controls/button/label_button.h" 12 #include "ui/views/controls/button/label_button.h"
12 #include "ui/views/controls/label.h" 13 #include "ui/views/controls/label.h"
13 #include "ui/views/controls/link.h" 14 #include "ui/views/controls/link.h"
14 15
16 // ChromeConfirmInfoBarDelegateFactory ----------------------------------------
15 17
16 // ConfirmInfoBarDelegate ----------------------------------------------------- 18 scoped_ptr<infobars::InfoBar>
17 19 ChromeConfirmInfoBarDelegateFactory::CreateInfoBar(
18 // static
19 scoped_ptr<infobars::InfoBar> ConfirmInfoBarDelegate::CreateInfoBar(
20 scoped_ptr<ConfirmInfoBarDelegate> delegate) { 20 scoped_ptr<ConfirmInfoBarDelegate> delegate) {
21 return make_scoped_ptr(new ConfirmInfoBar(delegate.Pass())); 21 return make_scoped_ptr(new ConfirmInfoBar(delegate.Pass()));
22 } 22 }
23 23
24 24
25 // ConfirmInfoBar ------------------------------------------------------------- 25 // ConfirmInfoBar -------------------------------------------------------------
26 26
27 ConfirmInfoBar::ConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate> delegate) 27 ConfirmInfoBar::ConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate> delegate)
28 : InfoBarView(delegate.Pass()), 28 : InfoBarView(delegate.Pass()),
29 label_(NULL), 29 label_(NULL),
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 127 }
128 128
129 int ConfirmInfoBar::NonLabelWidth() const { 129 int ConfirmInfoBar::NonLabelWidth() const {
130 int width = (label_->text().empty() || (!ok_button_ && !cancel_button_)) ? 130 int width = (label_->text().empty() || (!ok_button_ && !cancel_button_)) ?
131 0 : kEndOfLabelSpacing; 131 0 : kEndOfLabelSpacing;
132 if (ok_button_) 132 if (ok_button_)
133 width += ok_button_->width() + (cancel_button_ ? kButtonButtonSpacing : 0); 133 width += ok_button_->width() + (cancel_button_ ? kButtonButtonSpacing : 0);
134 width += (cancel_button_ ? cancel_button_->width() : 0); 134 width += (cancel_button_ ? cancel_button_->width() : 0);
135 return width + ((link_->text().empty() || !width) ? 0 : kEndOfLabelSpacing); 135 return width + ((link_->text().empty() || !width) ? 0 : kEndOfLabelSpacing);
136 } 136 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698