OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/views/external_protocol_dialog.h" | 5 #include "chrome/browser/ui/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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 std::wstring url_spec = ASCIIToWide(url.possibly_invalid_spec()); | 169 std::wstring url_spec = ASCIIToWide(url.possibly_invalid_spec()); |
170 std::wstring cmd_key_path = | 170 std::wstring cmd_key_path = |
171 ASCIIToWide(url.scheme() + "\\shell\\open\\command"); | 171 ASCIIToWide(url.scheme() + "\\shell\\open\\command"); |
172 base::win::RegKey cmd_key(HKEY_CLASSES_ROOT, cmd_key_path.c_str(), KEY_READ); | 172 base::win::RegKey cmd_key(HKEY_CLASSES_ROOT, cmd_key_path.c_str(), KEY_READ); |
173 size_t split_offset = url_spec.find(L':'); | 173 size_t split_offset = url_spec.find(L':'); |
174 if (split_offset == std::wstring::npos) | 174 if (split_offset == std::wstring::npos) |
175 return std::wstring(); | 175 return std::wstring(); |
176 std::wstring parameters = url_spec.substr(split_offset + 1, | 176 std::wstring parameters = url_spec.substr(split_offset + 1, |
177 url_spec.length() - 1); | 177 url_spec.length() - 1); |
178 std::wstring application_to_launch; | 178 std::wstring application_to_launch; |
179 if (cmd_key.ReadValue(NULL, &application_to_launch)) { | 179 if (cmd_key.ReadValue(NULL, &application_to_launch) == ERROR_SUCCESS) { |
180 ReplaceSubstringsAfterOffset(&application_to_launch, 0, L"%1", parameters); | 180 ReplaceSubstringsAfterOffset(&application_to_launch, 0, L"%1", parameters); |
181 return application_to_launch; | 181 return application_to_launch; |
182 } else { | 182 } else { |
183 return std::wstring(); | 183 return std::wstring(); |
184 } | 184 } |
185 } | 185 } |
OLD | NEW |