summaryrefslogtreecommitdiffstats
path: root/content/public/browser/resource_context.h
blob: ba713f60f18879cea685d26be77885d86956f03a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright (c) 2012 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 CONTENT_PUBLIC_BROWSER_RESOURCE_CONTEXT_H_
#define CONTENT_PUBLIC_BROWSER_RESOURCE_CONTEXT_H_

#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/supports_user_data.h"
#include "build/build_config.h"
#include "content/common/content_export.h"

class GURL;

namespace appcache {
class AppCacheService;
}

namespace net {
class ClientCertStore;
class HostResolver;
class URLRequestContext;
}

namespace content {

// ResourceContext contains the relevant context information required for
// resource loading. It lives on the IO thread, although it is constructed on
// the UI thread. It must be destructed on the IO thread.
class CONTENT_EXPORT ResourceContext : public base::SupportsUserData {
 public:
#if defined(OS_IOS)
  virtual ~ResourceContext() {}
#else
  ResourceContext();
  virtual ~ResourceContext();
#endif
  virtual net::HostResolver* GetHostResolver() = 0;

  // DEPRECATED: This is no longer a valid given isolated apps/sites and
  // storage partitioning. This getter returns the default context associated
  // with a BrowsingContext.
  virtual net::URLRequestContext* GetRequestContext() = 0;

  // Get platform ClientCertStore. May return NULL.
  virtual scoped_ptr<net::ClientCertStore> CreateClientCertStore();

  // Returns true if microphone access is allowed for |origin|. Used to
  // determine what level of authorization is given to |origin| to access
  // resource metadata.
  virtual bool AllowMicAccess(const GURL& origin) = 0;

  // Returns true if web camera access is allowed for |origin|. Used to
  // determine what level of authorization is given to |origin| to access
  // resource metadata.
  virtual bool AllowCameraAccess(const GURL& origin) = 0;

  // Returns a random salt string that is used for creating media device IDs.
  // The salt should be stored in the current user profile and should be reset
  // if cookies are cleared. Returns an empty string per default.
  // TODO(perkj): Make this method pure virtual when crbug/315022 is fixed.
  virtual std::string GetMediaDeviceIDSalt();
};

}  // namespace content

#endif  // CONTENT_PUBLIC_BROWSER_RESOURCE_CONTEXT_H_