1// Copyright 2014 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_UPDATER_CHROME_EXTENSION_DOWNLOADER_FACTORY_H_
6#define CHROME_BROWSER_EXTENSIONS_UPDATER_CHROME_EXTENSION_DOWNLOADER_FACTORY_H_
7
8#include "base/memory/scoped_ptr.h"
9
10class Profile;
11
12namespace extensions {
13class ExtensionDownloader;
14class ExtensionDownloaderDelegate;
15}
16
17namespace net {
18class URLRequestContextGetter;
19}
20
21// This provides a simple static interface for constructing an
22// ExtensionDownloader suitable for use from within Chrome.
23class ChromeExtensionDownloaderFactory {
24 public:
25  // Creates a downloader with the given request context. No profile identity
26  // is associated with this downloader.
27  static scoped_ptr<extensions::ExtensionDownloader> CreateForRequestContext(
28      net::URLRequestContextGetter* request_context,
29      extensions::ExtensionDownloaderDelegate* delegate);
30
31  // Creates a downloader for a given Profile. This downloader will be able
32  // to authenticate as the signed-in user in the event that it's asked to
33  // fetch a protected download.
34  static scoped_ptr<extensions::ExtensionDownloader> CreateForProfile(
35      Profile* profile,
36      extensions::ExtensionDownloaderDelegate* delegate);
37};
38
39#endif  // CHROME_BROWSER_EXTENSIONS_UPDATER_CHROME_EXTENSION_DOWNLOADER_FACTORY_H_
40