| 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 #ifndef CHROME_BROWSER_PLATFORM_UTIL_H_ | 5 #ifndef CHROME_BROWSER_PLATFORM_UTIL_H_ |
| 6 #define CHROME_BROWSER_PLATFORM_UTIL_H_ | 6 #define CHROME_BROWSER_PLATFORM_UTIL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/process.h" |
| 11 #include "base/string16.h" | 12 #include "base/string16.h" |
| 12 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
| 13 | 14 |
| 14 class FilePath; | 15 class FilePath; |
| 15 class GURL; | 16 class GURL; |
| 16 | 17 |
| 17 namespace platform_util { | 18 namespace platform_util { |
| 18 | 19 |
| 19 // Show the given file in a file manager. If possible, select the file. | 20 // Show the given file in a file manager. If possible, select the file. |
| 20 // Must be called from the UI thread. | 21 // Must be called from the UI thread. |
| 21 void ShowItemInFolder(const FilePath& full_path); | 22 void ShowItemInFolder(const FilePath& full_path); |
| 22 | 23 |
| 23 // Open the given file in the desktop's default manner. | 24 // Open the given file in the desktop's default manner. |
| 24 // Must be called from the UI thread. | 25 // Must be called from the UI thread. |
| 25 void OpenItem(const FilePath& full_path); | 26 // If |process_handle| is not NULL, it will contain the handle of the newly |
| 27 // spawned process that opened the file on Windows and Linux. On Mac or |
| 28 // Chrome OS, the process handle will be unchanged. |
| 29 // NOTE: In this case, the caller is responsible for closing the handle |
| 30 // (on Windows) / ensuring that the process gets reaped (on Linux). Otherwise |
| 31 // these things will be done automatically. |
| 32 // XXX |
| 33 void OpenItem(const FilePath& full_path, base::ProcessHandle* process_handle); |
| 26 | 34 |
| 27 // Open the given external protocol URL in the desktop's default manner. | 35 // Open the given external protocol URL in the desktop's default manner. |
| 28 // (For example, mailto: URLs in the default mail user agent.) | 36 // (For example, mailto: URLs in the default mail user agent.) |
| 29 void OpenExternal(const GURL& url); | 37 void OpenExternal(const GURL& url); |
| 30 | 38 |
| 31 // Get the top level window for the native view. This can return NULL. | 39 // Get the top level window for the native view. This can return NULL. |
| 32 gfx::NativeWindow GetTopLevel(gfx::NativeView view); | 40 gfx::NativeWindow GetTopLevel(gfx::NativeView view); |
| 33 | 41 |
| 34 // Get the direct parent of |view|, may return NULL. | 42 // Get the direct parent of |view|, may return NULL. |
| 35 gfx::NativeView GetParent(gfx::NativeView view); | 43 gfx::NativeView GetParent(gfx::NativeView view); |
| 36 | 44 |
| 37 // Returns true if |window| is the foreground top level window. | 45 // Returns true if |window| is the foreground top level window. |
| 38 bool IsWindowActive(gfx::NativeWindow window); | 46 bool IsWindowActive(gfx::NativeWindow window); |
| 39 | 47 |
| 40 // Activate the window, bringing it to the foreground top level. | 48 // Activate the window, bringing it to the foreground top level. |
| 41 void ActivateWindow(gfx::NativeWindow window); | 49 void ActivateWindow(gfx::NativeWindow window); |
| 42 | 50 |
| 43 // Returns true if the view is visible. The exact definition of this is | 51 // Returns true if the view is visible. The exact definition of this is |
| 44 // platform-specific, but it is generally not "visible to the user", rather | 52 // platform-specific, but it is generally not "visible to the user", rather |
| 45 // whether the view has the visible attribute set. | 53 // whether the view has the visible attribute set. |
| 46 bool IsVisible(gfx::NativeView view); | 54 bool IsVisible(gfx::NativeView view); |
| 47 | 55 |
| 48 } // platform_util | 56 } // platform_util |
| 49 | 57 |
| 50 #endif // CHROME_BROWSER_PLATFORM_UTIL_H_ | 58 #endif // CHROME_BROWSER_PLATFORM_UTIL_H_ |
| OLD | NEW |