Chromium Code Reviews| Index: chrome/browser/nacl_host/nacl_infobar.cc |
| diff --git a/chrome/browser/nacl_host/nacl_infobar.cc b/chrome/browser/nacl_host/nacl_infobar.cc |
| index 764ded005b96a1f4ca3caf910f23a6c36b90b69a..8006d49c1367c8db600bd4f9496b46ec538bdc87 100644 |
| --- a/chrome/browser/nacl_host/nacl_infobar.cc |
| +++ b/chrome/browser/nacl_host/nacl_infobar.cc |
| @@ -5,21 +5,51 @@ |
| #include "chrome/browser/nacl_host/nacl_infobar.h" |
| #include "base/bind.h" |
| +#include "base/string16.h" |
| #include "chrome/browser/api/infobars/infobar_service.h" |
| -#include "chrome/browser/api/infobars/simple_alert_infobar_delegate.h" |
| +#include "chrome/browser/api/infobars/confirm_infobar_delegate.h" |
| #include "content/public/browser/browser_thread.h" |
| #include "content/public/browser/render_view_host.h" |
| #include "content/public/browser/web_contents.h" |
| +#include "googleurl/src/gurl.h" |
| #include "grit/generated_resources.h" |
| #include "ppapi/c/private/ppb_nacl_private.h" |
| #include "ui/base/l10n/l10n_util.h" |
| - |
| using content::BrowserThread; |
| using content::RenderViewHost; |
| using content::WebContents; |
| namespace { |
| +// The URL for the "learn more" article. |
| +const char kNaClLearnMoreUrl[] = |
| + "https://support.google.com/chrome/?p=ib_nacl"; |
| + |
| +// A simple LinkInfoBarDelegate doesn't support making the link right-aligned |
| +// so use a ConfirmInfoBarDelegate without any buttons instead. |
| +class NaClInfobarDelegate : public ConfirmInfoBarDelegate { |
|
jvoung (off chromium)
2013/01/07 22:13:39
Could you make the definitions out of line instead
Derek Schuff
2013/01/08 16:53:27
Done.
|
| + public: |
| + NaClInfobarDelegate(WebContents* wc, InfoBarService* ibs) : |
| + ConfirmInfoBarDelegate(ibs), wc_(wc) {} |
| + virtual string16 GetMessageText() const { |
| + return l10n_util::GetStringUTF16(IDS_NACL_APP_MISSING_ARCH_MESSAGE); |
| + } |
| + virtual string16 GetLinkText() const { |
| + return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
| + } |
| + virtual bool LinkClicked(WindowOpenDisposition disposition) { |
| + content::OpenURLParams params( |
| + GURL(kNaClLearnMoreUrl), content::Referrer(), |
| + (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| + content::PAGE_TRANSITION_LINK, |
| + false); |
| + wc_->OpenURL(params); |
| + return false; |
| + } |
| + virtual int GetButtons() const { return BUTTON_NONE; } |
| + private: |
| + WebContents* wc_; |
| +}; |
| void ShowInfobar(int render_process_id, int render_view_id, |
| int error_id) { |
| @@ -30,8 +60,7 @@ void ShowInfobar(int render_process_id, int render_view_id, |
| render_view_id); |
| WebContents* wc = WebContents::FromRenderViewHost(rvh); |
| InfoBarService* ibs = InfoBarService::FromWebContents(wc); |
| - ibs->AddInfoBar(new SimpleAlertInfoBarDelegate(ibs, NULL, |
| - l10n_util::GetStringUTF16(IDS_NACL_APP_MISSING_ARCH_MESSAGE), true)); |
| + ibs->AddInfoBar(new NaClInfobarDelegate(wc, ibs)); |
| } |
| } // namespace |