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

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

Issue 6410115: Adds navigator.registerProtocolHandler. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: 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: 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..8b5f16a29b370db3350fa1e72e9d4e2de0ce2859 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,19 @@ void TabContents::ProcessExternalHostMessage(const std::string& message,
delegate()->ForwardMessageToExternalHost(message, origin, target);
}
+void TabContents::RegisterProtocolHandler(const std::string& protocol,
+ const std::string& url,
+ const std::string& title) {
+ ProtocolHandler* handler = ProtocolHandler::CreateProtocolHandler(protocol, url, title);
+
+ if (handler == NULL) {
+ return;
+ }
+
+ AddInfoBar(new RegisterProtocolHandlerInfoBarDelegate(
+ this, profile()->GetProtocolHandlerRegistry(), handler));
tony 2011/02/07 20:51:45 Have you thought about what happens if an extensio
koz (OOO until 15th September) 2011/02/13 22:33:48 Hm, I hadn't thought of that. I guess if the exten
+}
+
void TabContents::RunJavaScriptMessage(
const std::wstring& message,
const std::wstring& default_prompt,

Powered by Google App Engine
This is Rietveld 408576698