| Index: chrome/browser/ui/gtk/simple_message_box_gtk.cc
|
| diff --git a/chrome/browser/platform_util_common_linux.cc b/chrome/browser/ui/gtk/simple_message_box_gtk.cc
|
| similarity index 55%
|
| copy from chrome/browser/platform_util_common_linux.cc
|
| copy to chrome/browser/ui/gtk/simple_message_box_gtk.cc
|
| index 718dc5f34104b2c71fcc4f53e28592e2ed7d65f6..3e90f6e06726cb6e4f3bf1c4a16511ea6f536571 100644
|
| --- a/chrome/browser/platform_util_common_linux.cc
|
| +++ b/chrome/browser/ui/gtk/simple_message_box_gtk.cc
|
| @@ -2,19 +2,11 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "chrome/browser/platform_util.h"
|
| +#include "chrome/browser/simple_message_box.h"
|
|
|
| -#include <gtk/gtk.h>
|
| -
|
| -#include "base/file_util.h"
|
| #include "base/message_loop.h"
|
| -#include "base/process_util.h"
|
| -#include "base/string_util.h"
|
| #include "base/utf_string_conversions.h"
|
| #include "chrome/browser/ui/gtk/gtk_util.h"
|
| -#include "content/common/process_watcher.h"
|
| -#include "googleurl/src/gurl.h"
|
| -#include "ui/gfx/native_widget_types.h"
|
|
|
| namespace {
|
|
|
| @@ -45,9 +37,7 @@ void SetDialogTitle(GtkWidget* dialog, const string16& title) {
|
|
|
| int g_dialog_response;
|
|
|
| -void HandleOnResponseDialog(GtkWidget* widget,
|
| - int response,
|
| - void* user_data) {
|
| +void HandleOnResponseDialog(GtkWidget* widget, int response, void* user_data) {
|
| g_dialog_response = response;
|
| gtk_widget_destroy(widget);
|
| MessageLoop::current()->QuitNow();
|
| @@ -55,36 +45,17 @@ void HandleOnResponseDialog(GtkWidget* widget,
|
|
|
| } // namespace
|
|
|
| -namespace platform_util {
|
| -
|
| -gfx::NativeWindow GetTopLevel(gfx::NativeView view) {
|
| - // A detached widget won't have a toplevel window as an ancestor, so we can't
|
| - // assume that the query for toplevel will return a window.
|
| - GtkWidget* toplevel = gtk_widget_get_ancestor(view, GTK_TYPE_WINDOW);
|
| - return GTK_IS_WINDOW(toplevel) ? GTK_WINDOW(toplevel) : NULL;
|
| -}
|
| -
|
| -gfx::NativeView GetParent(gfx::NativeView view) {
|
| - return gtk_widget_get_parent(view);
|
| -}
|
| -
|
| -bool IsWindowActive(gfx::NativeWindow window) {
|
| - return gtk_window_is_active(window);
|
| -}
|
| -
|
| -void ActivateWindow(gfx::NativeWindow window) {
|
| - gtk_window_present(window);
|
| -}
|
| -
|
| -bool IsVisible(gfx::NativeView view) {
|
| - return gtk_widget_get_visible(view);
|
| -}
|
| -
|
| -void SimpleErrorBox(gfx::NativeWindow parent,
|
| - const string16& title,
|
| - const string16& message) {
|
| - GtkWidget* dialog = gtk_message_dialog_new(parent, GTK_DIALOG_MODAL,
|
| - GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", UTF16ToUTF8(message).c_str());
|
| +namespace browser {
|
| +
|
| +void ShowErrorBox(gfx::NativeWindow parent,
|
| + const string16& title,
|
| + const string16& message) {
|
| + GtkWidget* dialog = gtk_message_dialog_new(parent,
|
| + GTK_DIALOG_MODAL,
|
| + GTK_MESSAGE_ERROR,
|
| + GTK_BUTTONS_OK,
|
| + "%s",
|
| + UTF16ToUTF8(message).c_str());
|
| gtk_util::ApplyMessageDialogQuirks(dialog);
|
| SetDialogTitle(dialog, title);
|
|
|
| @@ -93,12 +64,15 @@ void SimpleErrorBox(gfx::NativeWindow parent,
|
| gtk_util::ShowDialog(dialog);
|
| }
|
|
|
| -bool SimpleYesNoBox(gfx::NativeWindow parent,
|
| - const string16& title,
|
| - const string16& message) {
|
| - GtkWidget* dialog = gtk_message_dialog_new(parent, GTK_DIALOG_MODAL,
|
| - GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "%s",
|
| - UTF16ToUTF8(message).c_str());
|
| +bool ShowYesNoBox(gfx::NativeWindow parent,
|
| + const string16& title,
|
| + const string16& message) {
|
| + GtkWidget* dialog = gtk_message_dialog_new(parent,
|
| + GTK_DIALOG_MODAL,
|
| + GTK_MESSAGE_QUESTION,
|
| + GTK_BUTTONS_YES_NO,
|
| + "%s",
|
| + UTF16ToUTF8(message).c_str());
|
| gtk_util::ApplyMessageDialogQuirks(dialog);
|
| SetDialogTitle(dialog, title);
|
|
|
| @@ -113,4 +87,4 @@ bool SimpleYesNoBox(gfx::NativeWindow parent,
|
| return g_dialog_response == GTK_RESPONSE_YES;
|
| }
|
|
|
| -} // namespace platform_util
|
| +} // namespace browser
|
|
|