| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 UI_SHELL_DIALOGS_SELECT_FILE_DIALOG_H_ | 5 #ifndef UI_SHELL_DIALOGS_SELECT_FILE_DIALOG_H_ |
| 6 #define UI_SHELL_DIALOGS_SELECT_FILE_DIALOG_H_ | 6 #define UI_SHELL_DIALOGS_SELECT_FILE_DIALOG_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 bool include_all_files; | 128 bool include_all_files; |
| 129 | 129 |
| 130 // Specifies which type of paths the caller can handle. If it is | 130 // Specifies which type of paths the caller can handle. If it is |
| 131 // NATIVE_PATH, the dialog creates a native replica of the non-native file | 131 // NATIVE_PATH, the dialog creates a native replica of the non-native file |
| 132 // and returns its path, so that the caller can use it without any | 132 // and returns its path, so that the caller can use it without any |
| 133 // difference than when it were local. | 133 // difference than when it were local. |
| 134 enum AllowedPaths { ANY_PATH, NATIVE_PATH, NATIVE_OR_DRIVE_PATH }; | 134 enum AllowedPaths { ANY_PATH, NATIVE_PATH, NATIVE_OR_DRIVE_PATH }; |
| 135 AllowedPaths allowed_paths; | 135 AllowedPaths allowed_paths; |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 // Returns a file path with a base name at most 255 characters long. This |
| 139 // is the limit on Windows and Linux, and on Windows the system file |
| 140 // selection dialog will fail to open if the file name exceeds 255 characters. |
| 141 static base::FilePath GetShortenedFilePath(const base::FilePath& path); |
| 142 |
| 138 // Selects a File. | 143 // Selects a File. |
| 139 // Before doing anything this function checks if FileBrowsing is forbidden | 144 // Before doing anything this function checks if FileBrowsing is forbidden |
| 140 // by Policy. If so, it tries to show an InfoBar and behaves as though no File | 145 // by Policy. If so, it tries to show an InfoBar and behaves as though no File |
| 141 // was selected (the user clicked `Cancel` immediately). | 146 // was selected (the user clicked `Cancel` immediately). |
| 142 // Otherwise it will start displaying the dialog box. This will also | 147 // Otherwise it will start displaying the dialog box. This will also |
| 143 // block the calling window until the dialog box is complete. The listener | 148 // block the calling window until the dialog box is complete. The listener |
| 144 // associated with this object will be notified when the selection is | 149 // associated with this object will be notified when the selection is |
| 145 // complete. | 150 // complete. |
| 146 // |type| is the type of file dialog to be shown, see Type enumeration above. | 151 // |type| is the type of file dialog to be shown, see Type enumeration above. |
| 147 // |title| is the title to be displayed in the dialog. If this string is | 152 // |title| is the title to be displayed in the dialog. If this string is |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 std::unique_ptr<SelectFilePolicy> select_file_policy_; | 215 std::unique_ptr<SelectFilePolicy> select_file_policy_; |
| 211 | 216 |
| 212 DISALLOW_COPY_AND_ASSIGN(SelectFileDialog); | 217 DISALLOW_COPY_AND_ASSIGN(SelectFileDialog); |
| 213 }; | 218 }; |
| 214 | 219 |
| 215 SelectFileDialog* CreateSelectFileDialog(SelectFileDialog::Listener* listener, | 220 SelectFileDialog* CreateSelectFileDialog(SelectFileDialog::Listener* listener, |
| 216 SelectFilePolicy* policy); | 221 SelectFilePolicy* policy); |
| 217 } // namespace ui | 222 } // namespace ui |
| 218 | 223 |
| 219 #endif // UI_SHELL_DIALOGS_SELECT_FILE_DIALOG_H_ | 224 #endif // UI_SHELL_DIALOGS_SELECT_FILE_DIALOG_H_ |
| OLD | NEW |