| 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_observer.h" | 5 #include "chrome/browser/plugins/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/api/infobars/confirm_infobar_delegate.h" | 11 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" |
| 12 #include "chrome/browser/api/infobars/simple_alert_infobar_delegate.h" | 12 #include "chrome/browser/api/infobars/simple_alert_infobar_delegate.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/content_settings/host_content_settings_map.h" | 14 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 15 #include "chrome/browser/infobars/infobar_tab_helper.h" | 15 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 16 #include "chrome/browser/metrics/metrics_service.h" | 16 #include "chrome/browser/metrics/metrics_service.h" |
| 17 #include "chrome/browser/plugins/plugin_finder.h" | 17 #include "chrome/browser/plugins/plugin_finder.h" |
| 18 #include "chrome/browser/plugins/plugin_infobar_delegates.h" | 18 #include "chrome/browser/plugins/plugin_infobar_delegates.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/ui/browser_dialogs.h" | |
| 21 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 20 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 21 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" |
| 22 #include "chrome/common/render_messages.h" | 22 #include "chrome/common/render_messages.h" |
| 23 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
| 24 #include "content/public/browser/plugin_service.h" | 24 #include "content/public/browser/plugin_service.h" |
| 25 #include "content/public/browser/render_view_host.h" | 25 #include "content/public/browser/render_view_host.h" |
| 26 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
| 27 #include "content/public/browser/web_contents_delegate.h" | 27 #include "content/public/browser/web_contents_delegate.h" |
| 28 #include "grit/generated_resources.h" | 28 #include "grit/generated_resources.h" |
| 29 #include "grit/theme_resources.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" |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 base::Bind(&PluginObserver::InstallMissingPlugin, | 294 base::Bind(&PluginObserver::InstallMissingPlugin, |
| 295 weak_ptr_factory_.GetWeakPtr(), installer)); | 295 weak_ptr_factory_.GetWeakPtr(), installer)); |
| 296 #endif | 296 #endif |
| 297 infobar_helper->AddInfoBar(delegate); | 297 infobar_helper->AddInfoBar(delegate); |
| 298 } | 298 } |
| 299 | 299 |
| 300 void PluginObserver::InstallMissingPlugin(PluginInstaller* installer) { | 300 void PluginObserver::InstallMissingPlugin(PluginInstaller* installer) { |
| 301 if (installer->url_for_display()) { | 301 if (installer->url_for_display()) { |
| 302 installer->OpenDownloadURL(web_contents()); | 302 installer->OpenDownloadURL(web_contents()); |
| 303 } else { | 303 } else { |
| 304 chrome::ShowTabModalConfirmDialog( | 304 TabModalConfirmDialog::Create( |
| 305 new ConfirmInstallDialogDelegate(web_contents(), installer), | 305 new ConfirmInstallDialogDelegate(web_contents(), installer), |
| 306 TabContents::FromWebContents(web_contents())); | 306 TabContents::FromWebContents(web_contents())); |
| 307 } | 307 } |
| 308 } | 308 } |
| 309 | 309 |
| 310 void PluginObserver::OnRemovePluginPlaceholderHost(int placeholder_id) { | 310 void PluginObserver::OnRemovePluginPlaceholderHost(int placeholder_id) { |
| 311 std::map<int, PluginPlaceholderHost*>::iterator it = | 311 std::map<int, PluginPlaceholderHost*>::iterator it = |
| 312 plugin_placeholders_.find(placeholder_id); | 312 plugin_placeholders_.find(placeholder_id); |
| 313 if (it == plugin_placeholders_.end()) { | 313 if (it == plugin_placeholders_.end()) { |
| 314 NOTREACHED(); | 314 NOTREACHED(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 335 InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper(); | 335 InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper(); |
| 336 infobar_helper->AddInfoBar(new SimpleAlertInfoBarDelegate( | 336 infobar_helper->AddInfoBar(new SimpleAlertInfoBarDelegate( |
| 337 infobar_helper, | 337 infobar_helper, |
| 338 &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 338 &ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
| 339 IDR_INFOBAR_PLUGIN_CRASHED), | 339 IDR_INFOBAR_PLUGIN_CRASHED), |
| 340 l10n_util::GetStringFUTF16(IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT, | 340 l10n_util::GetStringFUTF16(IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT, |
| 341 plugin_name), | 341 plugin_name), |
| 342 true /* auto_expire */)); | 342 true /* auto_expire */)); |
| 343 } | 343 } |
| 344 | 344 |
| OLD | NEW |