OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/install_verifier.h" | 5 #include "chrome/browser/extensions/install_verifier.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 #if defined(GOOGLE_CHROME_BUILD) | 49 #if defined(GOOGLE_CHROME_BUILD) |
50 const char kExperimentName[] = "ExtensionInstallVerification"; | 50 const char kExperimentName[] = "ExtensionInstallVerification"; |
51 #endif // defined(GOOGLE_CHROME_BUILD) | 51 #endif // defined(GOOGLE_CHROME_BUILD) |
52 | 52 |
53 VerifyStatus GetExperimentStatus() { | 53 VerifyStatus GetExperimentStatus() { |
54 #if defined(GOOGLE_CHROME_BUILD) | 54 #if defined(GOOGLE_CHROME_BUILD) |
55 const std::string group = base::FieldTrialList::FindFullName( | 55 const std::string group = base::FieldTrialList::FindFullName( |
56 kExperimentName); | 56 kExperimentName); |
57 | 57 |
58 std::string forced_trials = CommandLine::ForCurrentProcess()-> | 58 std::string forced_trials = |
59 GetSwitchValueASCII(switches::kForceFieldTrials); | 59 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 60 switches::kForceFieldTrials); |
60 if (forced_trials.find(kExperimentName) != std::string::npos) { | 61 if (forced_trials.find(kExperimentName) != std::string::npos) { |
61 // We don't want to allow turning off enforcement by forcing the field | 62 // We don't want to allow turning off enforcement by forcing the field |
62 // trial group to something other than enforcement. | 63 // trial group to something other than enforcement. |
63 return ENFORCE_STRICT; | 64 return ENFORCE_STRICT; |
64 } | 65 } |
65 | 66 |
66 VerifyStatus default_status = NONE; | 67 VerifyStatus default_status = NONE; |
67 | 68 |
68 if (group == "EnforceStrict") | 69 if (group == "EnforceStrict") |
69 return ENFORCE_STRICT; | 70 return ENFORCE_STRICT; |
70 else if (group == "Enforce") | 71 else if (group == "Enforce") |
71 return ENFORCE; | 72 return ENFORCE; |
72 else if (group == "Bootstrap") | 73 else if (group == "Bootstrap") |
73 return BOOTSTRAP; | 74 return BOOTSTRAP; |
74 else if (group == "None" || group == "Control") | 75 else if (group == "None" || group == "Control") |
75 return NONE; | 76 return NONE; |
76 else | 77 else |
77 return default_status; | 78 return default_status; |
78 #endif // defined(GOOGLE_CHROME_BUILD) | 79 #endif // defined(GOOGLE_CHROME_BUILD) |
79 | 80 |
80 return NONE; | 81 return NONE; |
81 } | 82 } |
82 | 83 |
83 VerifyStatus GetCommandLineStatus() { | 84 VerifyStatus GetCommandLineStatus() { |
84 const CommandLine* cmdline = CommandLine::ForCurrentProcess(); | 85 const base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); |
85 if (!InstallSigner::GetForcedNotFromWebstore().empty()) | 86 if (!InstallSigner::GetForcedNotFromWebstore().empty()) |
86 return ENFORCE; | 87 return ENFORCE; |
87 | 88 |
88 if (cmdline->HasSwitch(switches::kExtensionsInstallVerification)) { | 89 if (cmdline->HasSwitch(switches::kExtensionsInstallVerification)) { |
89 std::string value = cmdline->GetSwitchValueASCII( | 90 std::string value = cmdline->GetSwitchValueASCII( |
90 switches::kExtensionsInstallVerification); | 91 switches::kExtensionsInstallVerification); |
91 if (value == "bootstrap") | 92 if (value == "bootstrap") |
92 return BOOTSTRAP; | 93 return BOOTSTRAP; |
93 else if (value == "enforce_strict") | 94 else if (value == "enforce_strict") |
94 return ENFORCE_STRICT; | 95 return ENFORCE_STRICT; |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 } | 630 } |
630 | 631 |
631 OnVerificationComplete(success, operation->type); | 632 OnVerificationComplete(success, operation->type); |
632 } | 633 } |
633 | 634 |
634 if (!operation_queue_.empty()) | 635 if (!operation_queue_.empty()) |
635 BeginFetch(); | 636 BeginFetch(); |
636 } | 637 } |
637 | 638 |
638 } // namespace extensions | 639 } // namespace extensions |
OLD | NEW |