| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALLER_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALLER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 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" | |
| 16 | |
| 17 class Profile; | |
| 18 | |
| 19 namespace content { | |
| 20 class WebContents; | |
| 21 } | |
| 22 | |
| 23 namespace extensions { | |
| 24 | |
| 25 | |
| 26 // Holds common methods and data of extension installers. | |
| 27 // | |
| 28 // NOTE: This class is deprecated and has been replaced by | |
| 29 // ExtensionInstallChecker. | |
| 30 // TODO(tmdiep): CrxInstaller and UnpackedInstaller should be refactored to use | |
| 31 // this class (crbug.com/386404). | |
| 32 class ExtensionInstaller { | |
| 33 public: | |
| 34 typedef base::Callback<void(std::vector<std::string>)> RequirementsCallback; | |
| 35 | |
| 36 explicit ExtensionInstaller(Profile* profile); | |
| 37 ~ExtensionInstaller(); | |
| 38 | |
| 39 // Called on the UI thread to start the requirements check on the extension | |
| 40 void CheckRequirements(const RequirementsCallback& callback); | |
| 41 | |
| 42 // Checks the management policy if the extension can be installed. | |
| 43 base::string16 CheckManagementPolicy(); | |
| 44 | |
| 45 Profile* profile() const { | |
| 46 return profile_; | |
| 47 } | |
| 48 | |
| 49 void set_extension(const Extension* extension) { | |
| 50 extension_ = extension; | |
| 51 } | |
| 52 | |
| 53 scoped_refptr<const Extension> extension() { | |
| 54 return extension_; | |
| 55 } | |
| 56 | |
| 57 private: | |
| 58 scoped_ptr<RequirementsChecker> requirements_checker_; | |
| 59 | |
| 60 // The Profile where the extension is being installed in. | |
| 61 Profile* profile_; | |
| 62 | |
| 63 // The extension we're installing. We either pass it off to ExtensionService | |
| 64 // on success, or drop the reference on failure. | |
| 65 scoped_refptr<const Extension> extension_; | |
| 66 | |
| 67 base::WeakPtrFactory<ExtensionInstaller> weak_ptr_factory_; | |
| 68 | |
| 69 DISALLOW_COPY_AND_ASSIGN(ExtensionInstaller); | |
| 70 }; | |
| 71 | |
| 72 } // namespace extensions | |
| 73 | |
| 74 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALLER_H_ | |
| OLD | NEW |