| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 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. | |
| 4 | |
| 5 #include "chrome/browser/gtk/translate/translate_message_infobar_gtk.h" | |
| 6 | |
| 7 #include "base/utf_string_conversions.h" | |
| 8 #include "chrome/browser/gtk/gtk_util.h" | |
| 9 #include "chrome/browser/translate/translate_infobar_delegate.h" | |
| 10 | |
| 11 TranslateMessageInfoBar::TranslateMessageInfoBar( | |
| 12 TranslateInfoBarDelegate* delegate) | |
| 13 : TranslateInfoBarBase(delegate) { | |
| 14 } | |
| 15 | |
| 16 TranslateMessageInfoBar::~TranslateMessageInfoBar() { | |
| 17 } | |
| 18 | |
| 19 void TranslateMessageInfoBar::Init() { | |
| 20 TranslateInfoBarBase::Init(); | |
| 21 | |
| 22 GtkWidget* hbox = gtk_hbox_new(FALSE, gtk_util::kControlSpacing); | |
| 23 gtk_util::CenterWidgetInHBox(hbox_, hbox, false, 0); | |
| 24 | |
| 25 std::string text = UTF16ToUTF8(GetDelegate()->GetMessageInfoBarText()); | |
| 26 gtk_box_pack_start(GTK_BOX(hbox), CreateLabel(text.c_str()), FALSE, FALSE, 0); | |
| 27 string16 button_text = GetDelegate()->GetMessageInfoBarButtonText(); | |
| 28 if (!button_text.empty()) { | |
| 29 GtkWidget* button = | |
| 30 gtk_button_new_with_label(UTF16ToUTF8(button_text).c_str()); | |
| 31 g_signal_connect(button, "clicked",G_CALLBACK(&OnButtonPressedThunk), this); | |
| 32 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
| 33 } | |
| 34 } | |
| 35 | |
| 36 void TranslateMessageInfoBar::OnButtonPressed(GtkWidget* sender) { | |
| 37 GetDelegate()->MessageInfoBarButtonPressed(); | |
| 38 } | |
| OLD | NEW |