Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(601)

Side by Side Diff: chrome/common/win_util.h

Issue 10621: Adds the ability for save dialogs to take a default extension.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 CHROME_COMMON_WIN_UTIL_H__ 5 #ifndef CHROME_COMMON_WIN_UTIL_H__
6 #define CHROME_COMMON_WIN_UTIL_H__ 6 #define CHROME_COMMON_WIN_UTIL_H__
7 7
8 #include <objbase.h> 8 #include <objbase.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // zone on all downloads. This function is equivalent to OpenItemViaShell 118 // zone on all downloads. This function is equivalent to OpenItemViaShell
119 // without showing the zone warning dialog. 119 // without showing the zone warning dialog.
120 bool OpenItemViaShellNoZoneCheck(const std::wstring& full_path, 120 bool OpenItemViaShellNoZoneCheck(const std::wstring& full_path,
121 bool ask_for_app); 121 bool ask_for_app);
122 122
123 // Ask the user, via the Windows "Open With" dialog, for an application to use 123 // Ask the user, via the Windows "Open With" dialog, for an application to use
124 // to open the file specified by 'full_path'. 124 // to open the file specified by 'full_path'.
125 // Returns 'true' on successful open, 'false' otherwise. 125 // Returns 'true' on successful open, 'false' otherwise.
126 bool OpenItemWithExternalApp(const std::wstring& full_path); 126 bool OpenItemWithExternalApp(const std::wstring& full_path);
127 127
128 std::wstring GetFileFilterFromPath(const std::wstring& file_name);
129
128 // Prompt the user for location to save a file. 'suggested_name' is a full path 130 // Prompt the user for location to save a file. 'suggested_name' is a full path
129 // that gives the dialog box a hint as to how to initialize itself. 131 // that gives the dialog box a hint as to how to initialize itself.
130 // For example, a 'suggested_name' of: 132 // For example, a 'suggested_name' of:
131 // "C:\Documents and Settings\jojo\My Documents\picture.png" 133 // "C:\Documents and Settings\jojo\My Documents\picture.png"
132 // will start the dialog in the "C:\Documents and Settings\jojo\My Documents\" 134 // will start the dialog in the "C:\Documents and Settings\jojo\My Documents\"
133 // directory, and filter for .png file types. 135 // directory, and filter for .png file types.
134 // 'owner' is the window to which the dialog box is modal, NULL for a modeless 136 // 'owner' is the window to which the dialog box is modal, NULL for a modeless
135 // dialog box. 137 // dialog box.
136 // On success, returns true and 'final_name' contains the full path of the file 138 // On success, returns true and 'final_name' contains the full path of the file
137 // that the user chose. On error, returns false, and 'final_name' is not 139 // that the user chose. On error, returns false, and 'final_name' is not
138 // modified. 140 // modified.
139 // NOTE: DO NOT CALL THIS FUNCTION DIRECTLY! Instead use the helper objects in 141 // NOTE: DO NOT CALL THIS FUNCTION DIRECTLY! Instead use the helper objects in
140 // browser/shell_dialogs.cc to do this asynchronously on a different 142 // browser/shell_dialogs.cc to do this asynchronously on a different
141 // thread so that the app isn't jankified if the Windows shell dialog 143 // thread so that the app isn't jankified if the Windows shell dialog
142 // takes a long time to display. 144 // takes a long time to display.
143 bool SaveFileAs(HWND owner, 145 bool SaveFileAs(HWND owner,
144 const std::wstring& suggested_name, 146 const std::wstring& suggested_name,
145 std::wstring* final_name); 147 std::wstring* final_name);
146 148
147 // Prompt the user for location to save a file. 149 // Prompt the user for location to save a file.
148 // Callers should provide the filter string, and also a filter index. 150 // Callers should provide the filter string, and also a filter index.
149 // The parameter |index| indicates the initial index of filter description 151 // The parameter |index| indicates the initial index of filter description
150 // and filter pattern for the dialog box. If |index| is zero or greater than 152 // and filter pattern for the dialog box. If |index| is zero or greater than
151 // the number of total filter types, the system uses the first filter in the 153 // the number of total filter types, the system uses the first filter in the
152 // |filter| buffer. The parameter |final_name| returns the file name which 154 // |filter| buffer. |index| is used to specify the initial selected extension,
153 // contains the drive designator, path, file name, and extension of the user 155 // and when done contains the extension the user chose. The parameter
154 // selected file name. 156 // |final_name| returns the file name which contains the drive designator,
157 // path, file name, and extension of the user selected file name. |def_ext| is
158 // the default extension to give to the file if the user did not enter an
159 // extension.
155 bool SaveFileAsWithFilter(HWND owner, 160 bool SaveFileAsWithFilter(HWND owner,
156 const std::wstring& suggested_name, 161 const std::wstring& suggested_name,
157 const wchar_t* filter, 162 const wchar_t* filter,
158 const std::wstring& def_ext, 163 const std::wstring& def_ext,
159 unsigned* index, 164 unsigned* index,
160 std::wstring* final_name); 165 std::wstring* final_name);
161 166
162 // If the window does not fit on the default monitor, it is moved and possibly 167 // If the window does not fit on the default monitor, it is moved and possibly
163 // resized appropriately. 168 // resized appropriately.
164 void AdjustWindowToFit(HWND hwnd); 169 void AdjustWindowToFit(HWND hwnd);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 const std::wstring& caption, 234 const std::wstring& caption,
230 UINT flags); 235 UINT flags);
231 236
232 // Returns the system set window title font. 237 // Returns the system set window title font.
233 ChromeFont GetWindowTitleFont(); 238 ChromeFont GetWindowTitleFont();
234 239
235 } // namespace win_util 240 } // namespace win_util
236 241
237 #endif // WIN_COMMON_WIN_UTIL_H__ 242 #endif // WIN_COMMON_WIN_UTIL_H__
238 243
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698