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

Side by Side Diff: chrome/browser/ui/gtk/tab_modal_confirm_dialog_gtk.cc

Issue 12851002: Remove ConstrainedWindowGtkDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move SetBackgroundColor() Created 7 years, 9 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
« no previous file with comments | « chrome/browser/ui/gtk/tab_modal_confirm_dialog_gtk.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_modal_confirm_dialog_delegate.h" 10 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 ok_ = gtk_button_new_with_label( 64 ok_ = gtk_button_new_with_label(
65 UTF16ToUTF8(delegate->GetAcceptButtonTitle()).c_str()); 65 UTF16ToUTF8(delegate->GetAcceptButtonTitle()).c_str());
66 const char* accept_button_icon_id = delegate->GetAcceptButtonIcon(); 66 const char* accept_button_icon_id = delegate->GetAcceptButtonIcon();
67 if (accept_button_icon_id) { 67 if (accept_button_icon_id) {
68 gtk_button_set_image(GTK_BUTTON(ok_), gtk_image_new_from_stock( 68 gtk_button_set_image(GTK_BUTTON(ok_), gtk_image_new_from_stock(
69 accept_button_icon_id, GTK_ICON_SIZE_BUTTON)); 69 accept_button_icon_id, GTK_ICON_SIZE_BUTTON));
70 } 70 }
71 g_signal_connect(ok_, "clicked", G_CALLBACK(OnAcceptThunk), this); 71 g_signal_connect(ok_, "clicked", G_CALLBACK(OnAcceptThunk), this);
72 gtk_box_pack_end(GTK_BOX(buttonBox), ok_, FALSE, TRUE, 0); 72 gtk_box_pack_end(GTK_BOX(buttonBox), ok_, FALSE, TRUE, 0);
73 73
74 window_ = CreateWebContentsModalDialogGtk(web_contents, this); 74 g_signal_connect(dialog_, "destroy", G_CALLBACK(OnDestroyThunk), this);
75
76 window_ = CreateWebContentsModalDialogGtk(web_contents, dialog_, cancel_);
75 delegate_->set_close_delegate(this); 77 delegate_->set_close_delegate(this);
76 78
77 WebContentsModalDialogManager* web_contents_modal_dialog_manager = 79 WebContentsModalDialogManager* web_contents_modal_dialog_manager =
78 WebContentsModalDialogManager::FromWebContents(web_contents); 80 WebContentsModalDialogManager::FromWebContents(web_contents);
79 web_contents_modal_dialog_manager->ShowDialog(window_); 81 web_contents_modal_dialog_manager->ShowDialog(window_);
80 } 82 }
81 83
82 GtkWidget* TabModalConfirmDialogGtk::GetWidgetRoot() {
83 return dialog_;
84 }
85
86 GtkWidget* TabModalConfirmDialogGtk::GetFocusWidget() {
87 return cancel_;
88 }
89
90 void TabModalConfirmDialogGtk::DeleteDelegate() {
91 delete this;
92 }
93
94 TabModalConfirmDialogGtk::~TabModalConfirmDialogGtk() { 84 TabModalConfirmDialogGtk::~TabModalConfirmDialogGtk() {
95 gtk_widget_destroy(dialog_); 85 gtk_widget_destroy(dialog_);
96 } 86 }
97 87
98 void TabModalConfirmDialogGtk::AcceptTabModalDialog() { 88 void TabModalConfirmDialogGtk::AcceptTabModalDialog() {
99 OnAccept(NULL); 89 OnAccept(NULL);
100 } 90 }
101 91
102 void TabModalConfirmDialogGtk::CancelTabModalDialog() { 92 void TabModalConfirmDialogGtk::CancelTabModalDialog() {
103 OnCancel(NULL); 93 OnCancel(NULL);
104 } 94 }
105 95
106 void TabModalConfirmDialogGtk::CloseDialog() { 96 void TabModalConfirmDialogGtk::CloseDialog() {
107 gtk_widget_destroy(window_); 97 gtk_widget_destroy(window_);
108 } 98 }
109 99
110 void TabModalConfirmDialogGtk::OnAccept(GtkWidget* widget) { 100 void TabModalConfirmDialogGtk::OnAccept(GtkWidget* widget) {
111 delegate_->Accept(); 101 delegate_->Accept();
112 } 102 }
113 103
114 void TabModalConfirmDialogGtk::OnCancel(GtkWidget* widget) { 104 void TabModalConfirmDialogGtk::OnCancel(GtkWidget* widget) {
115 delegate_->Cancel(); 105 delegate_->Cancel();
116 } 106 }
107
108 void TabModalConfirmDialogGtk::OnDestroy(GtkWidget* widget) {
109 delete this;
110 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/tab_modal_confirm_dialog_gtk.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698