| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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_BASE_WIN_OPEN_FILE_NAME_WIN_H_ | 5 #ifndef UI_BASE_WIN_OPEN_FILE_NAME_WIN_H_ |
| 6 #define UI_BASE_WIN_OPEN_FILE_NAME_WIN_H_ | 6 #define UI_BASE_WIN_OPEN_FILE_NAME_WIN_H_ |
| 7 | 7 |
| 8 #include <Windows.h> | 8 #include <Windows.h> |
| 9 #include <Commdlg.h> | 9 #include <Commdlg.h> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 class UI_BASE_EXPORT OpenFileName { | 27 class UI_BASE_EXPORT OpenFileName { |
| 28 public: | 28 public: |
| 29 // Initializes the OPENFILENAME, which may be accessed using Get(). All fields | 29 // Initializes the OPENFILENAME, which may be accessed using Get(). All fields |
| 30 // will be NULL except for |lStructSize|, |lpstrFile|, and |nMaxFile|. The | 30 // will be NULL except for |lStructSize|, |lpstrFile|, and |nMaxFile|. The |
| 31 // file buffer will initially contain a null-terminated empty string. | 31 // file buffer will initially contain a null-terminated empty string. |
| 32 OpenFileName(HWND parent_window, DWORD flags); | 32 OpenFileName(HWND parent_window, DWORD flags); |
| 33 ~OpenFileName(); | 33 ~OpenFileName(); |
| 34 | 34 |
| 35 // Initializes |lpstrFilter| from the label/pattern pairs in |filters|. | 35 // Initializes |lpstrFilter| from the label/pattern pairs in |filters|. |
| 36 void SetFilters( | 36 void SetFilters( |
| 37 const std::vector<Tuple2<base::string16, base::string16> >& filters); | 37 const std::vector<Tuple<base::string16, base::string16>>& filters); |
| 38 | 38 |
| 39 // Sets |lpstrInitialDir| and |lpstrFile|. | 39 // Sets |lpstrInitialDir| and |lpstrFile|. |
| 40 void SetInitialSelection(const base::FilePath& initial_directory, | 40 void SetInitialSelection(const base::FilePath& initial_directory, |
| 41 const base::FilePath& initial_filename); | 41 const base::FilePath& initial_filename); |
| 42 | 42 |
| 43 // The save as dialog on Windows XP remembers its last position, and if the | 43 // The save as dialog on Windows XP remembers its last position, and if the |
| 44 // screen resolution has changed it may be off screen. This method will check | 44 // screen resolution has changed it may be off screen. This method will check |
| 45 // if we are running on XP and if so install a hook to reposition the dialog | 45 // if we are running on XP and if so install a hook to reposition the dialog |
| 46 // if necessary. | 46 // if necessary. |
| 47 void MaybeInstallWindowPositionHookForSaveAsOnXP(); | 47 void MaybeInstallWindowPositionHookForSaveAsOnXP(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 61 const OPENFILENAME* GetOPENFILENAME() const { return &openfilename_; } | 61 const OPENFILENAME* GetOPENFILENAME() const { return &openfilename_; } |
| 62 | 62 |
| 63 // Stores directory and filenames in the buffer pointed to by | 63 // Stores directory and filenames in the buffer pointed to by |
| 64 // |openfilename->lpstrFile| and sized |openfilename->nMaxFile|. | 64 // |openfilename->lpstrFile| and sized |openfilename->nMaxFile|. |
| 65 static void SetResult(const base::FilePath& directory, | 65 static void SetResult(const base::FilePath& directory, |
| 66 const std::vector<base::FilePath>& filenames, | 66 const std::vector<base::FilePath>& filenames, |
| 67 OPENFILENAME* openfilename); | 67 OPENFILENAME* openfilename); |
| 68 | 68 |
| 69 // Returns a vector of label/pattern pairs built from | 69 // Returns a vector of label/pattern pairs built from |
| 70 // |openfilename->lpstrFilter|. | 70 // |openfilename->lpstrFilter|. |
| 71 static std::vector<Tuple2<base::string16, base::string16> > GetFilters( | 71 static std::vector<Tuple<base::string16, base::string16>> GetFilters( |
| 72 const OPENFILENAME* openfilename); | 72 const OPENFILENAME* openfilename); |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 OPENFILENAME openfilename_; | 75 OPENFILENAME openfilename_; |
| 76 base::string16 initial_directory_buffer_; | 76 base::string16 initial_directory_buffer_; |
| 77 wchar_t filename_buffer_[UNICODE_STRING_MAX_CHARS]; | 77 wchar_t filename_buffer_[UNICODE_STRING_MAX_CHARS]; |
| 78 base::string16 filter_buffer_; | 78 base::string16 filter_buffer_; |
| 79 | 79 |
| 80 DISALLOW_COPY_AND_ASSIGN(OpenFileName); | 80 DISALLOW_COPY_AND_ASSIGN(OpenFileName); |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 } // namespace win | 83 } // namespace win |
| 84 } // namespace ui | 84 } // namespace ui |
| 85 | 85 |
| 86 #endif // UI_BASE_WIN_OPEN_FILE_NAME_WIN_H_ | 86 #endif // UI_BASE_WIN_OPEN_FILE_NAME_WIN_H_ |
| OLD | NEW |