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

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

Issue 2054773002: Replace the WAS_INSTALLED_BY_CUSTODIAN creation flag with a pref (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Response to code review by treib@ Created 4 years, 6 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/unpacked_installer.h" 5 #include "chrome/browser/extensions/unpacked_installer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 } 251 }
252 252
253 int UnpackedInstaller::GetFlags() { 253 int UnpackedInstaller::GetFlags() {
254 std::string id = crx_file::id_util::GenerateIdForPath(extension_path_); 254 std::string id = crx_file::id_util::GenerateIdForPath(extension_path_);
255 bool allow_file_access = 255 bool allow_file_access =
256 Manifest::ShouldAlwaysAllowFileAccess(Manifest::UNPACKED); 256 Manifest::ShouldAlwaysAllowFileAccess(Manifest::UNPACKED);
257 ExtensionPrefs* prefs = ExtensionPrefs::Get(service_weak_->profile()); 257 ExtensionPrefs* prefs = ExtensionPrefs::Get(service_weak_->profile());
258 if (prefs->HasAllowFileAccessSetting(id)) 258 if (prefs->HasAllowFileAccessSetting(id))
259 allow_file_access = prefs->AllowFileAccess(id); 259 allow_file_access = prefs->AllowFileAccess(id);
260 260
261 bool installed_by_custodian = prefs->WasInstalledByCustodian(id);
262
261 int result = Extension::FOLLOW_SYMLINKS_ANYWHERE; 263 int result = Extension::FOLLOW_SYMLINKS_ANYWHERE;
262 if (allow_file_access) 264 if (allow_file_access)
263 result |= Extension::ALLOW_FILE_ACCESS; 265 result |= Extension::ALLOW_FILE_ACCESS;
266 if (installed_by_custodian)
267 result |= Extension::WAS_INSTALLED_BY_CUSTODIAN;
264 if (require_modern_manifest_version_) 268 if (require_modern_manifest_version_)
265 result |= Extension::REQUIRE_MODERN_MANIFEST_VERSION; 269 result |= Extension::REQUIRE_MODERN_MANIFEST_VERSION;
266 270
267 return result; 271 return result;
268 } 272 }
269 273
270 bool UnpackedInstaller::IsLoadingUnpackedAllowed() const { 274 bool UnpackedInstaller::IsLoadingUnpackedAllowed() const {
271 if (!service_weak_.get()) 275 if (!service_weak_.get())
272 return true; 276 return true;
273 // If there is a "*" in the extension blacklist, then no extensions should be 277 // If there is a "*" in the extension blacklist, then no extensions should be
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 service_weak_->OnExtensionInstalled( 365 service_weak_->OnExtensionInstalled(
362 extension(), syncer::StringOrdinal(), kInstallFlagInstallImmediately); 366 extension(), syncer::StringOrdinal(), kInstallFlagInstallImmediately);
363 367
364 if (!callback_.is_null()) { 368 if (!callback_.is_null()) {
365 callback_.Run(extension(), extension_path_, std::string()); 369 callback_.Run(extension(), extension_path_, std::string());
366 callback_.Reset(); 370 callback_.Reset();
367 } 371 }
368 } 372 }
369 373
370 } // namespace extensions 374 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698