| OLD | NEW |
| 1 // Copyright (c) 2010 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/locale_settings.h" |
| 14 #include "grit/theme_resources.h" | 14 #include "grit/theme_resources.h" |
| 15 #include "webkit/plugins/npapi/default_plugin_shared.h" | 15 #include "webkit/glue/plugins/default_plugin_shared.h" |
| 16 | 16 |
| 17 // The URL for the "Problems installing" page for the Plugins infobar. | 17 // The URL for the "Problems installing" page for the Plugins infobar. |
| 18 static const char kLearnMorePluginInstallerUrl[] = | 18 static const char kLearnMorePluginInstallerUrl[] = |
| 19 "http://www.google.com/support/chrome/bin/answer.py?answer=95697&topic=1
4687"; | 19 "http://www.google.com/support/chrome/bin/answer.py?answer=95697&topic=1
4687"; |
| 20 | 20 |
| 21 PluginInstaller::PluginInstaller(TabContents* tab_contents) | 21 PluginInstaller::PluginInstaller(TabContents* tab_contents) |
| 22 : ConfirmInfoBarDelegate(tab_contents), | 22 : ConfirmInfoBarDelegate(tab_contents), |
| 23 tab_contents_(tab_contents) { | 23 tab_contents_(tab_contents) { |
| 24 } | 24 } |
| 25 | 25 |
| 26 PluginInstaller::~PluginInstaller() { | 26 PluginInstaller::~PluginInstaller() { |
| 27 // Remove any InfoBars we may be showing. | 27 // Remove any InfoBars we may be showing. |
| 28 tab_contents_->RemoveInfoBar(this); | 28 tab_contents_->RemoveInfoBar(this); |
| 29 } | 29 } |
| 30 | 30 |
| 31 void PluginInstaller::OnMissingPluginStatus(int status) { | 31 void PluginInstaller::OnMissingPluginStatus(int status) { |
| 32 switch (status) { | 32 switch (status) { |
| 33 case webkit::npapi::default_plugin::MISSING_PLUGIN_AVAILABLE: { | 33 case default_plugin::MISSING_PLUGIN_AVAILABLE: { |
| 34 tab_contents_->AddInfoBar(this); | 34 tab_contents_->AddInfoBar(this); |
| 35 break; | 35 break; |
| 36 } | 36 } |
| 37 case webkit::npapi::default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD: { | 37 case default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD: { |
| 38 // Hide the InfoBar if user already started download/install of the | 38 // Hide the InfoBar if user already started download/install of the |
| 39 // missing plugin. | 39 // missing plugin. |
| 40 tab_contents_->RemoveInfoBar(this); | 40 tab_contents_->RemoveInfoBar(this); |
| 41 break; | 41 break; |
| 42 } | 42 } |
| 43 default: { | 43 default: { |
| 44 NOTREACHED(); | 44 NOTREACHED(); |
| 45 break; | 45 break; |
| 46 } | 46 } |
| 47 } | 47 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 74 string16 PluginInstaller::GetLinkText() { | 74 string16 PluginInstaller::GetLinkText() { |
| 75 return l10n_util::GetStringUTF16(IDS_PLUGININSTALLER_PROBLEMSINSTALLING); | 75 return l10n_util::GetStringUTF16(IDS_PLUGININSTALLER_PROBLEMSINSTALLING); |
| 76 } | 76 } |
| 77 | 77 |
| 78 bool PluginInstaller::LinkClicked(WindowOpenDisposition disposition) { | 78 bool PluginInstaller::LinkClicked(WindowOpenDisposition disposition) { |
| 79 // Ignore the click dispostion and always open in a new top level tab. | 79 // Ignore the click dispostion and always open in a new top level tab. |
| 80 tab_contents_->OpenURL(GURL(kLearnMorePluginInstallerUrl), GURL(), | 80 tab_contents_->OpenURL(GURL(kLearnMorePluginInstallerUrl), GURL(), |
| 81 NEW_FOREGROUND_TAB, PageTransition::LINK); | 81 NEW_FOREGROUND_TAB, PageTransition::LINK); |
| 82 return false; // Do not dismiss the info bar. | 82 return false; // Do not dismiss the info bar. |
| 83 } | 83 } |
| OLD | NEW |