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

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

Issue 240193003: Move Infobars core files to the Infobars component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nib name on mac Created 6 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 | Annotate | Revision Log
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/confirm_infobar_delegate.h" 8 #include "chrome/browser/infobars/confirm_infobar_delegate.h"
9 #include "ui/base/window_open_disposition.h" 9 #include "ui/base/window_open_disposition.h"
10 #include "ui/views/controls/button/label_button.h" 10 #include "ui/views/controls/button/label_button.h"
11 #include "ui/views/controls/label.h" 11 #include "ui/views/controls/label.h"
12 #include "ui/views/controls/link.h" 12 #include "ui/views/controls/link.h"
13 13
14 14
15 // ConfirmInfoBarDelegate ----------------------------------------------------- 15 // ConfirmInfoBarDelegate -----------------------------------------------------
16 16
17 // static 17 // static
18 scoped_ptr<InfoBar> ConfirmInfoBarDelegate::CreateInfoBar( 18 scoped_ptr<infobars::InfoBar> ConfirmInfoBarDelegate::CreateInfoBar(
19 scoped_ptr<ConfirmInfoBarDelegate> delegate) { 19 scoped_ptr<ConfirmInfoBarDelegate> delegate) {
20 return scoped_ptr<InfoBar>(new ConfirmInfoBar(delegate.Pass())); 20 return scoped_ptr<infobars::InfoBar>(new ConfirmInfoBar(delegate.Pass()));
21 } 21 }
22 22
23 23
24 // ConfirmInfoBar ------------------------------------------------------------- 24 // ConfirmInfoBar -------------------------------------------------------------
25 25
26 ConfirmInfoBar::ConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate> delegate) 26 ConfirmInfoBar::ConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate> delegate)
27 : InfoBarView(delegate.PassAs<InfoBarDelegate>()), 27 : InfoBarView(delegate.PassAs<infobars::InfoBarDelegate>()),
28 label_(NULL), 28 label_(NULL),
29 ok_button_(NULL), 29 ok_button_(NULL),
30 cancel_button_(NULL), 30 cancel_button_(NULL),
31 link_(NULL) { 31 link_(NULL) {
32 } 32 }
33 33
34 ConfirmInfoBar::~ConfirmInfoBar() { 34 ConfirmInfoBar::~ConfirmInfoBar() {
35 } 35 }
36 36
37 void ConfirmInfoBar::Layout() { 37 void ConfirmInfoBar::Layout() {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 123 }
124 124
125 int ConfirmInfoBar::NonLabelWidth() const { 125 int ConfirmInfoBar::NonLabelWidth() const {
126 int width = (label_->text().empty() || (!ok_button_ && !cancel_button_)) ? 126 int width = (label_->text().empty() || (!ok_button_ && !cancel_button_)) ?
127 0 : kEndOfLabelSpacing; 127 0 : kEndOfLabelSpacing;
128 if (ok_button_) 128 if (ok_button_)
129 width += ok_button_->width() + (cancel_button_ ? kButtonButtonSpacing : 0); 129 width += ok_button_->width() + (cancel_button_ ? kButtonButtonSpacing : 0);
130 width += (cancel_button_ ? cancel_button_->width() : 0); 130 width += (cancel_button_ ? cancel_button_->width() : 0);
131 return width + ((link_->text().empty() || !width) ? 0 : kEndOfLabelSpacing); 131 return width + ((link_->text().empty() || !width) ? 0 : kEndOfLabelSpacing);
132 } 132 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/infobars/alternate_nav_infobar_view.cc ('k') | chrome/browser/ui/views/infobars/extension_infobar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698