| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" | 8 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" |
| 9 #include "chrome/browser/event_disposition.h" | 9 #include "ui/base/window_open_disposition.h" |
| 10 #include "ui/views/controls/button/text_button.h" | 10 #include "ui/views/controls/button/text_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 // ConfirmInfoBarDelegate ----------------------------------------------------- | 14 // ConfirmInfoBarDelegate ----------------------------------------------------- |
| 15 | 15 |
| 16 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { | 16 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { |
| 17 return new ConfirmInfoBar(owner, this); | 17 return new ConfirmInfoBar(owner, this); |
| 18 } | 18 } |
| 19 | 19 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 } | 121 } |
| 122 return width + ((cancel_button_ == NULL) ? 0 : | 122 return width + ((cancel_button_ == NULL) ? 0 : |
| 123 (before_cancel_spacing + cancel_button_->GetPreferredSize().width())); | 123 (before_cancel_spacing + cancel_button_->GetPreferredSize().width())); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void ConfirmInfoBar::LinkClicked(views::Link* source, int event_flags) { | 126 void ConfirmInfoBar::LinkClicked(views::Link* source, int event_flags) { |
| 127 if (!owned()) | 127 if (!owned()) |
| 128 return; // We're closing; don't call anything, it might access the owner. | 128 return; // We're closing; don't call anything, it might access the owner. |
| 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(ui::DispositionFromEventFlags(event_flags))) |
| 132 chrome::DispositionFromEventFlags(event_flags))) | |
| 133 RemoveSelf(); | 132 RemoveSelf(); |
| 134 } | 133 } |
| 135 | 134 |
| 136 ConfirmInfoBarDelegate* ConfirmInfoBar::GetDelegate() { | 135 ConfirmInfoBarDelegate* ConfirmInfoBar::GetDelegate() { |
| 137 return delegate()->AsConfirmInfoBarDelegate(); | 136 return delegate()->AsConfirmInfoBarDelegate(); |
| 138 } | 137 } |
| OLD | NEW |