OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/blocked_plugin_manager.h" |
| 6 |
| 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" |
| 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/renderer_host/render_view_host.h" |
| 11 #include "chrome/browser/tab_contents/tab_contents.h" |
| 12 #include "grit/generated_resources.h" |
| 13 #include "grit/theme_resources.h" |
| 14 |
| 15 BlockedPluginManager::BlockedPluginManager(TabContents* tab_contents) |
| 16 : ConfirmInfoBarDelegate(tab_contents), |
| 17 tab_contents_(tab_contents) { } |
| 18 |
| 19 void BlockedPluginManager::OnNonSandboxedPluginBlocked(const string16& name) { |
| 20 name_ = name; |
| 21 tab_contents_->AddInfoBar(this); |
| 22 } |
| 23 |
| 24 void BlockedPluginManager::OnBlockedPluginLoaded() { |
| 25 tab_contents_->RemoveInfoBar(this); |
| 26 } |
| 27 |
| 28 int BlockedPluginManager::GetButtons() const { |
| 29 return BUTTON_OK; |
| 30 } |
| 31 |
| 32 std::wstring BlockedPluginManager::GetButtonLabel(InfoBarButton button) const { |
| 33 if (button == BUTTON_OK) |
| 34 return l10n_util::GetString(IDS_PLUGIN_LOAD); |
| 35 return ConfirmInfoBarDelegate::GetButtonLabel(button); |
| 36 } |
| 37 |
| 38 std::wstring BlockedPluginManager::GetMessageText() const { |
| 39 return UTF16ToWide(l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED_PROMPT, |
| 40 name_)); |
| 41 } |
| 42 |
| 43 std::wstring BlockedPluginManager::GetLinkText() { |
| 44 return l10n_util::GetString(IDS_LEARN_MORE); |
| 45 } |
| 46 |
| 47 SkBitmap* BlockedPluginManager::GetIcon() const { |
| 48 return ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 49 IDR_INFOBAR_PLUGIN_INSTALL); |
| 50 } |
| 51 |
| 52 bool BlockedPluginManager::Accept() { |
| 53 tab_contents_->render_view_host()->LoadBlockedPlugins(); |
| 54 return true; |
| 55 } |
| 56 |
| 57 bool BlockedPluginManager::LinkClicked(WindowOpenDisposition disposition) { |
| 58 // TODO(bauerb): Navigate to a help page explaining why we blocked the plugin, |
| 59 // once we have one. |
| 60 return false; |
| 61 } |
OLD | NEW |