1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_PLATFORM_UTIL_H_
6 #define CHROME_BROWSER_PLATFORM_UTIL_H_
10 #include "base/string16.h"
11 #include "ui/gfx/native_widget_types.h"
19 namespace platform_util
{
21 // Show the given file in a file manager. If possible, select the file.
22 // Must be called from the UI thread.
23 void ShowItemInFolder(const base::FilePath
& full_path
);
25 // Open the given file in the desktop's default manner.
26 // Must be called from the UI thread.
27 void OpenItem(const base::FilePath
& full_path
);
29 // Open the given external protocol URL in the desktop's default manner.
30 // (For example, mailto: URLs in the default mail user agent.)
31 void OpenExternal(const GURL
& url
);
33 // Get the top level window for the native view. This can return NULL.
34 gfx::NativeWindow
GetTopLevel(gfx::NativeView view
);
36 // Get the direct parent of |view|, may return NULL.
37 gfx::NativeView
GetParent(gfx::NativeView view
);
39 // Returns true if |window| is the foreground top level window.
40 bool IsWindowActive(gfx::NativeWindow window
);
42 // Activate the window, bringing it to the foreground top level.
43 void ActivateWindow(gfx::NativeWindow window
);
45 // Returns true if the view is visible. The exact definition of this is
46 // platform-specific, but it is generally not "visible to the user", rather
47 // whether the view has the visible attribute set.
48 bool IsVisible(gfx::NativeView view
);
50 #if defined(OS_MACOSX)
51 // On 10.7+, back and forward swipe gestures can be triggered using a scroll
52 // gesture, if enabled in System Preferences. This function returns true if
53 // the feature is supported and enabled, and false otherwise.
54 bool IsSwipeTrackingFromScrollEventsEnabled();
59 #endif // CHROME_BROWSER_PLATFORM_UTIL_H_