| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 } | 170 } |
| 171 return new OutdatedPluginInfoBarDelegate( | 171 return new OutdatedPluginInfoBarDelegate( |
| 172 observer, installer, message); | 172 observer, installer, message); |
| 173 } | 173 } |
| 174 | 174 |
| 175 OutdatedPluginInfoBarDelegate::OutdatedPluginInfoBarDelegate( | 175 OutdatedPluginInfoBarDelegate::OutdatedPluginInfoBarDelegate( |
| 176 PluginObserver* observer, | 176 PluginObserver* observer, |
| 177 PluginInstaller* installer, | 177 PluginInstaller* installer, |
| 178 const string16& message) | 178 const string16& message) |
| 179 : PluginInfoBarDelegate( | 179 : PluginInfoBarDelegate( |
| 180 InfoBarService::FromTabContents(observer->tab_contents()), | 180 InfoBarService::FromTabContents( |
| 181 TabContents::FromWebContents(observer->web_contents())), |
| 181 installer->name(), | 182 installer->name(), |
| 182 installer->identifier()), | 183 installer->identifier()), |
| 183 WeakPluginInstallerObserver(installer), | 184 WeakPluginInstallerObserver(installer), |
| 184 observer_(observer), | 185 observer_(observer), |
| 185 message_(message) { | 186 message_(message) { |
| 186 content::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Shown")); | 187 content::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Shown")); |
| 187 std::string name = UTF16ToUTF8(installer->name()); | 188 std::string name = UTF16ToUTF8(installer->name()); |
| 188 if (name == webkit::npapi::PluginGroup::kJavaGroupName) | 189 if (name == webkit::npapi::PluginGroup::kJavaGroupName) |
| 189 content::RecordAction( | 190 content::RecordAction( |
| 190 UserMetricsAction("OutdatedPluginInfobar.Shown.Java")); | 191 UserMetricsAction("OutdatedPluginInfobar.Shown.Java")); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 content::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Update")); | 228 content::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Update")); |
| 228 if (installer()->state() != PluginInstaller::INSTALLER_STATE_IDLE) { | 229 if (installer()->state() != PluginInstaller::INSTALLER_STATE_IDLE) { |
| 229 NOTREACHED(); | 230 NOTREACHED(); |
| 230 return false; | 231 return false; |
| 231 } | 232 } |
| 232 | 233 |
| 233 content::WebContents* web_contents = owner()->GetWebContents(); | 234 content::WebContents* web_contents = owner()->GetWebContents(); |
| 234 if (installer()->url_for_display()) { | 235 if (installer()->url_for_display()) { |
| 235 installer()->OpenDownloadURL(web_contents); | 236 installer()->OpenDownloadURL(web_contents); |
| 236 } else { | 237 } else { |
| 237 installer()->StartInstalling(observer_->tab_contents()); | 238 installer()->StartInstalling( |
| 239 TabContents::FromWebContents(observer_->web_contents())); |
| 238 } | 240 } |
| 239 return false; | 241 return false; |
| 240 } | 242 } |
| 241 | 243 |
| 242 bool OutdatedPluginInfoBarDelegate::Cancel() { | 244 bool OutdatedPluginInfoBarDelegate::Cancel() { |
| 243 content::RecordAction( | 245 content::RecordAction( |
| 244 UserMetricsAction("OutdatedPluginInfobar.AllowThisTime")); | 246 UserMetricsAction("OutdatedPluginInfobar.AllowThisTime")); |
| 245 LoadBlockedPlugins(); | 247 LoadBlockedPlugins(); |
| 246 return true; | 248 return true; |
| 247 } | 249 } |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 "https://support.google.com/chrome/?ib_display_in_desktop")); | 485 "https://support.google.com/chrome/?ib_display_in_desktop")); |
| 484 OpenURLParams params( | 486 OpenURLParams params( |
| 485 url, Referrer(), | 487 url, Referrer(), |
| 486 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 488 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 487 content::PAGE_TRANSITION_LINK, false); | 489 content::PAGE_TRANSITION_LINK, false); |
| 488 owner()->GetWebContents()->OpenURL(params); | 490 owner()->GetWebContents()->OpenURL(params); |
| 489 return false; | 491 return false; |
| 490 } | 492 } |
| 491 #endif // defined(OS_WIN) | 493 #endif // defined(OS_WIN) |
| 492 #endif // defined(ENABLE_PLUGIN_INSTALLATION) | 494 #endif // defined(ENABLE_PLUGIN_INSTALLATION) |
| OLD | NEW |