| 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/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 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { |
| 18 scoped_ptr<InfoBar> ConfirmInfoBarDelegate::CreateInfoBar( | 18 return new ConfirmInfoBar(owner, this); |
| 19 scoped_ptr<ConfirmInfoBarDelegate> delegate) { | |
| 20 return scoped_ptr<InfoBar>(new ConfirmInfoBar(delegate.Pass())); | |
| 21 } | 19 } |
| 22 | 20 |
| 23 | 21 |
| 24 // ConfirmInfoBar ------------------------------------------------------------- | 22 // ConfirmInfoBar ------------------------------------------------------------- |
| 25 | 23 |
| 26 ConfirmInfoBar::ConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate> delegate) | 24 ConfirmInfoBar::ConfirmInfoBar(InfoBarService* owner, |
| 27 : InfoBarView(delegate.PassAs<InfoBarDelegate>()), | 25 ConfirmInfoBarDelegate* delegate) |
| 26 : InfoBarView(owner, delegate), |
| 28 label_(NULL), | 27 label_(NULL), |
| 29 ok_button_(NULL), | 28 ok_button_(NULL), |
| 30 cancel_button_(NULL), | 29 cancel_button_(NULL), |
| 31 link_(NULL) { | 30 link_(NULL) { |
| 32 } | 31 } |
| 33 | 32 |
| 34 ConfirmInfoBar::~ConfirmInfoBar() { | 33 ConfirmInfoBar::~ConfirmInfoBar() { |
| 35 } | 34 } |
| 36 | 35 |
| 37 void ConfirmInfoBar::Layout() { | 36 void ConfirmInfoBar::Layout() { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 return; // We're closing; don't call anything, it might access the owner. | 129 return; // We're closing; don't call anything, it might access the owner. |
| 131 DCHECK(link_ != NULL); | 130 DCHECK(link_ != NULL); |
| 132 DCHECK_EQ(link_, source); | 131 DCHECK_EQ(link_, source); |
| 133 if (GetDelegate()->LinkClicked(ui::DispositionFromEventFlags(event_flags))) | 132 if (GetDelegate()->LinkClicked(ui::DispositionFromEventFlags(event_flags))) |
| 134 RemoveSelf(); | 133 RemoveSelf(); |
| 135 } | 134 } |
| 136 | 135 |
| 137 ConfirmInfoBarDelegate* ConfirmInfoBar::GetDelegate() { | 136 ConfirmInfoBarDelegate* ConfirmInfoBar::GetDelegate() { |
| 138 return delegate()->AsConfirmInfoBarDelegate(); | 137 return delegate()->AsConfirmInfoBarDelegate(); |
| 139 } | 138 } |
| OLD | NEW |