| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_installer.h" | 5 #include "chrome/browser/plugin_installer.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "chrome/browser/renderer_host/render_view_host.h" | 10 #include "chrome/browser/renderer_host/render_view_host.h" |
| 11 #include "chrome/browser/tab_contents/tab_contents.h" | 11 #include "chrome/browser/tab_contents/tab_contents.h" |
| 12 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
| 13 #include "grit/locale_settings.h" |
| 13 #include "grit/theme_resources.h" | 14 #include "grit/theme_resources.h" |
| 14 #include "webkit/glue/plugins/default_plugin_shared.h" | 15 #include "webkit/glue/plugins/default_plugin_shared.h" |
| 15 | 16 |
| 16 PluginInstaller::PluginInstaller(TabContents* tab_contents) | 17 PluginInstaller::PluginInstaller(TabContents* tab_contents) |
| 17 : ConfirmInfoBarDelegate(tab_contents), | 18 : ConfirmInfoBarDelegate(tab_contents), |
| 18 tab_contents_(tab_contents) { | 19 tab_contents_(tab_contents) { |
| 19 } | 20 } |
| 20 | 21 |
| 21 PluginInstaller::~PluginInstaller() { | 22 PluginInstaller::~PluginInstaller() { |
| 22 // Remove any InfoBars we may be showing. | 23 // Remove any InfoBars we may be showing. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 std::wstring PluginInstaller::GetButtonLabel(InfoBarButton button) const { | 59 std::wstring PluginInstaller::GetButtonLabel(InfoBarButton button) const { |
| 59 if (button == BUTTON_OK) | 60 if (button == BUTTON_OK) |
| 60 return l10n_util::GetString(IDS_PLUGININSTALLER_INSTALLPLUGIN_BUTTON); | 61 return l10n_util::GetString(IDS_PLUGININSTALLER_INSTALLPLUGIN_BUTTON); |
| 61 return ConfirmInfoBarDelegate::GetButtonLabel(button); | 62 return ConfirmInfoBarDelegate::GetButtonLabel(button); |
| 62 } | 63 } |
| 63 | 64 |
| 64 bool PluginInstaller::Accept() { | 65 bool PluginInstaller::Accept() { |
| 65 tab_contents_->render_view_host()->InstallMissingPlugin(); | 66 tab_contents_->render_view_host()->InstallMissingPlugin(); |
| 66 return true; | 67 return true; |
| 67 } | 68 } |
| 69 |
| 70 std::wstring PluginInstaller::GetLinkText() { |
| 71 return l10n_util::GetString(IDS_PLUGININSTALLER_PROBLEMSINSTALLING); |
| 72 } |
| 73 |
| 74 bool PluginInstaller::LinkClicked(WindowOpenDisposition disposition) { |
| 75 // Ignore the click dispostion and always open in a new top level tab. |
| 76 tab_contents_->OpenURL( |
| 77 GURL(l10n_util::GetStringUTF8(IDS_LEARN_MORE_PLUGININSTALLER_URL)), |
| 78 GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); |
| 79 return false; // Do not dismiss the info bar. |
| 80 } |
| OLD | NEW |