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

Side by Side Diff: chrome/browser/extensions/standard_management_policy_provider.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/standard_management_policy_provider.h" 5 #include "chrome/browser/extensions/standard_management_policy_provider.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } 125 }
126 126
127 bool StandardManagementPolicyProvider::MustRemainEnabled( 127 bool StandardManagementPolicyProvider::MustRemainEnabled(
128 const Extension* extension, 128 const Extension* extension,
129 base::string16* error) const { 129 base::string16* error) const {
130 return !AdminPolicyIsModifiable(extension, error) || 130 return !AdminPolicyIsModifiable(extension, error) ||
131 (extension->location() == extensions::Manifest::EXTERNAL_COMPONENT && 131 (extension->location() == extensions::Manifest::EXTERNAL_COMPONENT &&
132 ExternalComponentLoader::IsModifiable(extension)); 132 ExternalComponentLoader::IsModifiable(extension));
133 } 133 }
134 134
135 bool StandardManagementPolicyProvider::MustRemainInstalled(
136 const Extension* extension,
137 base::string16* error) const {
138 ExtensionManagement::InstallationMode mode =
139 settings_->GetInstallationMode(extension->id());
140 // Disallow removing of recommended extension, to avoid re-install it
141 // again while policy is reload. But disabling of recommended extension is
142 // allowed.
143 if (mode == ExtensionManagement::INSTALLATION_FORCED ||
144 mode == ExtensionManagement::INSTALLATION_RECOMMENDED) {
145 if (error) {
146 *error = l10n_util::GetStringFUTF16(
147 IDS_EXTENSION_CANT_UNINSTALL_POLICY_REQUIRED,
148 base::UTF8ToUTF16(extension->name()));
149 }
150 return true;
151 }
152 return false;
153 }
154
135 } // namespace extensions 155 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/standard_management_policy_provider.h ('k') | chrome/browser/policy/policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698