OLD | NEW |
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/platform_util.h" | 5 #include "chrome/browser/platform_util.h" |
6 | 6 |
7 #include <commdlg.h> | 7 #include <commdlg.h> |
8 #include <dwmapi.h> | 8 #include <dwmapi.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #include <shlobj.h> | 10 #include <shlobj.h> |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 NOTREACHED(); | 109 NOTREACHED(); |
110 return; | 110 return; |
111 } | 111 } |
112 | 112 |
113 RegKey key; | 113 RegKey key; |
114 std::wstring registry_path = ASCIIToWide(url.scheme()) + | 114 std::wstring registry_path = ASCIIToWide(url.scheme()) + |
115 L"\\shell\\open\\command"; | 115 L"\\shell\\open\\command"; |
116 key.Open(HKEY_CLASSES_ROOT, registry_path.c_str(), KEY_READ); | 116 key.Open(HKEY_CLASSES_ROOT, registry_path.c_str(), KEY_READ); |
117 if (key.Valid()) { | 117 if (key.Valid()) { |
118 DWORD size = 0; | 118 DWORD size = 0; |
119 key.ReadValue(NULL, NULL, &size); | 119 key.ReadValue(NULL, NULL, &size, NULL); |
120 if (size <= 2) { | 120 if (size <= 2) { |
121 // ShellExecute crashes the process when the command is empty. | 121 // ShellExecute crashes the process when the command is empty. |
122 // We check for "2" because it always returns the trailing NULL. | 122 // We check for "2" because it always returns the trailing NULL. |
123 // TODO(nsylvain): we should also add a dialog to warn on errors. See | 123 // TODO(nsylvain): we should also add a dialog to warn on errors. See |
124 // bug 1136923. | 124 // bug 1136923. |
125 return; | 125 return; |
126 } | 126 } |
127 } | 127 } |
128 | 128 |
129 if (reinterpret_cast<ULONG_PTR>(ShellExecuteA(NULL, "open", | 129 if (reinterpret_cast<ULONG_PTR>(ShellExecuteA(NULL, "open", |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 176 |
177 GoogleUpdateSettings::GetChromeChannel(is_system_install, &channel); | 177 GoogleUpdateSettings::GetChromeChannel(is_system_install, &channel); |
178 } | 178 } |
179 return UTF16ToASCII(channel); | 179 return UTF16ToASCII(channel); |
180 #else | 180 #else |
181 return std::string(); | 181 return std::string(); |
182 #endif | 182 #endif |
183 } | 183 } |
184 | 184 |
185 } // namespace platform_util | 185 } // namespace platform_util |
OLD | NEW |