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" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 return l10n_util::GetStringFUTF16(IDS_PLUGIN_CONFIRM_INSTALL_DIALOG_MSG, | 96 return l10n_util::GetStringFUTF16(IDS_PLUGIN_CONFIRM_INSTALL_DIALOG_MSG, |
97 plugin_metadata_->name()); | 97 plugin_metadata_->name()); |
98 } | 98 } |
99 | 99 |
100 string16 ConfirmInstallDialogDelegate::GetAcceptButtonTitle() { | 100 string16 ConfirmInstallDialogDelegate::GetAcceptButtonTitle() { |
101 return l10n_util::GetStringUTF16( | 101 return l10n_util::GetStringUTF16( |
102 IDS_PLUGIN_CONFIRM_INSTALL_DIALOG_ACCEPT_BUTTON); | 102 IDS_PLUGIN_CONFIRM_INSTALL_DIALOG_ACCEPT_BUTTON); |
103 } | 103 } |
104 | 104 |
105 void ConfirmInstallDialogDelegate::OnAccepted() { | 105 void ConfirmInstallDialogDelegate::OnAccepted() { |
106 installer()->StartInstalling(plugin_metadata_->url_for_display(), | 106 installer()->StartInstalling(plugin_metadata_->plugin_url(), |
107 plugin_metadata_->plugin_url(), | |
108 TabContents::FromWebContents(web_contents_)); | 107 TabContents::FromWebContents(web_contents_)); |
109 } | 108 } |
110 | 109 |
111 void ConfirmInstallDialogDelegate::OnCanceled() { | 110 void ConfirmInstallDialogDelegate::OnCanceled() { |
112 } | 111 } |
113 | 112 |
114 void ConfirmInstallDialogDelegate::DownloadStarted() { | 113 void ConfirmInstallDialogDelegate::DownloadStarted() { |
115 Cancel(); | 114 Cancel(); |
116 } | 115 } |
117 | 116 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 plugin_metadata.Pass(), | 302 plugin_metadata.Pass(), |
304 callback); | 303 callback); |
305 #endif | 304 #endif |
306 infobar_helper->AddInfoBar(delegate); | 305 infobar_helper->AddInfoBar(delegate); |
307 } | 306 } |
308 | 307 |
309 void PluginObserver::InstallMissingPlugin( | 308 void PluginObserver::InstallMissingPlugin( |
310 PluginInstaller* installer, | 309 PluginInstaller* installer, |
311 scoped_ptr<PluginMetadata> plugin_metadata) { | 310 scoped_ptr<PluginMetadata> plugin_metadata) { |
312 if (plugin_metadata->url_for_display()) { | 311 if (plugin_metadata->url_for_display()) { |
313 installer->OpenDownloadURL(plugin_metadata->url_for_display(), | 312 installer->OpenDownloadURL(plugin_metadata->plugin_url(), web_contents()); |
314 plugin_metadata->plugin_url(), | |
315 web_contents()); | |
316 } else { | 313 } else { |
317 TabModalConfirmDialog::Create( | 314 TabModalConfirmDialog::Create( |
318 new ConfirmInstallDialogDelegate( | 315 new ConfirmInstallDialogDelegate( |
319 web_contents(), installer, plugin_metadata.Pass()), | 316 web_contents(), installer, plugin_metadata.Pass()), |
320 TabContents::FromWebContents(web_contents())); | 317 TabContents::FromWebContents(web_contents())); |
321 } | 318 } |
322 } | 319 } |
323 | 320 |
324 void PluginObserver::OnRemovePluginPlaceholderHost(int placeholder_id) { | 321 void PluginObserver::OnRemovePluginPlaceholderHost(int placeholder_id) { |
325 std::map<int, PluginPlaceholderHost*>::iterator it = | 322 std::map<int, PluginPlaceholderHost*>::iterator it = |
(...skipping 23 matching lines...) Expand all Loading... |
349 InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper(); | 346 InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper(); |
350 infobar_helper->AddInfoBar(new SimpleAlertInfoBarDelegate( | 347 infobar_helper->AddInfoBar(new SimpleAlertInfoBarDelegate( |
351 infobar_helper, | 348 infobar_helper, |
352 &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 349 &ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
353 IDR_INFOBAR_PLUGIN_CRASHED), | 350 IDR_INFOBAR_PLUGIN_CRASHED), |
354 l10n_util::GetStringFUTF16(IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT, | 351 l10n_util::GetStringFUTF16(IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT, |
355 plugin_name), | 352 plugin_name), |
356 true /* auto_expire */)); | 353 true /* auto_expire */)); |
357 } | 354 } |
358 | 355 |
OLD | NEW |