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

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: Responded to comments, simplified file format. 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..34d5adfab950d0053758e08c3dcecf0b08436728 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,23 @@ 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) {
+ ProtocolHandler* handler = ProtocolHandler::CreateProtocolHandler(protocol, url, title);
+
+ if (handler == NULL) {
+ return;
+ }
+
+ if (profile()->GetProtocolHandlerRegistry()->IsAlreadyRegistered(handler)) {
+ return;
tony 2011/02/14 23:40:07 Nit: 2 space indent. I would probably add a TODO(
koz (OOO until 15th September) 2011/02/15 03:37:27 Actually I've implemented the logic for showing a
+ }
+
+ AddInfoBar(new RegisterProtocolHandlerInfoBarDelegate(
+ this, profile()->GetProtocolHandlerRegistry(), handler));
+}
+
void TabContents::RunJavaScriptMessage(
const std::wstring& message,
const std::wstring& default_prompt,

Powered by Google App Engine
This is Rietveld 408576698