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/alternate_nav_infobar_view.h" | 5 #include "chrome/browser/ui/views/infobars/alternate_nav_infobar_view.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.h" | 8 #include "chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.h" |
9 #include "ui/base/window_open_disposition.h" | 9 #include "ui/base/window_open_disposition.h" |
10 #include "ui/views/controls/label.h" | 10 #include "ui/views/controls/label.h" |
11 #include "ui/views/controls/link.h" | 11 #include "ui/views/controls/link.h" |
12 | 12 |
13 | 13 |
14 // AlternateNavInfoBarDelegate ------------------------------------------------- | 14 // AlternateNavInfoBarDelegate ------------------------------------------------- |
15 | 15 |
16 // static | 16 InfoBar* AlternateNavInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { |
17 scoped_ptr<InfoBar> AlternateNavInfoBarDelegate::CreateInfoBar( | 17 return new AlternateNavInfoBarView(owner, this); |
18 scoped_ptr<AlternateNavInfoBarDelegate> delegate) { | |
19 return scoped_ptr<InfoBar>(new AlternateNavInfoBarView(delegate.Pass())); | |
20 } | 18 } |
21 | 19 |
22 | 20 |
23 // AlternateNavInfoBarView ----------------------------------------------------- | 21 // AlternateNavInfoBarView ----------------------------------------------------- |
24 | 22 |
25 AlternateNavInfoBarView::AlternateNavInfoBarView( | 23 AlternateNavInfoBarView::AlternateNavInfoBarView( |
26 scoped_ptr<AlternateNavInfoBarDelegate> delegate) | 24 InfoBarService* owner, |
27 : InfoBarView(delegate.PassAs<InfoBarDelegate>()), | 25 AlternateNavInfoBarDelegate* delegate) |
| 26 : InfoBarView(owner, delegate), |
28 label_1_(NULL), | 27 label_1_(NULL), |
29 link_(NULL), | 28 link_(NULL), |
30 label_2_(NULL) { | 29 label_2_(NULL) { |
31 } | 30 } |
32 | 31 |
33 AlternateNavInfoBarView::~AlternateNavInfoBarView() { | 32 AlternateNavInfoBarView::~AlternateNavInfoBarView() { |
34 } | 33 } |
35 | 34 |
36 void AlternateNavInfoBarView::Layout() { | 35 void AlternateNavInfoBarView::Layout() { |
37 InfoBarView::Layout(); | 36 InfoBarView::Layout(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 return; // We're closing; don't call anything, it might access the owner. | 81 return; // We're closing; don't call anything, it might access the owner. |
83 DCHECK(link_ != NULL); | 82 DCHECK(link_ != NULL); |
84 DCHECK_EQ(link_, source); | 83 DCHECK_EQ(link_, source); |
85 if (GetDelegate()->LinkClicked(ui::DispositionFromEventFlags(event_flags))) | 84 if (GetDelegate()->LinkClicked(ui::DispositionFromEventFlags(event_flags))) |
86 RemoveSelf(); | 85 RemoveSelf(); |
87 } | 86 } |
88 | 87 |
89 AlternateNavInfoBarDelegate* AlternateNavInfoBarView::GetDelegate() { | 88 AlternateNavInfoBarDelegate* AlternateNavInfoBarView::GetDelegate() { |
90 return static_cast<AlternateNavInfoBarDelegate*>(delegate()); | 89 return static_cast<AlternateNavInfoBarDelegate*>(delegate()); |
91 } | 90 } |
OLD | NEW |