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

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

Issue 536753003: Add recommended extension installation support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ext-3
Patch Set: add ui changes 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"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 } 156 }
157 157
158 ManagementPolicy::Provider* ExtensionManagement::GetProvider() { 158 ManagementPolicy::Provider* ExtensionManagement::GetProvider() {
159 return provider_.get(); 159 return provider_.get();
160 } 160 }
161 161
162 bool ExtensionManagement::BlacklistedByDefault() { 162 bool ExtensionManagement::BlacklistedByDefault() {
163 return default_settings_.installation_mode == INSTALLATION_BLOCKED; 163 return default_settings_.installation_mode == INSTALLATION_BLOCKED;
164 } 164 }
165 165
166 scoped_ptr<base::DictionaryValue> ExtensionManagement::GetForceInstallList() 166 scoped_ptr<base::DictionaryValue> ExtensionManagement::GetAutoInstallList(
167 const { 167 bool forced) const {
168 scoped_ptr<base::DictionaryValue> forcelist(new base::DictionaryValue()); 168 scoped_ptr<base::DictionaryValue> install_list(new base::DictionaryValue());
169 for (SettingsIdMap::const_iterator it = settings_by_id_.begin(); 169 for (SettingsIdMap::const_iterator it = settings_by_id_.begin();
170 it != settings_by_id_.end(); 170 it != settings_by_id_.end();
171 ++it) { 171 ++it) {
172 if (it->second.installation_mode == INSTALLATION_FORCED) { 172 if (it->second.installation_mode ==
173 (forced ? INSTALLATION_FORCED : INSTALLATION_RECOMMENDED)) {
173 ExternalPolicyLoader::AddExtension( 174 ExternalPolicyLoader::AddExtension(
174 forcelist.get(), it->first, it->second.update_url); 175 install_list.get(), it->first, it->second.update_url);
175 } 176 }
176 } 177 }
177 return forcelist.Pass(); 178 return install_list.Pass();
178 } 179 }
179 180
180 bool ExtensionManagement::IsInstallationAllowed(const ExtensionId& id) const { 181 bool ExtensionManagement::IsInstallationAllowed(const ExtensionId& id) const {
181 return ReadById(id).installation_mode != INSTALLATION_BLOCKED; 182 return ReadById(id).installation_mode != INSTALLATION_BLOCKED;
182 } 183 }
183 184
184 bool ExtensionManagement::IsOffstoreInstallAllowed(const GURL& url, 185 bool ExtensionManagement::IsOffstoreInstallAllowed(const GURL& url,
185 const GURL& referrer_url) { 186 const GURL& referrer_url) {
186 // No allowed install sites specified, disallow by default. 187 // No allowed install sites specified, disallow by default.
187 if (!global_settings_.has_restricted_install_sources) 188 if (!global_settings_.has_restricted_install_sources)
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 return new ExtensionManagement( 430 return new ExtensionManagement(
430 Profile::FromBrowserContext(context)->GetPrefs()); 431 Profile::FromBrowserContext(context)->GetPrefs());
431 } 432 }
432 433
433 content::BrowserContext* ExtensionManagementFactory::GetBrowserContextToUse( 434 content::BrowserContext* ExtensionManagementFactory::GetBrowserContextToUse(
434 content::BrowserContext* context) const { 435 content::BrowserContext* context) const {
435 return chrome::GetBrowserContextRedirectedInIncognito(context); 436 return chrome::GetBrowserContextRedirectedInIncognito(context);
436 } 437 }
437 438
438 } // namespace extensions 439 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698