Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Unified Diff: content/browser/tab_contents/tab_contents.cc

Issue 6410115: Adds navigator.registerProtocolHandler. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Sync'd, disallow non-same origin rph, adds hostname to the infobar. Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/tab_contents/tab_contents.cc
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index 30b91e962f978d70306a6240e48d41a59d47d2b5..c0de537aeaae9a839d67dfee4cffa6180c4299d6 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/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"
@@ -446,6 +448,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)
@@ -1963,6 +1967,19 @@ 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();
+ ProtocolHandler* handler = ProtocolHandler::CreateProtocolHandler(protocol,
+ url,
+ title);
+ if (handler != NULL) {
+ RegisterProtocolHandlerInfoBarDelegate::AttemptRegisterProtocolHandler(
+ this, registry, handler);
+ }
+}
+
void TabContents::OnSetSuggestions(
int32 page_id,
const std::vector<std::string>& suggestions) {
« chrome/browser/profiles/profile_io_data.cc ('K') | « content/browser/tab_contents/tab_contents.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698