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

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

Issue 384423002: [Canceled] Extensions: Add install_flags parameter to ManagementPolicy::UserMayLoad (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update tests Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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/installed_loader.h" 5 #include "chrome/browser/extensions/installed_loader.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 extension = NULL; 167 extension = NULL;
168 } 168 }
169 169
170 // Check policy on every load in case an extension was blacklisted while 170 // Check policy on every load in case an extension was blacklisted while
171 // Chrome was not running. 171 // Chrome was not running.
172 const ManagementPolicy* policy = extensions::ExtensionSystem::Get( 172 const ManagementPolicy* policy = extensions::ExtensionSystem::Get(
173 extension_service_->profile())->management_policy(); 173 extension_service_->profile())->management_policy();
174 if (extension.get()) { 174 if (extension.get()) {
175 Extension::DisableReason disable_reason = Extension::DISABLE_NONE; 175 Extension::DisableReason disable_reason = Extension::DISABLE_NONE;
176 bool force_disabled = false; 176 bool force_disabled = false;
177 if (!policy->UserMayLoad(extension.get(), NULL)) { 177 int install_flags = extension_prefs_->GetInstallFlags(extension->id());
178 if (!policy->UserMayLoad(extension.get(), install_flags, NULL)) {
178 // The error message from UserMayInstall() often contains the extension ID 179 // The error message from UserMayInstall() often contains the extension ID
179 // and is therefore not well suited to this UI. 180 // and is therefore not well suited to this UI.
180 error = errors::kDisabledByPolicy; 181 error = errors::kDisabledByPolicy;
181 extension = NULL; 182 extension = NULL;
182 } else if (!extension_prefs_->IsExtensionDisabled(extension->id()) && 183 } else if (!extension_prefs_->IsExtensionDisabled(extension->id()) &&
183 policy->MustRemainDisabled(extension, &disable_reason, NULL)) { 184 policy->MustRemainDisabled(extension, &disable_reason, NULL)) {
184 extension_prefs_->SetExtensionState(extension->id(), Extension::DISABLED); 185 extension_prefs_->SetExtensionState(extension->id(), Extension::DISABLED);
185 extension_prefs_->AddDisableReason(extension->id(), disable_reason); 186 extension_prefs_->AddDisableReason(extension->id(), disable_reason);
186 force_disabled = true; 187 force_disabled = true;
187 } 188 }
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { 548 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) {
548 int flags = extension_prefs_->GetCreationFlags(info->extension_id); 549 int flags = extension_prefs_->GetCreationFlags(info->extension_id);
549 if (!Manifest::IsUnpackedLocation(info->extension_location)) 550 if (!Manifest::IsUnpackedLocation(info->extension_location))
550 flags |= Extension::REQUIRE_KEY; 551 flags |= Extension::REQUIRE_KEY;
551 if (extension_prefs_->AllowFileAccess(info->extension_id)) 552 if (extension_prefs_->AllowFileAccess(info->extension_id))
552 flags |= Extension::ALLOW_FILE_ACCESS; 553 flags |= Extension::ALLOW_FILE_ACCESS;
553 return flags; 554 return flags;
554 } 555 }
555 556
556 } // namespace extensions 557 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/standard_management_policy_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698