Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: chrome/browser/plugins/plugin_prefs.cc

Issue 12079044: Fix enable state of Pepper Flash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/plugins/plugin_prefs.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 FilePath& plugin, bool enabled) { 65 void PluginPrefs::PluginState::Set(const FilePath& plugin, bool enabled) {
66 state_[ConvertMapKey(plugin)] = enabled; 66 state_[ConvertMapKey(plugin)] = enabled;
67 } 67 }
68 68
69 void PluginPrefs::PluginState::SetIgnorePseudoKey(const FilePath& plugin,
70 bool enabled) {
71 FilePath key = ConvertMapKey(plugin);
72 if (key == plugin)
73 state_[key] = enabled;
74 }
75
76 FilePath PluginPrefs::PluginState::ConvertMapKey(const FilePath& plugin) const { 69 FilePath PluginPrefs::PluginState::ConvertMapKey(const FilePath& plugin) const {
77 // Keep the state of component-updated and bundled Pepper Flash in sync. 70 // Keep the state of component-updated and bundled Pepper Flash in sync.
78 if (plugin.BaseName().value() == chrome::kPepperFlashPluginFilename) { 71 if (plugin.BaseName().value() == chrome::kPepperFlashPluginFilename) {
79 FilePath component_updated_pepper_flash_dir; 72 FilePath component_updated_pepper_flash_dir;
80 if (PathService::Get(chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN, 73 if (PathService::Get(chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN,
81 &component_updated_pepper_flash_dir) && 74 &component_updated_pepper_flash_dir) &&
82 component_updated_pepper_flash_dir.IsParent(plugin)) { 75 component_updated_pepper_flash_dir.IsParent(plugin)) {
83 FilePath bundled_pepper_flash; 76 FilePath bundled_pepper_flash;
84 if (PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN, 77 if (PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN,
85 &bundled_pepper_flash)) { 78 &bundled_pepper_flash)) {
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 } 452 }
460 } else if (migrate_to_pepper_flash && 453 } else if (migrate_to_pepper_flash &&
461 FilePath::CompareEqualIgnoreCase(path, npapi_flash.value())) { 454 FilePath::CompareEqualIgnoreCase(path, npapi_flash.value())) {
462 npapi_flash_enabled = enabled; 455 npapi_flash_enabled = enabled;
463 } else if (migrate_to_pepper_flash && 456 } else if (migrate_to_pepper_flash &&
464 FilePath::CompareEqualIgnoreCase(path, pepper_flash.value())) { 457 FilePath::CompareEqualIgnoreCase(path, pepper_flash.value())) {
465 if (!enabled) 458 if (!enabled)
466 pepper_flash_node = plugin; 459 pepper_flash_node = plugin;
467 } 460 }
468 461
469 plugin_state_.SetIgnorePseudoKey(plugin_path, enabled); 462 plugin_state_.Set(plugin_path, enabled);
470 } else if (!enabled && plugin->GetString("name", &group_name)) { 463 } else if (!enabled && plugin->GetString("name", &group_name)) {
471 // Don't disable this group if it's for the pdf or nacl plugins and 464 // Don't disable this group if it's for the pdf or nacl plugins and
472 // we just forced it on. 465 // we just forced it on.
473 if (force_enable_internal_pdf && pdf_group_name == group_name) 466 if (force_enable_internal_pdf && pdf_group_name == group_name)
474 continue; 467 continue;
475 if (force_enable_nacl && (nacl_group_name == group_name || 468 if (force_enable_nacl && (nacl_group_name == group_name ||
476 old_nacl_group_name == group_name)) 469 old_nacl_group_name == group_name))
477 continue; 470 continue;
478 471
479 // Otherwise this is a list of groups. 472 // Otherwise this is a list of groups.
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 } 624 }
632 } 625 }
633 626
634 void PluginPrefs::NotifyPluginStatusChanged() { 627 void PluginPrefs::NotifyPluginStatusChanged() {
635 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 628 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
636 content::NotificationService::current()->Notify( 629 content::NotificationService::current()->Notify(
637 chrome::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, 630 chrome::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED,
638 content::Source<Profile>(profile_), 631 content::Source<Profile>(profile_),
639 content::NotificationService::NoDetails()); 632 content::NotificationService::NoDetails());
640 } 633 }
OLDNEW
« no previous file with comments | « chrome/browser/plugins/plugin_prefs.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698