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

Side by Side Diff: chrome/browser/views/shell_dialogs_win.cc

Issue 3172009: Cleanup Registry API: part 3. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: chrome fixes Created 10 years, 4 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "chrome/browser/shell_dialogs.h" 5 #include "chrome/browser/shell_dialogs.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <commdlg.h> 8 #include <commdlg.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 10
(...skipping 30 matching lines...) Expand all
41 std::wstring return_value = filename; 41 std::wstring return_value = filename;
42 42
43 // If we wanted a specific extension, but the user's filename deleted it or 43 // If we wanted a specific extension, but the user's filename deleted it or
44 // changed it to something that the system doesn't understand, re-append. 44 // changed it to something that the system doesn't understand, re-append.
45 // Careful: Checking net::GetMimeTypeFromExtension() will only find 45 // Careful: Checking net::GetMimeTypeFromExtension() will only find
46 // extensions with a known MIME type, which many "known" extensions on Windows 46 // extensions with a known MIME type, which many "known" extensions on Windows
47 // don't have. So we check directly for the "known extension" registry key. 47 // don't have. So we check directly for the "known extension" registry key.
48 std::wstring file_extension(file_util::GetFileExtensionFromPath(filename)); 48 std::wstring file_extension(file_util::GetFileExtensionFromPath(filename));
49 std::wstring key(L"." + file_extension); 49 std::wstring key(L"." + file_extension);
50 if (!(filter_selected.empty() || filter_selected == L"*.*") && 50 if (!(filter_selected.empty() || filter_selected == L"*.*") &&
51 !RegKey(HKEY_CLASSES_ROOT, key.c_str()).Valid() && 51 !RegKey(HKEY_CLASSES_ROOT, key.c_str(), KEY_READ).Valid() &&
52 file_extension != suggested_ext) { 52 file_extension != suggested_ext) {
53 if (return_value[return_value.length() - 1] != L'.') 53 if (return_value[return_value.length() - 1] != L'.')
54 return_value.append(L"."); 54 return_value.append(L".");
55 return_value.append(suggested_ext); 55 return_value.append(suggested_ext);
56 } 56 }
57 57
58 // Strip any trailing dots, which Windows doesn't allow. 58 // Strip any trailing dots, which Windows doesn't allow.
59 size_t index = return_value.find_last_not_of(L'.'); 59 size_t index = return_value.find_last_not_of(L'.');
60 if (index < return_value.size() - 1) 60 if (index < return_value.size() - 1)
61 return_value.resize(index + 1); 61 return_value.resize(index + 1);
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 void SelectFontDialogImpl::FontNotSelected(void* params, RunState run_state) { 1119 void SelectFontDialogImpl::FontNotSelected(void* params, RunState run_state) {
1120 if (listener_) 1120 if (listener_)
1121 listener_->FontSelectionCanceled(params); 1121 listener_->FontSelectionCanceled(params);
1122 EndRun(run_state); 1122 EndRun(run_state);
1123 } 1123 }
1124 1124
1125 // static 1125 // static
1126 SelectFontDialog* SelectFontDialog::Create(Listener* listener) { 1126 SelectFontDialog* SelectFontDialog::Create(Listener* listener) {
1127 return new SelectFontDialogImpl(listener); 1127 return new SelectFontDialogImpl(listener);
1128 } 1128 }
OLDNEW
« no previous file with comments | « chrome/browser/policy/configuration_policy_provider_win_unittest.cc ('k') | chrome/installer/setup/uninstall.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698