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

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: Use const for "enable-nacl" 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // Only expose this for Chromium builds where users may not have the PDF 171 // Only expose this for Chromium builds where users may not have the PDF
169 // plugin. Do not give Google Chrome users the option to disable it here. 172 // plugin. Do not give Google Chrome users the option to disable it here.
170 { 173 {
171 "print-preview", // FLAGS:RECORD_UMA 174 "print-preview", // FLAGS:RECORD_UMA
172 IDS_FLAGS_PRINT_PREVIEW_NAME, 175 IDS_FLAGS_PRINT_PREVIEW_NAME,
173 IDS_FLAGS_PRINT_PREVIEW_DESCRIPTION, 176 IDS_FLAGS_PRINT_PREVIEW_DESCRIPTION,
174 kOsMac | kOsWin | kOsLinux, // This switch is not available in CrOS. 177 kOsMac | kOsWin | kOsLinux, // This switch is not available in CrOS.
175 SINGLE_VALUE_TYPE(switches::kEnablePrintPreview) 178 SINGLE_VALUE_TYPE(switches::kEnablePrintPreview)
176 }, 179 },
177 #endif 180 #endif
181 // TODO(dspringer): When NaCl is on by default, remove this flag entry.
178 { 182 {
179 "enable-nacl", // FLAGS:RECORD_UMA 183 switches::kEnableNaCl, // FLAGS:RECORD_UMA
180 IDS_FLAGS_ENABLE_NACL_NAME, 184 IDS_FLAGS_ENABLE_NACL_NAME,
181 IDS_FLAGS_ENABLE_NACL_DESCRIPTION, 185 IDS_FLAGS_ENABLE_NACL_DESCRIPTION,
182 kOsAll, 186 kOsAll,
183 SINGLE_VALUE_TYPE(switches::kEnableNaCl) 187 SINGLE_VALUE_TYPE(switches::kEnableNaCl)
184 }, 188 },
185 { 189 {
186 "dns-server", // FLAGS:RECORD_UMA 190 "dns-server", // FLAGS:RECORD_UMA
187 IDS_FLAGS_DNS_SERVER_NAME, 191 IDS_FLAGS_DNS_SERVER_NAME,
188 IDS_FLAGS_DNS_SERVER_DESCRIPTION, 192 IDS_FLAGS_DNS_SERVER_DESCRIPTION,
189 kOsLinux, 193 kOsLinux,
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 const Experiment* e = NULL; 683 const Experiment* e = NULL;
680 for (size_t i = 0; i < num_experiments; ++i) { 684 for (size_t i = 0; i < num_experiments; ++i) {
681 if (experiments[i].internal_name == internal_name) { 685 if (experiments[i].internal_name == internal_name) {
682 e = experiments + i; 686 e = experiments + i;
683 break; 687 break;
684 } 688 }
685 } 689 }
686 DCHECK(e); 690 DCHECK(e);
687 691
688 if (e->type == Experiment::SINGLE_VALUE) { 692 if (e->type == Experiment::SINGLE_VALUE) {
689 if (enable) 693 if (enable) {
690 enabled_experiments.insert(internal_name); 694 enabled_experiments.insert(internal_name);
691 else 695 // If enabling NaCl, make sure the plugin is also enabled. See bug
696 // http://code.google.com/p/chromium/issues/detail?id=81010 for more
697 // information.
698 // TODO(dspringer): When NaCl is on by default, remove this code.
699 if (internal_name == switches::kEnableNaCl) {
700 PluginUpdater* plugin_updater = PluginUpdater::GetInstance();
701 string16 nacl_plugin_name =
702 ASCIIToUTF16(chrome::ChromeContentClient::kNaClPluginName);
703 plugin_updater->EnablePluginGroup(true, nacl_plugin_name);
704 }
705 } else {
692 enabled_experiments.erase(internal_name); 706 enabled_experiments.erase(internal_name);
707 }
693 } else { 708 } else {
694 if (enable) { 709 if (enable) {
695 // Enable the first choice. 710 // Enable the first choice.
696 enabled_experiments.insert(NameForChoice(*e, 0)); 711 enabled_experiments.insert(NameForChoice(*e, 0));
697 } else { 712 } else {
698 // Find the currently enabled choice and disable it. 713 // Find the currently enabled choice and disable it.
699 for (int i = 0; i < e->num_choices; ++i) { 714 for (int i = 0; i < e->num_choices; ++i) {
700 std::string choice_name = NameForChoice(*e, i); 715 std::string choice_name = NameForChoice(*e, i);
701 if (enabled_experiments.find(choice_name) != 716 if (enabled_experiments.find(choice_name) !=
702 enabled_experiments.end()) { 717 enabled_experiments.end()) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 } 762 }
748 763
749 const Experiment* GetExperiments(size_t* count) { 764 const Experiment* GetExperiments(size_t* count) {
750 *count = num_experiments; 765 *count = num_experiments;
751 return experiments; 766 return experiments;
752 } 767 }
753 768
754 } // namespace testing 769 } // namespace testing
755 770
756 } // namespace about_flags 771 } // 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