| 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 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 const Experiment* e = NULL; | 717 const Experiment* e = NULL; |
| 719 for (size_t i = 0; i < num_experiments; ++i) { | 718 for (size_t i = 0; i < num_experiments; ++i) { |
| 720 if (experiments[i].internal_name == internal_name) { | 719 if (experiments[i].internal_name == internal_name) { |
| 721 e = experiments + i; | 720 e = experiments + i; |
| 722 break; | 721 break; |
| 723 } | 722 } |
| 724 } | 723 } |
| 725 DCHECK(e); | 724 DCHECK(e); |
| 726 | 725 |
| 727 if (e->type == Experiment::SINGLE_VALUE) { | 726 if (e->type == Experiment::SINGLE_VALUE) { |
| 728 if (enable) { | 727 if (enable) |
| 729 enabled_experiments.insert(internal_name); | 728 enabled_experiments.insert(internal_name); |
| 730 // If enabling NaCl, make sure the plugin is also enabled. See bug | 729 else |
| 731 // http://code.google.com/p/chromium/issues/detail?id=81010 for more | |
| 732 // information. | |
| 733 // TODO(dspringer): When NaCl is on by default, remove this code. | |
| 734 if (internal_name == switches::kEnableNaCl) { | |
| 735 PluginUpdater* plugin_updater = PluginUpdater::GetInstance(); | |
| 736 string16 nacl_plugin_name = | |
| 737 ASCIIToUTF16(chrome::ChromeContentClient::kNaClPluginName); | |
| 738 plugin_updater->EnablePluginGroup(true, nacl_plugin_name); | |
| 739 } | |
| 740 } else { | |
| 741 enabled_experiments.erase(internal_name); | 730 enabled_experiments.erase(internal_name); |
| 742 } | |
| 743 } else { | 731 } else { |
| 744 if (enable) { | 732 if (enable) { |
| 745 // Enable the first choice. | 733 // Enable the first choice. |
| 746 enabled_experiments.insert(NameForChoice(*e, 0)); | 734 enabled_experiments.insert(NameForChoice(*e, 0)); |
| 747 } else { | 735 } else { |
| 748 // Find the currently enabled choice and disable it. | 736 // Find the currently enabled choice and disable it. |
| 749 for (int i = 0; i < e->num_choices; ++i) { | 737 for (int i = 0; i < e->num_choices; ++i) { |
| 750 std::string choice_name = NameForChoice(*e, i); | 738 std::string choice_name = NameForChoice(*e, i); |
| 751 if (enabled_experiments.find(choice_name) != | 739 if (enabled_experiments.find(choice_name) != |
| 752 enabled_experiments.end()) { | 740 enabled_experiments.end()) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 } | 785 } |
| 798 | 786 |
| 799 const Experiment* GetExperiments(size_t* count) { | 787 const Experiment* GetExperiments(size_t* count) { |
| 800 *count = num_experiments; | 788 *count = num_experiments; |
| 801 return experiments; | 789 return experiments; |
| 802 } | 790 } |
| 803 | 791 |
| 804 } // namespace testing | 792 } // namespace testing |
| 805 | 793 |
| 806 } // namespace about_flags | 794 } // namespace about_flags |
| OLD | NEW |