| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_infobar_delegate.h" | 5 #include "chrome/browser/plugin_installer_infobar_delegate.h" |
| 6 | 6 |
| 7 #include "chrome/browser/google/google_util.h" | 7 #include "chrome/browser/google/google_util.h" |
| 8 #include "content/browser/renderer_host/render_view_host.h" | 8 #include "content/browser/renderer_host/render_view_host.h" |
| 9 #include "content/browser/tab_contents/tab_contents.h" | 9 #include "content/browser/tab_contents/tab_contents.h" |
| 10 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
| 11 #include "grit/generated_resources.h" | 11 #include "grit/generated_resources.h" |
| 12 #include "grit/locale_settings.h" | 12 #include "grit/locale_settings.h" |
| 13 #include "grit/theme_resources_standard.h" | 13 #include "grit/theme_resources_standard.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 15 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
| 16 #include "webkit/plugins/npapi/default_plugin_shared.h" |
| 16 | 17 |
| 17 PluginInstallerInfoBarDelegate::PluginInstallerInfoBarDelegate( | 18 PluginInstallerInfoBarDelegate::PluginInstallerInfoBarDelegate( |
| 18 TabContents* tab_contents) | 19 TabContents* tab_contents, gfx::NativeWindow window) |
| 19 : ConfirmInfoBarDelegate(tab_contents), | 20 : ConfirmInfoBarDelegate(tab_contents), |
| 20 tab_contents_(tab_contents) { | 21 tab_contents_(tab_contents), |
| 22 window_(window) { |
| 21 } | 23 } |
| 22 | 24 |
| 23 PluginInstallerInfoBarDelegate::~PluginInstallerInfoBarDelegate() { | 25 PluginInstallerInfoBarDelegate::~PluginInstallerInfoBarDelegate() { |
| 24 } | 26 } |
| 25 | 27 |
| 26 gfx::Image* PluginInstallerInfoBarDelegate::GetIcon() const { | 28 gfx::Image* PluginInstallerInfoBarDelegate::GetIcon() const { |
| 27 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 29 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
| 28 IDR_INFOBAR_PLUGIN_INSTALL); | 30 IDR_INFOBAR_PLUGIN_INSTALL); |
| 29 } | 31 } |
| 30 | 32 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 41 return BUTTON_OK; | 43 return BUTTON_OK; |
| 42 } | 44 } |
| 43 | 45 |
| 44 string16 PluginInstallerInfoBarDelegate::GetButtonLabel( | 46 string16 PluginInstallerInfoBarDelegate::GetButtonLabel( |
| 45 InfoBarButton button) const { | 47 InfoBarButton button) const { |
| 46 DCHECK_EQ(BUTTON_OK, button); | 48 DCHECK_EQ(BUTTON_OK, button); |
| 47 return l10n_util::GetStringUTF16(IDS_PLUGININSTALLER_INSTALLPLUGIN_BUTTON); | 49 return l10n_util::GetStringUTF16(IDS_PLUGININSTALLER_INSTALLPLUGIN_BUTTON); |
| 48 } | 50 } |
| 49 | 51 |
| 50 bool PluginInstallerInfoBarDelegate::Accept() { | 52 bool PluginInstallerInfoBarDelegate::Accept() { |
| 51 RenderViewHost* host = tab_contents_->render_view_host(); | 53 // TODO(PORT) for other platforms. |
| 52 host->Send(new ViewMsg_InstallMissingPlugin(host->routing_id())); | 54 #ifdef OS_WIN |
| 55 ::PostMessage(window_, |
| 56 webkit::npapi::default_plugin::kInstallMissingPluginMessage, |
| 57 0, |
| 58 0); |
| 59 #endif // OS_WIN |
| 53 return true; | 60 return true; |
| 54 } | 61 } |
| 55 | 62 |
| 56 string16 PluginInstallerInfoBarDelegate::GetLinkText() const { | 63 string16 PluginInstallerInfoBarDelegate::GetLinkText() const { |
| 57 return l10n_util::GetStringUTF16(IDS_PLUGININSTALLER_PROBLEMSINSTALLING); | 64 return l10n_util::GetStringUTF16(IDS_PLUGININSTALLER_PROBLEMSINSTALLING); |
| 58 } | 65 } |
| 59 | 66 |
| 60 bool PluginInstallerInfoBarDelegate::LinkClicked( | 67 bool PluginInstallerInfoBarDelegate::LinkClicked( |
| 61 WindowOpenDisposition disposition) { | 68 WindowOpenDisposition disposition) { |
| 62 tab_contents_->OpenURL(google_util::AppendGoogleLocaleParam(GURL( | 69 tab_contents_->OpenURL(google_util::AppendGoogleLocaleParam(GURL( |
| 63 "http://www.google.com/support/chrome/bin/answer.py?answer=95697&topic=" | 70 "http://www.google.com/support/chrome/bin/answer.py?answer=95697&topic=" |
| 64 "14687")), GURL(), | 71 "14687")), GURL(), |
| 65 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 72 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 66 PageTransition::LINK); | 73 PageTransition::LINK); |
| 67 return false; | 74 return false; |
| 68 } | 75 } |
| OLD | NEW |