Chromium Code Reviews| 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 "chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h" | |
| 8 #include "ui/base/page_transition_types.h" | 9 #include "ui/base/page_transition_types.h" |
| 9 | 10 |
| 10 class GURL; | 11 class GURL; |
| 11 | 12 |
| 12 namespace blink { | 13 namespace blink { |
| 13 class WebFrame; | 14 class WebFrame; |
| 14 } | 15 } |
| 15 | 16 |
| 16 namespace extensions { | 17 namespace extensions { |
| 17 | 18 |
| 18 // Encapsulates the policy for when chrome-extension:// and | 19 // Encapsulates the policy for when chrome-extension:// and |
| 19 // chrome-extension-resource:// URLs can be requested. | 20 // chrome-extension-resource:// URLs can be requested. |
| 20 class ResourceRequestPolicy { | 21 class ResourceRequestPolicy { |
| 21 public: | 22 public: |
| 22 // Returns true if the chrome-extension:// |resource_url| can be requested | 23 // Returns true if the chrome-extension:// |resource_url| can be requested |
| 23 // from |frame_url|. In some cases this decision is made based upon how | 24 // from |frame_url|. In some cases this decision is made based upon how |
| 24 // this request was generated. Web triggered transitions are more restrictive | 25 // this request was generated. Web triggered transitions are more restrictive |
| 25 // than those triggered through UI. | 26 // than those triggered through UI. |
| 26 static bool CanRequestResource(const GURL& resource_url, | 27 static bool CanRequestResource(const GURL& resource_url, |
| 27 blink::WebFrame* frame, | 28 blink::WebFrame* frame, |
| 28 ui::PageTransition transition_type); | 29 ui::PageTransition transition_type); |
| 29 // Returns true if the chrome-extension-resource:// |resource_url| can be | 30 // Returns true if the chrome-extension-resource:// |resource_url| can be |
| 30 // requested from |frame_url|. | 31 // requested from |frame_url|. |
| 31 static bool CanRequestExtensionResourceScheme(const GURL& resource_url, | 32 static bool CanRequestExtensionResourceScheme(const GURL& resource_url, |
| 32 blink::WebFrame* frame); | 33 blink::WebFrame* frame); |
| 33 | 34 |
| 34 private: | 35 private: |
| 36 friend class ::ChromeExtensionsDispatcherDelegate; | |
|
not at google - send to devlin
2015/08/31 18:31:44
Just make SetWebViewPartitionID part of the public
paulmeyer
2015/08/31 21:40:08
No longer necessary since I'll be taking partition
| |
| 37 | |
| 35 ResourceRequestPolicy(); | 38 ResourceRequestPolicy(); |
| 39 | |
| 40 // Sets the WebView parition ID for this renderer process. This ID is used by | |
| 41 // CanRequestResource() to check for WebView accessible resources for this | |
| 42 // partition in the extension manifest. | |
| 43 static void SetWebViewPartitionID(const std::string& parition_id); | |
| 36 }; | 44 }; |
| 37 | 45 |
| 38 } // namespace extensions | 46 } // namespace extensions |
| 39 | 47 |
| 40 #endif // CHROME_RENDERER_EXTENSIONS_RESOURCE_REQUEST_POLICY_H_ | 48 #endif // CHROME_RENDERER_EXTENSIONS_RESOURCE_REQUEST_POLICY_H_ |
| OLD | NEW |