| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/extensions/chrome_content_verifier_delegate.h" | 5 #include "chrome/browser/extensions/chrome_content_verifier_delegate.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 "ExtensionContentVerification"; | 34 "ExtensionContentVerification"; |
| 35 | 35 |
| 36 } // namespace | 36 } // namespace |
| 37 | 37 |
| 38 namespace extensions { | 38 namespace extensions { |
| 39 | 39 |
| 40 // static | 40 // static |
| 41 ContentVerifierDelegate::Mode ChromeContentVerifierDelegate::GetDefaultMode() { | 41 ContentVerifierDelegate::Mode ChromeContentVerifierDelegate::GetDefaultMode() { |
| 42 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 42 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 43 | 43 |
| 44 Mode experiment_value = NONE; | 44 Mode experiment_value; |
| 45 #if defined(GOOGLE_CHROME_BUILD) |
| 46 experiment_value = ContentVerifierDelegate::ENFORCE; |
| 47 #else |
| 48 experiment_value = ContentVerifierDelegate::NONE; |
| 49 #endif |
| 45 const std::string group = | 50 const std::string group = |
| 46 base::FieldTrialList::FindFullName(kContentVerificationExperimentName); | 51 base::FieldTrialList::FindFullName(kContentVerificationExperimentName); |
| 47 if (group == "EnforceStrict") | 52 if (group == "EnforceStrict") |
| 48 experiment_value = ContentVerifierDelegate::ENFORCE_STRICT; | 53 experiment_value = ContentVerifierDelegate::ENFORCE_STRICT; |
| 49 else if (group == "Enforce") | 54 else if (group == "Enforce") |
| 50 experiment_value = ContentVerifierDelegate::ENFORCE; | 55 experiment_value = ContentVerifierDelegate::ENFORCE; |
| 51 else if (group == "Bootstrap") | 56 else if (group == "Bootstrap") |
| 52 experiment_value = ContentVerifierDelegate::BOOTSTRAP; | 57 experiment_value = ContentVerifierDelegate::BOOTSTRAP; |
| 58 else if (group == "None") |
| 59 experiment_value = ContentVerifierDelegate::NONE; |
| 53 | 60 |
| 54 // The field trial value that normally comes from the server can be | 61 // The field trial value that normally comes from the server can be |
| 55 // overridden on the command line, which we don't want to allow since | 62 // overridden on the command line, which we don't want to allow since |
| 56 // malware can set chrome command line flags. There isn't currently a way | 63 // malware can set chrome command line flags. There isn't currently a way |
| 57 // to find out what the server-provided value is in this case, so we | 64 // to find out what the server-provided value is in this case, so we |
| 58 // conservatively default to the strictest mode if we detect our experiment | 65 // conservatively default to the strictest mode if we detect our experiment |
| 59 // name being overridden. | 66 // name being overridden. |
| 60 if (command_line->HasSwitch(switches::kForceFieldTrials)) { | 67 if (command_line->HasSwitch(switches::kForceFieldTrials)) { |
| 61 std::string forced_trials = | 68 std::string forced_trials = |
| 62 command_line->GetSwitchValueASCII(switches::kForceFieldTrials); | 69 command_line->GetSwitchValueASCII(switches::kForceFieldTrials); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 void ChromeContentVerifierDelegate::LogFailureForPolicyForceInstall( | 186 void ChromeContentVerifierDelegate::LogFailureForPolicyForceInstall( |
| 180 const std::string& extension_id) { | 187 const std::string& extension_id) { |
| 181 if (!ContainsKey(corrupt_policy_extensions_, extension_id)) { | 188 if (!ContainsKey(corrupt_policy_extensions_, extension_id)) { |
| 182 corrupt_policy_extensions_.insert(extension_id); | 189 corrupt_policy_extensions_.insert(extension_id); |
| 183 UMA_HISTOGRAM_BOOLEAN("Extensions.CorruptPolicyExtensionWouldBeDisabled", | 190 UMA_HISTOGRAM_BOOLEAN("Extensions.CorruptPolicyExtensionWouldBeDisabled", |
| 184 true); | 191 true); |
| 185 } | 192 } |
| 186 } | 193 } |
| 187 | 194 |
| 188 } // namespace extensions | 195 } // namespace extensions |
| OLD | NEW |