Fix issue 4898: File extension wrong for saved files
Fix issue 4898: File extension wrong for saved files

When the user specifies a filename without an extension, such as "foo" instead of "foo.gif", we would append "gif" to the filename instead of ".gif" (so the user ends up with a file named "foogif").

I'm not confident this is the only thing wrong with this function. For example if the user specifies "foo." and the filter says "*.gif" shouldn't we add ".gif" to the filename instead of deleting the dot?

Also, we seem to be ignoring the default_extension parameter passed in when we figure out what extension to tack on and instead get the file extension from GetFileExtensionFromPath... :s

Review URL: http://codereview.chromium.org/12838

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@6174 0039d316-1c4b-4281-b951-d872f2087c98

timopulkkinen/BubbleFish,dushu1203/chromium.src,junmin-zhu/chromium-rivertrail,littlstar/chromium.src,keishi/chromium,bright-sparks/chromium-spacewalk,junmin-zhu/chromium-rivertrail,axinging/chromium-crosswalk,M4sse/chromium.src,timopulkkinen/BubbleFish,anirudhSK/chromium,krieger-od/nwjs_chromium.src,rogerwang/chromium,mohamed--abdel-maksoud/chromium.src,ondra-novak/chromium.src,pozdnyakov/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,hujiajie/pa-chromium,mogoweb/chromium-crosswalk,dednal/chromium.src,ondra-novak/chromium.src,hujiajie/pa-chromium,axinging/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,krieger-od/nwjs_chromium.src,pozdnyakov/chromium-crosswalk,axinging/chromium-crosswalk,dushu1203/chromium.src,patrickm/chromium.src,ChromiumWebApps/chromium,anirudhSK/chromium,rogerwang/chromium,rogerwang/chromium,Pluto-tv/chromium-crosswalk,hujiajie/pa-chromium,markYoungH/chromium.src,krieger-od/nwjs_chromium.src,hujiajie/pa-chromium,hgl888/chromium-crosswalk-efl,M4sse/chromium.src,PeterWangIntel/chromium-crosswalk,ChromiumWebApps/chromium,anirudhSK/chromium,hgl888/chromium-crosswalk-efl,mogoweb/chromium-crosswalk,fujunwei/chromium-crosswalk,nacl-webkit/chrome_deps,dednal/chromium.src,hujiajie/pa-chromium,Fireblend/chromium-crosswalk,dushu1203/chromium.src,ChromiumWebApps/chromium,littlstar/chromium.src,anirudhSK/chromium,zcbenz/cefode-chromium,M4sse/chromium.src,dushu1203/chromium.src,anirudhSK/chromium,jaruba/chromium.src,Just-D/chromium-1,rogerwang/chromium,dednal/chromium.src,ltilve/chromium,dednal/chromium.src,Just-D/chromium-1,littlstar/chromium.src,patrickm/chromium.src,TheTypoMaster/chromium-crosswalk,robclark/chromium,hgl888/chromium-crosswalk-efl,Jonekee/chromium.src,junmin-zhu/chromium-rivertrail,Jonekee/chromium.src,chuan9/chromium-crosswalk,jaruba/chromium.src,mogoweb/chromium-crosswalk,rogerwang/chromium,nacl-webkit/chrome_deps,PeterWangIntel/chromium-crosswalk,Jonekee/chromium.src,ChromiumWebApps/chromium,anirudhSK/chromium,keishi/chromium,dushu1203/chromium.src,Chilledheart/chromium,ondra-novak/chromium.src,M4sse/chromium.src,ondra-novak/chromium.src,Fireblend/chromium-crosswalk,bright-sparks/chromium-spacewalk,ChromiumWebApps/chromium,dushu1203/chromium.src,crosswalk-project/chromium-crosswalk-efl,patrickm/chromium.src,timopulkkinen/BubbleFish,robclark/chromium,PeterWangIntel/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,dednal/chromium.src,Chilledheart/chromium,dednal/chromium.src,krieger-od/nwjs_chromium.src,Pluto-tv/chromium-crosswalk,M4sse/chromium.src,pozdnyakov/chromium-crosswalk,zcbenz/cefode-chromium,crosswalk-project/chromium-crosswalk-efl,Jonekee/chromium.src,TheTypoMaster/chromium-crosswalk,littlstar/chromium.src,robclark/chromium,hgl888/chromium-crosswalk,ltilve/chromium,Chilledheart/chromium,krieger-od/nwjs_chromium.src,rogerwang/chromium,Fireblend/chromium-crosswalk,M4sse/chromium.src,keishi/chromium,Just-D/chromium-1,Fireblend/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,Jonekee/chromium.src,dushu1203/chromium.src,timopulkkinen/BubbleFish,axinging/chromium-crosswalk,markYoungH/chromium.src,markYoungH/chromium.src,crosswalk-project/chromium-crosswalk-efl,mogoweb/chromium-crosswalk,chuan9/chromium-crosswalk,Just-D/chromium-1,ltilve/chromium,robclark/chromium,Chilledheart/chromium,zcbenz/cefode-chromium,TheTypoMaster/chromium-crosswalk,fujunwei/chromium-crosswalk,timopulkkinen/BubbleFish,mohamed--abdel-maksoud/chromium.src,Just-D/chromium-1,markYoungH/chromium.src,crosswalk-project/chromium-crosswalk-efl,jaruba/chromium.src,dushu1203/chromium.src,junmin-zhu/chromium-rivertrail,patrickm/chromium.src,pozdnyakov/chromium-crosswalk,ondra-novak/chromium.src,hgl888/chromium-crosswalk-efl,Chilledheart/chromium,mohamed--abdel-maksoud/chromium.src,pozdnyakov/chromium-crosswalk,patrickm/chromium.src,zcbenz/cefode-chromium,markYoungH/chromium.src,fujunwei/chromium-crosswalk,pozdnyakov/chromium-crosswalk,anirudhSK/chromium,Fireblend/chromium-crosswalk,fujunwei/chromium-crosswalk,chuan9/chromium-crosswalk,hgl888/chromium-crosswalk,hujiajie/pa-chromium,TheTypoMaster/chromium-crosswalk,zcbenz/cefode-chromium,markYoungH/chromium.src,Jonekee/chromium.src,hgl888/chromium-crosswalk,axinging/chromium-crosswalk,jaruba/chromium.src,mogoweb/chromium-crosswalk,hgl888/chromium-crosswalk-efl,keishi/chromium,ltilve/chromium,junmin-zhu/chromium-rivertrail,krieger-od/nwjs_chromium.src,nacl-webkit/chrome_deps,keishi/chromium,fujunwei/chromium-crosswalk,jaruba/chromium.src,patrickm/chromium.src,robclark/chromium,Chilledheart/chromium,ondra-novak/chromium.src,nacl-webkit/chrome_deps,dednal/chromium.src,zcbenz/cefode-chromium,hgl888/chromium-crosswalk,dednal/chromium.src,crosswalk-project/chromium-crosswalk-efl,hgl888/chromium-crosswalk-efl,M4sse/chromium.src,M4sse/chromium.src,hujiajie/pa-chromium,Pluto-tv/chromium-crosswalk,mogoweb/chromium-crosswalk,krieger-od/nwjs_chromium.src,hgl888/chromium-crosswalk-efl,Pluto-tv/chromium-crosswalk,robclark/chromium,Just-D/chromium-1,Pluto-tv/chromium-crosswalk,markYoungH/chromium.src,Just-D/chromium-1,keishi/chromium,junmin-zhu/chromium-rivertrail,zcbenz/cefode-chromium,axinging/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,Pluto-tv/chromium-crosswalk,hujiajie/pa-chromium,TheTypoMaster/chromium-crosswalk,chuan9/chromium-crosswalk,timopulkkinen/BubbleFish,fujunwei/chromium-crosswalk,mogoweb/chromium-crosswalk,zcbenz/cefode-chromium,keishi/chromium,ltilve/chromium,Fireblend/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,jaruba/chromium.src,crosswalk-project/chromium-crosswalk-efl,timopulkkinen/BubbleFish,jaruba/chromium.src,junmin-zhu/chromium-rivertrail,hujiajie/pa-chromium,ChromiumWebApps/chromium,PeterWangIntel/chromium-crosswalk,Pluto-tv/chromium-crosswalk,pozdnyakov/chromium-crosswalk,nacl-webkit/chrome_deps,jaruba/chromium.src,anirudhSK/chromium,hujiajie/pa-chromium,markYoungH/chromium.src,bright-sparks/chromium-spacewalk,bright-sparks/chromium-spacewalk,Just-D/chromium-1,markYoungH/chromium.src,anirudhSK/chromium,PeterWangIntel/chromium-crosswalk,junmin-zhu/chromium-rivertrail,Chilledheart/chromium,nacl-webkit/chrome_deps,ltilve/chromium,Jonekee/chromium.src,axinging/chromium-crosswalk,littlstar/chromium.src,Just-D/chromium-1,zcbenz/cefode-chromium,junmin-zhu/chromium-rivertrail,TheTypoMaster/chromium-crosswalk,pozdnyakov/chromium-crosswalk,hgl888/chromium-crosswalk,bright-sparks/chromium-spacewalk,robclark/chromium,axinging/chromium-crosswalk,junmin-zhu/chromium-rivertrail,timopulkkinen/BubbleFish,Jonekee/chromium.src,zcbenz/cefode-chromium,PeterWangIntel/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,littlstar/chromium.src,patrickm/chromium.src,rogerwang/chromium,axinging/chromium-crosswalk,markYoungH/chromium.src,jaruba/chromium.src,mogoweb/chromium-crosswalk,dushu1203/chromium.src,keishi/chromium,nacl-webkit/chrome_deps,ltilve/chromium,Jonekee/chromium.src,hgl888/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,fujunwei/chromium-crosswalk,patrickm/chromium.src,junmin-zhu/chromium-rivertrail,fujunwei/chromium-crosswalk,anirudhSK/chromium,littlstar/chromium.src,crosswalk-project/chromium-crosswalk-efl,krieger-od/nwjs_chromium.src,nacl-webkit/chrome_deps,patrickm/chromium.src,dushu1203/chromium.src,chuan9/chromium-crosswalk,nacl-webkit/chrome_deps,hgl888/chromium-crosswalk,Chilledheart/chromium,ChromiumWebApps/chromium,ondra-novak/chromium.src,mogoweb/chromium-crosswalk,pozdnyakov/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,ondra-novak/chromium.src,hujiajie/pa-chromium,M4sse/chromium.src,dednal/chromium.src,robclark/chromium,anirudhSK/chromium,krieger-od/nwjs_chromium.src,pozdnyakov/chromium-crosswalk,ChromiumWebApps/chromium,pozdnyakov/chromium-crosswalk,timopulkkinen/BubbleFish,M4sse/chromium.src,bright-sparks/chromium-spacewalk,anirudhSK/chromium,krieger-od/nwjs_chromium.src,keishi/chromium,jaruba/chromium.src,dednal/chromium.src,hgl888/chromium-crosswalk,ChromiumWebApps/chromium,hgl888/chromium-crosswalk-efl,mohamed--abdel-maksoud/chromium.src,zcbenz/cefode-chromium,chuan9/chromium-crosswalk,markYoungH/chromium.src,hgl888/chromium-crosswalk,rogerwang/chromium,axinging/chromium-crosswalk,keishi/chromium,rogerwang/chromium,nacl-webkit/chrome_deps,ChromiumWebApps/chromium,chuan9/chromium-crosswalk,Fireblend/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,Jonekee/chromium.src,Fireblend/chromium-crosswalk,hgl888/chromium-crosswalk-efl,keishi/chromium,robclark/chromium,Jonekee/chromium.src,bright-sparks/chromium-spacewalk,jaruba/chromium.src,crosswalk-project/chromium-crosswalk-efl,mohamed--abdel-maksoud/chromium.src,Pluto-tv/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,hgl888/chromium-crosswalk-efl,ChromiumWebApps/chromium,Pluto-tv/chromium-crosswalk,timopulkkinen/BubbleFish,robclark/chromium,bright-sparks/chromium-spacewalk,fujunwei/chromium-crosswalk,dednal/chromium.src,ChromiumWebApps/chromium,littlstar/chromium.src,chuan9/chromium-crosswalk,Fireblend/chromium-crosswalk,krieger-od/nwjs_chromium.src,nacl-webkit/chrome_deps,rogerwang/chromium,timopulkkinen/BubbleFish,ondra-novak/chromium.src,chuan9/chromium-crosswalk,bright-sparks/chromium-spacewalk,M4sse/chromium.src,Chilledheart/chromium,dushu1203/chromium.src,axinging/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,ltilve/chromium,ltilve/chromium,mogoweb/chromium-crosswalk