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

Side by Side Diff: chrome/browser/ui/gtk/infobars/translate_message_infobar_gtk.cc

Issue 7737001: content: Start splitting up chrome/browser/ui/gtk/gtk_util.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 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 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/gtk/infobars/translate_message_infobar_gtk.h" 5 #include "chrome/browser/ui/gtk/infobars/translate_message_infobar_gtk.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/translate/translate_infobar_delegate.h" 8 #include "chrome/browser/translate/translate_infobar_delegate.h"
9 #include "chrome/browser/ui/gtk/gtk_util.h" 9 #include "chrome/browser/ui/gtk/gtk_util.h"
10 #include "ui/base/gtk/gtk_hig_constants.h"
10 11
11 TranslateMessageInfoBar::TranslateMessageInfoBar( 12 TranslateMessageInfoBar::TranslateMessageInfoBar(
12 TabContentsWrapper* owner, 13 TabContentsWrapper* owner,
13 TranslateInfoBarDelegate* delegate) 14 TranslateInfoBarDelegate* delegate)
14 : TranslateInfoBarBase(owner, delegate) { 15 : TranslateInfoBarBase(owner, delegate) {
15 } 16 }
16 17
17 TranslateMessageInfoBar::~TranslateMessageInfoBar() { 18 TranslateMessageInfoBar::~TranslateMessageInfoBar() {
18 } 19 }
19 20
20 void TranslateMessageInfoBar::Init() { 21 void TranslateMessageInfoBar::Init() {
21 TranslateInfoBarBase::Init(); 22 TranslateInfoBarBase::Init();
22 23
23 GtkWidget* hbox = gtk_hbox_new(FALSE, gtk_util::kControlSpacing); 24 GtkWidget* hbox = gtk_hbox_new(FALSE, ui::kControlSpacing);
24 gtk_util::CenterWidgetInHBox(hbox_, hbox, false, 0); 25 gtk_util::CenterWidgetInHBox(hbox_, hbox, false, 0);
25 26
26 std::string text = UTF16ToUTF8(GetDelegate()->GetMessageInfoBarText()); 27 std::string text = UTF16ToUTF8(GetDelegate()->GetMessageInfoBarText());
27 gtk_box_pack_start(GTK_BOX(hbox), CreateLabel(text.c_str()), FALSE, FALSE, 0); 28 gtk_box_pack_start(GTK_BOX(hbox), CreateLabel(text.c_str()), FALSE, FALSE, 0);
28 string16 button_text = GetDelegate()->GetMessageInfoBarButtonText(); 29 string16 button_text = GetDelegate()->GetMessageInfoBarButtonText();
29 if (!button_text.empty()) { 30 if (!button_text.empty()) {
30 GtkWidget* button = 31 GtkWidget* button =
31 gtk_button_new_with_label(UTF16ToUTF8(button_text).c_str()); 32 gtk_button_new_with_label(UTF16ToUTF8(button_text).c_str());
32 g_signal_connect(button, "clicked",G_CALLBACK(&OnButtonPressedThunk), this); 33 g_signal_connect(button, "clicked",G_CALLBACK(&OnButtonPressedThunk), this);
33 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); 34 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
34 } 35 }
35 } 36 }
36 37
37 void TranslateMessageInfoBar::OnButtonPressed(GtkWidget* sender) { 38 void TranslateMessageInfoBar::OnButtonPressed(GtkWidget* sender) {
38 GetDelegate()->MessageInfoBarButtonPressed(); 39 GetDelegate()->MessageInfoBarButtonPressed();
39 } 40 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/infobars/infobar_gtk.cc ('k') | chrome/browser/ui/gtk/instant_confirm_dialog_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698