OLD | NEW |
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/html_dialog_gtk.h" | 5 #include "chrome/browser/ui/gtk/html_dialog_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 return std::string(); | 108 return std::string(); |
109 } | 109 } |
110 | 110 |
111 void HtmlDialogGtk::OnDialogClosed(const std::string& json_retval) { | 111 void HtmlDialogGtk::OnDialogClosed(const std::string& json_retval) { |
112 DCHECK(dialog_); | 112 DCHECK(dialog_); |
113 | 113 |
114 Detach(); | 114 Detach(); |
115 if (delegate_) { | 115 if (delegate_) { |
116 HtmlDialogUIDelegate* dialog_delegate = delegate_; | 116 HtmlDialogUIDelegate* dialog_delegate = delegate_; |
117 delegate_ = NULL; // We will not communicate further with the delegate. | 117 delegate_ = NULL; // We will not communicate further with the delegate. |
| 118 |
| 119 // Store the dialog bounds. |
| 120 gfx::Rect dialog_bounds = gtk_util::GetDialogBounds(GTK_WIDGET(dialog_)); |
| 121 dialog_delegate->StoreDialogSize(dialog_bounds); |
| 122 |
118 dialog_delegate->OnDialogClosed(json_retval); | 123 dialog_delegate->OnDialogClosed(json_retval); |
119 } | 124 } |
| 125 |
120 gtk_widget_destroy(dialog_); | 126 gtk_widget_destroy(dialog_); |
121 delete this; | 127 delete this; |
122 } | 128 } |
123 | 129 |
124 void HtmlDialogGtk::OnCloseContents(TabContents* source, | 130 void HtmlDialogGtk::OnCloseContents(TabContents* source, |
125 bool* out_close_dialog) { | 131 bool* out_close_dialog) { |
126 if (delegate_) | 132 if (delegate_) |
127 delegate_->OnCloseContents(source, out_close_dialog); | 133 delegate_->OnCloseContents(source, out_close_dialog); |
128 } | 134 } |
129 | 135 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 dialog_size.height()); | 206 dialog_size.height()); |
201 | 207 |
202 gtk_widget_show_all(dialog_); | 208 gtk_widget_show_all(dialog_); |
203 | 209 |
204 return GTK_WINDOW(dialog_); | 210 return GTK_WINDOW(dialog_); |
205 } | 211 } |
206 | 212 |
207 void HtmlDialogGtk::OnResponse(GtkWidget* dialog, int response_id) { | 213 void HtmlDialogGtk::OnResponse(GtkWidget* dialog, int response_id) { |
208 OnDialogClosed(std::string()); | 214 OnDialogClosed(std::string()); |
209 } | 215 } |
OLD | NEW |