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/external_protocol/external_protocol_handler.h" | 5 #include "chrome/browser/external_protocol/external_protocol_handler.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 bool prompt_user, | 89 bool prompt_user, |
90 ExternalProtocolHandler::Delegate* delegate) | 90 ExternalProtocolHandler::Delegate* delegate) |
91 : delegate_(delegate), | 91 : delegate_(delegate), |
92 escaped_url_(escaped_url), | 92 escaped_url_(escaped_url), |
93 render_process_host_id_(render_process_host_id), | 93 render_process_host_id_(render_process_host_id), |
94 tab_contents_id_(tab_contents_id), | 94 tab_contents_id_(tab_contents_id), |
95 prompt_user_(prompt_user) {} | 95 prompt_user_(prompt_user) {} |
96 | 96 |
97 virtual void SetDefaultWebClientUIState( | 97 virtual void SetDefaultWebClientUIState( |
98 ShellIntegration::DefaultWebClientUIState state) OVERRIDE { | 98 ShellIntegration::DefaultWebClientUIState state) OVERRIDE { |
99 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); | 99 DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); |
100 | 100 |
101 // If we are still working out if we're the default, or we've found | 101 // If we are still working out if we're the default, or we've found |
102 // out we definately are the default, we end here. | 102 // out we definately are the default, we end here. |
103 if (state == ShellIntegration::STATE_PROCESSING) { | 103 if (state == ShellIntegration::STATE_PROCESSING) { |
104 return; | 104 return; |
105 } | 105 } |
106 | 106 |
107 if (delegate_) | 107 if (delegate_) |
108 delegate_->FinishedProcessingCheck(); | 108 delegate_->FinishedProcessingCheck(); |
109 | 109 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 update_excluded_schemas->SetBoolean(scheme, (state == BLOCK)); | 240 update_excluded_schemas->SetBoolean(scheme, (state == BLOCK)); |
241 } | 241 } |
242 } | 242 } |
243 } | 243 } |
244 | 244 |
245 // static | 245 // static |
246 void ExternalProtocolHandler::LaunchUrlWithDelegate(const GURL& url, | 246 void ExternalProtocolHandler::LaunchUrlWithDelegate(const GURL& url, |
247 int render_process_host_id, | 247 int render_process_host_id, |
248 int tab_contents_id, | 248 int tab_contents_id, |
249 Delegate* delegate) { | 249 Delegate* delegate) { |
250 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); | 250 DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); |
251 | 251 |
252 // Escape the input scheme to be sure that the command does not | 252 // Escape the input scheme to be sure that the command does not |
253 // have parameters unexpected by the external program. | 253 // have parameters unexpected by the external program. |
254 std::string escaped_url_string = net::EscapeExternalHandlerValue(url.spec()); | 254 std::string escaped_url_string = net::EscapeExternalHandlerValue(url.spec()); |
255 GURL escaped_url(escaped_url_string); | 255 GURL escaped_url(escaped_url_string); |
256 BlockState block_state = GetBlockStateWithDelegate(escaped_url.scheme(), | 256 BlockState block_state = GetBlockStateWithDelegate(escaped_url.scheme(), |
257 delegate); | 257 delegate); |
258 if (block_state == BLOCK) { | 258 if (block_state == BLOCK) { |
259 if (delegate) | 259 if (delegate) |
260 delegate->BlockRequest(); | 260 delegate->BlockRequest(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 #endif | 296 #endif |
297 } | 297 } |
298 | 298 |
299 // static | 299 // static |
300 void ExternalProtocolHandler::RegisterPrefs(PrefRegistrySimple* registry) { | 300 void ExternalProtocolHandler::RegisterPrefs(PrefRegistrySimple* registry) { |
301 registry->RegisterDictionaryPref(prefs::kExcludedSchemes); | 301 registry->RegisterDictionaryPref(prefs::kExcludedSchemes); |
302 } | 302 } |
303 | 303 |
304 // static | 304 // static |
305 void ExternalProtocolHandler::PermitLaunchUrl() { | 305 void ExternalProtocolHandler::PermitLaunchUrl() { |
306 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); | 306 DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); |
307 g_accept_requests = true; | 307 g_accept_requests = true; |
308 } | 308 } |
OLD | NEW |