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

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

Issue 240193003: Move Infobars core files to the Infobars component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nib name on mac Created 6 years, 8 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/gfx/text_elider.h" 10 #include "ui/gfx/text_elider.h"
11 #include "ui/views/controls/label.h" 11 #include "ui/views/controls/label.h"
12 #include "ui/views/controls/link.h" 12 #include "ui/views/controls/link.h"
13 13
14 14
15 // AlternateNavInfoBarDelegate ------------------------------------------------- 15 // AlternateNavInfoBarDelegate -------------------------------------------------
16 16
17 // static 17 // static
18 scoped_ptr<InfoBar> AlternateNavInfoBarDelegate::CreateInfoBar( 18 scoped_ptr<infobars::InfoBar> AlternateNavInfoBarDelegate::CreateInfoBar(
19 scoped_ptr<AlternateNavInfoBarDelegate> delegate) { 19 scoped_ptr<AlternateNavInfoBarDelegate> delegate) {
20 return scoped_ptr<InfoBar>(new AlternateNavInfoBarView(delegate.Pass())); 20 return scoped_ptr<infobars::InfoBar>(
21 new AlternateNavInfoBarView(delegate.Pass()));
21 } 22 }
22 23
23 24
24 // AlternateNavInfoBarView ----------------------------------------------------- 25 // AlternateNavInfoBarView -----------------------------------------------------
25 26
26 AlternateNavInfoBarView::AlternateNavInfoBarView( 27 AlternateNavInfoBarView::AlternateNavInfoBarView(
27 scoped_ptr<AlternateNavInfoBarDelegate> delegate) 28 scoped_ptr<AlternateNavInfoBarDelegate> delegate)
28 : InfoBarView(delegate.PassAs<InfoBarDelegate>()), 29 : InfoBarView(delegate.PassAs<infobars::InfoBarDelegate>()),
29 label_1_(NULL), 30 label_1_(NULL),
30 link_(NULL), 31 link_(NULL),
31 label_2_(NULL) { 32 label_2_(NULL) {}
32 }
33 33
34 AlternateNavInfoBarView::~AlternateNavInfoBarView() { 34 AlternateNavInfoBarView::~AlternateNavInfoBarView() {
35 } 35 }
36 36
37 // static 37 // static
38 void AlternateNavInfoBarView::ElideLabels(Labels* labels, int available_width) { 38 void AlternateNavInfoBarView::ElideLabels(Labels* labels, int available_width) {
39 views::Label* last_label = labels->back(); 39 views::Label* last_label = labels->back();
40 labels->pop_back(); 40 labels->pop_back();
41 int used_width = 0; 41 int used_width = 0;
42 for (Labels::iterator i(labels->begin()); i != labels->end(); ++i) 42 for (Labels::iterator i(labels->begin()); i != labels->end(); ++i)
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 return; // We're closing; don't call anything, it might access the owner. 106 return; // We're closing; don't call anything, it might access the owner.
107 DCHECK(link_ != NULL); 107 DCHECK(link_ != NULL);
108 DCHECK_EQ(link_, source); 108 DCHECK_EQ(link_, source);
109 if (GetDelegate()->LinkClicked(ui::DispositionFromEventFlags(event_flags))) 109 if (GetDelegate()->LinkClicked(ui::DispositionFromEventFlags(event_flags)))
110 RemoveSelf(); 110 RemoveSelf();
111 } 111 }
112 112
113 AlternateNavInfoBarDelegate* AlternateNavInfoBarView::GetDelegate() { 113 AlternateNavInfoBarDelegate* AlternateNavInfoBarView::GetDelegate() {
114 return static_cast<AlternateNavInfoBarDelegate*>(delegate()); 114 return static_cast<AlternateNavInfoBarDelegate*>(delegate());
115 } 115 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.h ('k') | chrome/browser/ui/views/infobars/confirm_infobar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698