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

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: Fix buildbot compile errors 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
« no previous file with comments | « chrome/browser/content_settings/host_content_settings_map.cc ('k') | chrome/browser/prefs/browser_prefs.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f142d91c5dc6379a3c11b6bfaf952d47bf51ab30
--- /dev/null
+++ b/chrome/browser/intents/register_intent_handler_helper.cc
@@ -0,0 +1,57 @@
+// 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.
+
+#include <string>
+
+#include "chrome/browser/favicon/favicon_service.h"
+#include "chrome/browser/intents/register_intent_handler_infobar_delegate.h"
+#include "chrome/browser/intents/web_intents_registry_factory.h"
+#include "chrome/browser/intents/web_intents_util.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "content/public/browser/web_contents.h"
+#include "webkit/glue/web_intent_service_data.h"
+
+using content::WebContents;
+
+// 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());
+}
« no previous file with comments | « chrome/browser/content_settings/host_content_settings_map.cc ('k') | chrome/browser/prefs/browser_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698