Disable TabDragController tests that fail with a real compositor.
[chromium-blink-merge.git] / chrome / browser / ui / gtk / infobars / alternate_nav_infobar_gtk.cc
blobd4ac8f2475fedfb2eef6ca3c977160e484b88e57
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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/gtk/infobars/alternate_nav_infobar_gtk.h"
7 #include "chrome/browser/ui/gtk/event_utils.h"
8 #include "chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.h"
11 // AlternateNavInfoBarDelegate -------------------------------------------------
13 // static
14 scoped_ptr<InfoBar> AlternateNavInfoBarDelegate::CreateInfoBar(
15 scoped_ptr<AlternateNavInfoBarDelegate> delegate) {
16 return scoped_ptr<InfoBar>(new AlternateNavInfoBarGtk(delegate.Pass()));
20 // AlternateNavInfoBarGtk ------------------------------------------------------
22 AlternateNavInfoBarGtk::AlternateNavInfoBarGtk(
23 scoped_ptr<AlternateNavInfoBarDelegate> delegate)
24 : InfoBarGtk(delegate.PassAs<InfoBarDelegate>()) {
27 AlternateNavInfoBarGtk::~AlternateNavInfoBarGtk() {
30 void AlternateNavInfoBarGtk::PlatformSpecificSetOwner() {
31 InfoBarGtk::PlatformSpecificSetOwner();
33 size_t link_offset;
34 base::string16 display_text =
35 GetDelegate()->GetMessageTextWithOffset(&link_offset);
36 base::string16 link_text = GetDelegate()->GetLinkText();
37 AddLabelWithInlineLink(display_text, link_text, link_offset,
38 G_CALLBACK(OnLinkClickedThunk));
41 AlternateNavInfoBarDelegate* AlternateNavInfoBarGtk::GetDelegate() {
42 return static_cast<AlternateNavInfoBarDelegate*>(delegate());
45 void AlternateNavInfoBarGtk::OnLinkClicked(GtkWidget* button) {
46 if (GetDelegate()->LinkClicked(
47 event_utils::DispositionForCurrentButtonPressEvent()))
48 RemoveSelf();