| 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/link_infobar.h" | 5 #include "chrome/browser/ui/views/infobars/link_infobar.h" |
| 6 | 6 |
| 7 #include "chrome/browser/tab_contents/link_infobar_delegate.h" | 7 #include "chrome/browser/tab_contents/link_infobar_delegate.h" |
| 8 #include "chrome/browser/ui/views/event_utils.h" | 8 #include "chrome/browser/ui/views/event_utils.h" |
| 9 #include "views/controls/label.h" | 9 #include "views/controls/label.h" |
| 10 #include "views/controls/link.h" | 10 #include "views/controls/link.h" |
| 11 | 11 |
| 12 // LinkInfoBarDelegate -------------------------------------------------------- | 12 // LinkInfoBarDelegate -------------------------------------------------------- |
| 13 | 13 |
| 14 InfoBar* LinkInfoBarDelegate::CreateInfoBar() { | 14 InfoBar* LinkInfoBarDelegate::CreateInfoBar(TabContentsWrapper* owner) { |
| 15 return new LinkInfoBar(this); | 15 return new LinkInfoBar(owner, this); |
| 16 } | 16 } |
| 17 | 17 |
| 18 // LinkInfoBar ---------------------------------------------------------------- | 18 // LinkInfoBar ---------------------------------------------------------------- |
| 19 | 19 |
| 20 LinkInfoBar::LinkInfoBar(LinkInfoBarDelegate* delegate) | 20 LinkInfoBar::LinkInfoBar(TabContentsWrapper* owner, |
| 21 : InfoBarView(delegate), | 21 LinkInfoBarDelegate* delegate) |
| 22 : InfoBarView(owner, delegate), |
| 22 label_1_(NULL), | 23 label_1_(NULL), |
| 23 link_(NULL), | 24 link_(NULL), |
| 24 label_2_(NULL) { | 25 label_2_(NULL) { |
| 25 } | 26 } |
| 26 | 27 |
| 27 LinkInfoBar::~LinkInfoBar() { | 28 LinkInfoBar::~LinkInfoBar() { |
| 28 } | 29 } |
| 29 | 30 |
| 30 void LinkInfoBar::Layout() { | 31 void LinkInfoBar::Layout() { |
| 31 InfoBarView::Layout(); | 32 InfoBarView::Layout(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 DCHECK(link_ != NULL); | 75 DCHECK(link_ != NULL); |
| 75 DCHECK_EQ(link_, source); | 76 DCHECK_EQ(link_, source); |
| 76 if (GetDelegate()->LinkClicked( | 77 if (GetDelegate()->LinkClicked( |
| 77 event_utils::DispositionFromEventFlags(event_flags))) | 78 event_utils::DispositionFromEventFlags(event_flags))) |
| 78 RemoveInfoBar(); | 79 RemoveInfoBar(); |
| 79 } | 80 } |
| 80 | 81 |
| 81 LinkInfoBarDelegate* LinkInfoBar::GetDelegate() { | 82 LinkInfoBarDelegate* LinkInfoBar::GetDelegate() { |
| 82 return delegate()->AsLinkInfoBarDelegate(); | 83 return delegate()->AsLinkInfoBarDelegate(); |
| 83 } | 84 } |
| OLD | NEW |