blob: 43de912e1b9db1d5b53d3311fcbc7e6469031f8e [file] [log] [blame]
[email protected]bf2fcd52012-04-16 22:59:391// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]7054b592011-06-22 14:46:422// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4//
5// Download code which handles CRX files (extensions, themes, apps, ...).
6
7#ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CRX_UTIL_H_
8#define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CRX_UTIL_H_
9
10#pragma once
11
12#include "base/basictypes.h"
[email protected]bf2fcd52012-04-16 22:59:3913#include "base/memory/ref_counted.h"
[email protected]7054b592011-06-22 14:46:4214
15class CrxInstaller;
[email protected]7054b592011-06-22 14:46:4216class ExtensionInstallUI;
17class Profile;
18
[email protected]e582fdd2011-12-20 16:48:1719namespace content {
20class DownloadItem;
21}
22
[email protected]7054b592011-06-22 14:46:4223namespace download_crx_util {
24
25// Allow tests to install a mock extension install UI object, to fake
26// user clicks on the permissions dialog. Each installed mock object
27// is only used once. If you want to return a mock for two different
28// installs, you need to call this function once before the first
29// install, and again after the first install and before the second.
30void SetMockInstallUIForTesting(ExtensionInstallUI* mock_ui);
31
[email protected]adcf0f02012-05-02 20:24:5032// Returns true if the specified download_item containing an extension should be
33// automatically installed. This is typically true in the case of webstore
34// installations.
35bool ShouldOpenExtensionDownload(const content::DownloadItem& download_item);
36
[email protected]7054b592011-06-22 14:46:4237// Start installing a downloaded item item as a CRX (extension, theme, app,
38// ...). The installer does work on the file thread, so the installation
39// is not complete when this function returns. Returns the object managing
40// the installation.
41scoped_refptr<CrxInstaller> OpenChromeExtension(
42 Profile* profile,
[email protected]e582fdd2011-12-20 16:48:1743 const content::DownloadItem& download_item);
[email protected]7054b592011-06-22 14:46:4244
45} // namespace download_crx_util
46
47#endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CRX_UTIL_H_