| OLD | NEW |
| 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/utf_string_conversions.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "chrome/browser/plugin_updater.h" | |
| 18 #include "chrome/browser/prefs/pref_service.h" | 17 #include "chrome/browser/prefs/pref_service.h" |
| 19 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 18 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 20 #include "chrome/common/chrome_content_client.h" | 19 #include "chrome/common/chrome_content_client.h" |
| 21 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
| 22 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 23 #include "content/browser/user_metrics.h" | 22 #include "content/browser/user_metrics.h" |
| 24 #include "grit/generated_resources.h" | 23 #include "grit/generated_resources.h" |
| 25 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
| 26 #include "ui/gfx/gl/gl_switches.h" | 25 #include "ui/gfx/gl/gl_switches.h" |
| 27 | 26 |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 const Experiment* e = NULL; | 708 const Experiment* e = NULL; |
| 710 for (size_t i = 0; i < num_experiments; ++i) { | 709 for (size_t i = 0; i < num_experiments; ++i) { |
| 711 if (experiments[i].internal_name == internal_name) { | 710 if (experiments[i].internal_name == internal_name) { |
| 712 e = experiments + i; | 711 e = experiments + i; |
| 713 break; | 712 break; |
| 714 } | 713 } |
| 715 } | 714 } |
| 716 DCHECK(e); | 715 DCHECK(e); |
| 717 | 716 |
| 718 if (e->type == Experiment::SINGLE_VALUE) { | 717 if (e->type == Experiment::SINGLE_VALUE) { |
| 719 if (enable) { | 718 if (enable) |
| 720 enabled_experiments.insert(internal_name); | 719 enabled_experiments.insert(internal_name); |
| 721 // If enabling NaCl, make sure the plugin is also enabled. See bug | 720 else |
| 722 // http://code.google.com/p/chromium/issues/detail?id=81010 for more | |
| 723 // information. | |
| 724 // TODO(dspringer): When NaCl is on by default, remove this code. | |
| 725 if (internal_name == switches::kEnableNaCl) { | |
| 726 PluginUpdater* plugin_updater = PluginUpdater::GetInstance(); | |
| 727 string16 nacl_plugin_name = | |
| 728 ASCIIToUTF16(chrome::ChromeContentClient::kNaClPluginName); | |
| 729 plugin_updater->EnablePluginGroup(true, nacl_plugin_name); | |
| 730 } | |
| 731 } else { | |
| 732 enabled_experiments.erase(internal_name); | 721 enabled_experiments.erase(internal_name); |
| 733 } | |
| 734 } else { | 722 } else { |
| 735 if (enable) { | 723 if (enable) { |
| 736 // Enable the first choice. | 724 // Enable the first choice. |
| 737 enabled_experiments.insert(NameForChoice(*e, 0)); | 725 enabled_experiments.insert(NameForChoice(*e, 0)); |
| 738 } else { | 726 } else { |
| 739 // Find the currently enabled choice and disable it. | 727 // Find the currently enabled choice and disable it. |
| 740 for (int i = 0; i < e->num_choices; ++i) { | 728 for (int i = 0; i < e->num_choices; ++i) { |
| 741 std::string choice_name = NameForChoice(*e, i); | 729 std::string choice_name = NameForChoice(*e, i); |
| 742 if (enabled_experiments.find(choice_name) != | 730 if (enabled_experiments.find(choice_name) != |
| 743 enabled_experiments.end()) { | 731 enabled_experiments.end()) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 } | 776 } |
| 789 | 777 |
| 790 const Experiment* GetExperiments(size_t* count) { | 778 const Experiment* GetExperiments(size_t* count) { |
| 791 *count = num_experiments; | 779 *count = num_experiments; |
| 792 return experiments; | 780 return experiments; |
| 793 } | 781 } |
| 794 | 782 |
| 795 } // namespace testing | 783 } // namespace testing |
| 796 | 784 |
| 797 } // namespace about_flags | 785 } // namespace about_flags |
| OLD | NEW |