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 <stddef.h> | 7 #include <stddef.h> |
| 8 |
8 #include <utility> | 9 #include <utility> |
9 | 10 |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/ptr_util.h" |
11 #include "chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.h" | 13 #include "chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.h" |
12 #include "ui/base/window_open_disposition.h" | 14 #include "ui/base/window_open_disposition.h" |
13 #include "ui/gfx/text_elider.h" | 15 #include "ui/gfx/text_elider.h" |
14 #include "ui/views/controls/label.h" | 16 #include "ui/views/controls/label.h" |
15 #include "ui/views/controls/link.h" | 17 #include "ui/views/controls/link.h" |
16 | 18 |
17 | 19 |
18 // AlternateNavInfoBarDelegate ------------------------------------------------- | 20 // AlternateNavInfoBarDelegate ------------------------------------------------- |
19 | 21 |
20 // static | 22 // static |
21 scoped_ptr<infobars::InfoBar> AlternateNavInfoBarDelegate::CreateInfoBar( | 23 std::unique_ptr<infobars::InfoBar> AlternateNavInfoBarDelegate::CreateInfoBar( |
22 scoped_ptr<AlternateNavInfoBarDelegate> delegate) { | 24 std::unique_ptr<AlternateNavInfoBarDelegate> delegate) { |
23 return make_scoped_ptr(new AlternateNavInfoBarView(std::move(delegate))); | 25 return base::WrapUnique(new AlternateNavInfoBarView(std::move(delegate))); |
24 } | 26 } |
25 | 27 |
26 | 28 |
27 // AlternateNavInfoBarView ----------------------------------------------------- | 29 // AlternateNavInfoBarView ----------------------------------------------------- |
28 | 30 |
29 AlternateNavInfoBarView::AlternateNavInfoBarView( | 31 AlternateNavInfoBarView::AlternateNavInfoBarView( |
30 scoped_ptr<AlternateNavInfoBarDelegate> delegate) | 32 std::unique_ptr<AlternateNavInfoBarDelegate> delegate) |
31 : InfoBarView(std::move(delegate)), | 33 : InfoBarView(std::move(delegate)), |
32 label_1_(NULL), | 34 label_1_(NULL), |
33 link_(NULL), | 35 link_(NULL), |
34 label_2_(NULL) {} | 36 label_2_(NULL) {} |
35 | 37 |
36 AlternateNavInfoBarView::~AlternateNavInfoBarView() { | 38 AlternateNavInfoBarView::~AlternateNavInfoBarView() { |
37 } | 39 } |
38 | 40 |
39 // static | 41 // static |
40 void AlternateNavInfoBarView::ElideLabels(Labels* labels, int available_width) { | 42 void AlternateNavInfoBarView::ElideLabels(Labels* labels, int available_width) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 return; // We're closing; don't call anything, it might access the owner. | 110 return; // We're closing; don't call anything, it might access the owner. |
109 DCHECK(link_ != NULL); | 111 DCHECK(link_ != NULL); |
110 DCHECK_EQ(link_, source); | 112 DCHECK_EQ(link_, source); |
111 if (GetDelegate()->LinkClicked(ui::DispositionFromEventFlags(event_flags))) | 113 if (GetDelegate()->LinkClicked(ui::DispositionFromEventFlags(event_flags))) |
112 RemoveSelf(); | 114 RemoveSelf(); |
113 } | 115 } |
114 | 116 |
115 AlternateNavInfoBarDelegate* AlternateNavInfoBarView::GetDelegate() { | 117 AlternateNavInfoBarDelegate* AlternateNavInfoBarView::GetDelegate() { |
116 return static_cast<AlternateNavInfoBarDelegate*>(delegate()); | 118 return static_cast<AlternateNavInfoBarDelegate*>(delegate()); |
117 } | 119 } |
OLD | NEW |