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