| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 return std::string(); | 112 return std::string(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void HtmlDialogGtk::OnDialogClosed(const std::string& json_retval) { | 115 void HtmlDialogGtk::OnDialogClosed(const std::string& json_retval) { |
| 116 DCHECK(dialog_); | 116 DCHECK(dialog_); |
| 117 | 117 |
| 118 Detach(); | 118 Detach(); |
| 119 if (delegate_) { | 119 if (delegate_) { |
| 120 HtmlDialogUIDelegate* dialog_delegate = delegate_; | 120 HtmlDialogUIDelegate* dialog_delegate = delegate_; |
| 121 delegate_ = NULL; // We will not communicate further with the delegate. | 121 delegate_ = NULL; // We will not communicate further with the delegate. |
| 122 |
| 123 // Store the dialog bounds. |
| 124 gfx::Rect dialog_bounds = gtk_util::GetDialogBounds(GTK_WIDGET(dialog_)); |
| 125 dialog_delegate->StoreDialogSize(dialog_bounds); |
| 126 |
| 122 dialog_delegate->OnDialogClosed(json_retval); | 127 dialog_delegate->OnDialogClosed(json_retval); |
| 123 } | 128 } |
| 129 |
| 124 gtk_widget_destroy(dialog_); | 130 gtk_widget_destroy(dialog_); |
| 125 delete this; | 131 delete this; |
| 126 } | 132 } |
| 127 | 133 |
| 128 void HtmlDialogGtk::OnCloseContents(TabContents* source, | 134 void HtmlDialogGtk::OnCloseContents(TabContents* source, |
| 129 bool* out_close_dialog) { | 135 bool* out_close_dialog) { |
| 130 if (delegate_) | 136 if (delegate_) |
| 131 delegate_->OnCloseContents(source, out_close_dialog); | 137 delegate_->OnCloseContents(source, out_close_dialog); |
| 132 } | 138 } |
| 133 | 139 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 dialog_size.height()); | 211 dialog_size.height()); |
| 206 | 212 |
| 207 gtk_widget_show_all(dialog_); | 213 gtk_widget_show_all(dialog_); |
| 208 | 214 |
| 209 return GTK_WINDOW(dialog_); | 215 return GTK_WINDOW(dialog_); |
| 210 } | 216 } |
| 211 | 217 |
| 212 void HtmlDialogGtk::OnResponse(GtkWidget* dialog, int response_id) { | 218 void HtmlDialogGtk::OnResponse(GtkWidget* dialog, int response_id) { |
| 213 OnDialogClosed(std::string()); | 219 OnDialogClosed(std::string()); |
| 214 } | 220 } |
| OLD | NEW |