| Index: chrome/browser/tab_contents/tab_contents.cc
|
| diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
|
| index 2f946be16bb945a3a29a5caff2461bab3e7b1847..62c006bf02dc5a3cbd7ed7b153dd2aa3c0da4c90 100644
|
| --- a/chrome/browser/tab_contents/tab_contents.cc
|
| +++ b/chrome/browser/tab_contents/tab_contents.cc
|
| @@ -22,6 +22,8 @@
|
| #include "chrome/browser/child_process_security_policy.h"
|
| #include "chrome/browser/content_settings/content_settings_details.h"
|
| #include "chrome/browser/content_settings/host_content_settings_map.h"
|
| +#include "chrome/browser/custom_handlers/protocol_handler_registry.h"
|
| +#include "chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h"
|
| #include "chrome/browser/debugger/devtools_manager.h"
|
| #include "chrome/browser/defaults.h"
|
| #include "chrome/browser/desktop_notification_handler.h"
|
| @@ -2620,6 +2622,32 @@ void TabContents::ProcessExternalHostMessage(const std::string& message,
|
| delegate()->ForwardMessageToExternalHost(message, origin, target);
|
| }
|
|
|
| +void TabContents::RegisterProtocolHandler(const std::string& protocol,
|
| + const GURL& url,
|
| + const string16& title) {
|
| + ProtocolHandlerRegistry* registry = profile()->GetProtocolHandlerRegistry();
|
| + if (!registry->CanSchemeBeOverridden(protocol)) {
|
| + return;
|
| + }
|
| +
|
| + ProtocolHandler* handler = ProtocolHandler::CreateProtocolHandler(protocol,
|
| + url, title);
|
| + if (handler == NULL) {
|
| + return;
|
| + }
|
| +
|
| + if (registry->IsAlreadyRegistered(handler)) {
|
| + AddInfoBar(new SimpleAlertInfoBarDelegate(this, NULL,
|
| + l10n_util::GetStringFUTF16(
|
| + IDS_REGISTER_PROTOCOL_HANDLER_ALREADY_REGISTERED,
|
| + handler->title(), UTF8ToUTF16(handler->protocol())), true));
|
| + return;
|
| + }
|
| +
|
| + AddInfoBar(new RegisterProtocolHandlerInfoBarDelegate(this, registry,
|
| + handler));
|
| +}
|
| +
|
| void TabContents::RunJavaScriptMessage(
|
| const std::wstring& message,
|
| const std::wstring& default_prompt,
|
|
|