Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / extensions / extension_installer.cc
blob5ba862047d0521cf719d8d534fb98776e1e189ef
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
3 // found in the LICENSE file.
5 #include "chrome/browser/extensions/extension_installer.h"
7 #include "base/bind.h"
8 #include "chrome/browser/extensions/extension_system.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "content/public/browser/browser_thread.h"
11 #include "extensions/browser/management_policy.h"
13 namespace extensions {
15 ExtensionInstaller::ExtensionInstaller(Profile* profile)
16 : requirements_checker_(new RequirementsChecker()),
17 profile_(profile),
18 weak_ptr_factory_(this) {
21 ExtensionInstaller::~ExtensionInstaller() {
24 void ExtensionInstaller::CheckRequirements(
25 const RequirementsCallback& callback) {
26 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
27 requirements_checker_->Check(extension_, callback);
30 base::string16 ExtensionInstaller::CheckManagementPolicy() {
31 base::string16 error;
32 bool allowed = ExtensionSystem::Get(profile_)->management_policy()
33 ->UserMayLoad(extension_.get(), &error);
34 DCHECK(allowed || !error.empty());
35 return error;
38 } // namespace extensions