| OLD | NEW | 
|   1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |   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 |   2 // Use of this source code is governed by a BSD-style license that can be | 
|   3 // found in the LICENSE file. |   3 // found in the LICENSE file. | 
|   4  |   4  | 
|   5 #ifndef CHROME_RENDERER_EXTENSIONS_RESOURCE_REQUEST_POLICY_H_ |   5 #ifndef CHROME_RENDERER_EXTENSIONS_RESOURCE_REQUEST_POLICY_H_ | 
|   6 #define CHROME_RENDERER_EXTENSIONS_RESOURCE_REQUEST_POLICY_H_ |   6 #define CHROME_RENDERER_EXTENSIONS_RESOURCE_REQUEST_POLICY_H_ | 
|   7  |   7  | 
 |   8 #include "content/public/common/page_transition_types.h" | 
 |   9  | 
|   8 class ExtensionSet; |  10 class ExtensionSet; | 
|   9 class GURL; |  11 class GURL; | 
|  10  |  12  | 
|  11 namespace WebKit { |  13 namespace WebKit { | 
|  12 class WebFrame; |  14 class WebFrame; | 
|  13 } |  15 } | 
|  14  |  16  | 
|  15 namespace extensions { |  17 namespace extensions { | 
|  16  |  18  | 
|  17 // Encapsulates the policy for when chrome-extension:// and |  19 // Encapsulates the policy for when chrome-extension:// and | 
|  18 // chrome-extension-resource:// URLs can be requested. |  20 // chrome-extension-resource:// URLs can be requested. | 
|  19 class ResourceRequestPolicy { |  21 class ResourceRequestPolicy { | 
|  20  public: |  22  public: | 
|  21   // Returns true if the chrome-extension:// |resource_url| can be requested |  23   // Returns true if the chrome-extension:// |resource_url| can be requested | 
|  22   // from |frame_url|. |  24   // from |frame_url|. In some cases this decision is made based upon how | 
 |  25   // this request was generated. Web triggered transitions are more restrictive | 
 |  26   // than those triggered through UI. | 
|  23   static bool CanRequestResource(const GURL& resource_url, |  27   static bool CanRequestResource(const GURL& resource_url, | 
|  24                                  WebKit::WebFrame* frame, |  28                                  WebKit::WebFrame* frame, | 
 |  29                                  content::PageTransition transition_type, | 
|  25                                  const ExtensionSet* loaded_extensions); |  30                                  const ExtensionSet* loaded_extensions); | 
|  26   // Returns true if the chrome-extension-resource:// |resource_url| can be |  31   // Returns true if the chrome-extension-resource:// |resource_url| can be | 
|  27   // requested from |frame_url|. |  32   // requested from |frame_url|. | 
|  28   static bool CanRequestExtensionResourceScheme(const GURL& resource_url, |  33   static bool CanRequestExtensionResourceScheme(const GURL& resource_url, | 
|  29                                                 WebKit::WebFrame* frame); |  34                                                 WebKit::WebFrame* frame); | 
|  30  |  35  | 
|  31  private: |  36  private: | 
|  32   ResourceRequestPolicy(); |  37   ResourceRequestPolicy(); | 
|  33 }; |  38 }; | 
|  34  |  39  | 
|  35 }  // namespace extensions |  40 }  // namespace extensions | 
|  36  |  41  | 
|  37 #endif  // CHROME_RENDERER_EXTENSIONS_RESOURCE_REQUEST_POLICY_H_ |  42 #endif  // CHROME_RENDERER_EXTENSIONS_RESOURCE_REQUEST_POLICY_H_ | 
| OLD | NEW |