| 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_prefs.h" | 5 #include "chrome/browser/plugins/plugin_prefs.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 *enabled = iter->second; | 59 *enabled = iter->second; |
| 60 return true; | 60 return true; |
| 61 } | 61 } |
| 62 return false; | 62 return false; |
| 63 } | 63 } |
| 64 | 64 |
| 65 void PluginPrefs::PluginState::Set(const base::FilePath& plugin, bool enabled) { | 65 void PluginPrefs::PluginState::Set(const base::FilePath& plugin, bool enabled) { |
| 66 state_[ConvertMapKey(plugin)] = enabled; | 66 state_[ConvertMapKey(plugin)] = enabled; |
| 67 } | 67 } |
| 68 | 68 |
| 69 void PluginPrefs::PluginState::SetIgnorePseudoKey(const base::FilePath& plugin, |
| 70 bool enabled) { |
| 71 base::FilePath key = ConvertMapKey(plugin); |
| 72 if (key == plugin) |
| 73 state_[key] = enabled; |
| 74 } |
| 75 |
| 69 base::FilePath PluginPrefs::PluginState::ConvertMapKey( | 76 base::FilePath PluginPrefs::PluginState::ConvertMapKey( |
| 70 const base::FilePath& plugin) const { | 77 const base::FilePath& plugin) const { |
| 71 // Keep the state of component-updated and bundled Pepper Flash in sync. | 78 // Keep the state of component-updated and bundled Pepper Flash in sync. |
| 72 if (plugin.BaseName().value() == chrome::kPepperFlashPluginFilename) { | 79 if (plugin.BaseName().value() == chrome::kPepperFlashPluginFilename) { |
| 73 base::FilePath component_updated_pepper_flash_dir; | 80 base::FilePath component_updated_pepper_flash_dir; |
| 74 if (PathService::Get(chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN, | 81 if (PathService::Get(chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN, |
| 75 &component_updated_pepper_flash_dir) && | 82 &component_updated_pepper_flash_dir) && |
| 76 component_updated_pepper_flash_dir.IsParent(plugin)) { | 83 component_updated_pepper_flash_dir.IsParent(plugin)) { |
| 77 base::FilePath bundled_pepper_flash; | 84 base::FilePath bundled_pepper_flash; |
| 78 if (PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN, | 85 if (PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN, |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 base::FilePath::CompareEqualIgnoreCase( | 463 base::FilePath::CompareEqualIgnoreCase( |
| 457 path, npapi_flash.value())) { | 464 path, npapi_flash.value())) { |
| 458 npapi_flash_enabled = enabled; | 465 npapi_flash_enabled = enabled; |
| 459 } else if (migrate_to_pepper_flash && | 466 } else if (migrate_to_pepper_flash && |
| 460 base::FilePath::CompareEqualIgnoreCase( | 467 base::FilePath::CompareEqualIgnoreCase( |
| 461 path, pepper_flash.value())) { | 468 path, pepper_flash.value())) { |
| 462 if (!enabled) | 469 if (!enabled) |
| 463 pepper_flash_node = plugin; | 470 pepper_flash_node = plugin; |
| 464 } | 471 } |
| 465 | 472 |
| 466 plugin_state_.Set(plugin_path, enabled); | 473 plugin_state_.SetIgnorePseudoKey(plugin_path, enabled); |
| 467 } else if (!enabled && plugin->GetString("name", &group_name)) { | 474 } else if (!enabled && plugin->GetString("name", &group_name)) { |
| 468 // Don't disable this group if it's for the pdf or nacl plugins and | 475 // Don't disable this group if it's for the pdf or nacl plugins and |
| 469 // we just forced it on. | 476 // we just forced it on. |
| 470 if (force_enable_internal_pdf && pdf_group_name == group_name) | 477 if (force_enable_internal_pdf && pdf_group_name == group_name) |
| 471 continue; | 478 continue; |
| 472 if (force_enable_nacl && (nacl_group_name == group_name || | 479 if (force_enable_nacl && (nacl_group_name == group_name || |
| 473 old_nacl_group_name == group_name)) | 480 old_nacl_group_name == group_name)) |
| 474 continue; | 481 continue; |
| 475 | 482 |
| 476 // Otherwise this is a list of groups. | 483 // Otherwise this is a list of groups. |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 } | 635 } |
| 629 } | 636 } |
| 630 | 637 |
| 631 void PluginPrefs::NotifyPluginStatusChanged() { | 638 void PluginPrefs::NotifyPluginStatusChanged() { |
| 632 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 639 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 633 content::NotificationService::current()->Notify( | 640 content::NotificationService::current()->Notify( |
| 634 chrome::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, | 641 chrome::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, |
| 635 content::Source<Profile>(profile_), | 642 content::Source<Profile>(profile_), |
| 636 content::NotificationService::NoDetails()); | 643 content::NotificationService::NoDetails()); |
| 637 } | 644 } |
| OLD | NEW |