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 // This file provides functions for opening an item (file or directory) using
6 // the file manager.
7 
8 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_OPEN_UTIL_H_
9 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_OPEN_UTIL_H_
10 
11 #include "base/callback_forward.h"
12 #include "chrome/browser/platform_util.h"
13 
14 class Profile;
15 
16 namespace base {
17 class FilePath;
18 }
19 
20 namespace file_manager {
21 namespace util {
22 
23 // If |item_type| is OPEN_FILE: Opens an item using a file handler, a file
24 // browser handler, or the browser (open in a tab). The default handler has
25 // precedence over other handlers, if defined for the type of the target file.
26 //
27 // If |item_type| is OPEN_FOLDER: Open the directory at |file_path| using the
28 // file browser.
29 //
30 // It is an error for |file_path| to not match the type implied by |item_type|.
31 // This error will be reported to |callback|.
32 //
33 // If |callback| is null, shows an error message to the user indicating the
34 // error if the operation is unsuccessful. No error messages will be displayed
35 // if |callback| is non-null.
36 void OpenItem(Profile* profile,
37               const base::FilePath& file_path,
38               platform_util::OpenItemType item_type,
39               platform_util::OpenOperationCallback callback);
40 
41 // Opens the file manager for the folder containing the item specified by
42 // |file_path|, with the item selected.
43 void ShowItemInFolder(Profile* profile,
44                       const base::FilePath& file_path,
45                       platform_util::OpenOperationCallback callback);
46 
47 // Change the behavior of the above functions to do everything except launch any
48 // extensions including a file browser.
49 void DisableShellOperationsForTesting();
50 
51 }  // namespace util
52 }  // namespace file_manager
53 
54 #endif  // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_OPEN_UTIL_H_
55