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 "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/registry.h" | |
11 #include "base/string_util.h" | 10 #include "base/string_util.h" |
12 #include "base/thread.h" | 11 #include "base/thread.h" |
13 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "base/win/registry.h" |
14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/external_protocol_handler.h" | 15 #include "chrome/browser/external_protocol_handler.h" |
16 #include "chrome/browser/tab_contents/tab_contents.h" | 16 #include "chrome/browser/tab_contents/tab_contents.h" |
17 #include "chrome/browser/tab_contents/tab_util.h" | 17 #include "chrome/browser/tab_contents/tab_util.h" |
18 #include "grit/chromium_strings.h" | 18 #include "grit/chromium_strings.h" |
19 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
20 #include "views/controls/message_box_view.h" | 20 #include "views/controls/message_box_view.h" |
21 #include "views/window/window.h" | 21 #include "views/window/window.h" |
22 | 22 |
23 namespace { | 23 namespace { |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 views::Window::CreateChromeWindow(root_hwnd, gfx::Rect(), this)->Show(); | 154 views::Window::CreateChromeWindow(root_hwnd, gfx::Rect(), this)->Show(); |
155 } | 155 } |
156 | 156 |
157 // static | 157 // static |
158 std::wstring ExternalProtocolDialog::GetApplicationForProtocol( | 158 std::wstring ExternalProtocolDialog::GetApplicationForProtocol( |
159 const GURL& url) { | 159 const GURL& url) { |
160 std::wstring url_spec = ASCIIToWide(url.possibly_invalid_spec()); | 160 std::wstring url_spec = ASCIIToWide(url.possibly_invalid_spec()); |
161 std::wstring cmd_key_path = | 161 std::wstring cmd_key_path = |
162 ASCIIToWide(url.scheme() + "\\shell\\open\\command"); | 162 ASCIIToWide(url.scheme() + "\\shell\\open\\command"); |
163 RegKey cmd_key(HKEY_CLASSES_ROOT, cmd_key_path.c_str(), KEY_READ); | 163 base::win::RegKey cmd_key(HKEY_CLASSES_ROOT, cmd_key_path.c_str(), KEY_READ); |
164 size_t split_offset = url_spec.find(L':'); | 164 size_t split_offset = url_spec.find(L':'); |
165 if (split_offset == std::wstring::npos) | 165 if (split_offset == std::wstring::npos) |
166 return std::wstring(); | 166 return std::wstring(); |
167 std::wstring parameters = url_spec.substr(split_offset + 1, | 167 std::wstring parameters = url_spec.substr(split_offset + 1, |
168 url_spec.length() - 1); | 168 url_spec.length() - 1); |
169 std::wstring application_to_launch; | 169 std::wstring application_to_launch; |
170 if (cmd_key.ReadValue(NULL, &application_to_launch)) { | 170 if (cmd_key.ReadValue(NULL, &application_to_launch)) { |
171 ReplaceSubstringsAfterOffset(&application_to_launch, 0, L"%1", parameters); | 171 ReplaceSubstringsAfterOffset(&application_to_launch, 0, L"%1", parameters); |
172 return application_to_launch; | 172 return application_to_launch; |
173 } else { | 173 } else { |
174 return std::wstring(); | 174 return std::wstring(); |
175 } | 175 } |
176 } | 176 } |
OLD | NEW |