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/chromeos/native_dialog_window.h" | 5 #include "chrome/browser/chromeos/native_dialog_window.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 GtkRequisition requsition = { 0 }; | 137 GtkRequisition requsition = { 0 }; |
138 gtk_widget_size_request(contents, &requsition); | 138 gtk_widget_size_request(contents, &requsition); |
139 | 139 |
140 if (preferred_size_.height() != requsition.height) { | 140 if (preferred_size_.height() != requsition.height) { |
141 preferred_size_.set_width(requsition.width); | 141 preferred_size_.set_width(requsition.width); |
142 preferred_size_.set_height(requsition.height); | 142 preferred_size_.set_height(requsition.height); |
143 CheckSize(); | 143 CheckSize(); |
144 SizeToPreferredSize(); | 144 SizeToPreferredSize(); |
145 | 145 |
146 gfx::Size window_size = window()->non_client_view()->GetPreferredSize(); | 146 gfx::Size window_size = window()->non_client_view()->GetPreferredSize(); |
147 gfx::Rect window_bounds = window()->GetBounds(); | 147 gfx::Rect window_bounds = window()->GetWindowScreenBounds(); |
148 window_bounds.set_width(window_size.width()); | 148 window_bounds.set_width(window_size.width()); |
149 window_bounds.set_height(window_size.height()); | 149 window_bounds.set_height(window_size.height()); |
150 window()->SetBoundsConstrained(window_bounds, NULL); | 150 window()->SetBoundsConstrained(window_bounds, NULL); |
151 } | 151 } |
152 } | 152 } |
153 } | 153 } |
154 | 154 |
155 void NativeDialogHost::OnDialogDestroy(GtkWidget* widget) { | 155 void NativeDialogHost::OnDialogDestroy(GtkWidget* widget) { |
156 dialog_ = NULL; | 156 dialog_ = NULL; |
157 destroy_signal_id_ = 0; | 157 destroy_signal_id_ = 0; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 return host ? host->window()->GetNativeWindow() : NULL; | 281 return host ? host->window()->GetNativeWindow() : NULL; |
282 } | 282 } |
283 | 283 |
284 gfx::Rect GetNativeDialogContentsBounds(gfx::NativeView native_dialog) { | 284 gfx::Rect GetNativeDialogContentsBounds(gfx::NativeView native_dialog) { |
285 NativeDialogHost* host = reinterpret_cast<NativeDialogHost*>( | 285 NativeDialogHost* host = reinterpret_cast<NativeDialogHost*>( |
286 g_object_get_data(G_OBJECT(native_dialog), kNativeDialogHost)); | 286 g_object_get_data(G_OBJECT(native_dialog), kNativeDialogHost)); |
287 return host ? host->bounds() : gfx::Rect(); | 287 return host ? host->bounds() : gfx::Rect(); |
288 } | 288 } |
289 | 289 |
290 } // namespace chromeos | 290 } // namespace chromeos |
OLD | NEW |