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/external_protocol_handler.h" | 5 #include "chrome/browser/external_protocol_handler.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 // have parameters unexpected by the external program. | 138 // have parameters unexpected by the external program. |
139 std::string escaped_url_string = EscapeExternalHandlerValue(url.spec()); | 139 std::string escaped_url_string = EscapeExternalHandlerValue(url.spec()); |
140 GURL escaped_url(escaped_url_string); | 140 GURL escaped_url(escaped_url_string); |
141 BlockState block_state = GetBlockState(ASCIIToWide(escaped_url.scheme())); | 141 BlockState block_state = GetBlockState(ASCIIToWide(escaped_url.scheme())); |
142 if (block_state == BLOCK) | 142 if (block_state == BLOCK) |
143 return; | 143 return; |
144 | 144 |
145 g_accept_requests = false; | 145 g_accept_requests = false; |
146 | 146 |
147 if (block_state == UNKNOWN) { | 147 if (block_state == UNKNOWN) { |
148 #if defined(OS_WIN) || defined(TOOLKIT_GTK) || defined(OS_MACOSX) | |
149 // Ask the user if they want to allow the protocol. This will call | 148 // Ask the user if they want to allow the protocol. This will call |
150 // LaunchUrlWithoutSecurityCheck if the user decides to accept the protocol. | 149 // LaunchUrlWithoutSecurityCheck if the user decides to accept the protocol. |
151 RunExternalProtocolDialog(escaped_url, | 150 RunExternalProtocolDialog(escaped_url, |
152 render_process_host_id, | 151 render_process_host_id, |
153 tab_contents_id); | 152 tab_contents_id); |
154 #endif | |
155 // For now, allow only whitelisted protocols to fire on Linux/Views. | |
156 // See http://crbug.com/23853 . | |
157 return; | 153 return; |
158 } | 154 } |
159 | 155 |
160 LaunchUrlWithoutSecurityCheck(escaped_url); | 156 LaunchUrlWithoutSecurityCheck(escaped_url); |
161 } | 157 } |
162 | 158 |
163 // static | 159 // static |
164 void ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(const GURL& url) { | 160 void ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(const GURL& url) { |
165 #if defined(OS_MACOSX) | 161 #if defined(OS_MACOSX) |
166 // This must run on the UI thread on OS X. | 162 // This must run on the UI thread on OS X. |
(...skipping 14 matching lines...) Expand all Loading... |
181 // static | 177 // static |
182 void ExternalProtocolHandler::RegisterPrefs(PrefService* prefs) { | 178 void ExternalProtocolHandler::RegisterPrefs(PrefService* prefs) { |
183 prefs->RegisterDictionaryPref(prefs::kExcludedSchemes); | 179 prefs->RegisterDictionaryPref(prefs::kExcludedSchemes); |
184 } | 180 } |
185 | 181 |
186 // static | 182 // static |
187 void ExternalProtocolHandler::OnUserGesture() { | 183 void ExternalProtocolHandler::OnUserGesture() { |
188 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); | 184 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); |
189 g_accept_requests = true; | 185 g_accept_requests = true; |
190 } | 186 } |
OLD | NEW |