| 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/platform_util.h" | 5 #include "chrome/browser/platform_util.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 bool IsWindowActive(gfx::NativeWindow window) { | 71 bool IsWindowActive(gfx::NativeWindow window) { |
| 72 return gtk_window_is_active(window); | 72 return gtk_window_is_active(window); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void ActivateWindow(gfx::NativeWindow window) { | 75 void ActivateWindow(gfx::NativeWindow window) { |
| 76 gtk_window_present(window); | 76 gtk_window_present(window); |
| 77 } | 77 } |
| 78 | 78 |
| 79 bool IsVisible(gfx::NativeView view) { | 79 bool IsVisible(gfx::NativeView view) { |
| 80 return GTK_WIDGET_VISIBLE(view); | 80 return gtk_widget_get_visible(view); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void SimpleErrorBox(gfx::NativeWindow parent, | 83 void SimpleErrorBox(gfx::NativeWindow parent, |
| 84 const string16& title, | 84 const string16& title, |
| 85 const string16& message) { | 85 const string16& message) { |
| 86 GtkWidget* dialog = gtk_message_dialog_new(parent, GTK_DIALOG_MODAL, | 86 GtkWidget* dialog = gtk_message_dialog_new(parent, GTK_DIALOG_MODAL, |
| 87 GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", UTF16ToUTF8(message).c_str()); | 87 GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", UTF16ToUTF8(message).c_str()); |
| 88 gtk_util::ApplyMessageDialogQuirks(dialog); | 88 gtk_util::ApplyMessageDialogQuirks(dialog); |
| 89 SetDialogTitle(dialog, title); | 89 SetDialogTitle(dialog, title); |
| 90 | 90 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 107 "response", | 107 "response", |
| 108 G_CALLBACK(HandleOnResponseDialog), | 108 G_CALLBACK(HandleOnResponseDialog), |
| 109 NULL); | 109 NULL); |
| 110 gtk_util::ShowDialog(dialog); | 110 gtk_util::ShowDialog(dialog); |
| 111 // Not gtk_dialog_run as it prevents timers from running in the unit tests. | 111 // Not gtk_dialog_run as it prevents timers from running in the unit tests. |
| 112 MessageLoop::current()->Run(); | 112 MessageLoop::current()->Run(); |
| 113 return g_dialog_response == GTK_RESPONSE_YES; | 113 return g_dialog_response == GTK_RESPONSE_YES; |
| 114 } | 114 } |
| 115 | 115 |
| 116 } // namespace platform_util | 116 } // namespace platform_util |
| OLD | NEW |