OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/tab_contents/confirm_infobar_delegate.h" | 8 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" |
9 #include "chrome/browser/ui/views/event_utils.h" | 9 #include "chrome/browser/ui/views/event_utils.h" |
10 #include "views/controls/button/text_button.h" | 10 #include "views/controls/button/text_button.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 if (delegate->GetButtons() & ConfirmInfoBarDelegate::BUTTON_CANCEL) { | 80 if (delegate->GetButtons() & ConfirmInfoBarDelegate::BUTTON_CANCEL) { |
81 cancel_button_ = CreateTextButton(this, | 81 cancel_button_ = CreateTextButton(this, |
82 delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_CANCEL), | 82 delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_CANCEL), |
83 delegate->NeedElevation(ConfirmInfoBarDelegate::BUTTON_CANCEL)); | 83 delegate->NeedElevation(ConfirmInfoBarDelegate::BUTTON_CANCEL)); |
84 AddChildView(cancel_button_); | 84 AddChildView(cancel_button_); |
85 } | 85 } |
86 | 86 |
87 string16 link_text(delegate->GetLinkText()); | 87 string16 link_text(delegate->GetLinkText()); |
88 if (!link_text.empty()) { | 88 if (!link_text.empty()) { |
89 link_ = CreateLink(link_text, this, background()->get_color()); | 89 link_ = CreateLink(link_text, this); |
90 AddChildView(link_); | 90 AddChildView(link_); |
91 } | 91 } |
92 } | 92 } |
93 | 93 |
94 // This must happen after adding all other children so InfoBarView can ensure | 94 // This must happen after adding all other children so InfoBarView can ensure |
95 // the close button is the last child. | 95 // the close button is the last child. |
96 InfoBarView::ViewHierarchyChanged(is_add, parent, child); | 96 InfoBarView::ViewHierarchyChanged(is_add, parent, child); |
97 } | 97 } |
98 | 98 |
99 void ConfirmInfoBar::ButtonPressed(views::Button* sender, | 99 void ConfirmInfoBar::ButtonPressed(views::Button* sender, |
(...skipping 29 matching lines...) Expand all Loading... |
129 DCHECK(link_ != NULL); | 129 DCHECK(link_ != NULL); |
130 DCHECK_EQ(link_, source); | 130 DCHECK_EQ(link_, source); |
131 if (GetDelegate()->LinkClicked( | 131 if (GetDelegate()->LinkClicked( |
132 event_utils::DispositionFromEventFlags(event_flags))) | 132 event_utils::DispositionFromEventFlags(event_flags))) |
133 RemoveSelf(); | 133 RemoveSelf(); |
134 } | 134 } |
135 | 135 |
136 ConfirmInfoBarDelegate* ConfirmInfoBar::GetDelegate() { | 136 ConfirmInfoBarDelegate* ConfirmInfoBar::GetDelegate() { |
137 return delegate()->AsConfirmInfoBarDelegate(); | 137 return delegate()->AsConfirmInfoBarDelegate(); |
138 } | 138 } |
OLD | NEW |