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

Unified Diff: chrome/browser/intents/register_intent_handler_helper.cc

Issue 9521013: Remove web intents from Chrome on Android build (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Resolved nits Created 8 years, 9 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/intents/register_intent_handler_helper.cc
diff --git a/chrome/browser/intents/register_intent_handler_helper.cc b/chrome/browser/intents/register_intent_handler_helper.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6dd603d53da5a83184558d03d47e92a5f88993a3
--- /dev/null
+++ b/chrome/browser/intents/register_intent_handler_helper.cc
@@ -0,0 +1,44 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// static
+void Browser::RegisterIntentHandlerHelper(WebContents* tab,
+ const string16& action,
+ const string16& type,
+ const string16& href,
+ const string16& title,
+ const string16& disposition) {
+ if (!web_intents::IsWebIntentsEnabled())
+ return;
+
+ TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents(
+ tab);
+ if (!tcw || tcw->profile()->IsOffTheRecord())
+ return;
+
+ FaviconService* favicon_service =
+ tcw->profile()->GetFaviconService(Profile::EXPLICIT_ACCESS);
+
+ // |href| can be relative to originating URL. Resolve if necessary.
+ GURL service_url(href);
+ if (!service_url.is_valid()) {
+ const GURL& url = tab->GetURL();
+ service_url = url.Resolve(href);
+ }
+
+ webkit_glue::WebIntentServiceData service;
+ service.service_url = service_url;
+ service.action = action;
+ service.type = type;
+ service.title = title;
+ service.setDisposition(disposition);
+
+ RegisterIntentHandlerInfoBarDelegate::MaybeShowIntentInfoBar(
+ tcw->infobar_tab_helper(),
+ WebIntentsRegistryFactory::GetForProfile(tcw->profile()),
+ service,
+ favicon_service,
+ tab->GetURL());
+}
+

Powered by Google App Engine
This is Rietveld 408576698