diff options
author | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-09 13:32:29 +0000 |
---|---|---|
committer | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-09 13:32:29 +0000 |
commit | 851b1eb7c1ccf13b7fb7627bca78f7aefd03c67c (patch) | |
tree | a409d4ec9b6804999d0ea4bf25750d6e896f90ba /chrome/browser/tab_contents/tab_contents.cc | |
parent | b089b89cabbb56d499dcbe2ee070e20710d362ef (diff) | |
download | chromium_src-851b1eb7c1ccf13b7fb7627bca78f7aefd03c67c.zip chromium_src-851b1eb7c1ccf13b7fb7627bca78f7aefd03c67c.tar.gz chromium_src-851b1eb7c1ccf13b7fb7627bca78f7aefd03c67c.tar.bz2 |
Disable outdated non-sandboxed plugins.
Relanding r55227, which had a compile error.
BUG=47731
TEST=Run with --disable-outdated-plugins
Review URL: http://codereview.chromium.org/3071028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55394 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents/tab_contents.cc')
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.cc | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index 57e29e1..0127f35 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -236,6 +236,68 @@ void MakeNavigateParams(const NavigationController& controller, params->request_time = base::Time::Now(); } +class DisabledPluginInfoBar : public ConfirmInfoBarDelegate { + public: + DisabledPluginInfoBar(TabContents* tab_contents, + const string16& name, + const GURL& update_url) + : ConfirmInfoBarDelegate(tab_contents), + tab_contents_(tab_contents), + name_(name), + update_url_(update_url) { + tab_contents->AddInfoBar(this); + } + + virtual int GetButtons() const { + return BUTTON_OK | BUTTON_CANCEL | BUTTON_OK_DEFAULT; + } + + virtual std::wstring GetButtonLabel(InfoBarButton button) const { + if (button == BUTTON_CANCEL) + return l10n_util::GetString(IDS_PLUGIN_ENABLE_TEMPORARILY); + if (button == BUTTON_OK) + return l10n_util::GetString(IDS_PLUGIN_UPDATE); + return ConfirmInfoBarDelegate::GetButtonLabel(button); + } + + virtual std::wstring GetMessageText() const { + return UTF16ToWide(l10n_util::GetStringFUTF16(IDS_PLUGIN_OUTDATED_PROMPT, + name_)); + } + + virtual std::wstring GetLinkText() { + return l10n_util::GetString(IDS_LEARN_MORE); + } + + virtual SkBitmap* GetIcon() const { + return ResourceBundle::GetSharedInstance().GetBitmapNamed( + IDR_INFOBAR_PLUGIN_INSTALL); + } + + virtual bool Accept() { + tab_contents_->OpenURL(update_url_, GURL(), + CURRENT_TAB, PageTransition::LINK); + return false; + } + + virtual bool Cancel() { + tab_contents_->OpenURL(GURL(chrome::kChromeUIPluginsURL), GURL(), + CURRENT_TAB, PageTransition::LINK); + return false; + } + + virtual bool LinkClicked(WindowOpenDisposition disposition) { + // TODO(bauerb): Navigate to a help page explaining why we disabled + // the plugin, once we have one. + return false; + } + + private: + TabContents* tab_contents_; + string16 name_; + GURL update_url_; +}; + } // namespace // ----------------------------------------------------------------------------- @@ -1967,6 +2029,11 @@ void TabContents::OnDidGetApplicationInfo( delegate()->OnDidGetApplicationInfo(this, page_id); } +void TabContents::OnDisabledOutdatedPlugin(const string16& name, + const GURL& update_url) { + new DisabledPluginInfoBar(this, name, update_url); +} + void TabContents::OnPageContents(const GURL& url, int renderer_process_id, int32 page_id, |