| 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" |
| 11 #include "chrome/browser/lifetime/application_lifetime.h" | 11 #include "chrome/browser/lifetime/application_lifetime.h" |
| 12 #include "chrome/browser/plugins/plugin_metadata.h" |
| 12 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 13 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 13 #include "chrome/common/render_messages.h" | 14 #include "chrome/common/render_messages.h" |
| 14 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
| 15 #include "content/public/browser/render_view_host.h" | 16 #include "content/public/browser/render_view_host.h" |
| 16 #include "content/public/browser/user_metrics.h" | 17 #include "content/public/browser/user_metrics.h" |
| 17 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| 18 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
| 19 #include "grit/locale_settings.h" | 20 #include "grit/locale_settings.h" |
| 20 #include "grit/theme_resources.h" | 21 #include "grit/theme_resources.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 22 #include "ui/base/resource/resource_bundle.h" | 23 #include "ui/base/resource/resource_bundle.h" |
| 23 #include "webkit/plugins/npapi/plugin_group.h" | |
| 24 | 24 |
| 25 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
| 26 #include <shellapi.h> | 26 #include <shellapi.h> |
| 27 #include "ui/base/win/shell.h" | 27 #include "ui/base/win/shell.h" |
| 28 #endif | 28 #endif |
| 29 | 29 |
| 30 #if defined(ENABLE_PLUGIN_INSTALLATION) | 30 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 31 #include "chrome/browser/plugins/plugin_installer.h" | 31 #include "chrome/browser/plugins/plugin_installer.h" |
| 32 #endif // defined(ENABLE_PLUGIN_INSTALLATION) | 32 #endif // defined(ENABLE_PLUGIN_INSTALLATION) |
| 33 | 33 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 UnauthorizedPluginInfoBarDelegate::UnauthorizedPluginInfoBarDelegate( | 78 UnauthorizedPluginInfoBarDelegate::UnauthorizedPluginInfoBarDelegate( |
| 79 InfoBarService* infobar_service, | 79 InfoBarService* infobar_service, |
| 80 HostContentSettingsMap* content_settings, | 80 HostContentSettingsMap* content_settings, |
| 81 const string16& utf16_name, | 81 const string16& utf16_name, |
| 82 const std::string& identifier) | 82 const std::string& identifier) |
| 83 : PluginInfoBarDelegate(infobar_service, utf16_name, identifier), | 83 : PluginInfoBarDelegate(infobar_service, utf16_name, identifier), |
| 84 content_settings_(content_settings) { | 84 content_settings_(content_settings) { |
| 85 content::RecordAction(UserMetricsAction("BlockedPluginInfobar.Shown")); | 85 content::RecordAction(UserMetricsAction("BlockedPluginInfobar.Shown")); |
| 86 std::string name = UTF16ToUTF8(utf16_name); | 86 std::string name = UTF16ToUTF8(utf16_name); |
| 87 if (name == webkit::npapi::PluginGroup::kJavaGroupName) | 87 if (name == PluginMetadata::kJavaGroupName) |
| 88 content::RecordAction( | 88 content::RecordAction( |
| 89 UserMetricsAction("BlockedPluginInfobar.Shown.Java")); | 89 UserMetricsAction("BlockedPluginInfobar.Shown.Java")); |
| 90 else if (name == webkit::npapi::PluginGroup::kQuickTimeGroupName) | 90 else if (name == PluginMetadata::kQuickTimeGroupName) |
| 91 content::RecordAction( | 91 content::RecordAction( |
| 92 UserMetricsAction("BlockedPluginInfobar.Shown.QuickTime")); | 92 UserMetricsAction("BlockedPluginInfobar.Shown.QuickTime")); |
| 93 else if (name == webkit::npapi::PluginGroup::kShockwaveGroupName) | 93 else if (name == PluginMetadata::kShockwaveGroupName) |
| 94 content::RecordAction( | 94 content::RecordAction( |
| 95 UserMetricsAction("BlockedPluginInfobar.Shown.Shockwave")); | 95 UserMetricsAction("BlockedPluginInfobar.Shown.Shockwave")); |
| 96 else if (name == webkit::npapi::PluginGroup::kRealPlayerGroupName) | 96 else if (name == PluginMetadata::kRealPlayerGroupName) |
| 97 content::RecordAction( | 97 content::RecordAction( |
| 98 UserMetricsAction("BlockedPluginInfobar.Shown.RealPlayer")); | 98 UserMetricsAction("BlockedPluginInfobar.Shown.RealPlayer")); |
| 99 else if (name == webkit::npapi::PluginGroup::kWindowsMediaPlayerGroupName) | 99 else if (name == PluginMetadata::kWindowsMediaPlayerGroupName) |
| 100 content::RecordAction( | 100 content::RecordAction( |
| 101 UserMetricsAction("BlockedPluginInfobar.Shown.WindowsMediaPlayer")); | 101 UserMetricsAction("BlockedPluginInfobar.Shown.WindowsMediaPlayer")); |
| 102 } | 102 } |
| 103 | 103 |
| 104 UnauthorizedPluginInfoBarDelegate::~UnauthorizedPluginInfoBarDelegate() { | 104 UnauthorizedPluginInfoBarDelegate::~UnauthorizedPluginInfoBarDelegate() { |
| 105 content::RecordAction(UserMetricsAction("BlockedPluginInfobar.Closed")); | 105 content::RecordAction(UserMetricsAction("BlockedPluginInfobar.Closed")); |
| 106 } | 106 } |
| 107 | 107 |
| 108 std::string UnauthorizedPluginInfoBarDelegate::GetLearnMoreURL() const { | 108 std::string UnauthorizedPluginInfoBarDelegate::GetLearnMoreURL() const { |
| 109 return chrome::kBlockedPluginLearnMoreURL; | 109 return chrome::kBlockedPluginLearnMoreURL; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 const string16& message) | 177 const string16& message) |
| 178 : PluginInfoBarDelegate( | 178 : PluginInfoBarDelegate( |
| 179 InfoBarService::FromTabContents( | 179 InfoBarService::FromTabContents( |
| 180 TabContents::FromWebContents(web_contents)), | 180 TabContents::FromWebContents(web_contents)), |
| 181 installer->name(), | 181 installer->name(), |
| 182 installer->identifier()), | 182 installer->identifier()), |
| 183 WeakPluginInstallerObserver(installer), | 183 WeakPluginInstallerObserver(installer), |
| 184 message_(message) { | 184 message_(message) { |
| 185 content::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Shown")); | 185 content::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Shown")); |
| 186 std::string name = UTF16ToUTF8(installer->name()); | 186 std::string name = UTF16ToUTF8(installer->name()); |
| 187 if (name == webkit::npapi::PluginGroup::kJavaGroupName) | 187 if (name == PluginMetadata::kJavaGroupName) |
| 188 content::RecordAction( | 188 content::RecordAction( |
| 189 UserMetricsAction("OutdatedPluginInfobar.Shown.Java")); | 189 UserMetricsAction("OutdatedPluginInfobar.Shown.Java")); |
| 190 else if (name == webkit::npapi::PluginGroup::kQuickTimeGroupName) | 190 else if (name == PluginMetadata::kQuickTimeGroupName) |
| 191 content::RecordAction( | 191 content::RecordAction( |
| 192 UserMetricsAction("OutdatedPluginInfobar.Shown.QuickTime")); | 192 UserMetricsAction("OutdatedPluginInfobar.Shown.QuickTime")); |
| 193 else if (name == webkit::npapi::PluginGroup::kShockwaveGroupName) | 193 else if (name == PluginMetadata::kShockwaveGroupName) |
| 194 content::RecordAction( | 194 content::RecordAction( |
| 195 UserMetricsAction("OutdatedPluginInfobar.Shown.Shockwave")); | 195 UserMetricsAction("OutdatedPluginInfobar.Shown.Shockwave")); |
| 196 else if (name == webkit::npapi::PluginGroup::kRealPlayerGroupName) | 196 else if (name == PluginMetadata::kRealPlayerGroupName) |
| 197 content::RecordAction( | 197 content::RecordAction( |
| 198 UserMetricsAction("OutdatedPluginInfobar.Shown.RealPlayer")); | 198 UserMetricsAction("OutdatedPluginInfobar.Shown.RealPlayer")); |
| 199 else if (name == webkit::npapi::PluginGroup::kSilverlightGroupName) | 199 else if (name == PluginMetadata::kSilverlightGroupName) |
| 200 content::RecordAction( | 200 content::RecordAction( |
| 201 UserMetricsAction("OutdatedPluginInfobar.Shown.Silverlight")); | 201 UserMetricsAction("OutdatedPluginInfobar.Shown.Silverlight")); |
| 202 else if (name == webkit::npapi::PluginGroup::kAdobeReaderGroupName) | 202 else if (name == PluginMetadata::kAdobeReaderGroupName) |
| 203 content::RecordAction( | 203 content::RecordAction( |
| 204 UserMetricsAction("OutdatedPluginInfobar.Shown.Reader")); | 204 UserMetricsAction("OutdatedPluginInfobar.Shown.Reader")); |
| 205 } | 205 } |
| 206 | 206 |
| 207 OutdatedPluginInfoBarDelegate::~OutdatedPluginInfoBarDelegate() { | 207 OutdatedPluginInfoBarDelegate::~OutdatedPluginInfoBarDelegate() { |
| 208 content::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Closed")); | 208 content::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Closed")); |
| 209 } | 209 } |
| 210 | 210 |
| 211 std::string OutdatedPluginInfoBarDelegate::GetLearnMoreURL() const { | 211 std::string OutdatedPluginInfoBarDelegate::GetLearnMoreURL() const { |
| 212 return chrome::kOutdatedPluginLearnMoreURL; | 212 return chrome::kOutdatedPluginLearnMoreURL; |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 "https://support.google.com/chrome/?ib_display_in_desktop")); | 483 "https://support.google.com/chrome/?ib_display_in_desktop")); |
| 484 OpenURLParams params( | 484 OpenURLParams params( |
| 485 url, Referrer(), | 485 url, Referrer(), |
| 486 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 486 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 487 content::PAGE_TRANSITION_LINK, false); | 487 content::PAGE_TRANSITION_LINK, false); |
| 488 owner()->GetWebContents()->OpenURL(params); | 488 owner()->GetWebContents()->OpenURL(params); |
| 489 return false; | 489 return false; |
| 490 } | 490 } |
| 491 #endif // defined(OS_WIN) | 491 #endif // defined(OS_WIN) |
| 492 #endif // defined(ENABLE_PLUGIN_INSTALLATION) | 492 #endif // defined(ENABLE_PLUGIN_INSTALLATION) |
| OLD | NEW |