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

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

Issue 500043003: Add PolicyProvider to ExtensionManagement (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ext-1
Patch Set: rebase, format correction Created 6 years, 3 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"
11 #include "base/threading/thread_restrictions.h" 11 #include "base/threading/thread_restrictions.h"
12 #include "chrome/browser/extensions/extension_error_reporter.h" 12 #include "chrome/browser/extensions/extension_error_reporter.h"
13 #include "chrome/browser/extensions/extension_install_prompt.h" 13 #include "chrome/browser/extensions/extension_install_prompt.h"
14 #include "chrome/browser/extensions/extension_install_ui.h" 14 #include "chrome/browser/extensions/extension_install_ui.h"
15 #include "chrome/browser/extensions/extension_management.h"
15 #include "chrome/browser/extensions/extension_service.h" 16 #include "chrome/browser/extensions/extension_service.h"
16 #include "chrome/browser/extensions/permissions_updater.h" 17 #include "chrome/browser/extensions/permissions_updater.h"
17 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/common/extensions/api/plugins/plugins_handler.h" 19 #include "chrome/common/extensions/api/plugins/plugins_handler.h"
19 #include "components/crx_file/id_util.h" 20 #include "components/crx_file/id_util.h"
20 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
21 #include "extensions/browser/extension_prefs.h" 22 #include "extensions/browser/extension_prefs.h"
22 #include "extensions/browser/extension_registry.h" 23 #include "extensions/browser/extension_registry.h"
23 #include "extensions/browser/install_flag.h" 24 #include "extensions/browser/install_flag.h"
24 #include "extensions/common/extension.h" 25 #include "extensions/common/extension.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 result |= Extension::REQUIRE_MODERN_MANIFEST_VERSION; 225 result |= Extension::REQUIRE_MODERN_MANIFEST_VERSION;
225 226
226 return result; 227 return result;
227 } 228 }
228 229
229 bool UnpackedInstaller::IsLoadingUnpackedAllowed() const { 230 bool UnpackedInstaller::IsLoadingUnpackedAllowed() const {
230 if (!service_weak_.get()) 231 if (!service_weak_.get())
231 return true; 232 return true;
232 // If there is a "*" in the extension blacklist, then no extensions should be 233 // If there is a "*" in the extension blacklist, then no extensions should be
233 // allowed at all (except explicitly whitelisted extensions). 234 // allowed at all (except explicitly whitelisted extensions).
234 ExtensionPrefs* prefs = ExtensionPrefs::Get(service_weak_->profile()); 235 return !ExtensionManagementFactory::GetForBrowserContext(
235 return !prefs->ExtensionsBlacklistedByDefault(); 236 service_weak_->profile())->BlacklistedByDefault();
236 } 237 }
237 238
238 void UnpackedInstaller::GetAbsolutePath() { 239 void UnpackedInstaller::GetAbsolutePath() {
239 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 240 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
240 241
241 extension_path_ = base::MakeAbsoluteFilePath(extension_path_); 242 extension_path_ = base::MakeAbsoluteFilePath(extension_path_);
242 243
243 std::string error; 244 std::string error;
244 if (!file_util::CheckForIllegalFilenames(extension_path_, &error)) { 245 if (!file_util::CheckForIllegalFilenames(extension_path_, &error)) {
245 BrowserThread::PostTask( 246 BrowserThread::PostTask(
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 DCHECK_CURRENTLY_ON(BrowserThread::UI); 310 DCHECK_CURRENTLY_ON(BrowserThread::UI);
310 311
311 PermissionsUpdater perms_updater(service_weak_->profile()); 312 PermissionsUpdater perms_updater(service_weak_->profile());
312 perms_updater.GrantActivePermissions(extension()); 313 perms_updater.GrantActivePermissions(extension());
313 314
314 service_weak_->OnExtensionInstalled( 315 service_weak_->OnExtensionInstalled(
315 extension(), syncer::StringOrdinal(), kInstallFlagInstallImmediately); 316 extension(), syncer::StringOrdinal(), kInstallFlagInstallImmediately);
316 } 317 }
317 318
318 } // namespace extensions 319 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698