summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/extensions/extension_resource_request_policy.h
blob: 329b5a0adb24ea361b82b76a9ff51c93694b2ede (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
// 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 CHROME_RENDERER_EXTENSIONS_EXTENSION_RESOURCE_REQUEST_POLICY_H_
#define CHROME_RENDERER_EXTENSIONS_EXTENSION_RESOURCE_REQUEST_POLICY_H_
#pragma once

class ExtensionSet;
class GURL;
namespace WebKit {
class WebFrame;
}

// Encapsulates the policy for when chrome-extension:// and
// chrome-extension-resource:// URLs can be requested.
class ExtensionResourceRequestPolicy {
 public:
  // Returns true if the chrome-extension:// |resource_url| can be requested
  // from |frame_url|.
  static bool CanRequestResource(const GURL& resource_url,
                                 WebKit::WebFrame* frame,
                                 const ExtensionSet* loaded_extensions);
  // Returns true if the chrome-extension-resource:// |resource_url| can be
  // requested from |frame_url|.
  static bool CanRequestExtensionResourceScheme(
      const GURL& resource_url,
      WebKit::WebFrame* frame);

 private:
  ExtensionResourceRequestPolicy();
};

#endif  // CHROME_RENDERER_EXTENSIONS_EXTENSION_RESOURCE_REQUEST_POLICY_H_