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

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 compilation on Android 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/infobar_service.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 // InfoBarService -------------------------------------------------------------
15 17
16 // ConfirmInfoBarDelegate ----------------------------------------------------- 18 scoped_ptr<infobars::InfoBar> InfoBarService::CreateConfirmInfoBar(
17
18 // static
19 scoped_ptr<infobars::InfoBar> ConfirmInfoBarDelegate::CreateInfoBar(
20 scoped_ptr<ConfirmInfoBarDelegate> delegate) { 19 scoped_ptr<ConfirmInfoBarDelegate> delegate) {
21 return make_scoped_ptr(new ConfirmInfoBar(delegate.Pass())); 20 return make_scoped_ptr(new ConfirmInfoBar(delegate.Pass()));
22 } 21 }
23 22
24 23
25 // ConfirmInfoBar ------------------------------------------------------------- 24 // ConfirmInfoBar -------------------------------------------------------------
26 25
27 ConfirmInfoBar::ConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate> delegate) 26 ConfirmInfoBar::ConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate> delegate)
28 : InfoBarView(delegate.Pass()), 27 : InfoBarView(delegate.Pass()),
29 label_(NULL), 28 label_(NULL),
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 126 }
128 127
129 int ConfirmInfoBar::NonLabelWidth() const { 128 int ConfirmInfoBar::NonLabelWidth() const {
130 int width = (label_->text().empty() || (!ok_button_ && !cancel_button_)) ? 129 int width = (label_->text().empty() || (!ok_button_ && !cancel_button_)) ?
131 0 : kEndOfLabelSpacing; 130 0 : kEndOfLabelSpacing;
132 if (ok_button_) 131 if (ok_button_)
133 width += ok_button_->width() + (cancel_button_ ? kButtonButtonSpacing : 0); 132 width += ok_button_->width() + (cancel_button_ ? kButtonButtonSpacing : 0);
134 width += (cancel_button_ ? cancel_button_->width() : 0); 133 width += (cancel_button_ ? cancel_button_->width() : 0);
135 return width + ((link_->text().empty() || !width) ? 0 : kEndOfLabelSpacing); 134 return width + ((link_->text().empty() || !width) ? 0 : kEndOfLabelSpacing);
136 } 135 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698