Chromium Code Reviews| 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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f6d91e6f23c999f5906682ad00c01b580379cb20 |
| --- /dev/null |
| +++ b/chrome/browser/intents/register_intent_handler_infobar_delegate.cc |
| @@ -0,0 +1,60 @@ |
| +// Copyright (c) 2011 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 "chrome/browser/intents/register_intent_handler_infobar_delegate.h" |
| + |
| +#include "base/utf_string_conversions.h" |
| +#include "chrome/common/url_constants.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) |
| + : ConfirmInfoBarDelegate(tab_contents), |
| + tab_contents_(tab_contents) { |
| +} |
| + |
| +InfoBarDelegate::Type |
| +RegisterIntentHandlerInfoBarDelegate::GetInfoBarType() const { |
|
Peter Kasting
2011/07/26 22:08:32
Nit: Indent 4
James Hawkins
2011/07/26 22:35:39
Done. Perhaps this should be added to the style gu
|
| + return PAGE_ACTION_TYPE; |
| +} |
| + |
| +string16 RegisterIntentHandlerInfoBarDelegate::GetMessageText() const { |
| + return l10n_util::GetStringFUTF16(IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM, |
| + string16(), string16()); |
| +} |
| + |
| +int RegisterIntentHandlerInfoBarDelegate::GetButtons() const { |
| + return BUTTON_OK | BUTTON_CANCEL | BUTTON_NONE; |
|
Peter Kasting
2011/07/26 22:08:32
This doesn't work. BUTTON_NONE is zero, not a sep
James Hawkins
2011/07/26 22:35:39
There's an open question in the design doc about u
|
| +} |
| + |
| +string16 RegisterIntentHandlerInfoBarDelegate::GetButtonLabel( |
| + InfoBarButton button) const { |
| + switch (button) { |
| + case BUTTON_OK: |
| + return l10n_util::GetStringUTF16(IDS_REGISTER_INTENT_HANDLER_ACCEPT); |
| + case BUTTON_CANCEL: |
| + return l10n_util::GetStringFUTF16(IDS_REGISTER_INTENT_HANDLER_DENY, |
| + string16()); |
| + case BUTTON_NONE: |
| + return l10n_util::GetStringFUTF16(IDS_REGISTER_INTENT_HANDLER_NEVER, |
| + string16()); |
| + } |
| + |
| + NOTREACHED(); |
| + return string16(); |
| +} |
| + |
| +string16 RegisterIntentHandlerInfoBarDelegate::GetLinkText() const { |
| + return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
| +} |
| + |
| +bool RegisterIntentHandlerInfoBarDelegate::LinkClicked( |
| + WindowOpenDisposition disposition) { |
| + // TODO(jhawkins): Open the Web Intents Help Center article once it is |
| + // written. |
| + // TODO(jhawkins): Add associated bug for the article here. |
| + return false; |
| +} |