OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/component_updater/origin_trials_component_installer.h" | 5 #include "chrome/browser/component_updater/origin_trials_component_installer.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 const base::FilePath& install_dir, | 80 const base::FilePath& install_dir, |
81 std::unique_ptr<base::DictionaryValue> manifest) { | 81 std::unique_ptr<base::DictionaryValue> manifest) { |
82 // Read the configuration from the manifest and set values in browser | 82 // Read the configuration from the manifest and set values in browser |
83 // local_state. These will be used on the next browser restart. | 83 // local_state. These will be used on the next browser restart. |
84 // If an individual configuration value is missing, treat as a reset to the | 84 // If an individual configuration value is missing, treat as a reset to the |
85 // browser defaults. | 85 // browser defaults. |
86 PrefService* local_state = g_browser_process->local_state(); | 86 PrefService* local_state = g_browser_process->local_state(); |
87 std::string override_public_key; | 87 std::string override_public_key; |
88 if (manifest->GetString(kManifestPublicKeyPath, &override_public_key)) { | 88 if (manifest->GetString(kManifestPublicKeyPath, &override_public_key)) { |
89 local_state->Set(prefs::kOriginTrialPublicKey, | 89 local_state->Set(prefs::kOriginTrialPublicKey, |
90 base::StringValue(override_public_key)); | 90 base::Value(override_public_key)); |
91 } else { | 91 } else { |
92 local_state->ClearPref(prefs::kOriginTrialPublicKey); | 92 local_state->ClearPref(prefs::kOriginTrialPublicKey); |
93 } | 93 } |
94 base::ListValue* override_disabled_feature_list = nullptr; | 94 base::ListValue* override_disabled_feature_list = nullptr; |
95 const bool manifest_has_disabled_features = manifest->GetList( | 95 const bool manifest_has_disabled_features = manifest->GetList( |
96 kManifestDisabledFeaturesPath, &override_disabled_feature_list); | 96 kManifestDisabledFeaturesPath, &override_disabled_feature_list); |
97 if (manifest_has_disabled_features && | 97 if (manifest_has_disabled_features && |
98 !override_disabled_feature_list->empty()) { | 98 !override_disabled_feature_list->empty()) { |
99 ListPrefUpdate update(local_state, prefs::kOriginTrialDisabledFeatures); | 99 ListPrefUpdate update(local_state, prefs::kOriginTrialDisabledFeatures); |
100 update->Swap(override_disabled_feature_list); | 100 update->Swap(override_disabled_feature_list); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 const base::FilePath& user_data_dir) { | 133 const base::FilePath& user_data_dir) { |
134 std::unique_ptr<ComponentInstallerTraits> traits( | 134 std::unique_ptr<ComponentInstallerTraits> traits( |
135 new OriginTrialsComponentInstallerTraits()); | 135 new OriginTrialsComponentInstallerTraits()); |
136 // |cus| will take ownership of |installer| during installer->Register(cus). | 136 // |cus| will take ownership of |installer| during installer->Register(cus). |
137 DefaultComponentInstaller* installer = | 137 DefaultComponentInstaller* installer = |
138 new DefaultComponentInstaller(std::move(traits)); | 138 new DefaultComponentInstaller(std::move(traits)); |
139 installer->Register(cus, base::Closure()); | 139 installer->Register(cus, base::Closure()); |
140 } | 140 } |
141 | 141 |
142 } // namespace component_updater | 142 } // namespace component_updater |
OLD | NEW |