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

Unified Diff: chrome/browser/plugins/plugin_infobar_delegates.cc

Issue 230453004: Remove InfoBarDelegate::web_contents() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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/plugins/plugin_infobar_delegates.cc
diff --git a/chrome/browser/plugins/plugin_infobar_delegates.cc b/chrome/browser/plugins/plugin_infobar_delegates.cc
index 6530594b5241ec55bc25adab8779975837c71b8a..2769d3b05ba73f48fc9cc90b679bb2b9d1c76017 100644
--- a/chrome/browser/plugins/plugin_infobar_delegates.cc
+++ b/chrome/browser/plugins/plugin_infobar_delegates.cc
@@ -57,7 +57,9 @@ PluginInfoBarDelegate::~PluginInfoBarDelegate() {
}
bool PluginInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) {
- web_contents()->OpenURL(content::OpenURLParams(
+ content::WebContents* web_contents =
+ InfoBarService::WebContentsFromInfoBar(infobar());
+ web_contents->OpenURL(content::OpenURLParams(
GURL(GetLearnMoreURL()), content::Referrer(),
(disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
content::PAGE_TRANSITION_LINK, false));
@@ -65,8 +67,10 @@ bool PluginInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) {
}
void PluginInfoBarDelegate::LoadBlockedPlugins() {
+ content::WebContents* web_contents =
+ InfoBarService::WebContentsFromInfoBar(infobar());
ChromePluginServiceFilter::GetInstance()->AuthorizeAllPlugins(
- web_contents(), true, identifier_);
+ web_contents, true, identifier_);
}
int PluginInfoBarDelegate::GetIconID() const {
@@ -145,7 +149,7 @@ bool UnauthorizedPluginInfoBarDelegate::Accept() {
bool UnauthorizedPluginInfoBarDelegate::Cancel() {
content::RecordAction(UserMetricsAction("BlockedPluginInfobar.AlwaysAllow"));
- const GURL& url = web_contents()->GetURL();
+ const GURL& url = InfoBarService::WebContentsFromInfoBar(infobar())->GetURL();
content_settings_->AddExceptionForURL(url, url, CONTENT_SETTINGS_TYPE_PLUGINS,
CONTENT_SETTING_ALLOW);
LoadBlockedPlugins();
@@ -238,10 +242,12 @@ bool OutdatedPluginInfoBarDelegate::Accept() {
// result in deleting ourselves. Accordingly, we make sure to
// not pass a reference to an object that can go away.
GURL plugin_url(plugin_metadata_->plugin_url());
+ content::WebContents* web_contents =
+ InfoBarService::WebContentsFromInfoBar(infobar());
if (plugin_metadata_->url_for_display())
- installer()->OpenDownloadURL(plugin_url, web_contents());
+ installer()->OpenDownloadURL(plugin_url, web_contents);
else
- installer()->StartInstalling(plugin_url, web_contents());
+ installer()->StartInstalling(plugin_url, web_contents);
return false;
}
@@ -392,7 +398,10 @@ bool PluginInstallerInfoBarDelegate::LinkClicked(
url = google_util::AppendGoogleLocaleParam(GURL(
"https://www.google.com/support/chrome/bin/answer.py?answer=142064"));
}
- web_contents()->OpenURL(content::OpenURLParams(
+
+ content::WebContents* web_contents =
+ InfoBarService::WebContentsFromInfoBar(infobar());
+ web_contents->OpenURL(content::OpenURLParams(
url, content::Referrer(),
(disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
content::PAGE_TRANSITION_LINK, false));
@@ -515,7 +524,9 @@ bool PluginMetroModeInfoBarDelegate::LinkClicked(
// TODO(shrikant): We may need to change language a little at following
// support URLs. With new approach we will just restart for both missing
// and not missing mode.
- web_contents()->OpenURL(content::OpenURLParams(
+ content::WebContents* web_contents =
+ InfoBarService::WebContentsFromInfoBar(infobar());
+ web_contents->OpenURL(content::OpenURLParams(
GURL((mode_ == MISSING_PLUGIN) ?
"https://support.google.com/chrome/?p=ib_display_in_desktop" :
"https://support.google.com/chrome/?p=ib_redirect_to_desktop"),

Powered by Google App Engine
This is Rietveld 408576698