Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / chrome / renderer / extensions / resource_request_policy.h
blob6aa8ecbbe33f3a89b5a5c1e486d63da14348f255
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.
5 #ifndef CHROME_RENDERER_EXTENSIONS_RESOURCE_REQUEST_POLICY_H_
6 #define CHROME_RENDERER_EXTENSIONS_RESOURCE_REQUEST_POLICY_H_
8 #include "ui/base/page_transition_types.h"
10 class GURL;
12 namespace blink {
13 class WebFrame;
16 namespace extensions {
18 class Dispatcher;
20 // Encapsulates the policy for when chrome-extension:// and
21 // chrome-extension-resource:// URLs can be requested.
22 class ResourceRequestPolicy {
23 public:
24 explicit ResourceRequestPolicy(Dispatcher* dispatcher);
26 // Returns true if the chrome-extension:// |resource_url| can be requested
27 // from |frame_url|. In some cases this decision is made based upon how
28 // this request was generated. Web triggered transitions are more restrictive
29 // than those triggered through UI.
30 bool CanRequestResource(const GURL& resource_url,
31 blink::WebFrame* frame,
32 ui::PageTransition transition_type);
34 // Returns true if the chrome-extension-resource:// |resource_url| can be
35 // requested from |frame_url|.
36 bool CanRequestExtensionResourceScheme(const GURL& resource_url,
37 blink::WebFrame* frame);
39 private:
40 Dispatcher* dispatcher_;
42 DISALLOW_COPY_AND_ASSIGN(ResourceRequestPolicy);
45 } // namespace extensions
47 #endif // CHROME_RENDERER_EXTENSIONS_RESOURCE_REQUEST_POLICY_H_