Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(649)

Unified Diff: chrome/browser/tab_contents/tab_contents.cc

Issue 2967007: Disable outdated plugins, block non-sandboxed plugins. (Closed)
Patch Set: '' Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/tab_contents.cc
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index b5395ccf89530655321df0903b032a1dd1740d97..68f777dfea72e6ae91cffbcaade33221c66d56a7 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -21,6 +21,7 @@
#include "base/time.h"
#include "chrome/browser/autocomplete_history_manager.h"
#include "chrome/browser/autofill/autofill_manager.h"
+#include "chrome/browser/blocked_plugin_manager.h"
#include "chrome/browser/blocked_popup_container.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/browser.h"
@@ -232,6 +233,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
// -----------------------------------------------------------------------------
@@ -1957,6 +2020,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,
@@ -2173,6 +2241,12 @@ RenderViewHostDelegate::AutoFill* TabContents::GetAutoFillDelegate() {
return GetAutoFillManager();
}
+RenderViewHostDelegate::BlockedPlugin* TabContents::GetBlockedPluginDelegate() {
+ if (blocked_plugin_manager_.get() == NULL)
+ blocked_plugin_manager_.reset(new BlockedPluginManager(this));
+ return blocked_plugin_manager_.get();
+}
+
AutomationResourceRoutingDelegate*
TabContents::GetAutomationResourceRoutingDelegate() {
return delegate();
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698