| 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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/debug/crash_logging.h" | 9 #include "base/debug/crash_logging.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 &web_contents()->GetController(), | 328 &web_contents()->GetController(), |
| 329 infobar_text); | 329 infobar_text); |
| 330 } | 330 } |
| 331 | 331 |
| 332 bool PluginObserver::OnMessageReceived( | 332 bool PluginObserver::OnMessageReceived( |
| 333 const IPC::Message& message, | 333 const IPC::Message& message, |
| 334 content::RenderFrameHost* render_frame_host) { | 334 content::RenderFrameHost* render_frame_host) { |
| 335 IPC_BEGIN_MESSAGE_MAP(PluginObserver, message) | 335 IPC_BEGIN_MESSAGE_MAP(PluginObserver, message) |
| 336 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_BlockedOutdatedPlugin, | 336 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_BlockedOutdatedPlugin, |
| 337 OnBlockedOutdatedPlugin) | 337 OnBlockedOutdatedPlugin) |
| 338 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_BlockedUnauthorizedPlugin, | |
| 339 OnBlockedUnauthorizedPlugin) | |
| 340 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_NPAPINotSupported, | 338 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_NPAPINotSupported, |
| 341 OnNPAPINotSupported) | 339 OnNPAPINotSupported) |
| 342 #if defined(ENABLE_PLUGIN_INSTALLATION) | 340 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 343 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FindMissingPlugin, | 341 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FindMissingPlugin, |
| 344 OnFindMissingPlugin) | 342 OnFindMissingPlugin) |
| 345 #endif | 343 #endif |
| 346 | 344 |
| 347 IPC_MESSAGE_UNHANDLED(return false) | 345 IPC_MESSAGE_UNHANDLED(return false) |
| 348 IPC_END_MESSAGE_MAP() | 346 IPC_END_MESSAGE_MAP() |
| 349 | 347 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 360 OnOpenAboutPlugins) | 358 OnOpenAboutPlugins) |
| 361 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_CouldNotLoadPlugin, | 359 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_CouldNotLoadPlugin, |
| 362 OnCouldNotLoadPlugin) | 360 OnCouldNotLoadPlugin) |
| 363 | 361 |
| 364 IPC_MESSAGE_UNHANDLED(return false) | 362 IPC_MESSAGE_UNHANDLED(return false) |
| 365 IPC_END_MESSAGE_MAP() | 363 IPC_END_MESSAGE_MAP() |
| 366 | 364 |
| 367 return true; | 365 return true; |
| 368 } | 366 } |
| 369 | 367 |
| 370 void PluginObserver::OnBlockedUnauthorizedPlugin( | |
| 371 const base::string16& name, | |
| 372 const std::string& identifier) { | |
| 373 UnauthorizedPluginInfoBarDelegate::Create( | |
| 374 InfoBarService::FromWebContents(web_contents()), | |
| 375 Profile::FromBrowserContext(web_contents()->GetBrowserContext())-> | |
| 376 GetHostContentSettingsMap(), | |
| 377 name, identifier); | |
| 378 } | |
| 379 | |
| 380 void PluginObserver::OnBlockedOutdatedPlugin(int placeholder_id, | 368 void PluginObserver::OnBlockedOutdatedPlugin(int placeholder_id, |
| 381 const std::string& identifier) { | 369 const std::string& identifier) { |
| 382 #if defined(ENABLE_PLUGIN_INSTALLATION) | 370 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 383 PluginFinder* finder = PluginFinder::GetInstance(); | 371 PluginFinder* finder = PluginFinder::GetInstance(); |
| 384 // Find plugin to update. | 372 // Find plugin to update. |
| 385 PluginInstaller* installer = NULL; | 373 PluginInstaller* installer = NULL; |
| 386 scoped_ptr<PluginMetadata> plugin; | 374 scoped_ptr<PluginMetadata> plugin; |
| 387 if (finder->FindPluginWithIdentifier(identifier, &installer, &plugin)) { | 375 if (finder->FindPluginWithIdentifier(identifier, &installer, &plugin)) { |
| 388 plugin_placeholders_[placeholder_id] = new PluginPlaceholderHost( | 376 plugin_placeholders_[placeholder_id] = new PluginPlaceholderHost( |
| 389 this, placeholder_id, plugin->name(), installer); | 377 this, placeholder_id, plugin->name(), installer); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 scoped_ptr<PluginMetadata> plugin; | 480 scoped_ptr<PluginMetadata> plugin; |
| 493 bool ret = PluginFinder::GetInstance()->FindPluginWithIdentifier( | 481 bool ret = PluginFinder::GetInstance()->FindPluginWithIdentifier( |
| 494 identifier, NULL, &plugin); | 482 identifier, NULL, &plugin); |
| 495 DCHECK(ret); | 483 DCHECK(ret); |
| 496 | 484 |
| 497 PluginMetroModeInfoBarDelegate::Create( | 485 PluginMetroModeInfoBarDelegate::Create( |
| 498 InfoBarService::FromWebContents(web_contents()), | 486 InfoBarService::FromWebContents(web_contents()), |
| 499 PluginMetroModeInfoBarDelegate::DESKTOP_MODE_REQUIRED, plugin->name()); | 487 PluginMetroModeInfoBarDelegate::DESKTOP_MODE_REQUIRED, plugin->name()); |
| 500 #endif | 488 #endif |
| 501 } | 489 } |
| OLD | NEW |