| 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..5972e258e320da6807cca2dd00f6dc5b8247926d 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"
|
| @@ -532,6 +534,8 @@ bool TabContents::OnMessageReceived(const IPC::Message& message) {
|
| OnInstallApplication)
|
| IPC_MESSAGE_HANDLER(ViewHostMsg_PageContents, OnPageContents)
|
| IPC_MESSAGE_HANDLER(ViewHostMsg_PageTranslated, OnPageTranslated)
|
| + IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterProtocolHandler,
|
| + OnRegisterProtocolHandler)
|
| IPC_MESSAGE_HANDLER(ViewHostMsg_SetSuggestions, OnSetSuggestions)
|
| IPC_MESSAGE_HANDLER(ViewHostMsg_InstantSupportDetermined,
|
| OnInstantSupportDetermined)
|
| @@ -2170,6 +2174,32 @@ void TabContents::OnPageTranslated(int32 page_id,
|
| Details<PageTranslatedDetails>(&details));
|
| }
|
|
|
| +void TabContents::OnRegisterProtocolHandler(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::OnSetSuggestions(
|
| int32 page_id,
|
| const std::vector<std::string>& suggestions) {
|
|
|