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

Side by Side Diff: chrome/browser/about_flags.cc

Issue 7049012: Cause the 'enable-nacl' flag to be locked with enabling the NaCl plugin. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 7 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 | « no previous file | chrome/common/chrome_content_client.h » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/about_flags.h" 5 #include "chrome/browser/about_flags.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 11
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "base/utf_string_conversions.h"
15 #include "base/values.h" 16 #include "base/values.h"
17 #include "chrome/browser/plugin_updater.h"
16 #include "chrome/browser/prefs/pref_service.h" 18 #include "chrome/browser/prefs/pref_service.h"
17 #include "chrome/browser/prefs/scoped_user_pref_update.h" 19 #include "chrome/browser/prefs/scoped_user_pref_update.h"
20 #include "chrome/common/chrome_content_client.h"
18 #include "chrome/common/chrome_switches.h" 21 #include "chrome/common/chrome_switches.h"
19 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
20 #include "content/browser/user_metrics.h" 23 #include "content/browser/user_metrics.h"
21 #include "grit/generated_resources.h" 24 #include "grit/generated_resources.h"
22 #include "ui/base/l10n/l10n_util.h" 25 #include "ui/base/l10n/l10n_util.h"
23 26
24 namespace about_flags { 27 namespace about_flags {
25 28
26 // Macros to simplify specifying the type. 29 // Macros to simplify specifying the type.
27 #define SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, switch_value) \ 30 #define SINGLE_VALUE_TYPE_AND_VALUE(command_line_switch, switch_value) \
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 const Experiment* e = NULL; 668 const Experiment* e = NULL;
666 for (size_t i = 0; i < num_experiments; ++i) { 669 for (size_t i = 0; i < num_experiments; ++i) {
667 if (experiments[i].internal_name == internal_name) { 670 if (experiments[i].internal_name == internal_name) {
668 e = experiments + i; 671 e = experiments + i;
669 break; 672 break;
670 } 673 }
671 } 674 }
672 DCHECK(e); 675 DCHECK(e);
673 676
674 if (e->type == Experiment::SINGLE_VALUE) { 677 if (e->type == Experiment::SINGLE_VALUE) {
675 if (enable) 678 if (enable) {
676 enabled_experiments.insert(internal_name); 679 enabled_experiments.insert(internal_name);
677 else 680 // If enabling NaCl, make sure the plugin is also enabled. See bug
681 // http://code.google.com/p/chromium/issues/detail?id=81010 for more
682 // information.
683 // TODO(dspringer): When NaCl is on by default, remove this code.
684 if (internal_name == "enable-nacl") {
jam 2011/05/19 22:56:46 is there no constant for this? kEnableNaCl?
der Springer 2011/05/20 17:47:16 Done.
685 PluginUpdater* plugin_updater = PluginUpdater::GetInstance();
686 string16 nacl_plugin_name =
687 ASCIIToUTF16(chrome::ChromeContentClient::kNaClPluginName);
688 plugin_updater->EnablePluginGroup(true, nacl_plugin_name);
689 }
690 } else {
678 enabled_experiments.erase(internal_name); 691 enabled_experiments.erase(internal_name);
692 }
679 } else { 693 } else {
680 if (enable) { 694 if (enable) {
681 // Enable the first choice. 695 // Enable the first choice.
682 enabled_experiments.insert(NameForChoice(*e, 0)); 696 enabled_experiments.insert(NameForChoice(*e, 0));
683 } else { 697 } else {
684 // Find the currently enabled choice and disable it. 698 // Find the currently enabled choice and disable it.
685 for (int i = 0; i < e->num_choices; ++i) { 699 for (int i = 0; i < e->num_choices; ++i) {
686 std::string choice_name = NameForChoice(*e, i); 700 std::string choice_name = NameForChoice(*e, i);
687 if (enabled_experiments.find(choice_name) != 701 if (enabled_experiments.find(choice_name) !=
688 enabled_experiments.end()) { 702 enabled_experiments.end()) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 } 747 }
734 748
735 const Experiment* GetExperiments(size_t* count) { 749 const Experiment* GetExperiments(size_t* count) {
736 *count = num_experiments; 750 *count = num_experiments;
737 return experiments; 751 return experiments;
738 } 752 }
739 753
740 } // namespace testing 754 } // namespace testing
741 755
742 } // namespace about_flags 756 } // namespace about_flags
OLDNEW
« no previous file with comments | « no previous file | chrome/common/chrome_content_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698