resource_context.h revision 3240926e260ce088908e02ac07a6cf7b0c0cbf44
1// Copyright (c) 2012 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 CONTENT_PUBLIC_BROWSER_RESOURCE_CONTEXT_H_
6#define CONTENT_PUBLIC_BROWSER_RESOURCE_CONTEXT_H_
7
8#include "base/basictypes.h"
9#include "base/supports_user_data.h"
10#include "build/build_config.h"
11#include "content/common/content_export.h"
12
13class GURL;
14
15namespace appcache {
16class AppCacheService;
17}
18
19namespace net {
20class HostResolver;
21class URLRequestContext;
22}
23
24namespace content {
25
26// ResourceContext contains the relevant context information required for
27// resource loading. It lives on the IO thread, although it is constructed on
28// the UI thread. It must be destructed on the IO thread.
29class CONTENT_EXPORT ResourceContext : public base::SupportsUserData {
30 public:
31#if defined(OS_IOS)
32  virtual ~ResourceContext() {}
33#else
34  ResourceContext();
35  virtual ~ResourceContext();
36#endif
37  virtual net::HostResolver* GetHostResolver() = 0;
38
39  // DEPRECATED: This is no longer a valid given isolated apps/sites and
40  // storage partitioning. This getter returns the default context associated
41  // with a BrowsingContext.
42  virtual net::URLRequestContext* GetRequestContext() = 0;
43
44  // Returns true if microphone access is allowed for |origin|. Used to
45  // determine what level of authorization is given to |origin| to access
46  // resource metadata.
47  virtual bool AllowMicAccess(const GURL& origin) = 0;
48
49  // Returns true if web camera access is allowed for |origin|. Used to
50  // determine what level of authorization is given to |origin| to access
51  // resource metadata.
52  virtual bool AllowCameraAccess(const GURL& origin) = 0;
53};
54
55}  // namespace content
56
57#endif  // CONTENT_PUBLIC_BROWSER_RESOURCE_CONTEXT_H_
58