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/views/external_protocol_dialog.h" | 5 #include "chrome/browser/views/external_protocol_dialog.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/message_box_flags.h" | 8 #include "app/message_box_flags.h" |
9 #include "app/text_elider.h" | 9 #include "app/text_elider.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 std::wstring url_spec = ASCIIToWide(url.possibly_invalid_spec()); | 165 std::wstring url_spec = ASCIIToWide(url.possibly_invalid_spec()); |
166 std::wstring cmd_key_path = | 166 std::wstring cmd_key_path = |
167 ASCIIToWide(url.scheme() + "\\shell\\open\\command"); | 167 ASCIIToWide(url.scheme() + "\\shell\\open\\command"); |
168 base::win::RegKey cmd_key(HKEY_CLASSES_ROOT, cmd_key_path.c_str(), KEY_READ); | 168 base::win::RegKey cmd_key(HKEY_CLASSES_ROOT, cmd_key_path.c_str(), KEY_READ); |
169 size_t split_offset = url_spec.find(L':'); | 169 size_t split_offset = url_spec.find(L':'); |
170 if (split_offset == std::wstring::npos) | 170 if (split_offset == std::wstring::npos) |
171 return std::wstring(); | 171 return std::wstring(); |
172 std::wstring parameters = url_spec.substr(split_offset + 1, | 172 std::wstring parameters = url_spec.substr(split_offset + 1, |
173 url_spec.length() - 1); | 173 url_spec.length() - 1); |
174 std::wstring application_to_launch; | 174 std::wstring application_to_launch; |
175 if (cmd_key.ReadValue(NULL, &application_to_launch)) { | 175 if (cmd_key.ReadValue(NULL, &application_to_launch) == ERROR_SUCCESS) { |
176 ReplaceSubstringsAfterOffset(&application_to_launch, 0, L"%1", parameters); | 176 ReplaceSubstringsAfterOffset(&application_to_launch, 0, L"%1", parameters); |
177 return application_to_launch; | 177 return application_to_launch; |
178 } else { | 178 } else { |
179 return std::wstring(); | 179 return std::wstring(); |
180 } | 180 } |
181 } | 181 } |
OLD | NEW |