• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/strings/string16.h"
11 #include "ui/gfx/native_widget_types.h"
12 
13 class GURL;
14 class Profile;
15 
16 namespace base {
17 class FilePath;
18 }
19 
20 namespace platform_util {
21 
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);
27 
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);
31 
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);
36 
37 // Get the top level window for the native view. This can return NULL.
38 gfx::NativeWindow GetTopLevel(gfx::NativeView view);
39 
40 // Get the direct parent of |view|, may return NULL.
41 gfx::NativeView GetParent(gfx::NativeView view);
42 
43 // Returns true if |window| is the foreground top level window.
44 bool IsWindowActive(gfx::NativeWindow window);
45 
46 // Activate the window, bringing it to the foreground top level.
47 void ActivateWindow(gfx::NativeWindow window);
48 
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);
53 
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();
59 #endif
60 
61 }  // namespace platform_util
62 
63 #endif  // CHROME_BROWSER_PLATFORM_UTIL_H_
64