| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/common/platform_util.h" | 5 #include "chrome/common/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/process_util.h" | 10 #include "base/process_util.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "chrome/browser/gtk/gtk_theme_provider.h" | |
| 13 #include "chrome/common/gtk_util.h" | 12 #include "chrome/common/gtk_util.h" |
| 14 #include "chrome/common/process_watcher.h" | 13 #include "chrome/common/process_watcher.h" |
| 15 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
| 16 | 15 |
| 17 namespace { | 16 namespace { |
| 18 | 17 |
| 19 void XDGOpen(const std::string& path) { | 18 void XDGOpen(const std::string& path) { |
| 20 std::vector<std::string> argv; | 19 std::vector<std::string> argv; |
| 21 argv.push_back("xdg-open"); | 20 argv.push_back("xdg-open"); |
| 22 argv.push_back(path); | 21 argv.push_back(path); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 XDGOpen(url.spec()); | 65 XDGOpen(url.spec()); |
| 67 } | 66 } |
| 68 | 67 |
| 69 gfx::NativeWindow GetTopLevel(gfx::NativeView view) { | 68 gfx::NativeWindow GetTopLevel(gfx::NativeView view) { |
| 70 // A detached widget won't have a toplevel window as an ancestor, so we can't | 69 // A detached widget won't have a toplevel window as an ancestor, so we can't |
| 71 // assume that the query for toplevel will return a window. | 70 // assume that the query for toplevel will return a window. |
| 72 GtkWidget* toplevel = gtk_widget_get_ancestor(view, GTK_TYPE_WINDOW); | 71 GtkWidget* toplevel = gtk_widget_get_ancestor(view, GTK_TYPE_WINDOW); |
| 73 return GTK_IS_WINDOW(toplevel) ? GTK_WINDOW(toplevel) : NULL; | 72 return GTK_IS_WINDOW(toplevel) ? GTK_WINDOW(toplevel) : NULL; |
| 74 } | 73 } |
| 75 | 74 |
| 76 string16 GetWindowTitle(gfx::NativeWindow window) { | |
| 77 const gchar* title = gtk_window_get_title(window); | |
| 78 return UTF8ToUTF16(title); | |
| 79 } | |
| 80 | |
| 81 bool IsWindowActive(gfx::NativeWindow window) { | 75 bool IsWindowActive(gfx::NativeWindow window) { |
| 82 return gtk_window_is_active(window); | 76 return gtk_window_is_active(window); |
| 83 } | 77 } |
| 84 | 78 |
| 85 bool IsVisible(gfx::NativeView view) { | 79 bool IsVisible(gfx::NativeView view) { |
| 86 return GTK_WIDGET_VISIBLE(view); | 80 return GTK_WIDGET_VISIBLE(view); |
| 87 } | 81 } |
| 88 | 82 |
| 89 void SimpleErrorBox(gfx::NativeWindow parent, | 83 void SimpleErrorBox(gfx::NativeWindow parent, |
| 90 const string16& title, | 84 const string16& title, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // do nothing. | 123 // do nothing. |
| 130 } else { | 124 } else { |
| 131 modifier = "unknown"; | 125 modifier = "unknown"; |
| 132 } | 126 } |
| 133 #endif | 127 #endif |
| 134 | 128 |
| 135 return ASCIIToUTF16(modifier); | 129 return ASCIIToUTF16(modifier); |
| 136 } | 130 } |
| 137 | 131 |
| 138 } // namespace platform_util | 132 } // namespace platform_util |
| OLD | NEW |