OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/registry.h" | 7 #include "base/registry.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/thread.h" | 9 #include "base/thread.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
11 #include "chrome/browser/external_protocol_handler.h" | 11 #include "chrome/browser/external_protocol_handler.h" |
12 #include "chrome/browser/tab_contents/tab_util.h" | 12 #include "chrome/browser/tab_contents/tab_util.h" |
13 #include "chrome/browser/tab_contents/web_contents.h" | 13 #include "chrome/browser/tab_contents/web_contents.h" |
14 #include "chrome/common/l10n_util.h" | 14 #include "chrome/common/l10n_util.h" |
| 15 #include "chrome/common/message_box_flags.h" |
15 #include "chrome/views/controls/message_box_view.h" | 16 #include "chrome/views/controls/message_box_view.h" |
16 #include "chrome/views/window/window.h" | 17 #include "chrome/views/window/window.h" |
17 #include "grit/chromium_strings.h" | 18 #include "grit/chromium_strings.h" |
18 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 const int kMessageWidth = 400; | 23 const int kMessageWidth = 400; |
23 | 24 |
24 } // namespace | 25 } // namespace |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 std::wstring message_text = l10n_util::GetStringF( | 97 std::wstring message_text = l10n_util::GetStringF( |
97 IDS_EXTERNAL_PROTOCOL_INFORMATION, | 98 IDS_EXTERNAL_PROTOCOL_INFORMATION, |
98 ASCIIToWide(url.scheme() + ":"), | 99 ASCIIToWide(url.scheme() + ":"), |
99 ASCIIToWide(url.possibly_invalid_spec())) + L"\n\n"; | 100 ASCIIToWide(url.possibly_invalid_spec())) + L"\n\n"; |
100 | 101 |
101 message_text += l10n_util::GetStringF( | 102 message_text += l10n_util::GetStringF( |
102 IDS_EXTERNAL_PROTOCOL_APPLICATION_TO_LAUNCH, command) + L"\n\n"; | 103 IDS_EXTERNAL_PROTOCOL_APPLICATION_TO_LAUNCH, command) + L"\n\n"; |
103 | 104 |
104 message_text += l10n_util::GetString(IDS_EXTERNAL_PROTOCOL_WARNING); | 105 message_text += l10n_util::GetString(IDS_EXTERNAL_PROTOCOL_WARNING); |
105 | 106 |
106 message_box_view_ = new MessageBoxView(MessageBoxView::kIsConfirmMessageBox, | 107 message_box_view_ = new MessageBoxView(MessageBox::kIsConfirmMessageBox, |
107 message_text, | 108 message_text, |
108 L"", | 109 L"", |
109 kMessageWidth); | 110 kMessageWidth); |
110 HWND root_hwnd; | 111 HWND root_hwnd; |
111 if (tab_contents_) { | 112 if (tab_contents_) { |
112 root_hwnd = GetAncestor(tab_contents_->GetContentNativeView(), GA_ROOT); | 113 root_hwnd = GetAncestor(tab_contents_->GetContentNativeView(), GA_ROOT); |
113 } else { | 114 } else { |
114 // Dialog is top level if we don't have a tab_contents associated with us. | 115 // Dialog is top level if we don't have a tab_contents associated with us. |
115 root_hwnd = NULL; | 116 root_hwnd = NULL; |
116 } | 117 } |
(...skipping 14 matching lines...) Expand all Loading... |
131 std::wstring parameters = url_spec.substr(split_offset + 1, | 132 std::wstring parameters = url_spec.substr(split_offset + 1, |
132 url_spec.length() - 1); | 133 url_spec.length() - 1); |
133 std::wstring application_to_launch; | 134 std::wstring application_to_launch; |
134 if (cmd_key.ReadValue(NULL, &application_to_launch)) { | 135 if (cmd_key.ReadValue(NULL, &application_to_launch)) { |
135 ReplaceSubstringsAfterOffset(&application_to_launch, 0, L"%1", parameters); | 136 ReplaceSubstringsAfterOffset(&application_to_launch, 0, L"%1", parameters); |
136 return application_to_launch; | 137 return application_to_launch; |
137 } else { | 138 } else { |
138 return std::wstring(); | 139 return std::wstring(); |
139 } | 140 } |
140 } | 141 } |
OLD | NEW |