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" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
16 #include "chrome/browser/extensions/extension_management.h" | |
16 #include "chrome/browser/extensions/extension_service.h" | 17 #include "chrome/browser/extensions/extension_service.h" |
17 #include "chrome/browser/extensions/install_signer.h" | 18 #include "chrome/browser/extensions/install_signer.h" |
18 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
19 #include "chrome/common/extensions/manifest_url_handler.h" | 20 #include "chrome/common/extensions/manifest_url_handler.h" |
20 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
21 #include "chrome/grit/generated_resources.h" | 22 #include "chrome/grit/generated_resources.h" |
22 #include "content/public/browser/browser_context.h" | 23 #include "content/public/browser/browser_context.h" |
23 #include "content/public/common/content_switches.h" | 24 #include "content/public/common/content_switches.h" |
24 #include "extensions/browser/extension_prefs.h" | 25 #include "extensions/browser/extension_prefs.h" |
25 #include "extensions/browser/extension_registry.h" | 26 #include "extensions/browser/extension_registry.h" |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
315 InstallVerifier::PendingOperation* operation = | 316 InstallVerifier::PendingOperation* operation = |
316 new InstallVerifier::PendingOperation(InstallVerifier::REMOVE); | 317 new InstallVerifier::PendingOperation(InstallVerifier::REMOVE); |
317 operation->ids = ids; | 318 operation->ids = ids; |
318 | 319 |
319 operation_queue_.push(linked_ptr<PendingOperation>(operation)); | 320 operation_queue_.push(linked_ptr<PendingOperation>(operation)); |
320 if (operation_queue_.size() == 1) | 321 if (operation_queue_.size() == 1) |
321 BeginFetch(); | 322 BeginFetch(); |
322 } | 323 } |
323 | 324 |
324 bool InstallVerifier::AllowedByEnterprisePolicy(const std::string& id) const { | 325 bool InstallVerifier::AllowedByEnterprisePolicy(const std::string& id) const { |
325 PrefService* pref_service = prefs_->pref_service(); | 326 return ExtensionManagementFactory::GetInstance() |
326 if (pref_service->IsManagedPreference(pref_names::kInstallAllowList)) { | 327 ->GetForBrowserContext(context_) |
Joao da Silva
2014/09/04 12:07:46
ExtensionManagementFactory::GetForBrowserContext
binjin
2014/09/04 14:27:06
Done.
| |
327 const base::ListValue* whitelist = | 328 ->IsInstallationAllowed(id); |
328 pref_service->GetList(pref_names::kInstallAllowList); | |
329 base::StringValue id_value(id); | |
330 if (whitelist && whitelist->Find(id_value) != whitelist->end()) | |
331 return true; | |
332 } | |
333 if (pref_service->IsManagedPreference(pref_names::kInstallForceList)) { | |
334 const base::DictionaryValue* forcelist = | |
335 pref_service->GetDictionary(pref_names::kInstallForceList); | |
336 if (forcelist && forcelist->HasKey(id)) | |
337 return true; | |
338 } | |
339 return false; | |
340 } | 329 } |
341 | 330 |
342 std::string InstallVerifier::GetDebugPolicyProviderName() const { | 331 std::string InstallVerifier::GetDebugPolicyProviderName() const { |
343 return std::string("InstallVerifier"); | 332 return std::string("InstallVerifier"); |
344 } | 333 } |
345 | 334 |
346 namespace { | 335 namespace { |
347 | 336 |
348 enum MustRemainDisabledOutcome { | 337 enum MustRemainDisabledOutcome { |
349 VERIFIED = 0, | 338 VERIFIED = 0, |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
642 } | 631 } |
643 | 632 |
644 OnVerificationComplete(success, operation->type); | 633 OnVerificationComplete(success, operation->type); |
645 } | 634 } |
646 | 635 |
647 if (!operation_queue_.empty()) | 636 if (!operation_queue_.empty()) |
648 BeginFetch(); | 637 BeginFetch(); |
649 } | 638 } |
650 | 639 |
651 } // namespace extensions | 640 } // namespace extensions |
OLD | NEW |