diff options
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/platform_util.h | 5 | ||||
-rw-r--r-- | chrome/common/platform_util_linux.cc | 6 | ||||
-rw-r--r-- | chrome/common/platform_util_mac.mm | 5 | ||||
-rw-r--r-- | chrome/common/platform_util_win.cc | 5 |
4 files changed, 21 insertions, 0 deletions
diff --git a/chrome/common/platform_util.h b/chrome/common/platform_util.h index 27ef5c4..3886f17 100644 --- a/chrome/common/platform_util.h +++ b/chrome/common/platform_util.h @@ -5,6 +5,8 @@ #ifndef CHROME_COMMON_PLATFORM_UTIL_H_ #define CHROME_COMMON_PLATFORM_UTIL_H_ +#include "base/gfx/native_widget_types.h" + class FilePath; namespace platform_util { @@ -12,6 +14,9 @@ namespace platform_util { // Show the given file in a file manager. If possible, select the file. void ShowItemInFolder(const FilePath& full_path); +// Get the top level window for the native view. This can return NULL. +gfx::NativeWindow GetTopLevel(gfx::NativeView view); + } #endif // CHROME_COMMON_PLATFORM_UTIL_H_ diff --git a/chrome/common/platform_util_linux.cc b/chrome/common/platform_util_linux.cc index de06f04..3c0f5f6 100644 --- a/chrome/common/platform_util_linux.cc +++ b/chrome/common/platform_util_linux.cc @@ -4,6 +4,8 @@ #include "chrome/common/platform_util.h" +#include <gtk/gtk.h> + #include "base/file_path.h" #include "base/file_util.h" #include "base/process_util.h" @@ -25,4 +27,8 @@ void ShowItemInFolder(const FilePath& full_path) { base::LaunchApp(argv, no_files, false, NULL); } +gfx::NativeWindow GetTopLevel(gfx::NativeView view) { + return GTK_WINDOW(gtk_widget_get_toplevel(view)); +} + } // namespace platform_util diff --git a/chrome/common/platform_util_mac.mm b/chrome/common/platform_util_mac.mm index ea8474d..3ee3a2f 100644 --- a/chrome/common/platform_util_mac.mm +++ b/chrome/common/platform_util_mac.mm @@ -13,4 +13,9 @@ void ShowItemInFolder(const FilePath& full_path) { NOTIMPLEMENTED(); } +gfx::NativeWindow GetTopLevel(gfx::NativeView view) { + NOTIMPLEMENTED(); + return NULL; +} + } // namespace platform_util diff --git a/chrome/common/platform_util_win.cc b/chrome/common/platform_util_win.cc index 217d832..16ea8c0 100644 --- a/chrome/common/platform_util_win.cc +++ b/chrome/common/platform_util_win.cc @@ -13,6 +13,7 @@ #include "base/file_path.h" #include "base/file_util.h" +#include "base/gfx/native_widget_types.h" #include "base/logging.h" #include "chrome/common/win_util.h" @@ -80,4 +81,8 @@ void ShowItemInFolder(const FilePath& full_path) { highlight, NULL); } +gfx::NativeWindow GetTopLevel(gfx::NativeView view) { + return GetAncestor(view, GA_ROOT); +} + } // namespace platform_util |