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 #include "ui/shell_dialogs/select_file_dialog_win.h" | 5 #include "ui/shell_dialogs/select_file_dialog_win.h" |
6 | 6 |
7 #include <shlobj.h> | 7 #include <shlobj.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 class SelectFileDialogImpl : public ui::SelectFileDialog, | 161 class SelectFileDialogImpl : public ui::SelectFileDialog, |
162 public ui::BaseShellDialogImpl { | 162 public ui::BaseShellDialogImpl { |
163 public: | 163 public: |
164 SelectFileDialogImpl( | 164 SelectFileDialogImpl( |
165 Listener* listener, | 165 Listener* listener, |
166 ui::SelectFilePolicy* policy, | 166 ui::SelectFilePolicy* policy, |
167 const base::Callback<bool(OPENFILENAME*)>& get_open_file_name_impl, | 167 const base::Callback<bool(OPENFILENAME*)>& get_open_file_name_impl, |
168 const base::Callback<bool(OPENFILENAME*)>& get_save_file_name_impl); | 168 const base::Callback<bool(OPENFILENAME*)>& get_save_file_name_impl); |
169 | 169 |
170 // BaseShellDialog implementation: | 170 // BaseShellDialog implementation: |
171 virtual bool IsRunning(gfx::NativeWindow owning_window) const OVERRIDE; | 171 virtual bool IsRunning(gfx::NativeWindow owning_window) const override; |
172 virtual void ListenerDestroyed() OVERRIDE; | 172 virtual void ListenerDestroyed() override; |
173 | 173 |
174 protected: | 174 protected: |
175 // SelectFileDialog implementation: | 175 // SelectFileDialog implementation: |
176 virtual void SelectFileImpl( | 176 virtual void SelectFileImpl( |
177 Type type, | 177 Type type, |
178 const base::string16& title, | 178 const base::string16& title, |
179 const base::FilePath& default_path, | 179 const base::FilePath& default_path, |
180 const FileTypeInfo* file_types, | 180 const FileTypeInfo* file_types, |
181 int file_type_index, | 181 int file_type_index, |
182 const base::FilePath::StringType& default_extension, | 182 const base::FilePath::StringType& default_extension, |
183 gfx::NativeWindow owning_window, | 183 gfx::NativeWindow owning_window, |
184 void* params) OVERRIDE; | 184 void* params) override; |
185 | 185 |
186 private: | 186 private: |
187 virtual ~SelectFileDialogImpl(); | 187 virtual ~SelectFileDialogImpl(); |
188 | 188 |
189 // A struct for holding all the state necessary for displaying a Save dialog. | 189 // A struct for holding all the state necessary for displaying a Save dialog. |
190 struct ExecuteSelectParams { | 190 struct ExecuteSelectParams { |
191 ExecuteSelectParams(Type type, | 191 ExecuteSelectParams(Type type, |
192 const std::wstring& title, | 192 const std::wstring& title, |
193 const base::FilePath& default_path, | 193 const base::FilePath& default_path, |
194 const FileTypeInfo* file_types, | 194 const FileTypeInfo* file_types, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 bool RunOpenMultiFileDialog(const std::wstring& title, | 282 bool RunOpenMultiFileDialog(const std::wstring& title, |
283 const std::wstring& filter, | 283 const std::wstring& filter, |
284 HWND owner, | 284 HWND owner, |
285 std::vector<base::FilePath>* paths); | 285 std::vector<base::FilePath>* paths); |
286 | 286 |
287 // The callback function for when the select folder dialog is opened. | 287 // The callback function for when the select folder dialog is opened. |
288 static int CALLBACK BrowseCallbackProc(HWND window, UINT message, | 288 static int CALLBACK BrowseCallbackProc(HWND window, UINT message, |
289 LPARAM parameter, | 289 LPARAM parameter, |
290 LPARAM data); | 290 LPARAM data); |
291 | 291 |
292 virtual bool HasMultipleFileTypeChoicesImpl() OVERRIDE; | 292 virtual bool HasMultipleFileTypeChoicesImpl() override; |
293 | 293 |
294 // Returns the filter to be used while displaying the open/save file dialog. | 294 // Returns the filter to be used while displaying the open/save file dialog. |
295 // This is computed from the extensions for the file types being opened. | 295 // This is computed from the extensions for the file types being opened. |
296 // |file_types| can be NULL in which case the returned filter will be empty. | 296 // |file_types| can be NULL in which case the returned filter will be empty. |
297 base::string16 GetFilterForFileTypes(const FileTypeInfo* file_types); | 297 base::string16 GetFilterForFileTypes(const FileTypeInfo* file_types); |
298 | 298 |
299 bool has_multiple_file_type_choices_; | 299 bool has_multiple_file_type_choices_; |
300 base::Callback<bool(OPENFILENAME*)> get_open_file_name_impl_; | 300 base::Callback<bool(OPENFILENAME*)> get_open_file_name_impl_; |
301 base::Callback<bool(OPENFILENAME*)> get_save_file_name_impl_; | 301 base::Callback<bool(OPENFILENAME*)> get_save_file_name_impl_; |
302 | 302 |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 SelectFileDialog* CreateDefaultWinSelectFileDialog( | 768 SelectFileDialog* CreateDefaultWinSelectFileDialog( |
769 SelectFileDialog::Listener* listener, | 769 SelectFileDialog::Listener* listener, |
770 SelectFilePolicy* policy) { | 770 SelectFilePolicy* policy) { |
771 return CreateWinSelectFileDialog(listener, | 771 return CreateWinSelectFileDialog(listener, |
772 policy, | 772 policy, |
773 base::Bind(&CallBuiltinGetOpenFileName), | 773 base::Bind(&CallBuiltinGetOpenFileName), |
774 base::Bind(&CallBuiltinGetSaveFileName)); | 774 base::Bind(&CallBuiltinGetSaveFileName)); |
775 } | 775 } |
776 | 776 |
777 } // namespace ui | 777 } // namespace ui |
OLD | NEW |