| Index: chrome/browser/extensions/unpacked_installer.h
|
| diff --git a/chrome/browser/extensions/unpacked_installer.h b/chrome/browser/extensions/unpacked_installer.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2b3523e3cccc0b483b65a5152680c595ca07e961
|
| --- /dev/null
|
| +++ b/chrome/browser/extensions/unpacked_installer.h
|
| @@ -0,0 +1,77 @@
|
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_EXTENSIONS_UNPACKED_INSTALLER_H_
|
| +#define CHROME_BROWSER_EXTENSIONS_UNPACKED_INSTALLER_H_
|
| +#pragma once
|
| +
|
| +#include <string>
|
| +
|
| +#include "base/memory/ref_counted.h"
|
| +#include "base/memory/weak_ptr.h"
|
| +
|
| +class Extension;
|
| +class ExtensionService;
|
| +class FilePath;
|
| +
|
| +namespace extensions {
|
| +
|
| +// Installs and loads an unpacked extension.
|
| +// TODO(erikkay): It might be useful to be able to load a packed extension
|
| +// (presumably into memory) without installing it.
|
| +class UnpackedInstaller
|
| + : public base::RefCountedThreadSafe<UnpackedInstaller> {
|
| + public:
|
| + explicit UnpackedInstaller(base::WeakPtr<ExtensionService> extension_service);
|
| +
|
| + // Loads the extension from the directory |extension_path|.
|
| + void Load(const FilePath& extension_path);
|
| +
|
| + // Loads the extension from the directory |extension_path|;
|
| + // for use with command line switch --load-extension=path.
|
| + // This is equivalent to Load, except that it runs synchronously.
|
| + void LoadFromCommandLine(const FilePath& extension_path);
|
| +
|
| + // Allows prompting for plugins to be disabled; intended for testing only.
|
| + bool prompt_for_plugins() { return prompt_for_plugins_; }
|
| + void set_prompt_for_plugins(bool val) { prompt_for_plugins_ = val; }
|
| +
|
| + private:
|
| + friend class base::RefCountedThreadSafe<UnpackedInstaller>;
|
| +
|
| + virtual ~UnpackedInstaller();
|
| +
|
| + // Loads a single extension from |path| where |path| is the top directory of
|
| + // a specific extension where its manifest file lives.
|
| + // Errors are reported through ExtensionErrorReporter. On success,
|
| + // ExtensionService::AddExtension() is called.
|
| + void LoadSingleExtension(const FilePath &extension_path);
|
| +
|
| + // LoadSingleExtension needs to check the file access preference, which needs
|
| + // to happen back on the UI thread, so it posts CheckExtensionFileAccess on
|
| + // the UI thread. In turn, once that gets the pref, it goes back to the
|
| + // file thread with LoadSingleExtensionWithFileAccess.
|
| + void CheckExtensionFileAccess(const FilePath& extension_path);
|
| + void LoadSingleExtensionWithFileAccess(
|
| + const FilePath &path, bool allow_file_access);
|
| +
|
| + // Notify the frontend that there was an error loading an extension.
|
| + void ReportExtensionLoadError(const FilePath& extension_path,
|
| + const std::string& error);
|
| +
|
| + // Called when an unpacked extension has been loaded and installed.
|
| + void OnLoadSingleExtension(const scoped_refptr<const Extension>& extension);
|
| +
|
| + base::WeakPtr<ExtensionService> service_weak_;
|
| +
|
| + // If true and the extension contains plugins, we prompt the user before
|
| + // loading.
|
| + bool prompt_for_plugins_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(UnpackedInstaller);
|
| +};
|
| +
|
| +} // namespace extensions
|
| +
|
| +#endif // CHROME_BROWSER_EXTENSIONS_UNPACKED_INSTALLER_H_
|
|
|