Add a webstorePrivate API to show a permission prompt for delegated bundle installs
[chromium-blink-merge.git] / chrome / browser / extensions / external_policy_loader.cc
blob5a401d5794405eaa30eb39595487e713c61ac024
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/extensions/external_policy_loader.h"
7 #include "base/logging.h"
8 #include "base/strings/stringprintf.h"
9 #include "base/values.h"
10 #include "chrome/browser/extensions/external_provider_impl.h"
12 namespace extensions {
14 ExternalPolicyLoader::ExternalPolicyLoader(ExtensionManagement* settings,
15 InstallationType type)
16 : settings_(settings), type_(type) {
17 settings_->AddObserver(this);
20 ExternalPolicyLoader::~ExternalPolicyLoader() {
21 settings_->RemoveObserver(this);
24 void ExternalPolicyLoader::OnExtensionManagementSettingsChanged() {
25 StartLoading();
28 // static
29 void ExternalPolicyLoader::AddExtension(base::DictionaryValue* dict,
30 const std::string& extension_id,
31 const std::string& update_url) {
32 dict->SetString(base::StringPrintf("%s.%s", extension_id.c_str(),
33 ExternalProviderImpl::kExternalUpdateUrl),
34 update_url);
37 void ExternalPolicyLoader::StartLoading() {
38 switch (type_) {
39 case FORCED:
40 prefs_ = settings_->GetForceInstallList();
41 break;
42 case RECOMMENDED:
43 prefs_ = settings_->GetRecommendedInstallList();
44 break;
46 LoadFinished();
49 } // namespace extensions