Disable TabDragController tests that fail with a real compositor.
[chromium-blink-merge.git] / chrome / browser / ui / gtk / infobars / translate_message_infobar_gtk.cc
blob939d1bd55e752a8e7137be54fa83cdd44e99e38d
1 // Copyright (c) 2011 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/translate_message_infobar_gtk.h"
7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/translate/translate_infobar_delegate.h"
9 #include "chrome/browser/ui/gtk/gtk_util.h"
10 #include "ui/base/gtk/gtk_hig_constants.h"
11 #include "ui/base/gtk/gtk_signal_registrar.h"
13 TranslateMessageInfoBar::TranslateMessageInfoBar(
14 scoped_ptr<TranslateInfoBarDelegate> delegate)
15 : TranslateInfoBarBase(delegate.Pass()) {
18 TranslateMessageInfoBar::~TranslateMessageInfoBar() {
21 void TranslateMessageInfoBar::PlatformSpecificSetOwner() {
22 TranslateInfoBarBase::PlatformSpecificSetOwner();
24 GtkWidget* new_hbox = gtk_hbox_new(FALSE, ui::kControlSpacing);
25 gtk_util::CenterWidgetInHBox(hbox(), new_hbox, false, 0);
27 std::string text = base::UTF16ToUTF8(GetDelegate()->GetMessageInfoBarText());
28 gtk_box_pack_start(GTK_BOX(new_hbox), CreateLabel(text.c_str()), FALSE, FALSE,
29 0);
30 base::string16 button_text = GetDelegate()->GetMessageInfoBarButtonText();
31 if (!button_text.empty()) {
32 GtkWidget* button =
33 gtk_button_new_with_label(base::UTF16ToUTF8(button_text).c_str());
34 signals()->Connect(button, "clicked", G_CALLBACK(&OnButtonPressedThunk),
35 this);
36 gtk_box_pack_start(GTK_BOX(new_hbox), button, FALSE, FALSE, 0);
40 void TranslateMessageInfoBar::OnButtonPressed(GtkWidget* sender) {
41 GetDelegate()->MessageInfoBarButtonPressed();