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

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

Issue 8144013: Add a check to the registry before the intent infobar is shown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix provider to service in comments. Created 9 years, 1 month 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_infobar_delegate.cc
diff --git a/chrome/browser/intents/register_intent_handler_infobar_delegate.cc b/chrome/browser/intents/register_intent_handler_infobar_delegate.cc
index c0914323c1c1e8b9caedce3669f0a6d7c4a44ec9..86dee55ae3d293acebd4330f812cb276c4e7bd3b 100644
--- a/chrome/browser/intents/register_intent_handler_infobar_delegate.cc
+++ b/chrome/browser/intents/register_intent_handler_infobar_delegate.cc
@@ -4,8 +4,11 @@
#include "chrome/browser/intents/register_intent_handler_infobar_delegate.h"
+#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "base/logging.h"
#include "base/utf_string_conversions.h"
+#include "chrome/browser/infobars/infobar_tab_helper.h"
#include "chrome/browser/intents/web_intents_registry.h"
#include "chrome/browser/intents/web_intents_registry_factory.h"
#include "chrome/browser/profiles/profile.h"
@@ -60,3 +63,32 @@ bool RegisterIntentHandlerInfoBarDelegate::LinkClicked(
// TODO(jhawkins): Add associated bug for the article here.
return false;
}
+
+namespace {
+
+// Helper continuation for MaybeShowIntentInfoBar.
+void CheckProvider(InfoBarTabHelper* infobar_helper,
+ WebIntentsRegistry* registry,
+ const webkit_glue::WebIntentServiceData& service,
+ bool provider_exists) {
+ if (!provider_exists) {
+ infobar_helper->AddInfoBar(new RegisterIntentHandlerInfoBarDelegate(
+ infobar_helper, registry, service));
+ }
+}
+
+} // namespace
+
+// static
+void RegisterIntentHandlerInfoBarDelegate::MaybeShowIntentInfoBar(
+ InfoBarTabHelper* infobar_helper,
+ WebIntentsRegistry* registry,
+ const webkit_glue::WebIntentServiceData& service) {
+ DCHECK(infobar_helper);
+ DCHECK(registry);
+ registry->IntentProviderExists(service,
+ base::Bind(&CheckProvider,
+ base::Unretained(infobar_helper),
+ registry,
+ service));
+}
« no previous file with comments | « chrome/browser/intents/register_intent_handler_infobar_delegate.h ('k') | chrome/browser/intents/web_intents_registry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698