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

Side by Side Diff: app/win_util.h

Issue 858006: Remove some unnecessary dependencies on net from app/win_util and app/resourc... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 9 months 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
« no previous file with comments | « app/resource_bundle.cc ('k') | app/win_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 APP_WIN_UTIL_H_ 5 #ifndef APP_WIN_UTIL_H_
6 #define APP_WIN_UTIL_H_ 6 #define APP_WIN_UTIL_H_
7 7
8 #include <objbase.h> 8 #include <objbase.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // The download manager now writes the alternate data stream with the 123 // The download manager now writes the alternate data stream with the
124 // zone on all downloads. This function is equivalent to OpenItemViaShell 124 // zone on all downloads. This function is equivalent to OpenItemViaShell
125 // without showing the zone warning dialog. 125 // without showing the zone warning dialog.
126 bool OpenItemViaShellNoZoneCheck(const FilePath& full_path); 126 bool OpenItemViaShellNoZoneCheck(const FilePath& full_path);
127 127
128 // Ask the user, via the Windows "Open With" dialog, for an application to use 128 // Ask the user, via the Windows "Open With" dialog, for an application to use
129 // to open the file specified by 'full_path'. 129 // to open the file specified by 'full_path'.
130 // Returns 'true' on successful open, 'false' otherwise. 130 // Returns 'true' on successful open, 'false' otherwise.
131 bool OpenItemWithExternalApp(const std::wstring& full_path); 131 bool OpenItemWithExternalApp(const std::wstring& full_path);
132 132
133 // Set up a filter for a Save/Open dialog, which will consist of |file_ext| file
134 // extensions (internally separated by semicolons), |ext_desc| as the text
135 // descriptions of the |file_ext| types (optional), and (optionally) the default
136 // 'All Files' view. The purpose of the filter is to show only files of a
137 // particular type in a Windows Save/Open dialog box. The resulting filter is
138 // returned. The filters created here are:
139 // 1. only files that have 'file_ext' as their extension
140 // 2. all files (only added if 'include_all_files' is true)
141 // Example:
142 // file_ext: { "*.txt", "*.htm;*.html" }
143 // ext_desc: { "Text Document" }
144 // returned: "Text Document\0*.txt\0HTML Document\0*.htm;*.html\0"
145 // "All Files\0*.*\0\0" (in one big string)
146 // If a description is not provided for a file extension, it will be retrieved
147 // from the registry. If the file extension does not exist in the registry, it
148 // will be omitted from the filter, as it is likely a bogus extension.
149 std::wstring FormatFilterForExtensions(
150 const std::vector<std::wstring>& file_ext,
151 const std::vector<std::wstring>& ext_desc,
152 bool include_all_files);
153
154 // Prompt the user for location to save a file. 'suggested_name' is a full path
155 // that gives the dialog box a hint as to how to initialize itself.
156 // For example, a 'suggested_name' of:
157 // "C:\Documents and Settings\jojo\My Documents\picture.png"
158 // will start the dialog in the "C:\Documents and Settings\jojo\My Documents\"
159 // directory, and filter for .png file types.
160 // 'owner' is the window to which the dialog box is modal, NULL for a modeless
161 // dialog box.
162 // On success, returns true and 'final_name' contains the full path of the file
163 // that the user chose. On error, returns false, and 'final_name' is not
164 // modified.
165 // NOTE: DO NOT CALL THIS FUNCTION DIRECTLY! Instead use the helper objects in
166 // browser/shell_dialogs.cc to do this asynchronously on a different
167 // thread so that the app isn't jankified if the Windows shell dialog
168 // takes a long time to display.
169 bool SaveFileAs(HWND owner,
170 const std::wstring& suggested_name,
171 std::wstring* final_name);
172
173 // Prompt the user for location to save a file.
174 // Callers should provide the filter string, and also a filter index.
175 // The parameter |index| indicates the initial index of filter description
176 // and filter pattern for the dialog box. If |index| is zero or greater than
177 // the number of total filter types, the system uses the first filter in the
178 // |filter| buffer. |index| is used to specify the initial selected extension,
179 // and when done contains the extension the user chose. The parameter
180 // |final_name| returns the file name which contains the drive designator,
181 // path, file name, and extension of the user selected file name. |def_ext| is
182 // the default extension to give to the file if the user did not enter an
183 // extension. If |ignore_suggested_ext| is true, any file extension contained in
184 // |suggested_name| will not be used to generate the file name. This is useful
185 // in the case of saving web pages, where we know the extension type already and
186 // where |suggested_name| may contain a '.' character as a valid part of the
187 // name, thus confusing our extension detection code.
188 bool SaveFileAsWithFilter(HWND owner,
189 const std::wstring& suggested_name,
190 const std::wstring& filter,
191 const std::wstring& def_ext,
192 bool ignore_suggested_ext,
193 unsigned* index,
194 std::wstring* final_name);
195
196 // This function takes the output of a SaveAs dialog: a filename, a filter and
197 // the extension originally suggested to the user (shown in the dialog box) and
198 // returns back the filename with the appropriate extension tacked on. For
199 // example, if you pass in 'foo' as filename with filter '*.jpg' this function
200 // will return 'foo.jpg'. It respects MIME types, so if you pass in 'foo.jpeg'
201 // with filer '*.jpg' it will return 'foo.jpeg' (will not append .jpg).
202 // |filename| should contain the filename selected in the SaveAs dialog box and
203 // may include the path, |filter_selected| should be '*.something', for example
204 // '*.*' or it can be blank (which is treated as *.*). |suggested_ext| should
205 // contain the extension without the dot (.) in front, for example 'jpg'.
206 std::wstring AppendExtensionIfNeeded(const std::wstring& filename,
207 const std::wstring& filter_selected,
208 const std::wstring& suggested_ext);
209
210 // If the window does not fit on the default monitor, it is moved and possibly 133 // If the window does not fit on the default monitor, it is moved and possibly
211 // resized appropriately. 134 // resized appropriately.
212 void AdjustWindowToFit(HWND hwnd); 135 void AdjustWindowToFit(HWND hwnd);
213 136
214 // Sizes the window to have a client or window size (depending on the value of 137 // Sizes the window to have a client or window size (depending on the value of
215 // |pref_is_client|) of pref, then centers the window over parent, ensuring the 138 // |pref_is_client|) of pref, then centers the window over parent, ensuring the
216 // window fits on screen. 139 // window fits on screen.
217 void CenterAndSizeWindow(HWND parent, HWND window, const SIZE& pref, 140 void CenterAndSizeWindow(HWND parent, HWND window, const SIZE& pref,
218 bool pref_is_client); 141 bool pref_is_client);
219 142
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 extern const int kAutoHideTaskbarThicknessPx; 211 extern const int kAutoHideTaskbarThicknessPx;
289 212
290 // Sets the application id given as the Application Model ID for the window 213 // Sets the application id given as the Application Model ID for the window
291 // specified. This method is used to insure that different web applications 214 // specified. This method is used to insure that different web applications
292 // do not group together on the Win7 task bar. 215 // do not group together on the Win7 task bar.
293 void SetAppIdForWindow(const std::wstring& app_id, HWND hwnd); 216 void SetAppIdForWindow(const std::wstring& app_id, HWND hwnd);
294 217
295 } // namespace win_util 218 } // namespace win_util
296 219
297 #endif // APP_WIN_UTIL_H_ 220 #endif // APP_WIN_UTIL_H_
OLDNEW
« no previous file with comments | « app/resource_bundle.cc ('k') | app/win_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698