summaryrefslogtreecommitdiffstats
path: root/chrome/common/win_util.h
diff options
context:
space:
mode:
authorfinnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-09 20:30:43 +0000
committerfinnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-09 20:30:43 +0000
commit78a3c05468ae5f05463288f2f4de125913ae4a34 (patch)
tree41bf3a936f89250d1c1ddda3414d5f448dc20920 /chrome/common/win_util.h
parentcf4dbfb85d57b9b801a1b3d986e39b041c8e8d36 (diff)
downloadchromium_src-78a3c05468ae5f05463288f2f4de125913ae4a34.zip
chromium_src-78a3c05468ae5f05463288f2f4de125913ae4a34.tar.gz
chromium_src-78a3c05468ae5f05463288f2f4de125913ae4a34.tar.bz2
Adding a unit test for the AppendExtensionIfNeeded part
of the SaveFileAsWithFilter function (after splitting it out to a separate function). Review URL: http://codereview.chromium.org/13637 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6618 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/win_util.h')
-rw-r--r--chrome/common/win_util.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/chrome/common/win_util.h b/chrome/common/win_util.h
index 030d48a..2aac0a1 100644
--- a/chrome/common/win_util.h
+++ b/chrome/common/win_util.h
@@ -164,6 +164,20 @@ bool SaveFileAsWithFilter(HWND owner,
unsigned* index,
std::wstring* final_name);
+// This function takes the output of a SaveAs dialog: a filename, a filter and
+// the extension originally suggested to the user (shown in the dialog box) and
+// returns back the filename with the appropriate extension tacked on. For
+// example, if you pass in 'foo' as filename with filter '*.jpg' this function
+// will return 'foo.jpg'. It respects MIME types, so if you pass in 'foo.jpeg'
+// with filer '*.jpg' it will return 'foo.jpeg' (will not append .jpg).
+// |filename| should contain the filename selected in the SaveAs dialog box and
+// may include the path, |filter_selected| should be '*.something', for example
+// '*.*' or it can be blank (which is treated as *.*). |suggested_ext| should
+// contain the extension without the dot (.) in front, for example 'jpg'.
+std::wstring AppendExtensionIfNeeded(const std::wstring& filename,
+ const std::wstring& filter_selected,
+ const std::wstring& suggested_ext);
+
// If the window does not fit on the default monitor, it is moved and possibly
// resized appropriately.
void AdjustWindowToFit(HWND hwnd);
@@ -203,7 +217,7 @@ void SetChildBounds(HWND child_window, HWND parent_window,
gfx::Rect GetMonitorBoundsForRect(const gfx::Rect& rect);
// Returns true if the virtual key code is a digit coming from the numeric
-// keypad (with or without Num Lock on). |extended_key| should be set to the
+// keypad (with or without NumLock on). |extended_key| should be set to the
// extended key flag specified in the WM_KEYDOWN/UP where the |key_code|
// originated.
bool IsNumPadDigit(int key_code, bool extended_key);