| OLD | NEW |
| (Empty) |
| 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_CHROMEOS_EXTENSIONS_FILE_MANAGER_UTIL_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_UTIL_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/files/file_path.h" | |
| 11 #include "chrome/browser/google_apis/operation_registry.h" | |
| 12 #include "googleurl/src/gurl.h" | |
| 13 #include "ui/shell_dialogs/select_file_dialog.h" | |
| 14 | |
| 15 class Browser; | |
| 16 class Profile; | |
| 17 | |
| 18 namespace base { | |
| 19 class ListValue; | |
| 20 } | |
| 21 | |
| 22 extern const char kFileBrowserDomain[]; | |
| 23 extern const char kFileBrowserGalleryTaskId[]; | |
| 24 extern const char kFileBrowserWatchTaskId[]; | |
| 25 | |
| 26 // File manager helper methods. | |
| 27 namespace file_manager_util { | |
| 28 | |
| 29 // Gets base file browser url. | |
| 30 GURL GetFileBrowserExtensionUrl(); | |
| 31 GURL GetFileBrowserUrl(); | |
| 32 GURL GetMediaPlayerUrl(); | |
| 33 GURL GetVideoPlayerUrl(); | |
| 34 | |
| 35 // Converts |full_file_path| into external filesystem: url. Returns false | |
| 36 // if |full_file_path| is not managed by the external filesystem provider. | |
| 37 bool ConvertFileToFileSystemUrl(Profile* profile, | |
| 38 const base::FilePath& full_file_path, | |
| 39 const std::string& extension_id, | |
| 40 GURL* url); | |
| 41 | |
| 42 // Converts |full_file_path| into |relative_path| within the external provider | |
| 43 // in File API. Returns false if |full_file_path| is not managed by the | |
| 44 // external filesystem provider. | |
| 45 bool ConvertFileToRelativeFileSystemPath(Profile* profile, | |
| 46 const std::string& extension_id, | |
| 47 const base::FilePath& full_file_path, | |
| 48 base::FilePath* relative_path); | |
| 49 | |
| 50 // Gets base file browser url for. | |
| 51 GURL GetFileBrowserUrlWithParams( | |
| 52 ui::SelectFileDialog::Type type, | |
| 53 const string16& title, | |
| 54 const base::FilePath& default_virtual_path, | |
| 55 const ui::SelectFileDialog::FileTypeInfo* file_types, | |
| 56 int file_type_index, | |
| 57 const base::FilePath::StringType& default_extension); | |
| 58 | |
| 59 // Get file dialog title string from its type. | |
| 60 string16 GetTitleFromType(ui::SelectFileDialog::Type type); | |
| 61 | |
| 62 // Shows a freshly mounted removable drive. | |
| 63 // If there is another File Browser instance open this call does nothing. | |
| 64 // The mount event will cause file_manager.js to show the new drive in | |
| 65 // the left panel, and that is all we want. | |
| 66 // If there is no File Browser open, this call opens a new one pointing to | |
| 67 // |path|. In this case the tab will automatically close on |path| unmount. | |
| 68 void ViewRemovableDrive(const base::FilePath& path); | |
| 69 | |
| 70 // Opens a new window of the Files.app on the specified url using the | |
| 71 // provided profile. If |profile| is null, then the default one is used. | |
| 72 void OpenNewWindow(Profile* profile, const GURL& url); | |
| 73 | |
| 74 // Opens an action choice dialog for an external drive. | |
| 75 // One of the actions is opening the File Manager. Passes |advanced_mode| | |
| 76 // flag to the dialog. If it is enabled, then auto-choice gets disabled. | |
| 77 void OpenActionChoiceDialog(const base::FilePath& path, bool advanced_mode); | |
| 78 | |
| 79 // Opens item with the default File Browser handler. | |
| 80 void ViewItem(const base::FilePath& path); | |
| 81 | |
| 82 // Opens file browser on the folder containing the file, with the file selected. | |
| 83 void ShowFileInFolder(const base::FilePath& path); | |
| 84 | |
| 85 // Opens file browser application. | |
| 86 void OpenFileBrowser(); | |
| 87 | |
| 88 // Executes the built-in File Manager handler or tries to open |file| directly | |
| 89 // in the browser. Returns false if neither is possible. | |
| 90 bool ExecuteBuiltinHandler( | |
| 91 Browser* browser, | |
| 92 const base::FilePath& path, | |
| 93 const std::string& internal_task_id); | |
| 94 | |
| 95 // Checks whether a pepper plugin for |file_extension| is enabled. | |
| 96 bool ShouldBeOpenedWithPlugin(Profile* profile, const char* file_extension); | |
| 97 | |
| 98 // Converts the vector of progress status to their JSON (Value) form. | |
| 99 base::ListValue* ProgressStatusVectorToListValue( | |
| 100 Profile* profile, | |
| 101 const std::string& extension_id, | |
| 102 const google_apis::OperationProgressStatusList& list); | |
| 103 | |
| 104 } // namespace file_manager_util | |
| 105 | |
| 106 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_UTIL_H_ | |
| OLD | NEW |