| 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" |
| 11 #include "chrome/browser/chromeos/frame/bubble_window.h" | 11 #include "chrome/browser/chromeos/frame/bubble_window.h" |
| 12 #include "chrome/browser/ui/dialog_style.h" |
| 12 #include "chrome/browser/ui/views/window.h" | 13 #include "chrome/browser/ui/views/window.h" |
| 13 #include "ui/base/gtk/gtk_signal.h" | 14 #include "ui/base/gtk/gtk_signal.h" |
| 14 #include "ui/views/window/dialog_delegate.h" | 15 #include "ui/views/window/dialog_delegate.h" |
| 15 #include "ui/views/window/non_client_view.h" | 16 #include "ui/views/window/non_client_view.h" |
| 16 #include "views/controls/native/native_view_host.h" | 17 #include "views/controls/native/native_view_host.h" |
| 17 #include "views/widget/widget.h" | 18 #include "views/widget/widget.h" |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 const int kDialogPadding = 3; | 22 const int kDialogPadding = 3; |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 preferred_size_.set_height(min_size_.height()); | 325 preferred_size_.set_height(min_size_.height()); |
| 325 } | 326 } |
| 326 | 327 |
| 327 void ShowNativeDialog(gfx::NativeWindow parent, | 328 void ShowNativeDialog(gfx::NativeWindow parent, |
| 328 gfx::NativeView native_dialog, | 329 gfx::NativeView native_dialog, |
| 329 int flags, | 330 int flags, |
| 330 const gfx::Size& size, | 331 const gfx::Size& size, |
| 331 const gfx::Size& min_size) { | 332 const gfx::Size& min_size) { |
| 332 NativeDialogHost* native_dialog_host = | 333 NativeDialogHost* native_dialog_host = |
| 333 new NativeDialogHost(native_dialog, flags, size, min_size); | 334 new NativeDialogHost(native_dialog, flags, size, min_size); |
| 334 browser::CreateViewsWindow(parent, native_dialog_host); | 335 browser::CreateViewsWindow(parent, native_dialog_host, STYLE_GENERIC); |
| 335 native_dialog_host->GetWidget()->Show(); | 336 native_dialog_host->GetWidget()->Show(); |
| 336 } | 337 } |
| 337 | 338 |
| 338 gfx::NativeWindow GetNativeDialogWindow(gfx::NativeView native_dialog) { | 339 gfx::NativeWindow GetNativeDialogWindow(gfx::NativeView native_dialog) { |
| 339 NativeDialogHost* host = reinterpret_cast<NativeDialogHost*>( | 340 NativeDialogHost* host = reinterpret_cast<NativeDialogHost*>( |
| 340 g_object_get_data(G_OBJECT(native_dialog), kNativeDialogHost)); | 341 g_object_get_data(G_OBJECT(native_dialog), kNativeDialogHost)); |
| 341 return host ? host->GetWidget()->GetNativeWindow() : NULL; | 342 return host ? host->GetWidget()->GetNativeWindow() : NULL; |
| 342 } | 343 } |
| 343 | 344 |
| 344 gfx::Rect GetNativeDialogContentsBounds(gfx::NativeView native_dialog) { | 345 gfx::Rect GetNativeDialogContentsBounds(gfx::NativeView native_dialog) { |
| 345 NativeDialogHost* host = reinterpret_cast<NativeDialogHost*>( | 346 NativeDialogHost* host = reinterpret_cast<NativeDialogHost*>( |
| 346 g_object_get_data(G_OBJECT(native_dialog), kNativeDialogHost)); | 347 g_object_get_data(G_OBJECT(native_dialog), kNativeDialogHost)); |
| 347 return host ? host->bounds() : gfx::Rect(); | 348 return host ? host->bounds() : gfx::Rect(); |
| 348 } | 349 } |
| 349 | 350 |
| 350 } // namespace chromeos | 351 } // namespace chromeos |
| OLD | NEW |