| 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/plugin_observer.h" | 5 #include "chrome/browser/plugin_observer.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/content_settings/host_content_settings_map.h" | 12 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 13 #include "chrome/browser/infobars/infobar_tab_helper.h" | 13 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 14 #include "chrome/browser/plugin_finder.h" | 14 #include "chrome/browser/plugin_finder.h" |
| 15 #include "chrome/browser/plugin_infobar_delegates.h" | 15 #include "chrome/browser/plugin_infobar_delegates.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" | 17 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" |
| 18 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" | 18 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" |
| 19 #include "chrome/browser/ui/browser_dialogs.h" | 19 #include "chrome/browser/ui/browser_dialogs.h" |
| 20 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 20 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 21 #include "chrome/common/render_messages.h" | 21 #include "chrome/common/render_messages.h" |
| 22 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
| 23 #include "content/public/browser/plugin_service.h" | 23 #include "content/public/browser/plugin_service.h" |
| 24 #include "content/public/browser/render_view_host.h" | 24 #include "content/public/browser/render_view_host.h" |
| 25 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
| 26 #include "content/public/browser/web_contents_delegate.h" | 26 #include "content/public/browser/web_contents_delegate.h" |
| 27 #include "grit/generated_resources.h" | 27 #include "grit/generated_resources.h" |
| 28 #include "grit/theme_resources.h" |
| 28 #include "grit/theme_resources_standard.h" | 29 #include "grit/theme_resources_standard.h" |
| 29 #include "grit/theme_resources.h" | |
| 30 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
| 31 #include "ui/base/resource/resource_bundle.h" | 31 #include "ui/base/resource/resource_bundle.h" |
| 32 #include "webkit/plugins/webplugininfo.h" | 32 #include "webkit/plugins/webplugininfo.h" |
| 33 | 33 |
| 34 #if defined(ENABLE_PLUGIN_INSTALLATION) | 34 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 35 #include "chrome/browser/plugin_installer.h" | 35 #include "chrome/browser/plugin_installer.h" |
| 36 #include "chrome/browser/plugin_installer_observer.h" | 36 #include "chrome/browser/plugin_installer_observer.h" |
| 37 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" | 37 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" |
| 38 #endif // defined(ENABLE_PLUGIN_INSTALLATION) | 38 #endif // defined(ENABLE_PLUGIN_INSTALLATION) |
| 39 | 39 |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 base::Bind(&PluginObserver::InstallMissingPlugin, | 289 base::Bind(&PluginObserver::InstallMissingPlugin, |
| 290 weak_ptr_factory_.GetWeakPtr(), installer)); | 290 weak_ptr_factory_.GetWeakPtr(), installer)); |
| 291 #endif | 291 #endif |
| 292 infobar_helper->AddInfoBar(delegate); | 292 infobar_helper->AddInfoBar(delegate); |
| 293 } | 293 } |
| 294 | 294 |
| 295 void PluginObserver::InstallMissingPlugin(PluginInstaller* installer) { | 295 void PluginObserver::InstallMissingPlugin(PluginInstaller* installer) { |
| 296 if (installer->url_for_display()) { | 296 if (installer->url_for_display()) { |
| 297 installer->OpenDownloadURL(web_contents()); | 297 installer->OpenDownloadURL(web_contents()); |
| 298 } else { | 298 } else { |
| 299 browser::ShowTabModalConfirmDialog( | 299 chrome::ShowTabModalConfirmDialog( |
| 300 new ConfirmInstallDialogDelegate(tab_contents_, installer), | 300 new ConfirmInstallDialogDelegate(tab_contents_, installer), |
| 301 tab_contents_); | 301 tab_contents_); |
| 302 } | 302 } |
| 303 } | 303 } |
| 304 | 304 |
| 305 void PluginObserver::OnRemovePluginPlaceholderHost(int placeholder_id) { | 305 void PluginObserver::OnRemovePluginPlaceholderHost(int placeholder_id) { |
| 306 std::map<int, PluginPlaceholderHost*>::iterator it = | 306 std::map<int, PluginPlaceholderHost*>::iterator it = |
| 307 plugin_placeholders_.find(placeholder_id); | 307 plugin_placeholders_.find(placeholder_id); |
| 308 if (it == plugin_placeholders_.end()) { | 308 if (it == plugin_placeholders_.end()) { |
| 309 NOTREACHED(); | 309 NOTREACHED(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 328 InfoBarTabHelper* infobar_helper = tab_contents_->infobar_tab_helper(); | 328 InfoBarTabHelper* infobar_helper = tab_contents_->infobar_tab_helper(); |
| 329 infobar_helper->AddInfoBar(new SimpleAlertInfoBarDelegate( | 329 infobar_helper->AddInfoBar(new SimpleAlertInfoBarDelegate( |
| 330 infobar_helper, | 330 infobar_helper, |
| 331 &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 331 &ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
| 332 IDR_INFOBAR_PLUGIN_CRASHED), | 332 IDR_INFOBAR_PLUGIN_CRASHED), |
| 333 l10n_util::GetStringFUTF16(IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT, | 333 l10n_util::GetStringFUTF16(IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT, |
| 334 plugin_name), | 334 plugin_name), |
| 335 true /* auto_expire */)); | 335 true /* auto_expire */)); |
| 336 } | 336 } |
| 337 | 337 |
| OLD | NEW |