| 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 2097e3e339754ab4ce029b312b944c535e2b230b..78f2511bcd7ce3c0a01754af150564c71fe4e4ca 100644
|
| --- a/chrome/browser/intents/register_intent_handler_infobar_delegate.cc
|
| +++ b/chrome/browser/intents/register_intent_handler_infobar_delegate.cc
|
| @@ -5,14 +5,19 @@
|
| #include "chrome/browser/intents/register_intent_handler_infobar_delegate.h"
|
|
|
| #include "base/logging.h"
|
| +#include "base/utf_string_conversions.h"
|
| +#include "chrome/browser/intents/web_intents_registry.h"
|
| +#include "chrome/browser/profiles/profile.h"
|
| #include "content/browser/tab_contents/tab_contents.h"
|
| #include "grit/generated_resources.h"
|
| #include "ui/base/l10n/l10n_util.h"
|
|
|
| RegisterIntentHandlerInfoBarDelegate::RegisterIntentHandlerInfoBarDelegate(
|
| - TabContents* tab_contents)
|
| + TabContents* tab_contents, const WebIntentData& intent)
|
| : ConfirmInfoBarDelegate(tab_contents),
|
| - tab_contents_(tab_contents) {
|
| + tab_contents_(tab_contents),
|
| + profile_(Profile::FromBrowserContext(tab_contents->browser_context())),
|
| + intent_(intent) {
|
| }
|
|
|
| InfoBarDelegate::Type
|
| @@ -21,8 +26,10 @@ InfoBarDelegate::Type
|
| }
|
|
|
| string16 RegisterIntentHandlerInfoBarDelegate::GetMessageText() const {
|
| - return l10n_util::GetStringFUTF16(IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM,
|
| - string16(), string16());
|
| + return l10n_util::GetStringFUTF16(
|
| + IDS_REGISTER_INTENT_HANDLER_CONFIRM,
|
| + UTF8ToUTF16(intent_.service_url.GetOrigin().path()),
|
| + string16());
|
| }
|
|
|
| string16 RegisterIntentHandlerInfoBarDelegate::GetButtonLabel(
|
| @@ -36,6 +43,12 @@ string16 RegisterIntentHandlerInfoBarDelegate::GetButtonLabel(
|
| return l10n_util::GetStringUTF16(IDS_REGISTER_INTENT_HANDLER_DENY);
|
| }
|
|
|
| +bool RegisterIntentHandlerInfoBarDelegate::Accept() {
|
| + WebIntentsRegistry* registry = profile_->GetWebIntentsRegistry();
|
| + registry->RegisterIntentProvider(intent_);
|
| + return true;
|
| +}
|
| +
|
| string16 RegisterIntentHandlerInfoBarDelegate::GetLinkText() const {
|
| return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
|
| }
|
|
|