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

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: Fix the bug of delegated installs for pre-existing extensions 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 = false;
262 if (prefs->HasIsInstalledByCustodianSetting(id))
263 installed_by_custodian = prefs->IsInstalledByCustodian(id);
Marc Treib 2016/06/13 09:37:14 If this is unset, it should default to false anywa
mamir 2016/06/13 11:30:17 Done.
264
261 int result = Extension::FOLLOW_SYMLINKS_ANYWHERE; 265 int result = Extension::FOLLOW_SYMLINKS_ANYWHERE;
262 if (allow_file_access) 266 if (allow_file_access)
263 result |= Extension::ALLOW_FILE_ACCESS; 267 result |= Extension::ALLOW_FILE_ACCESS;
268 if (installed_by_custodian)
269 result |= Extension::WAS_INSTALLED_BY_CUSTODIAN;
264 if (require_modern_manifest_version_) 270 if (require_modern_manifest_version_)
265 result |= Extension::REQUIRE_MODERN_MANIFEST_VERSION; 271 result |= Extension::REQUIRE_MODERN_MANIFEST_VERSION;
266 272
267 return result; 273 return result;
268 } 274 }
269 275
270 bool UnpackedInstaller::IsLoadingUnpackedAllowed() const { 276 bool UnpackedInstaller::IsLoadingUnpackedAllowed() const {
271 if (!service_weak_.get()) 277 if (!service_weak_.get())
272 return true; 278 return true;
273 // If there is a "*" in the extension blacklist, then no extensions should be 279 // 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( 367 service_weak_->OnExtensionInstalled(
362 extension(), syncer::StringOrdinal(), kInstallFlagInstallImmediately); 368 extension(), syncer::StringOrdinal(), kInstallFlagInstallImmediately);
363 369
364 if (!callback_.is_null()) { 370 if (!callback_.is_null()) {
365 callback_.Run(extension(), extension_path_, std::string()); 371 callback_.Run(extension(), extension_path_, std::string());
366 callback_.Reset(); 372 callback_.Reset();
367 } 373 }
368 } 374 }
369 375
370 } // namespace extensions 376 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698