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" |
11 #include "ui/shell_dialogs/select_file_dialog.h" | 11 #include "ui/shell_dialogs/select_file_dialog.h" |
12 | 12 |
13 class Browser; | 13 class Browser; |
14 class GURL; | 14 class GURL; |
15 class Profile; | 15 class Profile; |
16 | 16 |
17 extern const char kFileBrowserDomain[]; | 17 extern const char kFileBrowserDomain[]; |
18 extern const char kFileBrowserGalleryTaskId[]; | 18 extern const char kFileBrowserGalleryTaskId[]; |
19 extern const char kFileBrowserWatchTaskId[]; | 19 extern const char kFileBrowserWatchTaskId[]; |
20 | 20 |
21 // File manager helper methods. | 21 // File manager helper methods. |
22 namespace file_manager { | 22 namespace file_manager { |
23 namespace util { | 23 namespace util { |
24 | 24 |
25 // Gets base file browser url. | 25 // Gets base file browser url. |
26 GURL GetFileBrowserExtensionUrl(); | 26 GURL GetFileBrowserExtensionUrl(); |
27 GURL GetFileBrowserUrl(); | 27 GURL GetFileBrowserUrl(); |
28 GURL GetMediaPlayerUrl(); | 28 GURL GetMediaPlayerUrl(); |
29 GURL GetVideoPlayerUrl(); | |
30 | 29 |
31 // Converts |relative_path| (e.g., "drive/root" or "Downloads") into external | 30 // Converts |relative_path| (e.g., "drive/root" or "Downloads") into external |
32 // filesystem URL (e.g., filesystem://id/external/drive/root). | 31 // filesystem URL (e.g., filesystem://id/external/drive/root). |
33 GURL ConvertRelativePathToFileSystemUrl(const base::FilePath& relative_path, | 32 GURL ConvertRelativePathToFileSystemUrl(const base::FilePath& relative_path, |
34 const std::string& extension_id); | 33 const std::string& extension_id); |
35 | 34 |
36 // Converts |full_file_path| (e.g., "/special/drive/root" or | 35 // Converts |full_file_path| (e.g., "/special/drive/root" or |
37 // "/home/chronos/user/Downloads") into external filesystem URL. Returns false | 36 // "/home/chronos/user/Downloads") into external filesystem URL. Returns false |
38 // if |full_file_path| is not managed by the external filesystem provider. | 37 // if |full_file_path| is not managed by the external filesystem provider. |
39 bool ConvertFileToFileSystemUrl(Profile* profile, | 38 bool ConvertFileToFileSystemUrl(Profile* profile, |
(...skipping 22 matching lines...) Expand all Loading... |
62 string16 GetTitleFromType(ui::SelectFileDialog::Type type); | 61 string16 GetTitleFromType(ui::SelectFileDialog::Type type); |
63 | 62 |
64 // Shows a freshly mounted removable drive. | 63 // Shows a freshly mounted removable drive. |
65 // If there is another File Browser instance open this call does nothing. | 64 // If there is another File Browser instance open this call does nothing. |
66 // The mount event will cause file_manager.js to show the new drive in | 65 // The mount event will cause file_manager.js to show the new drive in |
67 // the left panel, and that is all we want. | 66 // the left panel, and that is all we want. |
68 // 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 |
69 // |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. |
70 void ViewRemovableDrive(const base::FilePath& path); | 69 void ViewRemovableDrive(const base::FilePath& path); |
71 | 70 |
72 // Opens a new window of the Files.app on the specified url using the | |
73 // provided profile. If |profile| is null, then the default one is used. | |
74 void OpenNewWindow(Profile* profile, const GURL& url); | |
75 | |
76 // Opens an action choice dialog for an external drive. | 71 // Opens an action choice dialog for an external drive. |
77 // 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| |
78 // 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. |
79 void OpenActionChoiceDialog(const base::FilePath& path, bool advanced_mode); | 74 void OpenActionChoiceDialog(const base::FilePath& path, bool advanced_mode); |
80 | 75 |
81 // Opens item with the default File Browser handler. | 76 // Opens item with the default File Browser handler. |
82 void ViewItem(const base::FilePath& path); | 77 void ViewItem(const base::FilePath& path); |
83 | 78 |
84 // Opens file browser on the folder containing the file, with the file selected. | 79 // Opens file browser on the folder containing the file, with the file selected. |
85 void ShowFileInFolder(const base::FilePath& path); | 80 void ShowFileInFolder(const base::FilePath& path); |
86 | 81 |
87 // Executes the built-in File Manager handler or tries to open |file| directly | 82 // Executes the built-in File Manager handler or tries to open |file| directly |
88 // in the browser. Returns false if neither is possible. | 83 // in the browser. Returns false if neither is possible. |
89 bool ExecuteBuiltinHandler( | 84 bool ExecuteBuiltinHandler( |
90 Browser* browser, | 85 Browser* browser, |
91 const base::FilePath& path, | 86 const base::FilePath& path, |
92 const std::string& internal_task_id); | 87 const std::string& internal_task_id); |
93 | 88 |
94 // Checks whether a pepper plugin for |file_extension| is enabled. | 89 // Checks whether a pepper plugin for |file_extension| is enabled. |
95 bool ShouldBeOpenedWithPlugin(Profile* profile, const char* file_extension); | 90 bool ShouldBeOpenedWithPlugin(Profile* profile, const char* file_extension); |
96 | 91 |
97 // Returns the MIME type of |file_path|. | 92 // Returns the MIME type of |file_path|. |
98 std::string GetMimeTypeForPath(const base::FilePath& file_path); | 93 std::string GetMimeTypeForPath(const base::FilePath& file_path); |
99 | 94 |
100 } // namespace util | 95 } // namespace util |
101 } // namespace file_manager | 96 } // namespace file_manager |
102 | 97 |
103 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_MANAGER_UTIL_H_ | 98 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_MANAGER_UTIL_H_ |
OLD | NEW |