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