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