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

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: rebase, more fix Created 6 years, 2 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 <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 return default_settings_->installation_mode == INSTALLATION_BLOCKED; 71 return default_settings_->installation_mode == INSTALLATION_BLOCKED;
72 } 72 }
73 73
74 ExtensionManagement::InstallationMode ExtensionManagement::GetInstallationMode( 74 ExtensionManagement::InstallationMode ExtensionManagement::GetInstallationMode(
75 const ExtensionId& id) const { 75 const ExtensionId& id) const {
76 return ReadById(id)->installation_mode; 76 return ReadById(id)->installation_mode;
77 } 77 }
78 78
79 scoped_ptr<base::DictionaryValue> ExtensionManagement::GetForceInstallList() 79 scoped_ptr<base::DictionaryValue> ExtensionManagement::GetForceInstallList()
80 const { 80 const {
81 scoped_ptr<base::DictionaryValue> forcelist(new base::DictionaryValue()); 81 scoped_ptr<base::DictionaryValue> install_list(new base::DictionaryValue());
82 for (SettingsIdMap::const_iterator it = settings_by_id_.begin(); 82 for (SettingsIdMap::const_iterator it = settings_by_id_.begin();
83 it != settings_by_id_.end(); 83 it != settings_by_id_.end();
84 ++it) { 84 ++it) {
85 if (it->second->installation_mode == INSTALLATION_FORCED) { 85 if (it->second->installation_mode == INSTALLATION_FORCED) {
86 ExternalPolicyLoader::AddExtension( 86 ExternalPolicyLoader::AddExtension(
87 forcelist.get(), it->first, it->second->update_url); 87 install_list.get(), it->first, it->second->update_url);
88 } 88 }
89 } 89 }
90 return forcelist.Pass(); 90 return install_list.Pass();
91 }
92
93 scoped_ptr<base::DictionaryValue>
94 ExtensionManagement::GetRecommendedInstallList() const {
95 scoped_ptr<base::DictionaryValue> install_list(new base::DictionaryValue());
96 for (SettingsIdMap::const_iterator it = settings_by_id_.begin();
97 it != settings_by_id_.end();
98 ++it) {
99 if (it->second->installation_mode == INSTALLATION_RECOMMENDED) {
100 ExternalPolicyLoader::AddExtension(
101 install_list.get(), it->first, it->second->update_url);
102 }
103 }
104 return install_list.Pass();
91 } 105 }
92 106
93 bool ExtensionManagement::IsInstallationAllowed(const ExtensionId& id) const { 107 bool ExtensionManagement::IsInstallationAllowed(const ExtensionId& id) const {
94 return ReadById(id)->installation_mode != INSTALLATION_BLOCKED; 108 return ReadById(id)->installation_mode != INSTALLATION_BLOCKED;
95 } 109 }
96 110
97 bool ExtensionManagement::IsOffstoreInstallAllowed( 111 bool ExtensionManagement::IsOffstoreInstallAllowed(
98 const GURL& url, 112 const GURL& url,
99 const GURL& referrer_url) const { 113 const GURL& referrer_url) const {
100 // No allowed install sites specified, disallow by default. 114 // No allowed install sites specified, disallow by default.
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 } 370 }
357 371
358 void ExtensionManagementFactory::RegisterProfilePrefs( 372 void ExtensionManagementFactory::RegisterProfilePrefs(
359 user_prefs::PrefRegistrySyncable* user_prefs) { 373 user_prefs::PrefRegistrySyncable* user_prefs) {
360 user_prefs->RegisterDictionaryPref( 374 user_prefs->RegisterDictionaryPref(
361 pref_names::kExtensionManagement, 375 pref_names::kExtensionManagement,
362 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 376 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
363 } 377 }
364 378
365 } // namespace extensions 379 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_management.h ('k') | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698