Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Side by Side Diff: chrome/browser/extensions/extension_management.cc

Issue 536573003: Add ExtensionManagement based ExternalLoader (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ext-2
Patch Set: rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/extension_management.h" 5 #include "chrome/browser/extensions/extension_management.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "chrome/browser/extensions/external_policy_loader.h"
11 #include "chrome/browser/extensions/external_provider_impl.h" 12 #include "chrome/browser/extensions/external_provider_impl.h"
12 #include "chrome/browser/extensions/standard_management_policy_provider.h" 13 #include "chrome/browser/extensions/standard_management_policy_provider.h"
13 #include "chrome/browser/profiles/incognito_helpers.h" 14 #include "chrome/browser/profiles/incognito_helpers.h"
14 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
15 #include "components/crx_file/id_util.h" 16 #include "components/crx_file/id_util.h"
16 #include "components/keyed_service/content/browser_context_dependency_manager.h" 17 #include "components/keyed_service/content/browser_context_dependency_manager.h"
17 #include "extensions/browser/pref_names.h" 18 #include "extensions/browser/pref_names.h"
18 #include "extensions/common/url_pattern.h" 19 #include "extensions/common/url_pattern.h"
19 20
20 namespace extensions { 21 namespace extensions {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 69 }
69 70
70 ManagementPolicy::Provider* ExtensionManagement::GetProvider() { 71 ManagementPolicy::Provider* ExtensionManagement::GetProvider() {
71 return provider_.get(); 72 return provider_.get();
72 } 73 }
73 74
74 bool ExtensionManagement::BlacklistedByDefault() { 75 bool ExtensionManagement::BlacklistedByDefault() {
75 return default_settings_.installation_mode == INSTALLATION_BLOCKED; 76 return default_settings_.installation_mode == INSTALLATION_BLOCKED;
76 } 77 }
77 78
79 scoped_ptr<base::DictionaryValue> ExtensionManagement::GetForceInstallList()
80 const {
81 scoped_ptr<base::DictionaryValue> forcelist(new base::DictionaryValue());
82 for (SettingsIdMap::const_iterator it = settings_by_id_.begin();
83 it != settings_by_id_.end();
84 ++it) {
85 if (it->second.installation_mode == INSTALLATION_FORCED) {
86 ExternalPolicyLoader::AddExtension(
87 forcelist.get(), it->first, it->second.update_url);
88 }
89 }
90 return forcelist.Pass();
91 }
92
93 bool ExtensionManagement::IsInstallationAllowed(const ExtensionId& id) const {
94 return ReadById(id).installation_mode != INSTALLATION_BLOCKED;
95 }
96
78 const ExtensionManagement::IndividualSettings& ExtensionManagement::ReadById( 97 const ExtensionManagement::IndividualSettings& ExtensionManagement::ReadById(
79 const ExtensionId& id) const { 98 const ExtensionId& id) const {
80 DCHECK(crx_file::id_util::IdIsValid(id)) << "Invalid ID: " << id; 99 DCHECK(crx_file::id_util::IdIsValid(id)) << "Invalid ID: " << id;
81 SettingsIdMap::const_iterator it = settings_by_id_.find(id); 100 SettingsIdMap::const_iterator it = settings_by_id_.find(id);
82 if (it != settings_by_id_.end()) 101 if (it != settings_by_id_.end())
83 return it->second; 102 return it->second;
84 return default_settings_; 103 return default_settings_;
85 } 104 }
86 105
87 const ExtensionManagement::GlobalSettings& 106 const ExtensionManagement::GlobalSettings&
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 return new ExtensionManagement( 269 return new ExtensionManagement(
251 Profile::FromBrowserContext(context)->GetPrefs()); 270 Profile::FromBrowserContext(context)->GetPrefs());
252 } 271 }
253 272
254 content::BrowserContext* ExtensionManagementFactory::GetBrowserContextToUse( 273 content::BrowserContext* ExtensionManagementFactory::GetBrowserContextToUse(
255 content::BrowserContext* context) const { 274 content::BrowserContext* context) const {
256 return chrome::GetBrowserContextRedirectedInIncognito(context); 275 return chrome::GetBrowserContextRedirectedInIncognito(context);
257 } 276 }
258 277
259 } // namespace extensions 278 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_management.h ('k') | chrome/browser/extensions/external_policy_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698