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

Unified Diff: chrome/browser/ui/hung_plugin_tab_helper.cc

Issue 190063006: Infobar Componentization Proof of Concept (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor fixes Created 6 years, 9 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
Index: chrome/browser/ui/hung_plugin_tab_helper.cc
diff --git a/chrome/browser/ui/hung_plugin_tab_helper.cc b/chrome/browser/ui/hung_plugin_tab_helper.cc
index 229f0442b0784c36f933076a0a12c1087214b7d9..c22615351adfb2249fb93731fc6ecf3d2dcd1f3b 100644
--- a/chrome/browser/ui/hung_plugin_tab_helper.cc
+++ b/chrome/browser/ui/hung_plugin_tab_helper.cc
@@ -11,7 +11,7 @@
#include "base/rand_util.h"
#include "build/build_config.h"
#include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/infobars/confirm_infobar_delegate.h"
+#include "chrome/browser/infobars/content_confirm_infobar_delegate.h"
#include "chrome/browser/infobars/infobar.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/common/chrome_version_info.h"
@@ -128,7 +128,7 @@ void KillPluginOnIOThread(int child_id) {
// HungPluginInfoBarDelegate --------------------------------------------------
-class HungPluginInfoBarDelegate : public ConfirmInfoBarDelegate {
+class HungPluginInfoBarDelegate : public ContentConfirmInfoBarDelegate {
public:
// Creates a hung plugin infobar and delegate and adds the infobar to
// |infobar_service|. Returns the infobar if it was successfully added.
@@ -138,7 +138,8 @@ class HungPluginInfoBarDelegate : public ConfirmInfoBarDelegate {
const base::string16& plugin_name);
private:
- HungPluginInfoBarDelegate(HungPluginTabHelper* helper,
+ HungPluginInfoBarDelegate(content::WebContents* web_contents,
+ HungPluginTabHelper* helper,
int plugin_child_id,
const base::string16& plugin_name);
virtual ~HungPluginInfoBarDelegate();
@@ -162,23 +163,27 @@ InfoBar* HungPluginInfoBarDelegate::Create(InfoBarService* infobar_service,
HungPluginTabHelper* helper,
int plugin_child_id,
const base::string16& plugin_name) {
- return infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar(
- scoped_ptr<ConfirmInfoBarDelegate>(new HungPluginInfoBarDelegate(
- helper, plugin_child_id, plugin_name))));
+ return infobar_service->AddInfoBar(
+ ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr<ConfirmInfoBarDelegate>(
+ new HungPluginInfoBarDelegate(infobar_service->web_contents(),
+ helper,
+ plugin_child_id,
+ plugin_name))));
}
HungPluginInfoBarDelegate::HungPluginInfoBarDelegate(
+ content::WebContents* web_contents,
HungPluginTabHelper* helper,
int plugin_child_id,
const base::string16& plugin_name)
- : ConfirmInfoBarDelegate(),
+ : ContentConfirmInfoBarDelegate(web_contents),
helper_(helper),
plugin_child_id_(plugin_child_id),
- message_(l10n_util::GetStringFUTF16(
- IDS_BROWSER_HANGMONITOR_PLUGIN_INFOBAR, plugin_name)),
+ message_(
+ l10n_util::GetStringFUTF16(IDS_BROWSER_HANGMONITOR_PLUGIN_INFOBAR,
+ plugin_name)),
button_text_(l10n_util::GetStringUTF16(
- IDS_BROWSER_HANGMONITOR_PLUGIN_INFOBAR_KILLBUTTON)) {
-}
+ IDS_BROWSER_HANGMONITOR_PLUGIN_INFOBAR_KILLBUTTON)) {}
HungPluginInfoBarDelegate::~HungPluginInfoBarDelegate() {
}
@@ -284,7 +289,7 @@ void HungPluginTabHelper::PluginCrashed(const base::FilePath& plugin_path,
i != hung_plugins_.end(); ++i) {
if (i->second->path == plugin_path) {
if (i->second->infobar)
- infobar_service->RemoveInfoBar(i->second->infobar);
+ infobar_service->infobar_manager().RemoveInfoBar(i->second->infobar);
hung_plugins_.erase(i);
break;
}
@@ -305,7 +310,8 @@ void HungPluginTabHelper::PluginHungStatusChanged(
if (!is_hung) {
// Hung plugin became un-hung, close the infobar and delete our info.
if (found->second->infobar)
- infobar_service->RemoveInfoBar(found->second->infobar);
+ infobar_service->infobar_manager().RemoveInfoBar(
+ found->second->infobar);
hung_plugins_.erase(found);
}
return;
@@ -416,7 +422,7 @@ void HungPluginTabHelper::CloseBar(PluginState* state) {
InfoBarService* infobar_service =
InfoBarService::FromWebContents(web_contents());
if (infobar_service && state->infobar) {
- infobar_service->RemoveInfoBar(state->infobar);
+ infobar_service->infobar_manager().RemoveInfoBar(state->infobar);
state->infobar = NULL;
}
}

Powered by Google App Engine
This is Rietveld 408576698