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/strings/string16.h"
11 #include "ui/gfx/native_widget_types.h"
20 namespace platform_util
{
22 // Show the given file in a file manager. If possible, select the file.
23 // The |profile| is used to determine the running profile of file manager app
24 // in Chrome OS only. Not used in other platforms.
25 // Must be called from the UI thread.
26 void ShowItemInFolder(Profile
* profile
, const base::FilePath
& full_path
);
28 // Open the given file in the desktop's default manner.
29 // Must be called from the UI thread.
30 void OpenItem(Profile
* profile
, const base::FilePath
& full_path
);
32 // Open the given external protocol URL in the desktop's default manner.
33 // (For example, mailto: URLs in the default mail user agent.)
34 // Must be called from the UI thread.
35 void OpenExternal(Profile
* profile
, const GURL
& url
);
37 // Get the top level window for the native view. This can return NULL.
38 gfx::NativeWindow
GetTopLevel(gfx::NativeView view
);
40 // Get the direct parent of |view|, may return NULL.
41 gfx::NativeView
GetParent(gfx::NativeView view
);
43 // Returns true if |window| is the foreground top level window.
44 bool IsWindowActive(gfx::NativeWindow window
);
46 // Activate the window, bringing it to the foreground top level.
47 void ActivateWindow(gfx::NativeWindow window
);
49 // Returns true if the view is visible. The exact definition of this is
50 // platform-specific, but it is generally not "visible to the user", rather
51 // whether the view has the visible attribute set.
52 bool IsVisible(gfx::NativeView view
);
54 #if defined(OS_MACOSX)
55 // On 10.7+, back and forward swipe gestures can be triggered using a scroll
56 // gesture, if enabled in System Preferences. This function returns true if
57 // the feature is supported and enabled, and false otherwise.
58 bool IsSwipeTrackingFromScrollEventsEnabled();
61 } // namespace platform_util
63 #endif // CHROME_BROWSER_PLATFORM_UTIL_H_