Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / extensions / extension_installer.h
blobe72e01b13fa9ebe9af983e44a622246419d8e71f
1 // Copyright 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALLER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALLER_H_
8 #include <string>
9 #include <vector>
11 #include "base/memory/weak_ptr.h"
12 #include "base/strings/string16.h"
13 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/extensions/requirements_checker.h"
15 #include "extensions/common/extension.h"
17 class Profile;
19 namespace content {
20 class WebContents;
23 namespace extensions {
26 // Holds common methods and data of extension installers.
27 class ExtensionInstaller {
28 public:
29 typedef base::Callback<void(std::vector<std::string>)> RequirementsCallback;
31 explicit ExtensionInstaller(Profile* profile);
32 ~ExtensionInstaller();
34 // Called on the UI thread to start the requirements check on the extension
35 void CheckRequirements(const RequirementsCallback& callback);
37 // Checks the management policy if the extension can be installed.
38 base::string16 CheckManagementPolicy();
40 Profile* profile() const {
41 return profile_;
44 void set_extension(const Extension* extension) {
45 extension_ = extension;
48 scoped_refptr<const Extension> extension() {
49 return extension_;
52 private:
53 scoped_ptr<RequirementsChecker> requirements_checker_;
55 // The Profile where the extension is being installed in.
56 Profile* profile_;
58 // The extension we're installing. We either pass it off to ExtensionService
59 // on success, or drop the reference on failure.
60 scoped_refptr<const Extension> extension_;
62 base::WeakPtrFactory<ExtensionInstaller> weak_ptr_factory_;
64 DISALLOW_COPY_AND_ASSIGN(ExtensionInstaller);
67 } // namespace extensions
69 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALLER_H_