| OLD | NEW |
| 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/gtk/tab_modal_confirm_dialog_gtk.h" | 5 #include "chrome/browser/ui/gtk/tab_modal_confirm_dialog_gtk.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/ui/browser_dialogs.h" | 9 #include "chrome/browser/ui/browser_dialogs.h" |
| 10 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 TabContents* tab_contents) { | 23 TabContents* tab_contents) { |
| 24 new TabModalConfirmDialogGtk(delegate, tab_contents); | 24 new TabModalConfirmDialogGtk(delegate, tab_contents); |
| 25 } | 25 } |
| 26 | 26 |
| 27 } // namespace chrome | 27 } // namespace chrome |
| 28 | 28 |
| 29 TabModalConfirmDialogGtk::TabModalConfirmDialogGtk( | 29 TabModalConfirmDialogGtk::TabModalConfirmDialogGtk( |
| 30 TabModalConfirmDialogDelegate* delegate, | 30 TabModalConfirmDialogDelegate* delegate, |
| 31 TabContents* tab_contents) | 31 TabContents* tab_contents) |
| 32 : delegate_(delegate) { | 32 : delegate_(delegate) { |
| 33 dialog_ = gtk_vbox_new(FALSE, ui::kContentAreaBorder); | 33 dialog_ = gtk_vbox_new(FALSE, ui::kContentAreaSpacing); |
| 34 gtk_box_set_spacing(GTK_BOX(dialog_), ui::kContentAreaSpacing); | |
| 35 GtkWidget* label = gtk_label_new( | 34 GtkWidget* label = gtk_label_new( |
| 36 UTF16ToUTF8(delegate->GetMessage()).c_str()); | 35 UTF16ToUTF8(delegate->GetMessage()).c_str()); |
| 37 gfx::Image* icon = delegate->GetIcon(); | 36 gfx::Image* icon = delegate->GetIcon(); |
| 38 GtkWidget* image = icon ? gtk_image_new_from_pixbuf(icon->ToGdkPixbuf()) | 37 GtkWidget* image = icon ? gtk_image_new_from_pixbuf(icon->ToGdkPixbuf()) |
| 39 : gtk_image_new_from_stock(GTK_STOCK_DIALOG_QUESTION, | 38 : gtk_image_new_from_stock(GTK_STOCK_DIALOG_QUESTION, |
| 40 GTK_ICON_SIZE_DIALOG); | 39 GTK_ICON_SIZE_DIALOG); |
| 41 gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.0); | 40 gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.0); |
| 42 | 41 |
| 43 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | 42 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
| 44 gtk_label_set_selectable(GTK_LABEL(label), TRUE); | 43 gtk_label_set_selectable(GTK_LABEL(label), TRUE); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 gtk_widget_destroy(dialog_); | 94 gtk_widget_destroy(dialog_); |
| 96 } | 95 } |
| 97 | 96 |
| 98 void TabModalConfirmDialogGtk::OnAccept(GtkWidget* widget) { | 97 void TabModalConfirmDialogGtk::OnAccept(GtkWidget* widget) { |
| 99 delegate_->Accept(); | 98 delegate_->Accept(); |
| 100 } | 99 } |
| 101 | 100 |
| 102 void TabModalConfirmDialogGtk::OnCancel(GtkWidget* widget) { | 101 void TabModalConfirmDialogGtk::OnCancel(GtkWidget* widget) { |
| 103 delegate_->Cancel(); | 102 delegate_->Cancel(); |
| 104 } | 103 } |
| OLD | NEW |