Home | History | Annotate | Download | only in browser
      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 
     15 namespace base {
     16 class FilePath;
     17 }
     18 
     19 namespace platform_util {
     20 
     21 // Show the given file in a file manager. If possible, select the file.
     22 // Must be called from the UI thread.
     23 void ShowItemInFolder(const base::FilePath& full_path);
     24 
     25 // Open the given file in the desktop's default manner.
     26 // Must be called from the UI thread.
     27 void OpenItem(const base::FilePath& full_path);
     28 
     29 // Open the given external protocol URL in the desktop's default manner.
     30 // (For example, mailto: URLs in the default mail user agent.)
     31 void OpenExternal(const GURL& url);
     32 
     33 // Get the top level window for the native view. This can return NULL.
     34 gfx::NativeWindow GetTopLevel(gfx::NativeView view);
     35 
     36 // Get the direct parent of |view|, may return NULL.
     37 gfx::NativeView GetParent(gfx::NativeView view);
     38 
     39 // Returns true if |window| is the foreground top level window.
     40 bool IsWindowActive(gfx::NativeWindow window);
     41 
     42 // Activate the window, bringing it to the foreground top level.
     43 void ActivateWindow(gfx::NativeWindow window);
     44 
     45 // 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
     47 // whether the view has the visible attribute set.
     48 bool IsVisible(gfx::NativeView view);
     49 
     50 #if defined(OS_MACOSX)
     51 // 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
     53 // the feature is supported and enabled, and false otherwise.
     54 bool IsSwipeTrackingFromScrollEventsEnabled();
     55 #endif
     56 
     57 }  // platform_util
     58 
     59 #endif  // CHROME_BROWSER_PLATFORM_UTIL_H_
     60