| 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" |
| 11 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" | 11 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" |
| 12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 13 #include "content/public/browser/notification_types.h" | 13 #include "content/public/browser/notification_types.h" |
| 14 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
| 15 #include "ui/base/gtk/gtk_hig_constants.h" | 15 #include "ui/base/gtk/gtk_hig_constants.h" |
| 16 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
| 17 #include "ui/gfx/image/image.h" | 17 #include "ui/gfx/image/image.h" |
| 18 | 18 |
| 19 namespace browser { | 19 namespace chrome { |
| 20 | 20 |
| 21 // Declared in browser_dialogs.h so others don't have to depend on our header. | 21 // Declared in browser_dialogs.h so others don't have to depend on our header. |
| 22 void ShowTabModalConfirmDialog(TabModalConfirmDialogDelegate* delegate, | 22 void ShowTabModalConfirmDialog(TabModalConfirmDialogDelegate* delegate, |
| 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 } | 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::kContentAreaBorder); |
| 34 gtk_box_set_spacing(GTK_BOX(dialog_), ui::kContentAreaSpacing); | 34 gtk_box_set_spacing(GTK_BOX(dialog_), ui::kContentAreaSpacing); |
| 35 GtkWidget* label = gtk_label_new( | 35 GtkWidget* label = gtk_label_new( |
| 36 UTF16ToUTF8(delegate->GetMessage()).c_str()); | 36 UTF16ToUTF8(delegate->GetMessage()).c_str()); |
| 37 gfx::Image* icon = delegate->GetIcon(); | 37 gfx::Image* icon = delegate->GetIcon(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 gtk_widget_destroy(dialog_); | 95 gtk_widget_destroy(dialog_); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void TabModalConfirmDialogGtk::OnAccept(GtkWidget* widget) { | 98 void TabModalConfirmDialogGtk::OnAccept(GtkWidget* widget) { |
| 99 delegate_->Accept(); | 99 delegate_->Accept(); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void TabModalConfirmDialogGtk::OnCancel(GtkWidget* widget) { | 102 void TabModalConfirmDialogGtk::OnCancel(GtkWidget* widget) { |
| 103 delegate_->Cancel(); | 103 delegate_->Cancel(); |
| 104 } | 104 } |
| OLD | NEW |