| 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 "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
| 10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 IDS_EXTERNAL_PROTOCOL_INFORMATION, | 140 IDS_EXTERNAL_PROTOCOL_INFORMATION, |
| 141 ASCIIToUTF16(url.scheme() + ":"), | 141 ASCIIToUTF16(url.scheme() + ":"), |
| 142 elided_url_without_scheme) + ASCIIToUTF16("\n\n"); | 142 elided_url_without_scheme) + ASCIIToUTF16("\n\n"); |
| 143 | 143 |
| 144 message_text += l10n_util::GetStringFUTF16( | 144 message_text += l10n_util::GetStringFUTF16( |
| 145 IDS_EXTERNAL_PROTOCOL_APPLICATION_TO_LAUNCH, | 145 IDS_EXTERNAL_PROTOCOL_APPLICATION_TO_LAUNCH, |
| 146 elided_command) + ASCIIToUTF16("\n\n"); | 146 elided_command) + ASCIIToUTF16("\n\n"); |
| 147 | 147 |
| 148 message_text += l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_WARNING); | 148 message_text += l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_WARNING); |
| 149 | 149 |
| 150 message_box_view_ = new views::MessageBoxView( | 150 views::MessageBoxView::InitParams params(message_text); |
| 151 views::MessageBoxView::NO_OPTIONS, | 151 params.message_width = kMessageWidth; |
| 152 message_text, | 152 message_box_view_ = new views::MessageBoxView(params); |
| 153 string16(), | |
| 154 kMessageWidth); | |
| 155 message_box_view_->SetCheckBoxLabel( | 153 message_box_view_->SetCheckBoxLabel( |
| 156 l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT)); | 154 l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT)); |
| 157 | 155 |
| 158 HWND root_hwnd; | 156 HWND root_hwnd; |
| 159 if (web_contents_) { | 157 if (web_contents_) { |
| 160 root_hwnd = GetAncestor(web_contents_->GetContentNativeView(), GA_ROOT); | 158 root_hwnd = GetAncestor(web_contents_->GetContentNativeView(), GA_ROOT); |
| 161 } else { | 159 } else { |
| 162 // Dialog is top level if we don't have a tab_contents associated with us. | 160 // Dialog is top level if we don't have a tab_contents associated with us. |
| 163 root_hwnd = NULL; | 161 root_hwnd = NULL; |
| 164 } | 162 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 183 std::wstring parameters = url_spec.substr(split_offset + 1, | 181 std::wstring parameters = url_spec.substr(split_offset + 1, |
| 184 url_spec.length() - 1); | 182 url_spec.length() - 1); |
| 185 std::wstring application_to_launch; | 183 std::wstring application_to_launch; |
| 186 if (cmd_key.ReadValue(NULL, &application_to_launch) == ERROR_SUCCESS) { | 184 if (cmd_key.ReadValue(NULL, &application_to_launch) == ERROR_SUCCESS) { |
| 187 ReplaceSubstringsAfterOffset(&application_to_launch, 0, L"%1", parameters); | 185 ReplaceSubstringsAfterOffset(&application_to_launch, 0, L"%1", parameters); |
| 188 return application_to_launch; | 186 return application_to_launch; |
| 189 } else { | 187 } else { |
| 190 return std::wstring(); | 188 return std::wstring(); |
| 191 } | 189 } |
| 192 } | 190 } |
| OLD | NEW |