Add more checks to investigate SupervisedUserPrefStore crash at startup.
[chromium-blink-merge.git] / chrome / browser / platform_util.h
blob3e9346964fe4e399e3a47e4109521577fc41c7d5
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_
8 #include <string>
10 #include "base/strings/string16.h"
11 #include "ui/gfx/native_widget_types.h"
13 class GURL;
14 class Profile;
16 namespace base {
17 class FilePath;
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 // Returns a NativeView handle for parenting dialogs off |window|. This can be
41 // used to position a dialog using a NativeWindow, when a NativeView (e.g.
42 // browser tab) isn't available.
43 gfx::NativeView GetViewForWindow(gfx::NativeWindow window);
45 // Get the direct parent of |view|, may return NULL.
46 gfx::NativeView GetParent(gfx::NativeView view);
48 // Returns true if |window| is the foreground top level window.
49 bool IsWindowActive(gfx::NativeWindow window);
51 // Activate the window, bringing it to the foreground top level.
52 void ActivateWindow(gfx::NativeWindow window);
54 // Returns true if the view is visible. The exact definition of this is
55 // platform-specific, but it is generally not "visible to the user", rather
56 // whether the view has the visible attribute set.
57 bool IsVisible(gfx::NativeView view);
59 #if defined(OS_MACOSX)
60 // On 10.7+, back and forward swipe gestures can be triggered using a scroll
61 // gesture, if enabled in System Preferences. This function returns true if
62 // the feature is supported and enabled, and false otherwise.
63 bool IsSwipeTrackingFromScrollEventsEnabled();
64 #endif
66 } // namespace platform_util
68 #endif // CHROME_BROWSER_PLATFORM_UTIL_H_