diff options
author | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-06 15:38:29 +0000 |
---|---|---|
committer | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-06 15:38:29 +0000 |
commit | 8b86363bc6c71aed7d10bef1c496b558faac5628 (patch) | |
tree | 96a77f7782d593b380bc02332935b8c692902341 /chrome/browser/tab_contents | |
parent | c500bc9f09f9b28c9dbc2c956abdbb8e7f5e6600 (diff) | |
download | chromium_src-8b86363bc6c71aed7d10bef1c496b558faac5628.zip chromium_src-8b86363bc6c71aed7d10bef1c496b558faac5628.tar.gz chromium_src-8b86363bc6c71aed7d10bef1c496b558faac5628.tar.bz2 |
Disable outdated non-sandboxed plugins.
BUG=47731
TEST=Run with --disable-outdated-plugins
Review URL: http://codereview.chromium.org/3038051
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55227 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.cc | 67 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.h | 2 |
2 files changed, 69 insertions, 0 deletions
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index 2992612..96c2411 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, diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h index 3511b7c..ab4cf56 100644 --- a/chrome/browser/tab_contents/tab_contents.h +++ b/chrome/browser/tab_contents/tab_contents.h @@ -834,6 +834,8 @@ class TabContents : public PageNavigator, virtual void OnDidGetApplicationInfo( int32 page_id, const webkit_glue::WebApplicationInfo& info); + virtual void OnDisabledOutdatedPlugin(const string16& name, + const GURL& update_url); virtual void OnPageContents(const GURL& url, int renderer_process_id, int32 page_id, |