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

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

Issue 79045: Fixes saving files that don't have valid extensions. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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
« chrome/common/win_util.h ('K') | « chrome/common/win_util.h ('k') | no next file » | 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-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
scherkus (not reviewing) 2009/04/17 19:36:41 bump copyright year
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 #include "chrome/common/win_util.h" 5 #include "chrome/common/win_util.h"
6 6
7 #include <atlbase.h> 7 #include <atlbase.h>
8 #include <atlapp.h> 8 #include <atlapp.h>
9 #include <commdlg.h> 9 #include <commdlg.h>
10 #include <dwmapi.h> 10 #include <dwmapi.h>
11 #include <shellapi.h> 11 #include <shellapi.h>
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 include_all_files = true; 243 include_all_files = true;
244 continue; 244 continue;
245 } 245 }
246 246
247 if (desc.empty()) { 247 if (desc.empty()) {
248 DCHECK(ext.find(L'.') != std::wstring::npos); 248 DCHECK(ext.find(L'.') != std::wstring::npos);
249 std::wstring first_extension = ext.substr(ext.find(L'.')); 249 std::wstring first_extension = ext.substr(ext.find(L'.'));
250 size_t first_separator_index = first_extension.find(L';'); 250 size_t first_separator_index = first_extension.find(L';');
251 if (first_separator_index != std::wstring::npos) 251 if (first_separator_index != std::wstring::npos)
252 first_extension = first_extension.substr(0, first_separator_index); 252 first_extension = first_extension.substr(0, first_separator_index);
253 GetRegistryDescriptionFromExtension(first_extension, &desc); 253 if (!GetRegistryDescriptionFromExtension(first_extension, &desc)) {
254 // The extension doesn't exist in the registry. It's likely bogus, so
255 // just drop it.
256 include_all_files = true;
257 continue;
258 }
254 if (desc.empty()) 259 if (desc.empty())
255 desc = L"*." + first_extension; 260 desc = L"*." + first_extension;
256 } 261 }
257 262
258 result.append(desc.c_str(), desc.size()+1); // Append NULL too. 263 result.append(desc.c_str(), desc.size()+1); // Append NULL too.
259 result.append(ext.c_str(), ext.size()+1); 264 result.append(ext.c_str(), ext.size()+1);
260 } 265 }
261 266
262 if (include_all_files) { 267 if (include_all_files) {
263 result.append(all_desc.c_str(), all_desc.size()+1); 268 result.append(all_desc.c_str(), all_desc.size()+1);
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 815
811 ChromeFont GetWindowTitleFont() { 816 ChromeFont GetWindowTitleFont() {
812 NONCLIENTMETRICS ncm; 817 NONCLIENTMETRICS ncm;
813 win_util::GetNonClientMetrics(&ncm); 818 win_util::GetNonClientMetrics(&ncm);
814 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); 819 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont));
815 ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); 820 ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont)));
816 return ChromeFont::CreateFont(caption_font); 821 return ChromeFont::CreateFont(caption_font);
817 } 822 }
818 823
819 } // namespace win_util 824 } // namespace win_util
OLDNEW
« chrome/common/win_util.h ('K') | « chrome/common/win_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698