| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // support URLS of 2083 chars in length, 2K is safe." | 106 // support URLS of 2083 chars in length, 2K is safe." |
| 107 const size_t kMaxUrlLength = 2048; | 107 const size_t kMaxUrlLength = 2048; |
| 108 if (escaped_url.length() > kMaxUrlLength) { | 108 if (escaped_url.length() > kMaxUrlLength) { |
| 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()); | 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); |
| 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 } |
| (...skipping 49 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 channel; | 179 return channel; |
| 180 #else | 180 #else |
| 181 return string16(); | 181 return string16(); |
| 182 #endif | 182 #endif |
| 183 } | 183 } |
| 184 | 184 |
| 185 } // namespace platform_util | 185 } // namespace platform_util |
| OLD | NEW |