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

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

Issue 6090006: Regkey functions return error code instead of bool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | « chrome/browser/ui/views/external_protocol_dialog.cc ('k') | chrome/common/chrome_plugin_lib.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) 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 // Get the file type description from the registry. This will be "Text Document" 69 // Get the file type description from the registry. This will be "Text Document"
70 // for .txt files, "JPEG Image" for .jpg files, etc. If the registry doesn't 70 // for .txt files, "JPEG Image" for .jpg files, etc. If the registry doesn't
71 // have an entry for the file type, we return false, true if the description was 71 // have an entry for the file type, we return false, true if the description was
72 // found. 'file_ext' must be in form ".txt". 72 // found. 'file_ext' must be in form ".txt".
73 static bool GetRegistryDescriptionFromExtension(const std::wstring& file_ext, 73 static bool GetRegistryDescriptionFromExtension(const std::wstring& file_ext,
74 std::wstring* reg_description) { 74 std::wstring* reg_description) {
75 DCHECK(reg_description); 75 DCHECK(reg_description);
76 base::win::RegKey reg_ext(HKEY_CLASSES_ROOT, file_ext.c_str(), KEY_READ); 76 base::win::RegKey reg_ext(HKEY_CLASSES_ROOT, file_ext.c_str(), KEY_READ);
77 std::wstring reg_app; 77 std::wstring reg_app;
78 if (reg_ext.ReadValue(NULL, &reg_app) && !reg_app.empty()) { 78 if (reg_ext.ReadValue(NULL, &reg_app) == ERROR_SUCCESS && !reg_app.empty()) {
79 base::win::RegKey reg_link(HKEY_CLASSES_ROOT, reg_app.c_str(), KEY_READ); 79 base::win::RegKey reg_link(HKEY_CLASSES_ROOT, reg_app.c_str(), KEY_READ);
80 if (reg_link.ReadValue(NULL, reg_description)) 80 if (reg_link.ReadValue(NULL, reg_description) == ERROR_SUCCESS)
81 return true; 81 return true;
82 } 82 }
83 return false; 83 return false;
84 } 84 }
85 85
86 // Set up a filter for a Save/Open dialog, which will consist of |file_ext| file 86 // Set up a filter for a Save/Open dialog, which will consist of |file_ext| file
87 // extensions (internally separated by semicolons), |ext_desc| as the text 87 // extensions (internally separated by semicolons), |ext_desc| as the text
88 // descriptions of the |file_ext| types (optional), and (optionally) the default 88 // descriptions of the |file_ext| types (optional), and (optionally) the default
89 // 'All Files' view. The purpose of the filter is to show only files of a 89 // 'All Files' view. The purpose of the filter is to show only files of a
90 // particular type in a Windows Save/Open dialog box. The resulting filter is 90 // particular type in a Windows Save/Open dialog box. The resulting filter is
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 void SelectFontDialogImpl::FontNotSelected(void* params, RunState run_state) { 1122 void SelectFontDialogImpl::FontNotSelected(void* params, RunState run_state) {
1123 if (listener_) 1123 if (listener_)
1124 listener_->FontSelectionCanceled(params); 1124 listener_->FontSelectionCanceled(params);
1125 EndRun(run_state); 1125 EndRun(run_state);
1126 } 1126 }
1127 1127
1128 // static 1128 // static
1129 SelectFontDialog* SelectFontDialog::Create(Listener* listener) { 1129 SelectFontDialog* SelectFontDialog::Create(Listener* listener) {
1130 return new SelectFontDialogImpl(listener); 1130 return new SelectFontDialogImpl(listener);
1131 } 1131 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/external_protocol_dialog.cc ('k') | chrome/common/chrome_plugin_lib.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698