| 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 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.h" | 13 #include "chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.h" |
| 14 #include "ui/base/window_open_disposition.h" | 14 #include "ui/base/window_open_disposition.h" |
| 15 #include "ui/gfx/text_elider.h" | 15 #include "ui/gfx/text_elider.h" |
| 16 #include "ui/views/controls/label.h" | 16 #include "ui/views/controls/label.h" |
| 17 #include "ui/views/controls/link.h" | 17 #include "ui/views/controls/link.h" |
| 18 | 18 |
| 19 | 19 |
| 20 // AlternateNavInfoBarDelegate ------------------------------------------------- | 20 // AlternateNavInfoBarDelegate ------------------------------------------------- |
| 21 | 21 |
| 22 // static | 22 // static |
| 23 std::unique_ptr<infobars::InfoBar> AlternateNavInfoBarDelegate::CreateInfoBar( | 23 std::unique_ptr<infobars::InfoBar> AlternateNavInfoBarDelegate::CreateInfoBar( |
| 24 std::unique_ptr<AlternateNavInfoBarDelegate> delegate) { | 24 std::unique_ptr<AlternateNavInfoBarDelegate> delegate) { |
| 25 return base::WrapUnique(new AlternateNavInfoBarView(std::move(delegate))); | 25 return base::MakeUnique<AlternateNavInfoBarView>(std::move(delegate)); |
| 26 } | 26 } |
| 27 | 27 |
| 28 | 28 |
| 29 // AlternateNavInfoBarView ----------------------------------------------------- | 29 // AlternateNavInfoBarView ----------------------------------------------------- |
| 30 | 30 |
| 31 AlternateNavInfoBarView::AlternateNavInfoBarView( | 31 AlternateNavInfoBarView::AlternateNavInfoBarView( |
| 32 std::unique_ptr<AlternateNavInfoBarDelegate> delegate) | 32 std::unique_ptr<AlternateNavInfoBarDelegate> delegate) |
| 33 : InfoBarView(std::move(delegate)), | 33 : InfoBarView(std::move(delegate)), |
| 34 label_1_(NULL), | 34 label_1_(NULL), |
| 35 link_(NULL), | 35 link_(NULL), |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 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. |
| 111 DCHECK(link_ != NULL); | 111 DCHECK(link_ != NULL); |
| 112 DCHECK_EQ(link_, source); | 112 DCHECK_EQ(link_, source); |
| 113 if (GetDelegate()->LinkClicked(ui::DispositionFromEventFlags(event_flags))) | 113 if (GetDelegate()->LinkClicked(ui::DispositionFromEventFlags(event_flags))) |
| 114 RemoveSelf(); | 114 RemoveSelf(); |
| 115 } | 115 } |
| 116 | 116 |
| 117 AlternateNavInfoBarDelegate* AlternateNavInfoBarView::GetDelegate() { | 117 AlternateNavInfoBarDelegate* AlternateNavInfoBarView::GetDelegate() { |
| 118 return static_cast<AlternateNavInfoBarDelegate*>(delegate()); | 118 return static_cast<AlternateNavInfoBarDelegate*>(delegate()); |
| 119 } | 119 } |
| OLD | NEW |