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_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_MANAGER_UTIL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_MANAGER_UTIL_H_ |
6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_MANAGER_UTIL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_MANAGER_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // the left panel, and that is all we want. | 66 // the left panel, and that is all we want. |
67 // If there is no File Browser open, this call opens a new one pointing to | 67 // If there is no File Browser open, this call opens a new one pointing to |
68 // |path|. In this case the tab will automatically close on |path| unmount. | 68 // |path|. In this case the tab will automatically close on |path| unmount. |
69 void ViewRemovableDrive(const base::FilePath& path); | 69 void ViewRemovableDrive(const base::FilePath& path); |
70 | 70 |
71 // Opens an action choice dialog for an external drive. | 71 // Opens an action choice dialog for an external drive. |
72 // One of the actions is opening the File Manager. Passes |advanced_mode| | 72 // One of the actions is opening the File Manager. Passes |advanced_mode| |
73 // flag to the dialog. If it is enabled, then auto-choice gets disabled. | 73 // flag to the dialog. If it is enabled, then auto-choice gets disabled. |
74 void OpenActionChoiceDialog(const base::FilePath& path, bool advanced_mode); | 74 void OpenActionChoiceDialog(const base::FilePath& path, bool advanced_mode); |
75 | 75 |
76 // Opens item with the default File Browser handler. | 76 // Opens an item (file or directory). If the target is a directory, the |
| 77 // directory will be opened in the file manager. If the target is a file, the |
| 78 // file will be opened using a file handler, a file browser handler, or the |
| 79 // browser (open in a tab). The default handler has precedence over other |
| 80 // handlers, if defined for the type of the target file. |
77 void ViewItem(const base::FilePath& path); | 81 void ViewItem(const base::FilePath& path); |
78 | 82 |
79 // Opens file browser on the folder containing the file, with the file selected. | 83 // Opens file browser on the folder containing the file, with the file selected. |
80 void ShowFileInFolder(const base::FilePath& path); | 84 void ShowFileInFolder(const base::FilePath& path); |
81 | 85 |
82 // Executes the built-in File Manager handler or tries to open |path| directly | 86 // Opens the file specified by |path| with the browser. This function takes |
83 // in the browser. Returns false if neither is possible. | 87 // care of the following intricacies: |
84 bool ExecuteBuiltinHandler(Browser* browser, const base::FilePath& path); | 88 // |
| 89 // - If the file is a Drive hosted document, the hosted document will be |
| 90 // opened in the browser by extracting the right URL for the file. |
| 91 // - If the file is a CRX file, the CRX file will be installed. |
| 92 // - If the file is on Drive, the file will be downloaded from Drive as |
| 93 // needed. |
| 94 // |
| 95 // Returns false if failed to open. This happens if the file type is unknown. |
| 96 bool OpenFileWithBrowser(Browser* browser, const base::FilePath& path); |
85 | 97 |
86 // Checks whether a pepper plugin for |file_extension| is enabled. | 98 // Checks whether a pepper plugin for |file_extension| is enabled. |
87 bool ShouldBeOpenedWithPlugin(Profile* profile, const char* file_extension); | 99 bool ShouldBeOpenedWithPlugin(Profile* profile, const char* file_extension); |
88 | 100 |
89 // Returns the MIME type of |file_path|. | 101 // Returns the MIME type of |file_path|. |
90 std::string GetMimeTypeForPath(const base::FilePath& file_path); | 102 std::string GetMimeTypeForPath(const base::FilePath& file_path); |
91 | 103 |
92 } // namespace util | 104 } // namespace util |
93 } // namespace file_manager | 105 } // namespace file_manager |
94 | 106 |
95 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_MANAGER_UTIL_H_ | 107 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_MANAGER_UTIL_H_ |
OLD | NEW |