resource_context.h revision a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7
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/memory/scoped_ptr.h" 10#include "base/supports_user_data.h" 11#include "build/build_config.h" 12#include "content/common/content_export.h" 13 14class GURL; 15 16namespace appcache { 17class AppCacheService; 18} 19 20namespace net { 21class ClientCertStore; 22class HostResolver; 23class URLRequestContext; 24} 25 26namespace content { 27 28// ResourceContext contains the relevant context information required for 29// resource loading. It lives on the IO thread, although it is constructed on 30// the UI thread. It must be destructed on the IO thread. 31class CONTENT_EXPORT ResourceContext : public base::SupportsUserData { 32 public: 33#if defined(OS_IOS) 34 virtual ~ResourceContext() {} 35#else 36 ResourceContext(); 37 virtual ~ResourceContext(); 38#endif 39 virtual net::HostResolver* GetHostResolver() = 0; 40 41 // DEPRECATED: This is no longer a valid given isolated apps/sites and 42 // storage partitioning. This getter returns the default context associated 43 // with a BrowsingContext. 44 virtual net::URLRequestContext* GetRequestContext() = 0; 45 46 // Get platform ClientCertStore. May return NULL. 47 virtual scoped_ptr<net::ClientCertStore> CreateClientCertStore(); 48 49 // Returns true if microphone 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 AllowMicAccess(const GURL& origin) = 0; 53 54 // Returns true if web camera access is allowed for |origin|. Used to 55 // determine what level of authorization is given to |origin| to access 56 // resource metadata. 57 virtual bool AllowCameraAccess(const GURL& origin) = 0; 58 59 // Returns a random salt string that is used for creating media device IDs. 60 // The salt should be stored in the current user profile and should be reset 61 // if cookies are cleared. Returns an empty string per default. 62 // TODO(perkj): Make this method pure virtual when crbug/315022 is fixed. 63 virtual std::string GetMediaDeviceIDSalt(); 64}; 65 66} // namespace content 67 68#endif // CONTENT_PUBLIC_BROWSER_RESOURCE_CONTEXT_H_ 69