| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 bool prompt_user, | 96 bool prompt_user, |
| 97 ExternalProtocolHandler::Delegate* delegate) | 97 ExternalProtocolHandler::Delegate* delegate) |
| 98 : delegate_(delegate), | 98 : delegate_(delegate), |
| 99 escaped_url_(escaped_url), | 99 escaped_url_(escaped_url), |
| 100 render_process_host_id_(render_process_host_id), | 100 render_process_host_id_(render_process_host_id), |
| 101 tab_contents_id_(tab_contents_id), | 101 tab_contents_id_(tab_contents_id), |
| 102 prompt_user_(prompt_user) {} | 102 prompt_user_(prompt_user) {} |
| 103 | 103 |
| 104 virtual void SetDefaultWebClientUIState( | 104 virtual void SetDefaultWebClientUIState( |
| 105 ShellIntegration::DefaultWebClientUIState state) OVERRIDE { | 105 ShellIntegration::DefaultWebClientUIState state) OVERRIDE { |
| 106 DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); | 106 DCHECK(base::MessageLoopForUI::IsCurrent()); |
| 107 | 107 |
| 108 // If we are still working out if we're the default, or we've found | 108 // If we are still working out if we're the default, or we've found |
| 109 // out we definately are the default, we end here. | 109 // out we definately are the default, we end here. |
| 110 if (state == ShellIntegration::STATE_PROCESSING) { | 110 if (state == ShellIntegration::STATE_PROCESSING) { |
| 111 return; | 111 return; |
| 112 } | 112 } |
| 113 | 113 |
| 114 if (delegate_) | 114 if (delegate_) |
| 115 delegate_->FinishedProcessingCheck(); | 115 delegate_->FinishedProcessingCheck(); |
| 116 | 116 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 update_excluded_schemas->SetBoolean(scheme, (state == BLOCK)); | 249 update_excluded_schemas->SetBoolean(scheme, (state == BLOCK)); |
| 250 } | 250 } |
| 251 } | 251 } |
| 252 } | 252 } |
| 253 | 253 |
| 254 // static | 254 // static |
| 255 void ExternalProtocolHandler::LaunchUrlWithDelegate(const GURL& url, | 255 void ExternalProtocolHandler::LaunchUrlWithDelegate(const GURL& url, |
| 256 int render_process_host_id, | 256 int render_process_host_id, |
| 257 int tab_contents_id, | 257 int tab_contents_id, |
| 258 Delegate* delegate) { | 258 Delegate* delegate) { |
| 259 DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); | 259 DCHECK(base::MessageLoopForUI::IsCurrent()); |
| 260 | 260 |
| 261 // Escape the input scheme to be sure that the command does not | 261 // Escape the input scheme to be sure that the command does not |
| 262 // have parameters unexpected by the external program. | 262 // have parameters unexpected by the external program. |
| 263 std::string escaped_url_string = net::EscapeExternalHandlerValue(url.spec()); | 263 std::string escaped_url_string = net::EscapeExternalHandlerValue(url.spec()); |
| 264 GURL escaped_url(escaped_url_string); | 264 GURL escaped_url(escaped_url_string); |
| 265 BlockState block_state = GetBlockStateWithDelegate(escaped_url.scheme(), | 265 BlockState block_state = GetBlockStateWithDelegate(escaped_url.scheme(), |
| 266 delegate); | 266 delegate); |
| 267 if (block_state == BLOCK) { | 267 if (block_state == BLOCK) { |
| 268 if (delegate) | 268 if (delegate) |
| 269 delegate->BlockRequest(); | 269 delegate->BlockRequest(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 Profile::FromBrowserContext(web_contents->GetBrowserContext()), url); | 304 Profile::FromBrowserContext(web_contents->GetBrowserContext()), url); |
| 305 } | 305 } |
| 306 | 306 |
| 307 // static | 307 // static |
| 308 void ExternalProtocolHandler::RegisterPrefs(PrefRegistrySimple* registry) { | 308 void ExternalProtocolHandler::RegisterPrefs(PrefRegistrySimple* registry) { |
| 309 registry->RegisterDictionaryPref(prefs::kExcludedSchemes); | 309 registry->RegisterDictionaryPref(prefs::kExcludedSchemes); |
| 310 } | 310 } |
| 311 | 311 |
| 312 // static | 312 // static |
| 313 void ExternalProtocolHandler::PermitLaunchUrl() { | 313 void ExternalProtocolHandler::PermitLaunchUrl() { |
| 314 DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); | 314 DCHECK(base::MessageLoopForUI::IsCurrent()); |
| 315 g_accept_requests = true; | 315 g_accept_requests = true; |
| 316 } | 316 } |
| OLD | NEW |