Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: chrome/browser/ui/views/infobars/alternate_nav_infobar_view.cc

Issue 22694006: Infobar system refactor. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 InfoBar* AlternateNavInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { 16 // static
17 return new AlternateNavInfoBarView(owner, this); 17 scoped_ptr<InfoBar> AlternateNavInfoBarDelegate::CreateInfoBar(
18 scoped_ptr<AlternateNavInfoBarDelegate> delegate) {
19 return scoped_ptr<InfoBar>(new AlternateNavInfoBarView(delegate.Pass()));
18 } 20 }
19 21
20 22
21 // AlternateNavInfoBarView ----------------------------------------------------- 23 // AlternateNavInfoBarView -----------------------------------------------------
22 24
23 AlternateNavInfoBarView::AlternateNavInfoBarView( 25 AlternateNavInfoBarView::AlternateNavInfoBarView(
24 InfoBarService* owner, 26 scoped_ptr<AlternateNavInfoBarDelegate> delegate)
25 AlternateNavInfoBarDelegate* delegate) 27 : InfoBarView(delegate.PassAs<InfoBarDelegate>()),
26 : InfoBarView(owner, delegate),
27 label_1_(NULL), 28 label_1_(NULL),
28 link_(NULL), 29 link_(NULL),
29 label_2_(NULL) { 30 label_2_(NULL) {
30 } 31 }
31 32
32 AlternateNavInfoBarView::~AlternateNavInfoBarView() { 33 AlternateNavInfoBarView::~AlternateNavInfoBarView() {
33 } 34 }
34 35
35 void AlternateNavInfoBarView::Layout() { 36 void AlternateNavInfoBarView::Layout() {
36 InfoBarView::Layout(); 37 InfoBarView::Layout();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 return; // We're closing; don't call anything, it might access the owner. 82 return; // We're closing; don't call anything, it might access the owner.
82 DCHECK(link_ != NULL); 83 DCHECK(link_ != NULL);
83 DCHECK_EQ(link_, source); 84 DCHECK_EQ(link_, source);
84 if (GetDelegate()->LinkClicked(ui::DispositionFromEventFlags(event_flags))) 85 if (GetDelegate()->LinkClicked(ui::DispositionFromEventFlags(event_flags)))
85 RemoveSelf(); 86 RemoveSelf();
86 } 87 }
87 88
88 AlternateNavInfoBarDelegate* AlternateNavInfoBarView::GetDelegate() { 89 AlternateNavInfoBarDelegate* AlternateNavInfoBarView::GetDelegate() {
89 return static_cast<AlternateNavInfoBarDelegate*>(delegate()); 90 return static_cast<AlternateNavInfoBarDelegate*>(delegate());
90 } 91 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698