1// Copyright (c) 2011 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#pragma once
8
9#include "base/string16.h"
10#include "ui/gfx/native_widget_types.h"
11
12class FilePath;
13class GURL;
14
15namespace platform_util {
16
17// Show the given file in a file manager. If possible, select the file.
18void ShowItemInFolder(const FilePath& full_path);
19
20// Open the given file in the desktop's default manner.
21void OpenItem(const FilePath& full_path);
22
23// Open the given external protocol URL in the desktop's default manner.
24// (For example, mailto: URLs in the default mail user agent.)
25void OpenExternal(const GURL& url);
26
27// Get the top level window for the native view. This can return NULL.
28gfx::NativeWindow GetTopLevel(gfx::NativeView view);
29
30// Get the direct parent of |view|, may return NULL.
31gfx::NativeView GetParent(gfx::NativeView view);
32
33// Returns true if |window| is the foreground top level window.
34bool IsWindowActive(gfx::NativeWindow window);
35
36// Activate the window, bringing it to the foreground top level.
37void ActivateWindow(gfx::NativeWindow window);
38
39// Returns true if the view is visible. The exact definition of this is
40// platform-specific, but it is generally not "visible to the user", rather
41// whether the view has the visible attribute set.
42bool IsVisible(gfx::NativeView view);
43
44// Pops up an error box with an OK button. If |parent| is non-null, the box
45// will be modal on it. (On Mac, it is always app-modal.) Generally speaking,
46// this function should not be used for much. Infobars are preferred.
47void SimpleErrorBox(gfx::NativeWindow parent,
48                    const string16& title,
49                    const string16& message);
50
51// Pops up a dialog box with two buttons (Yes/No), with the default button of
52// Yes. If |parent| is non-null, the box will be modal on it. (On Mac, it is
53// always app-modal.) Returns true if the Yes button was chosen.
54bool SimpleYesNoBox(gfx::NativeWindow parent,
55                    const string16& title,
56                    const string16& message);
57
58// Return a human readable modifier for the version string.  For a
59// branded Chrome (not Chromium), this modifier is the channel (dev,
60// beta, but "" for stable).
61std::string GetVersionStringModifier();
62
63// Returns true if the running browser can be set as the default browser.
64bool CanSetAsDefaultBrowser();
65
66}
67
68#endif  // CHROME_BROWSER_PLATFORM_UTIL_H_
69