OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 const std::wstring& command) | 128 const std::wstring& command) |
129 : url_(url), | 129 : url_(url), |
130 render_process_host_id_(render_process_host_id), | 130 render_process_host_id_(render_process_host_id), |
131 routing_id_(routing_id), | 131 routing_id_(routing_id), |
132 creation_time_(base::TimeTicks::Now()) { | 132 creation_time_(base::TimeTicks::Now()) { |
133 const int kMaxUrlWithoutSchemeSize = 256; | 133 const int kMaxUrlWithoutSchemeSize = 256; |
134 const int kMaxCommandSize = 256; | 134 const int kMaxCommandSize = 256; |
135 base::string16 elided_url_without_scheme; | 135 base::string16 elided_url_without_scheme; |
136 base::string16 elided_command; | 136 base::string16 elided_command; |
137 gfx::ElideString(base::ASCIIToUTF16(url.possibly_invalid_spec()), | 137 gfx::ElideString(base::ASCIIToUTF16(url.possibly_invalid_spec()), |
138 kMaxUrlWithoutSchemeSize, &elided_url_without_scheme); | 138 kMaxUrlWithoutSchemeSize, &elided_url_without_scheme); |
139 gfx::ElideString(WideToUTF16Hack(command), kMaxCommandSize, &elided_command); | 139 gfx::ElideString(base::WideToUTF16Hack(command), |
| 140 kMaxCommandSize, &elided_command); |
140 | 141 |
141 base::string16 message_text = l10n_util::GetStringFUTF16( | 142 base::string16 message_text = l10n_util::GetStringFUTF16( |
142 IDS_EXTERNAL_PROTOCOL_INFORMATION, | 143 IDS_EXTERNAL_PROTOCOL_INFORMATION, |
143 base::ASCIIToUTF16(url.scheme() + ":"), | 144 base::ASCIIToUTF16(url.scheme() + ":"), |
144 elided_url_without_scheme) + base::ASCIIToUTF16("\n\n"); | 145 elided_url_without_scheme) + base::ASCIIToUTF16("\n\n"); |
145 | 146 |
146 message_text += l10n_util::GetStringFUTF16( | 147 message_text += l10n_util::GetStringFUTF16( |
147 IDS_EXTERNAL_PROTOCOL_APPLICATION_TO_LAUNCH, | 148 IDS_EXTERNAL_PROTOCOL_APPLICATION_TO_LAUNCH, |
148 elided_command) + base::ASCIIToUTF16("\n\n"); | 149 elided_command) + base::ASCIIToUTF16("\n\n"); |
149 | 150 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 std::wstring parameters = url_spec.substr(split_offset + 1, | 182 std::wstring parameters = url_spec.substr(split_offset + 1, |
182 url_spec.length() - 1); | 183 url_spec.length() - 1); |
183 std::wstring application_to_launch; | 184 std::wstring application_to_launch; |
184 if (cmd_key.ReadValue(NULL, &application_to_launch) == ERROR_SUCCESS) { | 185 if (cmd_key.ReadValue(NULL, &application_to_launch) == ERROR_SUCCESS) { |
185 ReplaceSubstringsAfterOffset(&application_to_launch, 0, L"%1", parameters); | 186 ReplaceSubstringsAfterOffset(&application_to_launch, 0, L"%1", parameters); |
186 return application_to_launch; | 187 return application_to_launch; |
187 } else { | 188 } else { |
188 return std::wstring(); | 189 return std::wstring(); |
189 } | 190 } |
190 } | 191 } |
OLD | NEW |