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