| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/plugins/plugin_infobar_delegates.h" | 5 #include "chrome/browser/plugins/plugin_infobar_delegates.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/api/infobars/infobar_service.h" | 8 #include "chrome/browser/api/infobars/infobar_service.h" |
| 9 #include "chrome/browser/content_settings/host_content_settings_map.h" | 9 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 10 #include "chrome/browser/google/google_util.h" | 10 #include "chrome/browser/google/google_util.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 } | 226 } |
| 227 | 227 |
| 228 bool OutdatedPluginInfoBarDelegate::Accept() { | 228 bool OutdatedPluginInfoBarDelegate::Accept() { |
| 229 content::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Update")); | 229 content::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Update")); |
| 230 if (installer()->state() != PluginInstaller::INSTALLER_STATE_IDLE) { | 230 if (installer()->state() != PluginInstaller::INSTALLER_STATE_IDLE) { |
| 231 NOTREACHED(); | 231 NOTREACHED(); |
| 232 return false; | 232 return false; |
| 233 } | 233 } |
| 234 | 234 |
| 235 content::WebContents* web_contents = owner()->GetWebContents(); | 235 content::WebContents* web_contents = owner()->GetWebContents(); |
| 236 // A call to any of |OpenDownloadURL()| or |StartInstalling()| will |
| 237 // result in deleting ourselves. Accordingly, we make sure to |
| 238 // not pass a reference to an object that can go away. |
| 239 // http://crbug.com/54167 |
| 240 GURL plugin_url(plugin_metadata_->plugin_url()); |
| 236 if (plugin_metadata_->url_for_display()) { | 241 if (plugin_metadata_->url_for_display()) { |
| 237 installer()->OpenDownloadURL(plugin_metadata_->url_for_display(), | 242 installer()->OpenDownloadURL(plugin_url, web_contents); |
| 238 plugin_metadata_->plugin_url(), | |
| 239 web_contents); | |
| 240 } else { | 243 } else { |
| 241 installer()->StartInstalling( | 244 installer()->StartInstalling(plugin_url, |
| 242 plugin_metadata_->url_for_display(), | 245 TabContents::FromWebContents(web_contents)); |
| 243 plugin_metadata_->plugin_url(), | |
| 244 TabContents::FromWebContents(web_contents)); | |
| 245 } | 246 } |
| 246 return false; | 247 return false; |
| 247 } | 248 } |
| 248 | 249 |
| 249 bool OutdatedPluginInfoBarDelegate::Cancel() { | 250 bool OutdatedPluginInfoBarDelegate::Cancel() { |
| 250 content::RecordAction( | 251 content::RecordAction( |
| 251 UserMetricsAction("OutdatedPluginInfobar.AllowThisTime")); | 252 UserMetricsAction("OutdatedPluginInfobar.AllowThisTime")); |
| 252 LoadBlockedPlugins(); | 253 LoadBlockedPlugins(); |
| 253 return true; | 254 return true; |
| 254 } | 255 } |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 "https://support.google.com/chrome/?ib_display_in_desktop")); | 497 "https://support.google.com/chrome/?ib_display_in_desktop")); |
| 497 OpenURLParams params( | 498 OpenURLParams params( |
| 498 url, Referrer(), | 499 url, Referrer(), |
| 499 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 500 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 500 content::PAGE_TRANSITION_LINK, false); | 501 content::PAGE_TRANSITION_LINK, false); |
| 501 owner()->GetWebContents()->OpenURL(params); | 502 owner()->GetWebContents()->OpenURL(params); |
| 502 return false; | 503 return false; |
| 503 } | 504 } |
| 504 #endif // defined(OS_WIN) | 505 #endif // defined(OS_WIN) |
| 505 #endif // defined(ENABLE_PLUGIN_INSTALLATION) | 506 #endif // defined(ENABLE_PLUGIN_INSTALLATION) |
| OLD | NEW |