| 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/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/property_bag.h" | 9 #include "base/property_bag.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 handlers->clear(); | 107 handlers->clear(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void HtmlDialogGtk::GetDialogSize(gfx::Size* size) const { | 110 void HtmlDialogGtk::GetDialogSize(gfx::Size* size) const { |
| 111 if (delegate_) | 111 if (delegate_) |
| 112 delegate_->GetDialogSize(size); | 112 delegate_->GetDialogSize(size); |
| 113 else | 113 else |
| 114 *size = gfx::Size(); | 114 *size = gfx::Size(); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void HtmlDialogGtk::GetMinimumDialogSize(gfx::Size* size) const { | |
| 118 if (delegate_) | |
| 119 delegate_->GetMinimumDialogSize(size); | |
| 120 else | |
| 121 *size = gfx::Size(); | |
| 122 } | |
| 123 | |
| 124 std::string HtmlDialogGtk::GetDialogArgs() const { | 117 std::string HtmlDialogGtk::GetDialogArgs() const { |
| 125 if (delegate_) | 118 if (delegate_) |
| 126 return delegate_->GetDialogArgs(); | 119 return delegate_->GetDialogArgs(); |
| 127 else | 120 else |
| 128 return std::string(); | 121 return std::string(); |
| 129 } | 122 } |
| 130 | 123 |
| 131 void HtmlDialogGtk::OnDialogClosed(const std::string& json_retval) { | 124 void HtmlDialogGtk::OnDialogClosed(const std::string& json_retval) { |
| 132 DCHECK(dialog_); | 125 DCHECK(dialog_); |
| 133 | 126 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 | 238 |
| 246 tab_contents_container_.reset(new TabContentsContainerGtk(NULL)); | 239 tab_contents_container_.reset(new TabContentsContainerGtk(NULL)); |
| 247 GtkWidget* content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog_)); | 240 GtkWidget* content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog_)); |
| 248 gtk_box_pack_start(GTK_BOX(content_area), | 241 gtk_box_pack_start(GTK_BOX(content_area), |
| 249 tab_contents_container_->widget(), TRUE, TRUE, 0); | 242 tab_contents_container_->widget(), TRUE, TRUE, 0); |
| 250 | 243 |
| 251 tab_contents_container_->SetTab(tab_.get()); | 244 tab_contents_container_->SetTab(tab_.get()); |
| 252 | 245 |
| 253 gfx::Size dialog_size; | 246 gfx::Size dialog_size; |
| 254 delegate_->GetDialogSize(&dialog_size); | 247 delegate_->GetDialogSize(&dialog_size); |
| 255 if (!dialog_size.IsEmpty()) { | 248 |
| 256 gtk_window_set_default_size(GTK_WINDOW(dialog_), | 249 gtk_widget_set_size_request(GTK_WIDGET(tab_contents_container_->widget()), |
| 257 dialog_size.width(), | 250 dialog_size.width(), |
| 258 dialog_size.height()); | 251 dialog_size.height()); |
| 259 } | |
| 260 gfx::Size minimum_dialog_size; | |
| 261 delegate_->GetMinimumDialogSize(&minimum_dialog_size); | |
| 262 if (!minimum_dialog_size.IsEmpty()) { | |
| 263 gtk_widget_set_size_request(GTK_WIDGET(tab_contents_container_->widget()), | |
| 264 minimum_dialog_size.width(), | |
| 265 minimum_dialog_size.height()); | |
| 266 } | |
| 267 | 252 |
| 268 gtk_widget_show_all(dialog_); | 253 gtk_widget_show_all(dialog_); |
| 269 | 254 |
| 270 return GTK_WINDOW(dialog_); | 255 return GTK_WINDOW(dialog_); |
| 271 } | 256 } |
| 272 | 257 |
| 273 void HtmlDialogGtk::OnResponse(GtkWidget* dialog, int response_id) { | 258 void HtmlDialogGtk::OnResponse(GtkWidget* dialog, int response_id) { |
| 274 OnDialogClosed(std::string()); | 259 OnDialogClosed(std::string()); |
| 275 } | 260 } |
| OLD | NEW |