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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 } | 102 } |
103 | 103 |
104 VerifyStatus GetStatus() { | 104 VerifyStatus GetStatus() { |
105 return std::max(GetExperimentStatus(), GetCommandLineStatus()); | 105 return std::max(GetExperimentStatus(), GetCommandLineStatus()); |
106 } | 106 } |
107 | 107 |
108 bool ShouldFetchSignature() { | 108 bool ShouldFetchSignature() { |
109 return GetStatus() >= BOOTSTRAP; | 109 return GetStatus() >= BOOTSTRAP; |
110 } | 110 } |
111 | 111 |
112 bool ShouldEnforce() { | |
113 return GetStatus() >= ENFORCE; | |
114 } | |
115 | |
116 enum InitResult { | 112 enum InitResult { |
117 INIT_NO_PREF = 0, | 113 INIT_NO_PREF = 0, |
118 INIT_UNPARSEABLE_PREF, | 114 INIT_UNPARSEABLE_PREF, |
119 INIT_INVALID_SIGNATURE, | 115 INIT_INVALID_SIGNATURE, |
120 INIT_VALID_SIGNATURE, | 116 INIT_VALID_SIGNATURE, |
121 | 117 |
122 // This is used in histograms - do not remove or reorder entries above! Also | 118 // This is used in histograms - do not remove or reorder entries above! Also |
123 // the "MAX" item below should always be the last element. | 119 // the "MAX" item below should always be the last element. |
124 | 120 |
125 INIT_RESULT_MAX | 121 INIT_RESULT_MAX |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 content::BrowserContext* context) | 173 content::BrowserContext* context) |
178 : prefs_(prefs), | 174 : prefs_(prefs), |
179 context_(context), | 175 context_(context), |
180 bootstrap_check_complete_(false), | 176 bootstrap_check_complete_(false), |
181 weak_factory_(this) { | 177 weak_factory_(this) { |
182 } | 178 } |
183 | 179 |
184 InstallVerifier::~InstallVerifier() {} | 180 InstallVerifier::~InstallVerifier() {} |
185 | 181 |
186 // static | 182 // static |
| 183 bool InstallVerifier::ShouldEnforce() { |
| 184 return GetStatus() >= ENFORCE; |
| 185 } |
| 186 |
| 187 // static |
187 bool InstallVerifier::NeedsVerification(const Extension& extension) { | 188 bool InstallVerifier::NeedsVerification(const Extension& extension) { |
188 return IsFromStore(extension) && CanUseExtensionApis(extension); | 189 return IsFromStore(extension) && CanUseExtensionApis(extension); |
189 } | 190 } |
190 | 191 |
191 | 192 |
192 | 193 |
193 // static | 194 // static |
194 bool InstallVerifier::IsFromStore(const Extension& extension) { | 195 bool InstallVerifier::IsFromStore(const Extension& extension) { |
195 if (extension.from_webstore() || ManifestURL::UpdatesFromGallery(&extension)) | 196 if (extension.from_webstore() || ManifestURL::UpdatesFromGallery(&extension)) |
196 return true; | 197 return true; |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 } | 633 } |
633 | 634 |
634 OnVerificationComplete(success, operation->type); | 635 OnVerificationComplete(success, operation->type); |
635 } | 636 } |
636 | 637 |
637 if (!operation_queue_.empty()) | 638 if (!operation_queue_.empty()) |
638 BeginFetch(); | 639 BeginFetch(); |
639 } | 640 } |
640 | 641 |
641 } // namespace extensions | 642 } // namespace extensions |
OLD | NEW |