| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 content::NavigationController* controller, | 132 content::NavigationController* controller, |
| 133 const base::string16& message); | 133 const base::string16& message); |
| 134 | 134 |
| 135 private: | 135 private: |
| 136 ReloadPluginInfoBarDelegate(content::NavigationController* controller, | 136 ReloadPluginInfoBarDelegate(content::NavigationController* controller, |
| 137 const base::string16& message); | 137 const base::string16& message); |
| 138 ~ReloadPluginInfoBarDelegate() override; | 138 ~ReloadPluginInfoBarDelegate() override; |
| 139 | 139 |
| 140 // ConfirmInfobarDelegate: | 140 // ConfirmInfobarDelegate: |
| 141 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; | 141 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; |
| 142 int GetIconId() const override; | |
| 143 gfx::VectorIconId GetVectorIconId() const override; | 142 gfx::VectorIconId GetVectorIconId() const override; |
| 144 base::string16 GetMessageText() const override; | 143 base::string16 GetMessageText() const override; |
| 145 int GetButtons() const override; | 144 int GetButtons() const override; |
| 146 base::string16 GetButtonLabel(InfoBarButton button) const override; | 145 base::string16 GetButtonLabel(InfoBarButton button) const override; |
| 147 bool Accept() override; | 146 bool Accept() override; |
| 148 | 147 |
| 149 content::NavigationController* controller_; | 148 content::NavigationController* controller_; |
| 150 base::string16 message_; | 149 base::string16 message_; |
| 151 }; | 150 }; |
| 152 | 151 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 166 : controller_(controller), | 165 : controller_(controller), |
| 167 message_(message) {} | 166 message_(message) {} |
| 168 | 167 |
| 169 ReloadPluginInfoBarDelegate::~ReloadPluginInfoBarDelegate() {} | 168 ReloadPluginInfoBarDelegate::~ReloadPluginInfoBarDelegate() {} |
| 170 | 169 |
| 171 infobars::InfoBarDelegate::InfoBarIdentifier | 170 infobars::InfoBarDelegate::InfoBarIdentifier |
| 172 ReloadPluginInfoBarDelegate::GetIdentifier() const { | 171 ReloadPluginInfoBarDelegate::GetIdentifier() const { |
| 173 return RELOAD_PLUGIN_INFOBAR_DELEGATE; | 172 return RELOAD_PLUGIN_INFOBAR_DELEGATE; |
| 174 } | 173 } |
| 175 | 174 |
| 176 int ReloadPluginInfoBarDelegate::GetIconId() const { | |
| 177 return IDR_INFOBAR_PLUGIN_CRASHED; | |
| 178 } | |
| 179 | |
| 180 gfx::VectorIconId ReloadPluginInfoBarDelegate::GetVectorIconId() const { | 175 gfx::VectorIconId ReloadPluginInfoBarDelegate::GetVectorIconId() const { |
| 181 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | |
| 182 return gfx::VectorIconId::EXTENSION_CRASHED; | 176 return gfx::VectorIconId::EXTENSION_CRASHED; |
| 183 #else | |
| 184 return gfx::VectorIconId::VECTOR_ICON_NONE; | |
| 185 #endif | |
| 186 } | 177 } |
| 187 | 178 |
| 188 base::string16 ReloadPluginInfoBarDelegate::GetMessageText() const { | 179 base::string16 ReloadPluginInfoBarDelegate::GetMessageText() const { |
| 189 return message_; | 180 return message_; |
| 190 } | 181 } |
| 191 | 182 |
| 192 int ReloadPluginInfoBarDelegate::GetButtons() const { | 183 int ReloadPluginInfoBarDelegate::GetButtons() const { |
| 193 return BUTTON_OK; | 184 return BUTTON_OK; |
| 194 } | 185 } |
| 195 | 186 |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 // TODO(tommycli): Show a permission bubble for the associated tab. | 448 // TODO(tommycli): Show a permission bubble for the associated tab. |
| 458 } | 449 } |
| 459 | 450 |
| 460 void PluginObserver::OnCouldNotLoadPlugin(const base::FilePath& plugin_path) { | 451 void PluginObserver::OnCouldNotLoadPlugin(const base::FilePath& plugin_path) { |
| 461 g_browser_process->GetMetricsServicesManager()->OnPluginLoadingError( | 452 g_browser_process->GetMetricsServicesManager()->OnPluginLoadingError( |
| 462 plugin_path); | 453 plugin_path); |
| 463 base::string16 plugin_name = | 454 base::string16 plugin_name = |
| 464 PluginService::GetInstance()->GetPluginDisplayNameByPath(plugin_path); | 455 PluginService::GetInstance()->GetPluginDisplayNameByPath(plugin_path); |
| 465 SimpleAlertInfoBarDelegate::Create( | 456 SimpleAlertInfoBarDelegate::Create( |
| 466 InfoBarService::FromWebContents(web_contents()), | 457 InfoBarService::FromWebContents(web_contents()), |
| 467 infobars::InfoBarDelegate::PLUGIN_OBSERVER, | 458 infobars::InfoBarDelegate::PLUGIN_OBSERVER, 0, |
| 468 IDR_INFOBAR_PLUGIN_CRASHED, | |
| 469 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | |
| 470 gfx::VectorIconId::EXTENSION_CRASHED, | 459 gfx::VectorIconId::EXTENSION_CRASHED, |
| 471 #else | |
| 472 gfx::VectorIconId::VECTOR_ICON_NONE, | |
| 473 #endif | |
| 474 l10n_util::GetStringFUTF16(IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT, | 460 l10n_util::GetStringFUTF16(IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT, |
| 475 plugin_name), | 461 plugin_name), |
| 476 true); | 462 true); |
| 477 } | 463 } |
| OLD | NEW |