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

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

Issue 8469018: Provide assumed favicon for intents if service provider page was never visited. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review issues 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 86dee55ae3d293acebd4330f812cb276c4e7bd3b..7eb810f572cfedc51bcfa7cab8ffd5700d9b1012 100644
--- a/chrome/browser/intents/register_intent_handler_infobar_delegate.cc
+++ b/chrome/browser/intents/register_intent_handler_infobar_delegate.cc
@@ -8,6 +8,7 @@
#include "base/bind_helpers.h"
#include "base/logging.h"
#include "base/utf_string_conversions.h"
+#include "chrome/browser/favicon/favicon_service.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"
@@ -18,10 +19,14 @@
RegisterIntentHandlerInfoBarDelegate::RegisterIntentHandlerInfoBarDelegate(
InfoBarTabHelper* infobar_helper,
WebIntentsRegistry* registry,
- const webkit_glue::WebIntentServiceData& service)
+ const webkit_glue::WebIntentServiceData& service,
+ FaviconService* favicon_service,
+ const GURL& origin_url)
: ConfirmInfoBarDelegate(infobar_helper),
registry_(registry),
- service_(service) {
+ service_(service),
+ favicon_service_(favicon_service),
+ origin_url_(origin_url) {
}
InfoBarDelegate::Type
@@ -49,6 +54,11 @@ string16 RegisterIntentHandlerInfoBarDelegate::GetButtonLabel(
bool RegisterIntentHandlerInfoBarDelegate::Accept() {
registry_->RegisterIntentProvider(service_);
+
+ // Register a temporary FavIcon in case we never visited the provider page.
+ if (favicon_service_ && origin_url_ != service_.service_url)
+ favicon_service_->CloneFavicon(origin_url_, service_.service_url);
+
return true;
}
@@ -70,10 +80,12 @@ namespace {
void CheckProvider(InfoBarTabHelper* infobar_helper,
WebIntentsRegistry* registry,
const webkit_glue::WebIntentServiceData& service,
+ FaviconService* favicon_service,
+ const GURL& origin_url,
bool provider_exists) {
if (!provider_exists) {
infobar_helper->AddInfoBar(new RegisterIntentHandlerInfoBarDelegate(
- infobar_helper, registry, service));
+ infobar_helper, registry, service, favicon_service, origin_url));
}
}
@@ -83,12 +95,16 @@ void CheckProvider(InfoBarTabHelper* infobar_helper,
void RegisterIntentHandlerInfoBarDelegate::MaybeShowIntentInfoBar(
InfoBarTabHelper* infobar_helper,
WebIntentsRegistry* registry,
- const webkit_glue::WebIntentServiceData& service) {
+ const webkit_glue::WebIntentServiceData& service,
+ FaviconService* favicon_service,
+ const GURL& origin_url) {
DCHECK(infobar_helper);
DCHECK(registry);
registry->IntentProviderExists(service,
base::Bind(&CheckProvider,
base::Unretained(infobar_helper),
registry,
- service));
+ service,
+ favicon_service,
+ origin_url));
}

Powered by Google App Engine
This is Rietveld 408576698