platform_util.h revision 5821806d5e7f356e8fa4b058a389a808ea183019
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.
4
5#ifndef CHROME_BROWSER_PLATFORM_UTIL_H_
6#define CHROME_BROWSER_PLATFORM_UTIL_H_
7
8#include <string>
9
10#include "base/string16.h"
11#include "ui/gfx/native_widget_types.h"
12
13class FilePath;
14class GURL;
15
16namespace platform_util {
17
18// Show the given file in a file manager. If possible, select the file.
19// Must be called from the UI thread.
20void ShowItemInFolder(const FilePath& full_path);
21
22// Open the given file in the desktop's default manner.
23// Must be called from the UI thread.
24void OpenItem(const FilePath& full_path);
25
26// Open the given external protocol URL in the desktop's default manner.
27// (For example, mailto: URLs in the default mail user agent.)
28void OpenExternal(const GURL& url);
29
30// Get the top level window for the native view. This can return NULL.
31gfx::NativeWindow GetTopLevel(gfx::NativeView view);
32
33// Get the direct parent of |view|, may return NULL.
34gfx::NativeView GetParent(gfx::NativeView view);
35
36// Returns true if |window| is the foreground top level window.
37bool IsWindowActive(gfx::NativeWindow window);
38
39// Activate the window, bringing it to the foreground top level.
40void ActivateWindow(gfx::NativeWindow window);
41
42// Returns true if the view is visible. The exact definition of this is
43// platform-specific, but it is generally not "visible to the user", rather
44// whether the view has the visible attribute set.
45bool IsVisible(gfx::NativeView view);
46
47#if defined(OS_MACOSX)
48// On 10.7+, back and forward swipe gestures can be triggered using a scroll
49// gesture, if enabled in System Preferences. This function returns true if
50// the feature is supported and enabled, and false otherwise.
51bool IsSwipeTrackingFromScrollEventsEnabled();
52#endif
53
54}  // platform_util
55
56#endif  // CHROME_BROWSER_PLATFORM_UTIL_H_
57